From 9dd7c046137f1fca01f393c922b983c0da32ceb5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 30 May 2023 07:34:14 +0000 Subject: [PATCH] CodeGen from PR 24218 in Azure/azure-rest-api-specs Merge 6c924680cca9364020b6230caf7b56b60b11740a into a81abb255dcdc7c04052f6d7d78c019d4ba5dc1a --- .../armauthorization/CHANGELOG.md | 421 ++ .../accessreviewdefaultsettings_client.go | 142 + .../accessreviewhistorydefinition_client.go | 143 + ...sreviewhistorydefinitioninstance_client.go | 104 + ...reviewhistorydefinitioninstances_client.go | 110 + .../accessreviewhistorydefinitions_client.go | 164 + .../accessreviewinstance_client.go | 286 ++ ...reviewinstancecontactedreviewers_client.go | 115 + .../accessreviewinstancedecisions_client.go | 120 + .../accessreviewinstancemydecisions_client.go | 232 ++ .../accessreviewinstances_client.go | 232 ++ ...ewinstancesassignedformyapproval_client.go | 162 + .../accessreviewscheduledefinitions_client.go | 305 ++ ...definitionsassignedformyapproval_client.go | 101 + .../alertconfigurations_client.go | 190 + .../alertdefinitions_client.go | 150 + .../armauthorization/alertincidents_client.go | 195 + .../armauthorization/alertoperation_client.go | 87 + .../armauthorization/alerts_client.go | 298 ++ .../armauthorization/autorest.md | 7 +- .../classicadministrators_client.go | 105 - ...assicadministrators_client_example_test.go | 64 - .../armauthorization/client_factory.go | 134 +- .../armauthorization/constants.go | 514 ++- .../denyassignments_client.go | 413 -- .../denyassignments_client_example_test.go | 368 -- .../eligiblechildresources_client.go | 101 - ...giblechildresources_client_example_test.go | 57 - .../globaladministrator_client.go | 74 - ...globaladministrator_client_example_test.go | 35 - .../authorization/armauthorization/go.mod | 16 +- .../authorization/armauthorization/go.sum | 22 +- .../authorization/armauthorization/models.go | 2420 +++++------ .../armauthorization/models_serde.go | 3525 ++++++----------- .../armauthorization/operations_client.go | 94 + .../armauthorization/permissions_client.go | 186 - .../permissions_client_example_test.go | 90 - .../armauthorization/polymorphic_helpers.go | 91 +- .../provideroperationsmetadata_client.go | 148 - ...roperationsmetadata_client_example_test.go | 96 - .../armauthorization/response_types.go | 386 +- .../roleassignments_client.go | 644 --- .../roleassignments_client_example_test.go | 489 --- .../roleassignmentscheduleinstances_client.go | 154 - ...ntscheduleinstances_client_example_test.go | 149 - .../roleassignmentschedulerequests_client.go | 305 -- ...entschedulerequests_client_example_test.go | 290 -- .../roleassignmentschedules_client.go | 154 - ...assignmentschedules_client_example_test.go | 147 - .../roledefinitions_client.go | 302 -- .../roledefinitions_client_example_test.go | 215 - ...roleeligibilityscheduleinstances_client.go | 154 - ...tyscheduleinstances_client_example_test.go | 141 - .../roleeligibilityschedulerequests_client.go | 304 -- ...ityschedulerequests_client_example_test.go | 288 -- .../roleeligibilityschedules_client.go | 154 - ...ligibilityschedules_client_example_test.go | 143 - .../rolemanagementpolicies_client.go | 245 -- ...emanagementpolicies_client_example_test.go | 2632 ------------ .../rolemanagementpolicyassignments_client.go | 245 -- ...ntpolicyassignments_client_example_test.go | 695 ---- ...scopeaccessreviewdefaultsettings_client.go | 141 + ...opeaccessreviewhistorydefinition_client.go | 142 + ...sreviewhistorydefinitioninstance_client.go | 102 + ...reviewhistorydefinitioninstances_client.go | 108 + ...peaccessreviewhistorydefinitions_client.go | 163 + .../scopeaccessreviewinstance_client.go | 293 ++ ...reviewinstancecontactedreviewers_client.go | 113 + ...opeaccessreviewinstancedecisions_client.go | 118 + .../scopeaccessreviewinstances_client.go | 232 ++ ...eaccessreviewscheduledefinitions_client.go | 307 ++ ...reviewinstancecontactedreviewers_client.go | 108 + 72 files changed, 8509 insertions(+), 13671 deletions(-) create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/alerts_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/operations_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/permissions_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go delete mode 100644 sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go create mode 100644 sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go diff --git a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md index 4d4506fd30bf..c22217cc34cd 100644 --- a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md +++ b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md @@ -1,5 +1,426 @@ # Release History +## 3.0.0-beta.1 (2023-05-30) +### Breaking Changes + +- Enum `ApprovalMode` has been removed +- Enum `AssignmentType` has been removed +- Enum `EnablementRules` has been removed +- Enum `MemberType` has been removed +- Enum `NotificationDeliveryMechanism` has been removed +- Enum `NotificationLevel` has been removed +- Enum `PrincipalType` has been removed +- Enum `RecipientType` has been removed +- Enum `RequestType` has been removed +- Enum `RoleManagementPolicyRuleType` has been removed +- Enum `Status` has been removed +- Enum `Type` has been removed +- Enum `UserType` has been removed +- Function `NewClassicAdministratorsClient` has been removed +- Function `*ClassicAdministratorsClient.NewListPager` has been removed +- Function `*ClientFactory.NewClassicAdministratorsClient` has been removed +- Function `*ClientFactory.NewDenyAssignmentsClient` has been removed +- Function `*ClientFactory.NewEligibleChildResourcesClient` has been removed +- Function `*ClientFactory.NewGlobalAdministratorClient` has been removed +- Function `*ClientFactory.NewPermissionsClient` has been removed +- Function `*ClientFactory.NewProviderOperationsMetadataClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentScheduleInstancesClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentScheduleRequestsClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentSchedulesClient` has been removed +- Function `*ClientFactory.NewRoleAssignmentsClient` has been removed +- Function `*ClientFactory.NewRoleDefinitionsClient` has been removed +- Function `*ClientFactory.NewRoleEligibilityScheduleInstancesClient` has been removed +- Function `*ClientFactory.NewRoleEligibilityScheduleRequestsClient` has been removed +- Function `*ClientFactory.NewRoleEligibilitySchedulesClient` has been removed +- Function `*ClientFactory.NewRoleManagementPoliciesClient` has been removed +- Function `*ClientFactory.NewRoleManagementPolicyAssignmentsClient` has been removed +- Function `NewDenyAssignmentsClient` has been removed +- Function `*DenyAssignmentsClient.Get` has been removed +- Function `*DenyAssignmentsClient.GetByID` has been removed +- Function `*DenyAssignmentsClient.NewListForResourceGroupPager` has been removed +- Function `*DenyAssignmentsClient.NewListForResourcePager` has been removed +- Function `*DenyAssignmentsClient.NewListForScopePager` has been removed +- Function `*DenyAssignmentsClient.NewListPager` has been removed +- Function `NewEligibleChildResourcesClient` has been removed +- Function `*EligibleChildResourcesClient.NewGetPager` has been removed +- Function `NewGlobalAdministratorClient` has been removed +- Function `*GlobalAdministratorClient.ElevateAccess` has been removed +- Function `NewPermissionsClient` has been removed +- Function `*PermissionsClient.NewListForResourceGroupPager` has been removed +- Function `*PermissionsClient.NewListForResourcePager` has been removed +- Function `NewProviderOperationsMetadataClient` has been removed +- Function `*ProviderOperationsMetadataClient.Get` has been removed +- Function `*ProviderOperationsMetadataClient.NewListPager` has been removed +- Function `NewRoleAssignmentScheduleInstancesClient` has been removed +- Function `*RoleAssignmentScheduleInstancesClient.Get` has been removed +- Function `*RoleAssignmentScheduleInstancesClient.NewListForScopePager` has been removed +- Function `NewRoleAssignmentScheduleRequestsClient` has been removed +- Function `*RoleAssignmentScheduleRequestsClient.Cancel` has been removed +- Function `*RoleAssignmentScheduleRequestsClient.Create` has been removed +- Function `*RoleAssignmentScheduleRequestsClient.Get` has been removed +- Function `*RoleAssignmentScheduleRequestsClient.NewListForScopePager` has been removed +- Function `*RoleAssignmentScheduleRequestsClient.Validate` has been removed +- Function `NewRoleAssignmentSchedulesClient` has been removed +- Function `*RoleAssignmentSchedulesClient.Get` has been removed +- Function `*RoleAssignmentSchedulesClient.NewListForScopePager` has been removed +- Function `NewRoleAssignmentsClient` has been removed +- Function `*RoleAssignmentsClient.Create` has been removed +- Function `*RoleAssignmentsClient.CreateByID` has been removed +- Function `*RoleAssignmentsClient.Delete` has been removed +- Function `*RoleAssignmentsClient.DeleteByID` has been removed +- Function `*RoleAssignmentsClient.Get` has been removed +- Function `*RoleAssignmentsClient.GetByID` has been removed +- Function `*RoleAssignmentsClient.NewListForResourceGroupPager` has been removed +- Function `*RoleAssignmentsClient.NewListForResourcePager` has been removed +- Function `*RoleAssignmentsClient.NewListForScopePager` has been removed +- Function `*RoleAssignmentsClient.NewListForSubscriptionPager` has been removed +- Function `NewRoleDefinitionsClient` has been removed +- Function `*RoleDefinitionsClient.CreateOrUpdate` has been removed +- Function `*RoleDefinitionsClient.Delete` has been removed +- Function `*RoleDefinitionsClient.Get` has been removed +- Function `*RoleDefinitionsClient.GetByID` has been removed +- Function `*RoleDefinitionsClient.NewListPager` has been removed +- Function `NewRoleEligibilityScheduleInstancesClient` has been removed +- Function `*RoleEligibilityScheduleInstancesClient.Get` has been removed +- Function `*RoleEligibilityScheduleInstancesClient.NewListForScopePager` has been removed +- Function `NewRoleEligibilityScheduleRequestsClient` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Cancel` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Create` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Get` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.NewListForScopePager` has been removed +- Function `*RoleEligibilityScheduleRequestsClient.Validate` has been removed +- Function `NewRoleEligibilitySchedulesClient` has been removed +- Function `*RoleEligibilitySchedulesClient.Get` has been removed +- Function `*RoleEligibilitySchedulesClient.NewListForScopePager` has been removed +- Function `NewRoleManagementPoliciesClient` has been removed +- Function `*RoleManagementPoliciesClient.Delete` has been removed +- Function `*RoleManagementPoliciesClient.Get` has been removed +- Function `*RoleManagementPoliciesClient.NewListForScopePager` has been removed +- Function `*RoleManagementPoliciesClient.Update` has been removed +- Function `*RoleManagementPolicyApprovalRule.GetRoleManagementPolicyRule` has been removed +- Function `NewRoleManagementPolicyAssignmentsClient` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.Create` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.Delete` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.Get` has been removed +- Function `*RoleManagementPolicyAssignmentsClient.NewListForScopePager` has been removed +- Function `*RoleManagementPolicyAuthenticationContextRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyEnablementRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyExpirationRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyNotificationRule.GetRoleManagementPolicyRule` has been removed +- Function `*RoleManagementPolicyRule.GetRoleManagementPolicyRule` has been removed +- Struct `ApprovalSettings` has been removed +- Struct `ApprovalStage` has been removed +- Struct `ClassicAdministrator` has been removed +- Struct `ClassicAdministratorListResult` has been removed +- Struct `ClassicAdministratorProperties` has been removed +- Struct `DenyAssignment` has been removed +- Struct `DenyAssignmentFilter` has been removed +- Struct `DenyAssignmentListResult` has been removed +- Struct `DenyAssignmentPermission` has been removed +- Struct `DenyAssignmentProperties` has been removed +- Struct `EligibleChildResource` has been removed +- Struct `EligibleChildResourcesListResult` has been removed +- Struct `ErrorAdditionalInfo` has been removed +- Struct `ErrorDetail` has been removed +- Struct `ErrorResponse` has been removed +- Struct `ExpandedProperties` has been removed +- Struct `ExpandedPropertiesPrincipal` has been removed +- Struct `ExpandedPropertiesRoleDefinition` has been removed +- Struct `ExpandedPropertiesScope` has been removed +- Struct `Permission` has been removed +- Struct `PermissionGetResult` has been removed +- Struct `PolicyAssignmentProperties` has been removed +- Struct `PolicyAssignmentPropertiesPolicy` has been removed +- Struct `PolicyAssignmentPropertiesRoleDefinition` has been removed +- Struct `PolicyAssignmentPropertiesScope` has been removed +- Struct `PolicyProperties` has been removed +- Struct `PolicyPropertiesScope` has been removed +- Struct `Principal` has been removed +- Struct `ProviderOperation` has been removed +- Struct `ProviderOperationsMetadata` has been removed +- Struct `ProviderOperationsMetadataListResult` has been removed +- Struct `ResourceType` has been removed +- Struct `RoleAssignment` has been removed +- Struct `RoleAssignmentCreateParameters` has been removed +- Struct `RoleAssignmentFilter` has been removed +- Struct `RoleAssignmentListResult` has been removed +- Struct `RoleAssignmentProperties` has been removed +- Struct `RoleAssignmentSchedule` has been removed +- Struct `RoleAssignmentScheduleFilter` has been removed +- Struct `RoleAssignmentScheduleInstance` has been removed +- Struct `RoleAssignmentScheduleInstanceFilter` has been removed +- Struct `RoleAssignmentScheduleInstanceListResult` has been removed +- Struct `RoleAssignmentScheduleInstanceProperties` has been removed +- Struct `RoleAssignmentScheduleListResult` has been removed +- Struct `RoleAssignmentScheduleProperties` has been removed +- Struct `RoleAssignmentScheduleRequest` has been removed +- Struct `RoleAssignmentScheduleRequestFilter` has been removed +- Struct `RoleAssignmentScheduleRequestListResult` has been removed +- Struct `RoleAssignmentScheduleRequestProperties` has been removed +- Struct `RoleAssignmentScheduleRequestPropertiesScheduleInfo` has been removed +- Struct `RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration` has been removed +- Struct `RoleAssignmentScheduleRequestPropertiesTicketInfo` has been removed +- Struct `RoleDefinition` has been removed +- Struct `RoleDefinitionFilter` has been removed +- Struct `RoleDefinitionListResult` has been removed +- Struct `RoleDefinitionProperties` has been removed +- Struct `RoleEligibilitySchedule` has been removed +- Struct `RoleEligibilityScheduleFilter` has been removed +- Struct `RoleEligibilityScheduleInstance` has been removed +- Struct `RoleEligibilityScheduleInstanceFilter` has been removed +- Struct `RoleEligibilityScheduleInstanceListResult` has been removed +- Struct `RoleEligibilityScheduleInstanceProperties` has been removed +- Struct `RoleEligibilityScheduleListResult` has been removed +- Struct `RoleEligibilityScheduleProperties` has been removed +- Struct `RoleEligibilityScheduleRequest` has been removed +- Struct `RoleEligibilityScheduleRequestFilter` has been removed +- Struct `RoleEligibilityScheduleRequestListResult` has been removed +- Struct `RoleEligibilityScheduleRequestProperties` has been removed +- Struct `RoleEligibilityScheduleRequestPropertiesScheduleInfo` has been removed +- Struct `RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration` has been removed +- Struct `RoleEligibilityScheduleRequestPropertiesTicketInfo` has been removed +- Struct `RoleManagementPolicy` has been removed +- Struct `RoleManagementPolicyApprovalRule` has been removed +- Struct `RoleManagementPolicyAssignment` has been removed +- Struct `RoleManagementPolicyAssignmentListResult` has been removed +- Struct `RoleManagementPolicyAssignmentProperties` has been removed +- Struct `RoleManagementPolicyAuthenticationContextRule` has been removed +- Struct `RoleManagementPolicyEnablementRule` has been removed +- Struct `RoleManagementPolicyExpirationRule` has been removed +- Struct `RoleManagementPolicyListResult` has been removed +- Struct `RoleManagementPolicyNotificationRule` has been removed +- Struct `RoleManagementPolicyProperties` has been removed +- Struct `RoleManagementPolicyRuleTarget` has been removed +- Struct `UserSet` has been removed +- Struct `ValidationResponse` has been removed +- Struct `ValidationResponseErrorInfo` has been removed + +### Features Added + +- New enum type `AccessRecommendationType` with values `AccessRecommendationTypeApprove`, `AccessRecommendationTypeDeny`, `AccessRecommendationTypeNoInfoAvailable` +- New enum type `AccessReviewActorIdentityType` with values `AccessReviewActorIdentityTypeServicePrincipal`, `AccessReviewActorIdentityTypeUser` +- New enum type `AccessReviewApplyResult` with values `AccessReviewApplyResultAppliedSuccessfully`, `AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound`, `AccessReviewApplyResultAppliedWithUnknownFailure`, `AccessReviewApplyResultApplyNotSupported`, `AccessReviewApplyResultApplying`, `AccessReviewApplyResultNew` +- New enum type `AccessReviewDecisionInsightType` with values `AccessReviewDecisionInsightTypeUserSignInInsight` +- New enum type `AccessReviewDecisionPrincipalResourceMembershipType` with values `AccessReviewDecisionPrincipalResourceMembershipTypeDirect`, `AccessReviewDecisionPrincipalResourceMembershipTypeIndirect` +- New enum type `AccessReviewHistoryDefinitionStatus` with values `AccessReviewHistoryDefinitionStatusDone`, `AccessReviewHistoryDefinitionStatusError`, `AccessReviewHistoryDefinitionStatusInProgress`, `AccessReviewHistoryDefinitionStatusRequested` +- New enum type `AccessReviewInstanceReviewersType` with values `AccessReviewInstanceReviewersTypeAssigned`, `AccessReviewInstanceReviewersTypeManagers`, `AccessReviewInstanceReviewersTypeSelf` +- New enum type `AccessReviewInstanceStatus` with values `AccessReviewInstanceStatusApplied`, `AccessReviewInstanceStatusApplying`, `AccessReviewInstanceStatusAutoReviewed`, `AccessReviewInstanceStatusAutoReviewing`, `AccessReviewInstanceStatusCompleted`, `AccessReviewInstanceStatusCompleting`, `AccessReviewInstanceStatusInProgress`, `AccessReviewInstanceStatusInitializing`, `AccessReviewInstanceStatusNotStarted`, `AccessReviewInstanceStatusScheduled`, `AccessReviewInstanceStatusStarting` +- New enum type `AccessReviewRecurrencePatternType` with values `AccessReviewRecurrencePatternTypeAbsoluteMonthly`, `AccessReviewRecurrencePatternTypeWeekly` +- New enum type `AccessReviewRecurrenceRangeType` with values `AccessReviewRecurrenceRangeTypeEndDate`, `AccessReviewRecurrenceRangeTypeNoEnd`, `AccessReviewRecurrenceRangeTypeNumbered` +- New enum type `AccessReviewResult` with values `AccessReviewResultApprove`, `AccessReviewResultDeny`, `AccessReviewResultDontKnow`, `AccessReviewResultNotNotified`, `AccessReviewResultNotReviewed` +- New enum type `AccessReviewReviewerType` with values `AccessReviewReviewerTypeServicePrincipal`, `AccessReviewReviewerTypeUser` +- New enum type `AccessReviewScheduleDefinitionReviewersType` with values `AccessReviewScheduleDefinitionReviewersTypeAssigned`, `AccessReviewScheduleDefinitionReviewersTypeManagers`, `AccessReviewScheduleDefinitionReviewersTypeSelf` +- New enum type `AccessReviewScheduleDefinitionStatus` with values `AccessReviewScheduleDefinitionStatusApplied`, `AccessReviewScheduleDefinitionStatusApplying`, `AccessReviewScheduleDefinitionStatusAutoReviewed`, `AccessReviewScheduleDefinitionStatusAutoReviewing`, `AccessReviewScheduleDefinitionStatusCompleted`, `AccessReviewScheduleDefinitionStatusCompleting`, `AccessReviewScheduleDefinitionStatusInProgress`, `AccessReviewScheduleDefinitionStatusInitializing`, `AccessReviewScheduleDefinitionStatusNotStarted`, `AccessReviewScheduleDefinitionStatusScheduled`, `AccessReviewScheduleDefinitionStatusStarting` +- New enum type `AccessReviewScopeAssignmentState` with values `AccessReviewScopeAssignmentStateActive`, `AccessReviewScopeAssignmentStateEligible` +- New enum type `AccessReviewScopePrincipalType` with values `AccessReviewScopePrincipalTypeGuestUser`, `AccessReviewScopePrincipalTypeRedeemedGuestUser`, `AccessReviewScopePrincipalTypeServicePrincipal`, `AccessReviewScopePrincipalTypeUser`, `AccessReviewScopePrincipalTypeUserGroup` +- New enum type `DecisionResourceType` with values `DecisionResourceTypeAzureRole` +- New enum type `DecisionTargetType` with values `DecisionTargetTypeServicePrincipal`, `DecisionTargetTypeUser` +- New enum type `DefaultDecisionType` with values `DefaultDecisionTypeApprove`, `DefaultDecisionTypeDeny`, `DefaultDecisionTypeRecommendation` +- New enum type `RecordAllDecisionsResult` with values `RecordAllDecisionsResultApprove`, `RecordAllDecisionsResultDeny` +- New enum type `SeverityLevel` with values `SeverityLevelHigh`, `SeverityLevelLow`, `SeverityLevelMedium` +- New function `*AccessReviewDecisionIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionInsightProperties.GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties` +- New function `*AccessReviewDecisionServicePrincipalIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionUserIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionUserSignInInsightProperties.GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties` +- New function `NewAccessReviewDefaultSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewDefaultSettingsClient, error)` +- New function `*AccessReviewDefaultSettingsClient.Get(context.Context, *AccessReviewDefaultSettingsClientGetOptions) (AccessReviewDefaultSettingsClientGetResponse, error)` +- New function `*AccessReviewDefaultSettingsClient.Put(context.Context, AccessReviewScheduleSettings, *AccessReviewDefaultSettingsClientPutOptions) (AccessReviewDefaultSettingsClientPutResponse, error)` +- New function `NewAccessReviewHistoryDefinitionClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionClient, error)` +- New function `*AccessReviewHistoryDefinitionClient.Create(context.Context, string, AccessReviewHistoryDefinitionProperties, *AccessReviewHistoryDefinitionClientCreateOptions) (AccessReviewHistoryDefinitionClientCreateResponse, error)` +- New function `*AccessReviewHistoryDefinitionClient.DeleteByID(context.Context, string, *AccessReviewHistoryDefinitionClientDeleteByIDOptions) (AccessReviewHistoryDefinitionClientDeleteByIDResponse, error)` +- New function `NewAccessReviewHistoryDefinitionInstanceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstanceClient, error)` +- New function `*AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI(context.Context, string, string, *AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error)` +- New function `NewAccessReviewHistoryDefinitionInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstancesClient, error)` +- New function `*AccessReviewHistoryDefinitionInstancesClient.NewListPager(string, *AccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionInstancesClientListResponse]` +- New function `NewAccessReviewHistoryDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionsClient, error)` +- New function `*AccessReviewHistoryDefinitionsClient.GetByID(context.Context, string, *AccessReviewHistoryDefinitionsClientGetByIDOptions) (AccessReviewHistoryDefinitionsClientGetByIDResponse, error)` +- New function `*AccessReviewHistoryDefinitionsClient.NewListPager(*AccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionsClientListResponse]` +- New function `NewAccessReviewInstanceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceClient, error)` +- New function `*AccessReviewInstanceClient.AcceptRecommendations(context.Context, string, string, *AccessReviewInstanceClientAcceptRecommendationsOptions) (AccessReviewInstanceClientAcceptRecommendationsResponse, error)` +- New function `*AccessReviewInstanceClient.ApplyDecisions(context.Context, string, string, *AccessReviewInstanceClientApplyDecisionsOptions) (AccessReviewInstanceClientApplyDecisionsResponse, error)` +- New function `*AccessReviewInstanceClient.ResetDecisions(context.Context, string, string, *AccessReviewInstanceClientResetDecisionsOptions) (AccessReviewInstanceClientResetDecisionsResponse, error)` +- New function `*AccessReviewInstanceClient.SendReminders(context.Context, string, string, *AccessReviewInstanceClientSendRemindersOptions) (AccessReviewInstanceClientSendRemindersResponse, error)` +- New function `*AccessReviewInstanceClient.Stop(context.Context, string, string, *AccessReviewInstanceClientStopOptions) (AccessReviewInstanceClientStopResponse, error)` +- New function `NewAccessReviewInstanceContactedReviewersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceContactedReviewersClient, error)` +- New function `*AccessReviewInstanceContactedReviewersClient.NewListPager(string, string, *AccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[AccessReviewInstanceContactedReviewersClientListResponse]` +- New function `NewAccessReviewInstanceDecisionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceDecisionsClient, error)` +- New function `*AccessReviewInstanceDecisionsClient.NewListPager(string, string, *AccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceDecisionsClientListResponse]` +- New function `NewAccessReviewInstanceMyDecisionsClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceMyDecisionsClient, error)` +- New function `*AccessReviewInstanceMyDecisionsClient.GetByID(context.Context, string, string, string, *AccessReviewInstanceMyDecisionsClientGetByIDOptions) (AccessReviewInstanceMyDecisionsClientGetByIDResponse, error)` +- New function `*AccessReviewInstanceMyDecisionsClient.NewListPager(string, string, *AccessReviewInstanceMyDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceMyDecisionsClientListResponse]` +- New function `*AccessReviewInstanceMyDecisionsClient.Patch(context.Context, string, string, string, AccessReviewDecisionProperties, *AccessReviewInstanceMyDecisionsClientPatchOptions) (AccessReviewInstanceMyDecisionsClientPatchResponse, error)` +- New function `NewAccessReviewInstancesAssignedForMyApprovalClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstancesAssignedForMyApprovalClient, error)` +- New function `*AccessReviewInstancesAssignedForMyApprovalClient.GetByID(context.Context, string, string, *AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions) (AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse, error)` +- New function `*AccessReviewInstancesAssignedForMyApprovalClient.NewListPager(string, *AccessReviewInstancesAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewInstancesAssignedForMyApprovalClientListResponse]` +- New function `NewAccessReviewInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstancesClient, error)` +- New function `*AccessReviewInstancesClient.Create(context.Context, string, string, AccessReviewInstanceProperties, *AccessReviewInstancesClientCreateOptions) (AccessReviewInstancesClientCreateResponse, error)` +- New function `*AccessReviewInstancesClient.GetByID(context.Context, string, string, *AccessReviewInstancesClientGetByIDOptions) (AccessReviewInstancesClientGetByIDResponse, error)` +- New function `*AccessReviewInstancesClient.NewListPager(string, *AccessReviewInstancesClientListOptions) *runtime.Pager[AccessReviewInstancesClientListResponse]` +- New function `NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient, error)` +- New function `*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager(*AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse]` +- New function `NewAccessReviewScheduleDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewScheduleDefinitionsClient, error)` +- New function `*AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID(context.Context, string, AccessReviewScheduleDefinitionProperties, *AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.DeleteByID(context.Context, string, *AccessReviewScheduleDefinitionsClientDeleteByIDOptions) (AccessReviewScheduleDefinitionsClientDeleteByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.GetByID(context.Context, string, *AccessReviewScheduleDefinitionsClientGetByIDOptions) (AccessReviewScheduleDefinitionsClientGetByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.NewListPager(*AccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsClientListResponse]` +- New function `*AccessReviewScheduleDefinitionsClient.Stop(context.Context, string, *AccessReviewScheduleDefinitionsClientStopOptions) (AccessReviewScheduleDefinitionsClientStopResponse, error)` +- New function `*AlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `NewAlertConfigurationsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertConfigurationsClient, error)` +- New function `*AlertConfigurationsClient.Get(context.Context, string, string, *AlertConfigurationsClientGetOptions) (AlertConfigurationsClientGetResponse, error)` +- New function `*AlertConfigurationsClient.NewListForScopePager(string, *AlertConfigurationsClientListForScopeOptions) *runtime.Pager[AlertConfigurationsClientListForScopeResponse]` +- New function `*AlertConfigurationsClient.Update(context.Context, string, string, AlertConfiguration, *AlertConfigurationsClientUpdateOptions) (AlertConfigurationsClientUpdateResponse, error)` +- New function `NewAlertDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertDefinitionsClient, error)` +- New function `*AlertDefinitionsClient.Get(context.Context, string, string, *AlertDefinitionsClientGetOptions) (AlertDefinitionsClientGetResponse, error)` +- New function `*AlertDefinitionsClient.NewListForScopePager(string, *AlertDefinitionsClientListForScopeOptions) *runtime.Pager[AlertDefinitionsClientListForScopeResponse]` +- New function `*AlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `NewAlertIncidentsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertIncidentsClient, error)` +- New function `*AlertIncidentsClient.Get(context.Context, string, string, string, *AlertIncidentsClientGetOptions) (AlertIncidentsClientGetResponse, error)` +- New function `*AlertIncidentsClient.NewListForScopePager(string, string, *AlertIncidentsClientListForScopeOptions) *runtime.Pager[AlertIncidentsClientListForScopeResponse]` +- New function `*AlertIncidentsClient.Remediate(context.Context, string, string, string, *AlertIncidentsClientRemediateOptions) (AlertIncidentsClientRemediateResponse, error)` +- New function `NewAlertOperationClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertOperationClient, error)` +- New function `*AlertOperationClient.Get(context.Context, string, string, *AlertOperationClientGetOptions) (AlertOperationClientGetResponse, error)` +- New function `NewAlertsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertsClient, error)` +- New function `*AlertsClient.Get(context.Context, string, string, *AlertsClientGetOptions) (AlertsClientGetResponse, error)` +- New function `*AlertsClient.NewListForScopePager(string, *AlertsClientListForScopeOptions) *runtime.Pager[AlertsClientListForScopeResponse]` +- New function `*AlertsClient.BeginRefresh(context.Context, string, string, *AlertsClientBeginRefreshOptions) (*runtime.Poller[AlertsClientRefreshResponse], error)` +- New function `*AlertsClient.BeginRefreshAll(context.Context, string, *AlertsClientBeginRefreshAllOptions) (*runtime.Poller[AlertsClientRefreshAllResponse], error)` +- New function `*AlertsClient.Update(context.Context, string, string, Alert, *AlertsClientUpdateOptions) (AlertsClientUpdateResponse, error)` +- New function `*AzureRolesAssignedOutsidePimAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*AzureRolesAssignedOutsidePimAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `*ClientFactory.NewAccessReviewDefaultSettingsClient() *AccessReviewDefaultSettingsClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionClient() *AccessReviewHistoryDefinitionClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionInstanceClient() *AccessReviewHistoryDefinitionInstanceClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionInstancesClient() *AccessReviewHistoryDefinitionInstancesClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionsClient() *AccessReviewHistoryDefinitionsClient` +- New function `*ClientFactory.NewAccessReviewInstanceClient() *AccessReviewInstanceClient` +- New function `*ClientFactory.NewAccessReviewInstanceContactedReviewersClient() *AccessReviewInstanceContactedReviewersClient` +- New function `*ClientFactory.NewAccessReviewInstanceDecisionsClient() *AccessReviewInstanceDecisionsClient` +- New function `*ClientFactory.NewAccessReviewInstanceMyDecisionsClient() *AccessReviewInstanceMyDecisionsClient` +- New function `*ClientFactory.NewAccessReviewInstancesAssignedForMyApprovalClient() *AccessReviewInstancesAssignedForMyApprovalClient` +- New function `*ClientFactory.NewAccessReviewInstancesClient() *AccessReviewInstancesClient` +- New function `*ClientFactory.NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient() *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient` +- New function `*ClientFactory.NewAccessReviewScheduleDefinitionsClient() *AccessReviewScheduleDefinitionsClient` +- New function `*ClientFactory.NewAlertConfigurationsClient() *AlertConfigurationsClient` +- New function `*ClientFactory.NewAlertDefinitionsClient() *AlertDefinitionsClient` +- New function `*ClientFactory.NewAlertIncidentsClient() *AlertIncidentsClient` +- New function `*ClientFactory.NewAlertOperationClient() *AlertOperationClient` +- New function `*ClientFactory.NewAlertsClient() *AlertsClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewScopeAccessReviewDefaultSettingsClient() *ScopeAccessReviewDefaultSettingsClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionClient() *ScopeAccessReviewHistoryDefinitionClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstanceClient() *ScopeAccessReviewHistoryDefinitionInstanceClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstancesClient() *ScopeAccessReviewHistoryDefinitionInstancesClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionsClient() *ScopeAccessReviewHistoryDefinitionsClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceClient() *ScopeAccessReviewInstanceClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceContactedReviewersClient() *ScopeAccessReviewInstanceContactedReviewersClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceDecisionsClient() *ScopeAccessReviewInstanceDecisionsClient` +- New function `*ClientFactory.NewScopeAccessReviewInstancesClient() *ScopeAccessReviewInstancesClient` +- New function `*ClientFactory.NewScopeAccessReviewScheduleDefinitionsClient() *ScopeAccessReviewScheduleDefinitionsClient` +- New function `*ClientFactory.NewTenantLevelAccessReviewInstanceContactedReviewersClient() *TenantLevelAccessReviewInstanceContactedReviewersClient` +- New function `*DuplicateRoleCreatedAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*DuplicateRoleCreatedAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `NewOperationsClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsClient, error)` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New function `NewScopeAccessReviewDefaultSettingsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewDefaultSettingsClient, error)` +- New function `*ScopeAccessReviewDefaultSettingsClient.Get(context.Context, string, *ScopeAccessReviewDefaultSettingsClientGetOptions) (ScopeAccessReviewDefaultSettingsClientGetResponse, error)` +- New function `*ScopeAccessReviewDefaultSettingsClient.Put(context.Context, string, AccessReviewScheduleSettings, *ScopeAccessReviewDefaultSettingsClientPutOptions) (ScopeAccessReviewDefaultSettingsClientPutResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionClient.Create(context.Context, string, string, AccessReviewHistoryDefinitionProperties, *ScopeAccessReviewHistoryDefinitionClientCreateOptions) (ScopeAccessReviewHistoryDefinitionClientCreateResponse, error)` +- New function `*ScopeAccessReviewHistoryDefinitionClient.DeleteByID(context.Context, string, string, *ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions) (ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionInstanceClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstanceClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI(context.Context, string, string, string, *ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstancesClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager(string, string, *ScopeAccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionInstancesClientListResponse]` +- New function `NewScopeAccessReviewHistoryDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionsClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionsClient.GetByID(context.Context, string, string, *ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions) (ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewHistoryDefinitionsClient.NewListPager(string, *ScopeAccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionsClientListResponse]` +- New function `NewScopeAccessReviewInstanceClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceClient, error)` +- New function `*ScopeAccessReviewInstanceClient.ApplyDecisions(context.Context, string, string, string, *ScopeAccessReviewInstanceClientApplyDecisionsOptions) (ScopeAccessReviewInstanceClientApplyDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.RecordAllDecisions(context.Context, string, string, string, RecordAllDecisionsProperties, *ScopeAccessReviewInstanceClientRecordAllDecisionsOptions) (ScopeAccessReviewInstanceClientRecordAllDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.ResetDecisions(context.Context, string, string, string, *ScopeAccessReviewInstanceClientResetDecisionsOptions) (ScopeAccessReviewInstanceClientResetDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.SendReminders(context.Context, string, string, string, *ScopeAccessReviewInstanceClientSendRemindersOptions) (ScopeAccessReviewInstanceClientSendRemindersResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.Stop(context.Context, string, string, string, *ScopeAccessReviewInstanceClientStopOptions) (ScopeAccessReviewInstanceClientStopResponse, error)` +- New function `NewScopeAccessReviewInstanceContactedReviewersClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceContactedReviewersClient, error)` +- New function `*ScopeAccessReviewInstanceContactedReviewersClient.NewListPager(string, string, string, *ScopeAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceContactedReviewersClientListResponse]` +- New function `NewScopeAccessReviewInstanceDecisionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceDecisionsClient, error)` +- New function `*ScopeAccessReviewInstanceDecisionsClient.NewListPager(string, string, string, *ScopeAccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceDecisionsClientListResponse]` +- New function `NewScopeAccessReviewInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstancesClient, error)` +- New function `*ScopeAccessReviewInstancesClient.Create(context.Context, string, string, string, AccessReviewInstanceProperties, *ScopeAccessReviewInstancesClientCreateOptions) (ScopeAccessReviewInstancesClientCreateResponse, error)` +- New function `*ScopeAccessReviewInstancesClient.GetByID(context.Context, string, string, string, *ScopeAccessReviewInstancesClientGetByIDOptions) (ScopeAccessReviewInstancesClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewInstancesClient.NewListPager(string, string, *ScopeAccessReviewInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewInstancesClientListResponse]` +- New function `NewScopeAccessReviewScheduleDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewScheduleDefinitionsClient, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID(context.Context, string, string, AccessReviewScheduleDefinitionProperties, *ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.DeleteByID(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.GetByID(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.NewListPager(string, *ScopeAccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewScheduleDefinitionsClientListResponse]` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.Stop(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientStopOptions) (ScopeAccessReviewScheduleDefinitionsClientStopResponse, error)` +- New function `NewTenantLevelAccessReviewInstanceContactedReviewersClient(azcore.TokenCredential, *arm.ClientOptions) (*TenantLevelAccessReviewInstanceContactedReviewersClient, error)` +- New function `*TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager(string, string, *TenantLevelAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[TenantLevelAccessReviewInstanceContactedReviewersClientListResponse]` +- New function `*TooManyOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*TooManyOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `*TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New struct `AccessReviewActorIdentity` +- New struct `AccessReviewContactedReviewer` +- New struct `AccessReviewContactedReviewerListResult` +- New struct `AccessReviewContactedReviewerProperties` +- New struct `AccessReviewDecision` +- New struct `AccessReviewDecisionInsight` +- New struct `AccessReviewDecisionListResult` +- New struct `AccessReviewDecisionPrincipalResourceMembership` +- New struct `AccessReviewDecisionProperties` +- New struct `AccessReviewDecisionResource` +- New struct `AccessReviewDecisionServicePrincipalIdentity` +- New struct `AccessReviewDecisionUserIdentity` +- New struct `AccessReviewDecisionUserSignInInsightProperties` +- New struct `AccessReviewDefaultSettings` +- New struct `AccessReviewHistoryDefinition` +- New struct `AccessReviewHistoryDefinitionInstanceListResult` +- New struct `AccessReviewHistoryDefinitionListResult` +- New struct `AccessReviewHistoryDefinitionProperties` +- New struct `AccessReviewHistoryInstance` +- New struct `AccessReviewHistoryInstanceProperties` +- New struct `AccessReviewHistoryScheduleSettings` +- New struct `AccessReviewInstance` +- New struct `AccessReviewInstanceListResult` +- New struct `AccessReviewInstanceProperties` +- New struct `AccessReviewRecurrencePattern` +- New struct `AccessReviewRecurrenceRange` +- New struct `AccessReviewRecurrenceSettings` +- New struct `AccessReviewReviewer` +- New struct `AccessReviewScheduleDefinition` +- New struct `AccessReviewScheduleDefinitionListResult` +- New struct `AccessReviewScheduleDefinitionProperties` +- New struct `AccessReviewScheduleSettings` +- New struct `AccessReviewScope` +- New struct `Alert` +- New struct `AlertConfiguration` +- New struct `AlertConfigurationListResult` +- New struct `AlertDefinition` +- New struct `AlertDefinitionListResult` +- New struct `AlertDefinitionProperties` +- New struct `AlertIncident` +- New struct `AlertIncidentListResult` +- New struct `AlertListResult` +- New struct `AlertOperationResult` +- New struct `AlertProperties` +- New struct `AzureRolesAssignedOutsidePimAlertConfigurationProperties` +- New struct `AzureRolesAssignedOutsidePimAlertIncidentProperties` +- New struct `DuplicateRoleCreatedAlertConfigurationProperties` +- New struct `DuplicateRoleCreatedAlertIncidentProperties` +- New struct `ErrorDefinition` +- New struct `ErrorDefinitionProperties` +- New struct `Operation` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `RecordAllDecisionsProperties` +- New struct `TooManyOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyOwnersAssignedToResourceAlertIncidentProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties` + + ## 2.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go new file mode 100644 index 000000000000..8ed7b97e973f --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go @@ -0,0 +1,142 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewDefaultSettingsClient contains the methods for the AccessReviewDefaultSettings group. +// Don't use this type directly, use NewAccessReviewDefaultSettingsClient() instead. +type AccessReviewDefaultSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewDefaultSettingsClient creates a new instance of AccessReviewDefaultSettingsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewDefaultSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewDefaultSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewDefaultSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewDefaultSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Get +// method. +func (client *AccessReviewDefaultSettingsClient) Get(ctx context.Context, options *AccessReviewDefaultSettingsClientGetOptions) (AccessReviewDefaultSettingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, options) + if err != nil { + return AccessReviewDefaultSettingsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewDefaultSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewDefaultSettingsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AccessReviewDefaultSettingsClient) getCreateRequest(ctx context.Context, options *AccessReviewDefaultSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccessReviewDefaultSettingsClient) getHandleResponse(resp *http.Response) (AccessReviewDefaultSettingsClientGetResponse, error) { + result := AccessReviewDefaultSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return AccessReviewDefaultSettingsClientGetResponse{}, err + } + return result, nil +} + +// Put - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - properties - Access review schedule settings. +// - options - AccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Put +// method. +func (client *AccessReviewDefaultSettingsClient) Put(ctx context.Context, properties AccessReviewScheduleSettings, options *AccessReviewDefaultSettingsClientPutOptions) (AccessReviewDefaultSettingsClientPutResponse, error) { + req, err := client.putCreateRequest(ctx, properties, options) + if err != nil { + return AccessReviewDefaultSettingsClientPutResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewDefaultSettingsClientPutResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewDefaultSettingsClientPutResponse{}, runtime.NewResponseError(resp) + } + return client.putHandleResponse(resp) +} + +// putCreateRequest creates the Put request. +func (client *AccessReviewDefaultSettingsClient) putCreateRequest(ctx context.Context, properties AccessReviewScheduleSettings, options *AccessReviewDefaultSettingsClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// putHandleResponse handles the Put response. +func (client *AccessReviewDefaultSettingsClient) putHandleResponse(resp *http.Response) (AccessReviewDefaultSettingsClientPutResponse, error) { + result := AccessReviewDefaultSettingsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return AccessReviewDefaultSettingsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go new file mode 100644 index 000000000000..418ef799f8c1 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go @@ -0,0 +1,143 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionClient contains the methods for the AccessReviewHistoryDefinition group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionClient() instead. +type AccessReviewHistoryDefinitionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionClient creates a new instance of AccessReviewHistoryDefinitionClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create a scheduled or one-time Access Review History Definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - properties - Access review history definition properties. +// - options - AccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.Create +// method. +func (client *AccessReviewHistoryDefinitionClient) Create(ctx context.Context, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *AccessReviewHistoryDefinitionClientCreateOptions) (AccessReviewHistoryDefinitionClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, historyDefinitionID, properties, options) + if err != nil { + return AccessReviewHistoryDefinitionClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *AccessReviewHistoryDefinitionClient) createCreateRequest(ctx context.Context, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *AccessReviewHistoryDefinitionClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *AccessReviewHistoryDefinitionClient) createHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionClientCreateResponse, error) { + result := AccessReviewHistoryDefinitionClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return AccessReviewHistoryDefinitionClientCreateResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete an access review history definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - options - AccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.DeleteByID +// method. +func (client *AccessReviewHistoryDefinitionClient) DeleteByID(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionClientDeleteByIDOptions) (AccessReviewHistoryDefinitionClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, historyDefinitionID, options) + if err != nil { + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *AccessReviewHistoryDefinitionClient) deleteByIDCreateRequest(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_client.go new file mode 100644 index 000000000000..2c1b12dbbe34 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_client.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionInstanceClient contains the methods for the AccessReviewHistoryDefinitionInstance group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionInstanceClient() instead. +type AccessReviewHistoryDefinitionInstanceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionInstanceClient creates a new instance of AccessReviewHistoryDefinitionInstanceClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionInstanceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GenerateDownloadURI - Generates a uri which can be used to retrieve review history data. This URI has a TTL of 1 day and +// can be retrieved by fetching the accessReviewHistoryDefinition object. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - instanceID - The id of the access review history definition instance to generate a URI for. +// - options - AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for the +// AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI method. +func (client *AccessReviewHistoryDefinitionInstanceClient) GenerateDownloadURI(ctx context.Context, historyDefinitionID string, instanceID string, options *AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + req, err := client.generateDownloadURICreateRequest(ctx, historyDefinitionID, instanceID, options) + if err != nil { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, runtime.NewResponseError(resp) + } + return client.generateDownloadURIHandleResponse(resp) +} + +// generateDownloadURICreateRequest creates the GenerateDownloadURI request. +func (client *AccessReviewHistoryDefinitionInstanceClient) generateDownloadURICreateRequest(ctx context.Context, historyDefinitionID string, instanceID string, options *AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generateDownloadURIHandleResponse handles the GenerateDownloadURI response. +func (client *AccessReviewHistoryDefinitionInstanceClient) generateDownloadURIHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + result := AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryInstance); err != nil { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go new file mode 100644 index 000000000000..078277be385d --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionInstancesClient contains the methods for the AccessReviewHistoryDefinitionInstances group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionInstancesClient() instead. +type AccessReviewHistoryDefinitionInstancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionInstancesClient creates a new instance of AccessReviewHistoryDefinitionInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review history definition instances by definition Id +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - options - AccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the AccessReviewHistoryDefinitionInstancesClient.NewListPager +// method. +func (client *AccessReviewHistoryDefinitionInstancesClient) NewListPager(historyDefinitionID string, options *AccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewHistoryDefinitionInstancesClientListResponse]{ + More: func(page AccessReviewHistoryDefinitionInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewHistoryDefinitionInstancesClientListResponse) (AccessReviewHistoryDefinitionInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, historyDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewHistoryDefinitionInstancesClient) listCreateRequest(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewHistoryDefinitionInstancesClient) listHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionInstancesClientListResponse, error) { + result := AccessReviewHistoryDefinitionInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionInstanceListResult); err != nil { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go new file mode 100644 index 000000000000..38bad9bbb2e8 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionsClient contains the methods for the AccessReviewHistoryDefinitions group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionsClient() instead. +type AccessReviewHistoryDefinitionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionsClient creates a new instance of AccessReviewHistoryDefinitionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetByID - Get access review history definition by definition Id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - options - AccessReviewHistoryDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionsClient.GetByID +// method. +func (client *AccessReviewHistoryDefinitionsClient) GetByID(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionsClientGetByIDOptions) (AccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, historyDefinitionID, options) + if err != nil { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewHistoryDefinitionsClient) getByIDCreateRequest(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewHistoryDefinitionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + result := AccessReviewHistoryDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the accessReviewHistoryDefinitions available from this provider, definition instances are only available +// for 30 days after creation. +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewHistoryDefinitionsClientListOptions contains the optional parameters for the AccessReviewHistoryDefinitionsClient.NewListPager +// method. +func (client *AccessReviewHistoryDefinitionsClient) NewListPager(options *AccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewHistoryDefinitionsClientListResponse]{ + More: func(page AccessReviewHistoryDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewHistoryDefinitionsClientListResponse) (AccessReviewHistoryDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewHistoryDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewHistoryDefinitionsClient) listCreateRequest(ctx context.Context, options *AccessReviewHistoryDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewHistoryDefinitionsClient) listHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionsClientListResponse, error) { + result := AccessReviewHistoryDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionListResult); err != nil { + return AccessReviewHistoryDefinitionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go new file mode 100644 index 000000000000..d5e3125ed5a4 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go @@ -0,0 +1,286 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceClient contains the methods for the AccessReviewInstance group. +// Don't use this type directly, use NewAccessReviewInstanceClient() instead. +type AccessReviewInstanceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstanceClient creates a new instance of AccessReviewInstanceClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// AcceptRecommendations - An action to accept recommendations for decision in an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientAcceptRecommendationsOptions contains the optional parameters for the AccessReviewInstanceClient.AcceptRecommendations +// method. +func (client *AccessReviewInstanceClient) AcceptRecommendations(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientAcceptRecommendationsOptions) (AccessReviewInstanceClientAcceptRecommendationsResponse, error) { + req, err := client.acceptRecommendationsCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, nil +} + +// acceptRecommendationsCreateRequest creates the AcceptRecommendations request. +func (client *AccessReviewInstanceClient) acceptRecommendationsCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientAcceptRecommendationsOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ApplyDecisions - An action to apply all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ApplyDecisions +// method. +func (client *AccessReviewInstanceClient) ApplyDecisions(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientApplyDecisionsOptions) (AccessReviewInstanceClientApplyDecisionsResponse, error) { + req, err := client.applyDecisionsCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientApplyDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientApplyDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientApplyDecisionsResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientApplyDecisionsResponse{}, nil +} + +// applyDecisionsCreateRequest creates the ApplyDecisions request. +func (client *AccessReviewInstanceClient) applyDecisionsCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientApplyDecisionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ResetDecisions - An action to reset all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ResetDecisions +// method. +func (client *AccessReviewInstanceClient) ResetDecisions(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientResetDecisionsOptions) (AccessReviewInstanceClientResetDecisionsResponse, error) { + req, err := client.resetDecisionsCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientResetDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientResetDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientResetDecisionsResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientResetDecisionsResponse{}, nil +} + +// resetDecisionsCreateRequest creates the ResetDecisions request. +func (client *AccessReviewInstanceClient) resetDecisionsCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientResetDecisionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// SendReminders - An action to send reminders for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the AccessReviewInstanceClient.SendReminders +// method. +func (client *AccessReviewInstanceClient) SendReminders(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientSendRemindersOptions) (AccessReviewInstanceClientSendRemindersResponse, error) { + req, err := client.sendRemindersCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientSendRemindersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientSendRemindersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientSendRemindersResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientSendRemindersResponse{}, nil +} + +// sendRemindersCreateRequest creates the SendReminders request. +func (client *AccessReviewInstanceClient) sendRemindersCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientSendRemindersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Stop - An action to stop an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientStopOptions contains the optional parameters for the AccessReviewInstanceClient.Stop +// method. +func (client *AccessReviewInstanceClient) Stop(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientStopOptions) (AccessReviewInstanceClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientStopResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *AccessReviewInstanceClient) stopCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go new file mode 100644 index 000000000000..4b7f3aaadb44 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceContactedReviewersClient contains the methods for the AccessReviewInstanceContactedReviewers group. +// Don't use this type directly, use NewAccessReviewInstanceContactedReviewersClient() instead. +type AccessReviewInstanceContactedReviewersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstanceContactedReviewersClient creates a new instance of AccessReviewInstanceContactedReviewersClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceContactedReviewersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceContactedReviewersClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceContactedReviewersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceContactedReviewersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance contacted reviewers +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the AccessReviewInstanceContactedReviewersClient.NewListPager +// method. +func (client *AccessReviewInstanceContactedReviewersClient) NewListPager(scheduleDefinitionID string, id string, options *AccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[AccessReviewInstanceContactedReviewersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstanceContactedReviewersClientListResponse]{ + More: func(page AccessReviewInstanceContactedReviewersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstanceContactedReviewersClientListResponse) (AccessReviewInstanceContactedReviewersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstanceContactedReviewersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceContactedReviewersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceContactedReviewersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstanceContactedReviewersClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceContactedReviewersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstanceContactedReviewersClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceContactedReviewersClientListResponse, error) { + result := AccessReviewInstanceContactedReviewersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewContactedReviewerListResult); err != nil { + return AccessReviewInstanceContactedReviewersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go new file mode 100644 index 000000000000..0048c75f1aa5 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceDecisionsClient contains the methods for the AccessReviewInstanceDecisions group. +// Don't use this type directly, use NewAccessReviewInstanceDecisionsClient() instead. +type AccessReviewInstanceDecisionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstanceDecisionsClient creates a new instance of AccessReviewInstanceDecisionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceDecisionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceDecisionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceDecisionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceDecisionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance decisions +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceDecisionsClientListOptions contains the optional parameters for the AccessReviewInstanceDecisionsClient.NewListPager +// method. +func (client *AccessReviewInstanceDecisionsClient) NewListPager(scheduleDefinitionID string, id string, options *AccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceDecisionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstanceDecisionsClientListResponse]{ + More: func(page AccessReviewInstanceDecisionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstanceDecisionsClientListResponse) (AccessReviewInstanceDecisionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstanceDecisionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceDecisionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceDecisionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstanceDecisionsClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceDecisionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstanceDecisionsClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceDecisionsClientListResponse, error) { + result := AccessReviewInstanceDecisionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { + return AccessReviewInstanceDecisionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go new file mode 100644 index 000000000000..0676e7a8ef43 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go @@ -0,0 +1,232 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceMyDecisionsClient contains the methods for the AccessReviewInstanceMyDecisions group. +// Don't use this type directly, use NewAccessReviewInstanceMyDecisionsClient() instead. +type AccessReviewInstanceMyDecisionsClient struct { + internal *arm.Client +} + +// NewAccessReviewInstanceMyDecisionsClient creates a new instance of AccessReviewInstanceMyDecisionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceMyDecisionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceMyDecisionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceMyDecisionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceMyDecisionsClient{ + internal: cl, + } + return client, nil +} + +// GetByID - Get my single access review instance decision. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - decisionID - The id of the decision record. +// - options - AccessReviewInstanceMyDecisionsClientGetByIDOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.GetByID +// method. +func (client *AccessReviewInstanceMyDecisionsClient) GetByID(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, options *AccessReviewInstanceMyDecisionsClientGetByIDOptions) (AccessReviewInstanceMyDecisionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, id, decisionID, options) + if err != nil { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewInstanceMyDecisionsClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, options *AccessReviewInstanceMyDecisionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + if decisionID == "" { + return nil, errors.New("parameter decisionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{decisionId}", url.PathEscape(decisionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewInstanceMyDecisionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsClientGetByIDResponse, error) { + result := AccessReviewInstanceMyDecisionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecision); err != nil { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get my access review instance decisions. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceMyDecisionsClientListOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.NewListPager +// method. +func (client *AccessReviewInstanceMyDecisionsClient) NewListPager(scheduleDefinitionID string, id string, options *AccessReviewInstanceMyDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceMyDecisionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstanceMyDecisionsClientListResponse]{ + More: func(page AccessReviewInstanceMyDecisionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstanceMyDecisionsClientListResponse) (AccessReviewInstanceMyDecisionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstanceMyDecisionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceMyDecisionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceMyDecisionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstanceMyDecisionsClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceMyDecisionsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstanceMyDecisionsClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsClientListResponse, error) { + result := AccessReviewInstanceMyDecisionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { + return AccessReviewInstanceMyDecisionsClientListResponse{}, err + } + return result, nil +} + +// Patch - Record a decision. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - decisionID - The id of the decision record. +// - properties - Access review decision properties to patch. +// - options - AccessReviewInstanceMyDecisionsClientPatchOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.Patch +// method. +func (client *AccessReviewInstanceMyDecisionsClient) Patch(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, properties AccessReviewDecisionProperties, options *AccessReviewInstanceMyDecisionsClientPatchOptions) (AccessReviewInstanceMyDecisionsClientPatchResponse, error) { + req, err := client.patchCreateRequest(ctx, scheduleDefinitionID, id, decisionID, properties, options) + if err != nil { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, runtime.NewResponseError(resp) + } + return client.patchHandleResponse(resp) +} + +// patchCreateRequest creates the Patch request. +func (client *AccessReviewInstanceMyDecisionsClient) patchCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, properties AccessReviewDecisionProperties, options *AccessReviewInstanceMyDecisionsClientPatchOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + if decisionID == "" { + return nil, errors.New("parameter decisionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{decisionId}", url.PathEscape(decisionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// patchHandleResponse handles the Patch response. +func (client *AccessReviewInstanceMyDecisionsClient) patchHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsClientPatchResponse, error) { + result := AccessReviewInstanceMyDecisionsClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecision); err != nil { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go new file mode 100644 index 000000000000..5c86c8717bd0 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go @@ -0,0 +1,232 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstancesClient contains the methods for the AccessReviewInstances group. +// Don't use this type directly, use NewAccessReviewInstancesClient() instead. +type AccessReviewInstancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstancesClient creates a new instance of AccessReviewInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Update access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - properties - Access review instance properties. +// - options - AccessReviewInstancesClientCreateOptions contains the optional parameters for the AccessReviewInstancesClient.Create +// method. +func (client *AccessReviewInstancesClient) Create(ctx context.Context, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *AccessReviewInstancesClientCreateOptions) (AccessReviewInstancesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, scheduleDefinitionID, id, properties, options) + if err != nil { + return AccessReviewInstancesClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *AccessReviewInstancesClient) createCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *AccessReviewInstancesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *AccessReviewInstancesClient) createHandleResponse(resp *http.Response) (AccessReviewInstancesClientCreateResponse, error) { + result := AccessReviewInstancesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return AccessReviewInstancesClientCreateResponse{}, err + } + return result, nil +} + +// GetByID - Get access review instances +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstancesClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesClient.GetByID +// method. +func (client *AccessReviewInstancesClient) GetByID(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesClientGetByIDOptions) (AccessReviewInstancesClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstancesClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewInstancesClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewInstancesClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstancesClientGetByIDResponse, error) { + result := AccessReviewInstancesClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return AccessReviewInstancesClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review instances +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewInstancesClientListOptions contains the optional parameters for the AccessReviewInstancesClient.NewListPager +// method. +func (client *AccessReviewInstancesClient) NewListPager(scheduleDefinitionID string, options *AccessReviewInstancesClientListOptions) *runtime.Pager[AccessReviewInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstancesClientListResponse]{ + More: func(page AccessReviewInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstancesClientListResponse) (AccessReviewInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstancesClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstancesClient) listHandleResponse(resp *http.Response) (AccessReviewInstancesClientListResponse, error) { + result := AccessReviewInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { + return AccessReviewInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go new file mode 100644 index 000000000000..f911882f8f67 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go @@ -0,0 +1,162 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstancesAssignedForMyApprovalClient contains the methods for the AccessReviewInstancesAssignedForMyApproval group. +// Don't use this type directly, use NewAccessReviewInstancesAssignedForMyApprovalClient() instead. +type AccessReviewInstancesAssignedForMyApprovalClient struct { + internal *arm.Client +} + +// NewAccessReviewInstancesAssignedForMyApprovalClient creates a new instance of AccessReviewInstancesAssignedForMyApprovalClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstancesAssignedForMyApprovalClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstancesAssignedForMyApprovalClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstancesAssignedForMyApprovalClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstancesAssignedForMyApprovalClient{ + internal: cl, + } + return client, nil +} + +// GetByID - Get single access review instance assigned for my approval. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesAssignedForMyApprovalClient.GetByID +// method. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) GetByID(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions) (AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse, error) { + result := AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review instances assigned for my approval. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewInstancesAssignedForMyApprovalClientListOptions contains the optional parameters for the AccessReviewInstancesAssignedForMyApprovalClient.NewListPager +// method. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) NewListPager(scheduleDefinitionID string, options *AccessReviewInstancesAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewInstancesAssignedForMyApprovalClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstancesAssignedForMyApprovalClientListResponse]{ + More: func(page AccessReviewInstancesAssignedForMyApprovalClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstancesAssignedForMyApprovalClientListResponse) (AccessReviewInstancesAssignedForMyApprovalClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewInstancesAssignedForMyApprovalClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) listHandleResponse(resp *http.Response) (AccessReviewInstancesAssignedForMyApprovalClientListResponse, error) { + result := AccessReviewInstancesAssignedForMyApprovalClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go new file mode 100644 index 000000000000..75ac537ae145 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go @@ -0,0 +1,305 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewScheduleDefinitionsClient contains the methods for the AccessReviewScheduleDefinitions group. +// Don't use this type directly, use NewAccessReviewScheduleDefinitionsClient() instead. +type AccessReviewScheduleDefinitionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewScheduleDefinitionsClient creates a new instance of AccessReviewScheduleDefinitionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewScheduleDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewScheduleDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewScheduleDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewScheduleDefinitionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdateByID - Create or Update access review schedule definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - properties - Access review schedule definition properties. +// - options - AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID +// method. +func (client *AccessReviewScheduleDefinitionsClient) CreateOrUpdateByID(ctx context.Context, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + req, err := client.createOrUpdateByIDCreateRequest(ctx, scheduleDefinitionID, properties, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateByIDHandleResponse(resp) +} + +// createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. +func (client *AccessReviewScheduleDefinitionsClient) createOrUpdateByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createOrUpdateByIDHandleResponse handles the CreateOrUpdateByID response. +func (client *AccessReviewScheduleDefinitionsClient) createOrUpdateByIDHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + result := AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete access review schedule definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.DeleteByID +// method. +func (client *AccessReviewScheduleDefinitionsClient) DeleteByID(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientDeleteByIDOptions) (AccessReviewScheduleDefinitionsClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, scheduleDefinitionID, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *AccessReviewScheduleDefinitionsClient) deleteByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetByID - Get single access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.GetByID +// method. +func (client *AccessReviewScheduleDefinitionsClient) GetByID(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientGetByIDOptions) (AccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewScheduleDefinitionsClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewScheduleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + result := AccessReviewScheduleDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review schedule definitions +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.NewListPager +// method. +func (client *AccessReviewScheduleDefinitionsClient) NewListPager(options *AccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewScheduleDefinitionsClientListResponse]{ + More: func(page AccessReviewScheduleDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewScheduleDefinitionsClientListResponse) (AccessReviewScheduleDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewScheduleDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewScheduleDefinitionsClient) listCreateRequest(ctx context.Context, options *AccessReviewScheduleDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewScheduleDefinitionsClient) listHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsClientListResponse, error) { + result := AccessReviewScheduleDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { + return AccessReviewScheduleDefinitionsClientListResponse{}, err + } + return result, nil +} + +// Stop - Stop access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.Stop +// method. +func (client *AccessReviewScheduleDefinitionsClient) Stop(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientStopOptions) (AccessReviewScheduleDefinitionsClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scheduleDefinitionID, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewScheduleDefinitionsClientStopResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewScheduleDefinitionsClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *AccessReviewScheduleDefinitionsClient) stopCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go new file mode 100644 index 000000000000..5dea7a3d2627 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go @@ -0,0 +1,101 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClient contains the methods for the AccessReviewScheduleDefinitionsAssignedForMyApproval group. +// Don't use this type directly, use NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient() instead. +type AccessReviewScheduleDefinitionsAssignedForMyApprovalClient struct { + internal *arm.Client +} + +// NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient creates a new instance of AccessReviewScheduleDefinitionsAssignedForMyApprovalClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewScheduleDefinitionsAssignedForMyApprovalClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instances assigned for my approval. +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions contains the optional parameters for the +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager method. +func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) NewListPager(options *AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse]{ + More: func(page AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse) (AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) listCreateRequest(ctx context.Context, options *AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) listHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse, error) { + result := AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go b/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go new file mode 100644 index 000000000000..c83634418c9b --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go @@ -0,0 +1,190 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertConfigurationsClient contains the methods for the AlertConfigurations group. +// Don't use this type directly, use NewAlertConfigurationsClient() instead. +type AlertConfigurationsClient struct { + internal *arm.Client +} + +// NewAlertConfigurationsClient creates a new instance of AlertConfigurationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertConfigurationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertConfigurationsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert configuration. 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. +// - alertID - The name of the alert configuration to get. +// - options - AlertConfigurationsClientGetOptions contains the optional parameters for the AlertConfigurationsClient.Get method. +func (client *AlertConfigurationsClient) Get(ctx context.Context, scope string, alertID string, options *AlertConfigurationsClientGetOptions) (AlertConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertID, options) + if err != nil { + return AlertConfigurationsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertConfigurationsClient) getCreateRequest(ctx context.Context, scope string, alertID string, options *AlertConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertConfigurationsClient) getHandleResponse(resp *http.Response) (AlertConfigurationsClientGetResponse, error) { + result := AlertConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertConfiguration); err != nil { + return AlertConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alert configurations for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert configuration. +// - options - AlertConfigurationsClientListForScopeOptions contains the optional parameters for the AlertConfigurationsClient.NewListForScopePager +// method. +func (client *AlertConfigurationsClient) NewListForScopePager(scope string, options *AlertConfigurationsClientListForScopeOptions) *runtime.Pager[AlertConfigurationsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertConfigurationsClientListForScopeResponse]{ + More: func(page AlertConfigurationsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertConfigurationsClientListForScopeResponse) (AlertConfigurationsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertConfigurationsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertConfigurationsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertConfigurationsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertConfigurationsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *AlertConfigurationsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertConfigurationsClient) listForScopeHandleResponse(resp *http.Response) (AlertConfigurationsClientListForScopeResponse, error) { + result := AlertConfigurationsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertConfigurationListResult); err != nil { + return AlertConfigurationsClientListForScopeResponse{}, err + } + return result, nil +} + +// Update - Update an alert configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert configuration. +// - alertID - The name of the alert configuration to update. +// - parameters - Parameters for the alert configuration. +// - options - AlertConfigurationsClientUpdateOptions contains the optional parameters for the AlertConfigurationsClient.Update +// method. +func (client *AlertConfigurationsClient) Update(ctx context.Context, scope string, alertID string, parameters AlertConfiguration, options *AlertConfigurationsClientUpdateOptions) (AlertConfigurationsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, scope, alertID, parameters, options) + if err != nil { + return AlertConfigurationsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertConfigurationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertConfigurationsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return AlertConfigurationsClientUpdateResponse{}, nil +} + +// updateCreateRequest creates the Update request. +func (client *AlertConfigurationsClient) updateCreateRequest(ctx context.Context, scope string, alertID string, parameters AlertConfiguration, options *AlertConfigurationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go new file mode 100644 index 000000000000..6c849a9667e9 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go @@ -0,0 +1,150 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertDefinitionsClient contains the methods for the AlertDefinitions group. +// Don't use this type directly, use NewAlertDefinitionsClient() instead. +type AlertDefinitionsClient struct { + internal *arm.Client +} + +// NewAlertDefinitionsClient creates a new instance of AlertDefinitionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertDefinitionsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert definition. 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. +// - alertDefinitionID - The name of the alert definition to get. +// - options - AlertDefinitionsClientGetOptions contains the optional parameters for the AlertDefinitionsClient.Get method. +func (client *AlertDefinitionsClient) Get(ctx context.Context, scope string, alertDefinitionID string, options *AlertDefinitionsClientGetOptions) (AlertDefinitionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertDefinitionID, options) + if err != nil { + return AlertDefinitionsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertDefinitionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertDefinitionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertDefinitionsClient) getCreateRequest(ctx context.Context, scope string, alertDefinitionID string, options *AlertDefinitionsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertDefinitionId}", alertDefinitionID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertDefinitionsClient) getHandleResponse(resp *http.Response) (AlertDefinitionsClientGetResponse, error) { + result := AlertDefinitionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertDefinition); err != nil { + return AlertDefinitionsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alert definitions for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert definition. +// - options - AlertDefinitionsClientListForScopeOptions contains the optional parameters for the AlertDefinitionsClient.NewListForScopePager +// method. +func (client *AlertDefinitionsClient) NewListForScopePager(scope string, options *AlertDefinitionsClientListForScopeOptions) *runtime.Pager[AlertDefinitionsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertDefinitionsClientListForScopeResponse]{ + More: func(page AlertDefinitionsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertDefinitionsClientListForScopeResponse) (AlertDefinitionsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertDefinitionsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertDefinitionsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertDefinitionsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertDefinitionsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *AlertDefinitionsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertDefinitionsClient) listForScopeHandleResponse(resp *http.Response) (AlertDefinitionsClientListForScopeResponse, error) { + result := AlertDefinitionsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertDefinitionListResult); err != nil { + return AlertDefinitionsClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go b/sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go new file mode 100644 index 000000000000..10021ec8ad77 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go @@ -0,0 +1,195 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertIncidentsClient contains the methods for the AlertIncidents group. +// Don't use this type directly, use NewAlertIncidentsClient() instead. +type AlertIncidentsClient struct { + internal *arm.Client +} + +// NewAlertIncidentsClient creates a new instance of AlertIncidentsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertIncidentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertIncidentsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertIncidentsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertIncidentsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert incident. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert incident. 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. +// - alertID - The name of the alert. +// - alertIncidentID - The name of the alert incident to get. +// - options - AlertIncidentsClientGetOptions contains the optional parameters for the AlertIncidentsClient.Get method. +func (client *AlertIncidentsClient) Get(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientGetOptions) (AlertIncidentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertID, alertIncidentID, options) + if err != nil { + return AlertIncidentsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertIncidentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertIncidentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertIncidentsClient) getCreateRequest(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + urlPath = strings.ReplaceAll(urlPath, "{alertIncidentId}", alertIncidentID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertIncidentsClient) getHandleResponse(resp *http.Response) (AlertIncidentsClientGetResponse, error) { + result := AlertIncidentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertIncident); err != nil { + return AlertIncidentsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alert incidents for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert incident. +// - alertID - The name of the alert. +// - options - AlertIncidentsClientListForScopeOptions contains the optional parameters for the AlertIncidentsClient.NewListForScopePager +// method. +func (client *AlertIncidentsClient) NewListForScopePager(scope string, alertID string, options *AlertIncidentsClientListForScopeOptions) *runtime.Pager[AlertIncidentsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertIncidentsClientListForScopeResponse]{ + More: func(page AlertIncidentsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertIncidentsClientListForScopeResponse) (AlertIncidentsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, alertID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertIncidentsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertIncidentsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertIncidentsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertIncidentsClient) listForScopeCreateRequest(ctx context.Context, scope string, alertID string, options *AlertIncidentsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertIncidentsClient) listForScopeHandleResponse(resp *http.Response) (AlertIncidentsClientListForScopeResponse, error) { + result := AlertIncidentsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertIncidentListResult); err != nil { + return AlertIncidentsClientListForScopeResponse{}, err + } + return result, nil +} + +// Remediate - Remediate an alert incident. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert incident. +// - alertID - The name of the alert. +// - alertIncidentID - The name of the alert incident to remediate. +// - options - AlertIncidentsClientRemediateOptions contains the optional parameters for the AlertIncidentsClient.Remediate +// method. +func (client *AlertIncidentsClient) Remediate(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientRemediateOptions) (AlertIncidentsClientRemediateResponse, error) { + req, err := client.remediateCreateRequest(ctx, scope, alertID, alertIncidentID, options) + if err != nil { + return AlertIncidentsClientRemediateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertIncidentsClientRemediateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertIncidentsClientRemediateResponse{}, runtime.NewResponseError(resp) + } + return AlertIncidentsClientRemediateResponse{}, nil +} + +// remediateCreateRequest creates the Remediate request. +func (client *AlertIncidentsClient) remediateCreateRequest(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientRemediateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + urlPath = strings.ReplaceAll(urlPath, "{alertIncidentId}", alertIncidentID) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go b/sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go new file mode 100644 index 000000000000..48057e6e7f0c --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertOperationClient contains the methods for the AlertOperation group. +// Don't use this type directly, use NewAlertOperationClient() instead. +type AlertOperationClient struct { + internal *arm.Client +} + +// NewAlertOperationClient creates a new instance of AlertOperationClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertOperationClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertOperationClient, error) { + cl, err := arm.NewClient(moduleName+".AlertOperationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertOperationClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert operation. +// - operationID - The id of the alert operation. +// - options - AlertOperationClientGetOptions contains the optional parameters for the AlertOperationClient.Get method. +func (client *AlertOperationClient) Get(ctx context.Context, scope string, operationID string, options *AlertOperationClientGetOptions) (AlertOperationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, operationID, options) + if err != nil { + return AlertOperationClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertOperationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertOperationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertOperationClient) getCreateRequest(ctx context.Context, scope string, operationID string, options *AlertOperationClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{operationId}", operationID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertOperationClient) getHandleResponse(resp *http.Response) (AlertOperationClientGetResponse, error) { + result := AlertOperationClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertOperationResult); err != nil { + return AlertOperationClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alerts_client.go b/sdk/resourcemanager/authorization/armauthorization/alerts_client.go new file mode 100644 index 000000000000..1ab64cb6d7dd --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alerts_client.go @@ -0,0 +1,298 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertsClient contains the methods for the Alerts group. +// Don't use this type directly, use NewAlertsClient() instead. +type AlertsClient struct { + internal *arm.Client +} + +// NewAlertsClient creates a new instance of AlertsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. 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. +// - alertID - The name of the alert to get. +// - options - AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +func (client *AlertsClient) Get(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (AlertsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertID, options) + if err != nil { + return AlertsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertsClient) getCreateRequest(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertsClient) getHandleResponse(resp *http.Response) (AlertsClientGetResponse, error) { + result := AlertsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { + return AlertsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alerts for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - options - AlertsClientListForScopeOptions contains the optional parameters for the AlertsClient.NewListForScopePager method. +func (client *AlertsClient) NewListForScopePager(scope string, options *AlertsClientListForScopeOptions) *runtime.Pager[AlertsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertsClientListForScopeResponse]{ + More: func(page AlertsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertsClientListForScopeResponse) (AlertsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *AlertsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertsClient) listForScopeHandleResponse(resp *http.Response) (AlertsClientListForScopeResponse, error) { + result := AlertsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertListResult); err != nil { + return AlertsClientListForScopeResponse{}, err + } + return result, nil +} + +// BeginRefresh - Refresh an alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - alertID - The name of the alert to refresh. +// - options - AlertsClientBeginRefreshOptions contains the optional parameters for the AlertsClient.BeginRefresh method. +func (client *AlertsClient) BeginRefresh(ctx context.Context, scope string, alertID string, options *AlertsClientBeginRefreshOptions) (*runtime.Poller[AlertsClientRefreshResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refresh(ctx, scope, alertID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AlertsClientRefreshResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AlertsClientRefreshResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Refresh - Refresh an alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +func (client *AlertsClient) refresh(ctx context.Context, scope string, alertID string, options *AlertsClientBeginRefreshOptions) (*http.Response, error) { + req, err := client.refreshCreateRequest(ctx, scope, alertID, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// refreshCreateRequest creates the Refresh request. +func (client *AlertsClient) refreshCreateRequest(ctx context.Context, scope string, alertID string, options *AlertsClientBeginRefreshOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRefreshAll - Refresh all alerts for a resource scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - options - AlertsClientBeginRefreshAllOptions contains the optional parameters for the AlertsClient.BeginRefreshAll method. +func (client *AlertsClient) BeginRefreshAll(ctx context.Context, scope string, options *AlertsClientBeginRefreshAllOptions) (*runtime.Poller[AlertsClientRefreshAllResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refreshAll(ctx, scope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AlertsClientRefreshAllResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AlertsClientRefreshAllResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// RefreshAll - Refresh all alerts for a resource scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +func (client *AlertsClient) refreshAll(ctx context.Context, scope string, options *AlertsClientBeginRefreshAllOptions) (*http.Response, error) { + req, err := client.refreshAllCreateRequest(ctx, scope, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// refreshAllCreateRequest creates the RefreshAll request. +func (client *AlertsClient) refreshAllCreateRequest(ctx context.Context, scope string, options *AlertsClientBeginRefreshAllOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update an alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - alertID - The name of the alert to dismiss. +// - parameters - Parameters for the alert. +// - options - AlertsClientUpdateOptions contains the optional parameters for the AlertsClient.Update method. +func (client *AlertsClient) Update(ctx context.Context, scope string, alertID string, parameters Alert, options *AlertsClientUpdateOptions) (AlertsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, scope, alertID, parameters, options) + if err != nil { + return AlertsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return AlertsClientUpdateResponse{}, nil +} + +// updateCreateRequest creates the Update request. +func (client *AlertsClient) updateCreateRequest(ctx context.Context, scope string, alertID string, parameters Alert, options *AlertsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/authorization/armauthorization/autorest.md b/sdk/resourcemanager/authorization/armauthorization/autorest.md index 114d6e2b73ff..0ccade06ed3f 100644 --- a/sdk/resourcemanager/authorization/armauthorization/autorest.md +++ b/sdk/resourcemanager/authorization/armauthorization/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/authorization/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/authorization/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.1.1 -tag: package-2022-04-01 +module-version: 3.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go b/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go deleted file mode 100644 index ff6f2aba5a5e..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ClassicAdministratorsClient contains the methods for the ClassicAdministrators group. -// Don't use this type directly, use NewClassicAdministratorsClient() instead. -type ClassicAdministratorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewClassicAdministratorsClient creates a new instance of ClassicAdministratorsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewClassicAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClassicAdministratorsClient, error) { - cl, err := arm.NewClient(moduleName+".ClassicAdministratorsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ClassicAdministratorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Gets service administrator, account administrator, and co-administrators for the subscription. -// -// Generated from API version 2015-07-01 -// - options - ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.NewListPager -// method. -func (client *ClassicAdministratorsClient) NewListPager(options *ClassicAdministratorsClientListOptions) *runtime.Pager[ClassicAdministratorsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ClassicAdministratorsClientListResponse]{ - More: func(page ClassicAdministratorsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ClassicAdministratorsClientListResponse) (ClassicAdministratorsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ClassicAdministratorsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ClassicAdministratorsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClassicAdministratorsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *ClassicAdministratorsClient) listCreateRequest(ctx context.Context, options *ClassicAdministratorsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-07-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ClassicAdministratorsClient) listHandleResponse(resp *http.Response) (ClassicAdministratorsClientListResponse, error) { - result := ClassicAdministratorsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ClassicAdministratorListResult); err != nil { - return ClassicAdministratorsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go deleted file mode 100644 index c88e382e222c..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetClassicAdministrators.json -func ExampleClassicAdministratorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClassicAdministratorsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClassicAdministratorListResult = armauthorization.ClassicAdministratorListResult{ - // Value: []*armauthorization.ClassicAdministrator{ - // { - // Name: to.Ptr("classicadminid"), - // Type: to.Ptr("Microsoft.Authorization/classicAdministrators"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Authorization/classicAdministrators/classicadminid"), - // Properties: &armauthorization.ClassicAdministratorProperties{ - // EmailAddress: to.Ptr("test@test.com"), - // Role: to.Ptr("ServiceAdministrator;AccountAdministrator"), - // }, - // }, - // { - // Name: to.Ptr("classicadminid2"), - // Type: to.Ptr("Microsoft.Authorization/classicAdministrators"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Authorization/classicAdministrators/classicadminid2"), - // Properties: &armauthorization.ClassicAdministratorProperties{ - // EmailAddress: to.Ptr("coadmin@test.com"), - // Role: to.Ptr("CoAdministrator"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/client_factory.go b/sdk/resourcemanager/authorization/armauthorization/client_factory.go index 07b3cf896c4b..e683ff8cdcdb 100644 --- a/sdk/resourcemanager/authorization/armauthorization/client_factory.go +++ b/sdk/resourcemanager/authorization/armauthorization/client_factory.go @@ -38,82 +38,152 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewClassicAdministratorsClient() *ClassicAdministratorsClient { - subClient, _ := NewClassicAdministratorsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewGlobalAdministratorClient() *GlobalAdministratorClient { - subClient, _ := NewGlobalAdministratorClient(c.credential, c.options) +func (c *ClientFactory) NewAccessReviewHistoryDefinitionsClient() *AccessReviewHistoryDefinitionsClient { + subClient, _ := NewAccessReviewHistoryDefinitionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDenyAssignmentsClient() *DenyAssignmentsClient { - subClient, _ := NewDenyAssignmentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAccessReviewHistoryDefinitionClient() *AccessReviewHistoryDefinitionClient { + subClient, _ := NewAccessReviewHistoryDefinitionClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewProviderOperationsMetadataClient() *ProviderOperationsMetadataClient { - subClient, _ := NewProviderOperationsMetadataClient(c.credential, c.options) +func (c *ClientFactory) NewAccessReviewHistoryDefinitionInstanceClient() *AccessReviewHistoryDefinitionInstanceClient { + subClient, _ := NewAccessReviewHistoryDefinitionInstanceClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleAssignmentsClient() *RoleAssignmentsClient { - subClient, _ := NewRoleAssignmentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAccessReviewHistoryDefinitionInstancesClient() *AccessReviewHistoryDefinitionInstancesClient { + subClient, _ := NewAccessReviewHistoryDefinitionInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPermissionsClient() *PermissionsClient { - subClient, _ := NewPermissionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAccessReviewScheduleDefinitionsClient() *AccessReviewScheduleDefinitionsClient { + subClient, _ := NewAccessReviewScheduleDefinitionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleDefinitionsClient() *RoleDefinitionsClient { - subClient, _ := NewRoleDefinitionsClient(c.credential, c.options) +func (c *ClientFactory) NewAccessReviewInstancesClient() *AccessReviewInstancesClient { + subClient, _ := NewAccessReviewInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewEligibleChildResourcesClient() *EligibleChildResourcesClient { - subClient, _ := NewEligibleChildResourcesClient(c.credential, c.options) +func (c *ClientFactory) NewAccessReviewInstanceClient() *AccessReviewInstanceClient { + subClient, _ := NewAccessReviewInstanceClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleAssignmentSchedulesClient() *RoleAssignmentSchedulesClient { - subClient, _ := NewRoleAssignmentSchedulesClient(c.credential, c.options) +func (c *ClientFactory) NewAccessReviewInstanceDecisionsClient() *AccessReviewInstanceDecisionsClient { + subClient, _ := NewAccessReviewInstanceDecisionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleAssignmentScheduleInstancesClient() *RoleAssignmentScheduleInstancesClient { - subClient, _ := NewRoleAssignmentScheduleInstancesClient(c.credential, c.options) +func (c *ClientFactory) NewAccessReviewInstanceContactedReviewersClient() *AccessReviewInstanceContactedReviewersClient { + subClient, _ := NewAccessReviewInstanceContactedReviewersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleAssignmentScheduleRequestsClient() *RoleAssignmentScheduleRequestsClient { - subClient, _ := NewRoleAssignmentScheduleRequestsClient(c.credential, c.options) +func (c *ClientFactory) NewAccessReviewDefaultSettingsClient() *AccessReviewDefaultSettingsClient { + subClient, _ := NewAccessReviewDefaultSettingsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleEligibilitySchedulesClient() *RoleEligibilitySchedulesClient { - subClient, _ := NewRoleEligibilitySchedulesClient(c.credential, c.options) +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionsClient() *ScopeAccessReviewHistoryDefinitionsClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleEligibilityScheduleInstancesClient() *RoleEligibilityScheduleInstancesClient { - subClient, _ := NewRoleEligibilityScheduleInstancesClient(c.credential, c.options) +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionClient() *ScopeAccessReviewHistoryDefinitionClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleEligibilityScheduleRequestsClient() *RoleEligibilityScheduleRequestsClient { - subClient, _ := NewRoleEligibilityScheduleRequestsClient(c.credential, c.options) +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionInstanceClient() *ScopeAccessReviewHistoryDefinitionInstanceClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionInstanceClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleManagementPoliciesClient() *RoleManagementPoliciesClient { - subClient, _ := NewRoleManagementPoliciesClient(c.credential, c.options) +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionInstancesClient() *ScopeAccessReviewHistoryDefinitionInstancesClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionInstancesClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewRoleManagementPolicyAssignmentsClient() *RoleManagementPolicyAssignmentsClient { - subClient, _ := NewRoleManagementPolicyAssignmentsClient(c.credential, c.options) +func (c *ClientFactory) NewScopeAccessReviewScheduleDefinitionsClient() *ScopeAccessReviewScheduleDefinitionsClient { + subClient, _ := NewScopeAccessReviewScheduleDefinitionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstancesClient() *ScopeAccessReviewInstancesClient { + subClient, _ := NewScopeAccessReviewInstancesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstanceClient() *ScopeAccessReviewInstanceClient { + subClient, _ := NewScopeAccessReviewInstanceClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstanceDecisionsClient() *ScopeAccessReviewInstanceDecisionsClient { + subClient, _ := NewScopeAccessReviewInstanceDecisionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstanceContactedReviewersClient() *ScopeAccessReviewInstanceContactedReviewersClient { + subClient, _ := NewScopeAccessReviewInstanceContactedReviewersClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewDefaultSettingsClient() *ScopeAccessReviewDefaultSettingsClient { + subClient, _ := NewScopeAccessReviewDefaultSettingsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient() *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient { + subClient, _ := NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstancesAssignedForMyApprovalClient() *AccessReviewInstancesAssignedForMyApprovalClient { + subClient, _ := NewAccessReviewInstancesAssignedForMyApprovalClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstanceMyDecisionsClient() *AccessReviewInstanceMyDecisionsClient { + subClient, _ := NewAccessReviewInstanceMyDecisionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTenantLevelAccessReviewInstanceContactedReviewersClient() *TenantLevelAccessReviewInstanceContactedReviewersClient { + subClient, _ := NewTenantLevelAccessReviewInstanceContactedReviewersClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertsClient() *AlertsClient { + subClient, _ := NewAlertsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertConfigurationsClient() *AlertConfigurationsClient { + subClient, _ := NewAlertConfigurationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertDefinitionsClient() *AlertDefinitionsClient { + subClient, _ := NewAlertDefinitionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertIncidentsClient() *AlertIncidentsClient { + subClient, _ := NewAlertIncidentsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertOperationClient() *AlertOperationClient { + subClient, _ := NewAlertOperationClient(c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/authorization/armauthorization/constants.go b/sdk/resourcemanager/authorization/armauthorization/constants.go index 41729e2b0ba1..9e5185ef150a 100644 --- a/sdk/resourcemanager/authorization/armauthorization/constants.go +++ b/sdk/resourcemanager/authorization/armauthorization/constants.go @@ -11,291 +11,413 @@ package armauthorization const ( moduleName = "armauthorization" - moduleVersion = "v2.1.1" + moduleVersion = "v3.0.0-beta.1" ) -// ApprovalMode - The type of rule -type ApprovalMode string +// AccessRecommendationType - The feature- generated recommendation shown to the reviewer. +type AccessRecommendationType string const ( - ApprovalModeNoApproval ApprovalMode = "NoApproval" - ApprovalModeParallel ApprovalMode = "Parallel" - ApprovalModeSerial ApprovalMode = "Serial" - ApprovalModeSingleStage ApprovalMode = "SingleStage" + AccessRecommendationTypeApprove AccessRecommendationType = "Approve" + AccessRecommendationTypeDeny AccessRecommendationType = "Deny" + AccessRecommendationTypeNoInfoAvailable AccessRecommendationType = "NoInfoAvailable" ) -// PossibleApprovalModeValues returns the possible values for the ApprovalMode const type. -func PossibleApprovalModeValues() []ApprovalMode { - return []ApprovalMode{ - ApprovalModeNoApproval, - ApprovalModeParallel, - ApprovalModeSerial, - ApprovalModeSingleStage, +// PossibleAccessRecommendationTypeValues returns the possible values for the AccessRecommendationType const type. +func PossibleAccessRecommendationTypeValues() []AccessRecommendationType { + return []AccessRecommendationType{ + AccessRecommendationTypeApprove, + AccessRecommendationTypeDeny, + AccessRecommendationTypeNoInfoAvailable, } } -// AssignmentType - Assignment type of the role assignment schedule -type AssignmentType string +// AccessReviewActorIdentityType - The identity type : user/servicePrincipal +type AccessReviewActorIdentityType string const ( - AssignmentTypeActivated AssignmentType = "Activated" - AssignmentTypeAssigned AssignmentType = "Assigned" + AccessReviewActorIdentityTypeServicePrincipal AccessReviewActorIdentityType = "servicePrincipal" + AccessReviewActorIdentityTypeUser AccessReviewActorIdentityType = "user" ) -// PossibleAssignmentTypeValues returns the possible values for the AssignmentType const type. -func PossibleAssignmentTypeValues() []AssignmentType { - return []AssignmentType{ - AssignmentTypeActivated, - AssignmentTypeAssigned, +// PossibleAccessReviewActorIdentityTypeValues returns the possible values for the AccessReviewActorIdentityType const type. +func PossibleAccessReviewActorIdentityTypeValues() []AccessReviewActorIdentityType { + return []AccessReviewActorIdentityType{ + AccessReviewActorIdentityTypeServicePrincipal, + AccessReviewActorIdentityTypeUser, } } -// EnablementRules - The type of enablement rule -type EnablementRules string +// AccessReviewApplyResult - The outcome of applying the decision. +type AccessReviewApplyResult string const ( - EnablementRulesJustification EnablementRules = "Justification" - EnablementRulesMultiFactorAuthentication EnablementRules = "MultiFactorAuthentication" - EnablementRulesTicketing EnablementRules = "Ticketing" + AccessReviewApplyResultAppliedSuccessfully AccessReviewApplyResult = "AppliedSuccessfully" + AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound AccessReviewApplyResult = "AppliedSuccessfullyButObjectNotFound" + AccessReviewApplyResultAppliedWithUnknownFailure AccessReviewApplyResult = "AppliedWithUnknownFailure" + AccessReviewApplyResultApplyNotSupported AccessReviewApplyResult = "ApplyNotSupported" + AccessReviewApplyResultApplying AccessReviewApplyResult = "Applying" + AccessReviewApplyResultNew AccessReviewApplyResult = "New" ) -// PossibleEnablementRulesValues returns the possible values for the EnablementRules const type. -func PossibleEnablementRulesValues() []EnablementRules { - return []EnablementRules{ - EnablementRulesJustification, - EnablementRulesMultiFactorAuthentication, - EnablementRulesTicketing, +// PossibleAccessReviewApplyResultValues returns the possible values for the AccessReviewApplyResult const type. +func PossibleAccessReviewApplyResultValues() []AccessReviewApplyResult { + return []AccessReviewApplyResult{ + AccessReviewApplyResultAppliedSuccessfully, + AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound, + AccessReviewApplyResultAppliedWithUnknownFailure, + AccessReviewApplyResultApplyNotSupported, + AccessReviewApplyResultApplying, + AccessReviewApplyResultNew, } } -// MemberType - Membership type of the role assignment schedule -type MemberType string +// AccessReviewDecisionInsightType - The type of insight +type AccessReviewDecisionInsightType string const ( - MemberTypeDirect MemberType = "Direct" - MemberTypeGroup MemberType = "Group" - MemberTypeInherited MemberType = "Inherited" + AccessReviewDecisionInsightTypeUserSignInInsight AccessReviewDecisionInsightType = "userSignInInsight" ) -// PossibleMemberTypeValues returns the possible values for the MemberType const type. -func PossibleMemberTypeValues() []MemberType { - return []MemberType{ - MemberTypeDirect, - MemberTypeGroup, - MemberTypeInherited, +// PossibleAccessReviewDecisionInsightTypeValues returns the possible values for the AccessReviewDecisionInsightType const type. +func PossibleAccessReviewDecisionInsightTypeValues() []AccessReviewDecisionInsightType { + return []AccessReviewDecisionInsightType{ + AccessReviewDecisionInsightTypeUserSignInInsight, } } -// NotificationDeliveryMechanism - The type of notification. -type NotificationDeliveryMechanism string +type AccessReviewDecisionPrincipalResourceMembershipType string const ( - NotificationDeliveryMechanismEmail NotificationDeliveryMechanism = "Email" + AccessReviewDecisionPrincipalResourceMembershipTypeDirect AccessReviewDecisionPrincipalResourceMembershipType = "direct" + AccessReviewDecisionPrincipalResourceMembershipTypeIndirect AccessReviewDecisionPrincipalResourceMembershipType = "indirect" ) -// PossibleNotificationDeliveryMechanismValues returns the possible values for the NotificationDeliveryMechanism const type. -func PossibleNotificationDeliveryMechanismValues() []NotificationDeliveryMechanism { - return []NotificationDeliveryMechanism{ - NotificationDeliveryMechanismEmail, +// PossibleAccessReviewDecisionPrincipalResourceMembershipTypeValues returns the possible values for the AccessReviewDecisionPrincipalResourceMembershipType const type. +func PossibleAccessReviewDecisionPrincipalResourceMembershipTypeValues() []AccessReviewDecisionPrincipalResourceMembershipType { + return []AccessReviewDecisionPrincipalResourceMembershipType{ + AccessReviewDecisionPrincipalResourceMembershipTypeDirect, + AccessReviewDecisionPrincipalResourceMembershipTypeIndirect, } } -// NotificationLevel - The notification level. -type NotificationLevel string +// AccessReviewHistoryDefinitionStatus - This read-only field specifies the of the requested review history data. This is +// either requested, in-progress, done or error. +type AccessReviewHistoryDefinitionStatus string const ( - NotificationLevelAll NotificationLevel = "All" - NotificationLevelCritical NotificationLevel = "Critical" - NotificationLevelNone NotificationLevel = "None" + AccessReviewHistoryDefinitionStatusDone AccessReviewHistoryDefinitionStatus = "Done" + AccessReviewHistoryDefinitionStatusError AccessReviewHistoryDefinitionStatus = "Error" + AccessReviewHistoryDefinitionStatusInProgress AccessReviewHistoryDefinitionStatus = "InProgress" + AccessReviewHistoryDefinitionStatusRequested AccessReviewHistoryDefinitionStatus = "Requested" ) -// PossibleNotificationLevelValues returns the possible values for the NotificationLevel const type. -func PossibleNotificationLevelValues() []NotificationLevel { - return []NotificationLevel{ - NotificationLevelAll, - NotificationLevelCritical, - NotificationLevelNone, +// PossibleAccessReviewHistoryDefinitionStatusValues returns the possible values for the AccessReviewHistoryDefinitionStatus const type. +func PossibleAccessReviewHistoryDefinitionStatusValues() []AccessReviewHistoryDefinitionStatus { + return []AccessReviewHistoryDefinitionStatus{ + AccessReviewHistoryDefinitionStatusDone, + AccessReviewHistoryDefinitionStatusError, + AccessReviewHistoryDefinitionStatusInProgress, + AccessReviewHistoryDefinitionStatusRequested, } } -// PrincipalType - The principal type of the assigned principal ID. -type PrincipalType string +// AccessReviewInstanceReviewersType - 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. +type AccessReviewInstanceReviewersType string const ( - PrincipalTypeDevice PrincipalType = "Device" - PrincipalTypeForeignGroup PrincipalType = "ForeignGroup" - PrincipalTypeGroup PrincipalType = "Group" - PrincipalTypeServicePrincipal PrincipalType = "ServicePrincipal" - PrincipalTypeUser PrincipalType = "User" + AccessReviewInstanceReviewersTypeAssigned AccessReviewInstanceReviewersType = "Assigned" + AccessReviewInstanceReviewersTypeManagers AccessReviewInstanceReviewersType = "Managers" + AccessReviewInstanceReviewersTypeSelf AccessReviewInstanceReviewersType = "Self" ) -// PossiblePrincipalTypeValues returns the possible values for the PrincipalType const type. -func PossiblePrincipalTypeValues() []PrincipalType { - return []PrincipalType{ - PrincipalTypeDevice, - PrincipalTypeForeignGroup, - PrincipalTypeGroup, - PrincipalTypeServicePrincipal, - PrincipalTypeUser, +// PossibleAccessReviewInstanceReviewersTypeValues returns the possible values for the AccessReviewInstanceReviewersType const type. +func PossibleAccessReviewInstanceReviewersTypeValues() []AccessReviewInstanceReviewersType { + return []AccessReviewInstanceReviewersType{ + AccessReviewInstanceReviewersTypeAssigned, + AccessReviewInstanceReviewersTypeManagers, + AccessReviewInstanceReviewersTypeSelf, } } -// RecipientType - The recipient type. -type RecipientType string +// AccessReviewInstanceStatus - This read-only field specifies the status of an access review instance. +type AccessReviewInstanceStatus string const ( - RecipientTypeAdmin RecipientType = "Admin" - RecipientTypeApprover RecipientType = "Approver" - RecipientTypeRequestor RecipientType = "Requestor" + AccessReviewInstanceStatusApplied AccessReviewInstanceStatus = "Applied" + AccessReviewInstanceStatusApplying AccessReviewInstanceStatus = "Applying" + AccessReviewInstanceStatusAutoReviewed AccessReviewInstanceStatus = "AutoReviewed" + AccessReviewInstanceStatusAutoReviewing AccessReviewInstanceStatus = "AutoReviewing" + AccessReviewInstanceStatusCompleted AccessReviewInstanceStatus = "Completed" + AccessReviewInstanceStatusCompleting AccessReviewInstanceStatus = "Completing" + AccessReviewInstanceStatusInProgress AccessReviewInstanceStatus = "InProgress" + AccessReviewInstanceStatusInitializing AccessReviewInstanceStatus = "Initializing" + AccessReviewInstanceStatusNotStarted AccessReviewInstanceStatus = "NotStarted" + AccessReviewInstanceStatusScheduled AccessReviewInstanceStatus = "Scheduled" + AccessReviewInstanceStatusStarting AccessReviewInstanceStatus = "Starting" ) -// PossibleRecipientTypeValues returns the possible values for the RecipientType const type. -func PossibleRecipientTypeValues() []RecipientType { - return []RecipientType{ - RecipientTypeAdmin, - RecipientTypeApprover, - RecipientTypeRequestor, +// PossibleAccessReviewInstanceStatusValues returns the possible values for the AccessReviewInstanceStatus const type. +func PossibleAccessReviewInstanceStatusValues() []AccessReviewInstanceStatus { + return []AccessReviewInstanceStatus{ + AccessReviewInstanceStatusApplied, + AccessReviewInstanceStatusApplying, + AccessReviewInstanceStatusAutoReviewed, + AccessReviewInstanceStatusAutoReviewing, + AccessReviewInstanceStatusCompleted, + AccessReviewInstanceStatusCompleting, + AccessReviewInstanceStatusInProgress, + AccessReviewInstanceStatusInitializing, + AccessReviewInstanceStatusNotStarted, + AccessReviewInstanceStatusScheduled, + AccessReviewInstanceStatusStarting, } } -// RequestType - The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc -type RequestType string +// AccessReviewRecurrencePatternType - The recurrence type : weekly, monthly, etc. +type AccessReviewRecurrencePatternType string const ( - RequestTypeAdminAssign RequestType = "AdminAssign" - RequestTypeAdminExtend RequestType = "AdminExtend" - RequestTypeAdminRemove RequestType = "AdminRemove" - RequestTypeAdminRenew RequestType = "AdminRenew" - RequestTypeAdminUpdate RequestType = "AdminUpdate" - RequestTypeSelfActivate RequestType = "SelfActivate" - RequestTypeSelfDeactivate RequestType = "SelfDeactivate" - RequestTypeSelfExtend RequestType = "SelfExtend" - RequestTypeSelfRenew RequestType = "SelfRenew" + AccessReviewRecurrencePatternTypeAbsoluteMonthly AccessReviewRecurrencePatternType = "absoluteMonthly" + AccessReviewRecurrencePatternTypeWeekly AccessReviewRecurrencePatternType = "weekly" ) -// PossibleRequestTypeValues returns the possible values for the RequestType const type. -func PossibleRequestTypeValues() []RequestType { - return []RequestType{ - RequestTypeAdminAssign, - RequestTypeAdminExtend, - RequestTypeAdminRemove, - RequestTypeAdminRenew, - RequestTypeAdminUpdate, - RequestTypeSelfActivate, - RequestTypeSelfDeactivate, - RequestTypeSelfExtend, - RequestTypeSelfRenew, +// PossibleAccessReviewRecurrencePatternTypeValues returns the possible values for the AccessReviewRecurrencePatternType const type. +func PossibleAccessReviewRecurrencePatternTypeValues() []AccessReviewRecurrencePatternType { + return []AccessReviewRecurrencePatternType{ + AccessReviewRecurrencePatternTypeAbsoluteMonthly, + AccessReviewRecurrencePatternTypeWeekly, } } -// RoleManagementPolicyRuleType - The type of rule -type RoleManagementPolicyRuleType string +// AccessReviewRecurrenceRangeType - The recurrence range type. The possible values are: endDate, noEnd, numbered. +type AccessReviewRecurrenceRangeType string const ( - RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule RoleManagementPolicyRuleType = "RoleManagementPolicyApprovalRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule RoleManagementPolicyRuleType = "RoleManagementPolicyAuthenticationContextRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule RoleManagementPolicyRuleType = "RoleManagementPolicyEnablementRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule RoleManagementPolicyRuleType = "RoleManagementPolicyExpirationRule" - RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule RoleManagementPolicyRuleType = "RoleManagementPolicyNotificationRule" + AccessReviewRecurrenceRangeTypeEndDate AccessReviewRecurrenceRangeType = "endDate" + AccessReviewRecurrenceRangeTypeNoEnd AccessReviewRecurrenceRangeType = "noEnd" + AccessReviewRecurrenceRangeTypeNumbered AccessReviewRecurrenceRangeType = "numbered" ) -// PossibleRoleManagementPolicyRuleTypeValues returns the possible values for the RoleManagementPolicyRuleType const type. -func PossibleRoleManagementPolicyRuleTypeValues() []RoleManagementPolicyRuleType { - return []RoleManagementPolicyRuleType{ - RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule, - RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule, +// PossibleAccessReviewRecurrenceRangeTypeValues returns the possible values for the AccessReviewRecurrenceRangeType const type. +func PossibleAccessReviewRecurrenceRangeTypeValues() []AccessReviewRecurrenceRangeType { + return []AccessReviewRecurrenceRangeType{ + AccessReviewRecurrenceRangeTypeEndDate, + AccessReviewRecurrenceRangeTypeNoEnd, + AccessReviewRecurrenceRangeTypeNumbered, } } -// Status - The status of the role assignment schedule. -type Status string +// AccessReviewResult - Represents a reviewer's decision for a given review +type AccessReviewResult string const ( - StatusAccepted Status = "Accepted" - StatusAdminApproved Status = "AdminApproved" - StatusAdminDenied Status = "AdminDenied" - StatusCanceled Status = "Canceled" - StatusDenied Status = "Denied" - StatusFailed Status = "Failed" - StatusFailedAsResourceIsLocked Status = "FailedAsResourceIsLocked" - StatusGranted Status = "Granted" - StatusInvalid Status = "Invalid" - StatusPendingAdminDecision Status = "PendingAdminDecision" - StatusPendingApproval Status = "PendingApproval" - StatusPendingApprovalProvisioning Status = "PendingApprovalProvisioning" - StatusPendingEvaluation Status = "PendingEvaluation" - StatusPendingExternalProvisioning Status = "PendingExternalProvisioning" - StatusPendingProvisioning Status = "PendingProvisioning" - StatusPendingRevocation Status = "PendingRevocation" - StatusPendingScheduleCreation Status = "PendingScheduleCreation" - StatusProvisioned Status = "Provisioned" - StatusProvisioningStarted Status = "ProvisioningStarted" - StatusRevoked Status = "Revoked" - StatusScheduleCreated Status = "ScheduleCreated" - StatusTimedOut Status = "TimedOut" + AccessReviewResultApprove AccessReviewResult = "Approve" + AccessReviewResultDeny AccessReviewResult = "Deny" + AccessReviewResultDontKnow AccessReviewResult = "DontKnow" + AccessReviewResultNotNotified AccessReviewResult = "NotNotified" + AccessReviewResultNotReviewed AccessReviewResult = "NotReviewed" ) -// PossibleStatusValues returns the possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{ - StatusAccepted, - StatusAdminApproved, - StatusAdminDenied, - StatusCanceled, - StatusDenied, - StatusFailed, - StatusFailedAsResourceIsLocked, - StatusGranted, - StatusInvalid, - StatusPendingAdminDecision, - StatusPendingApproval, - StatusPendingApprovalProvisioning, - StatusPendingEvaluation, - StatusPendingExternalProvisioning, - StatusPendingProvisioning, - StatusPendingRevocation, - StatusPendingScheduleCreation, - StatusProvisioned, - StatusProvisioningStarted, - StatusRevoked, - StatusScheduleCreated, - StatusTimedOut, +// PossibleAccessReviewResultValues returns the possible values for the AccessReviewResult const type. +func PossibleAccessReviewResultValues() []AccessReviewResult { + return []AccessReviewResult{ + AccessReviewResultApprove, + AccessReviewResultDeny, + AccessReviewResultDontKnow, + AccessReviewResultNotNotified, + AccessReviewResultNotReviewed, } } -// Type - Type of the role assignment schedule expiration -type Type string +// AccessReviewReviewerType - The identity type : user/servicePrincipal +type AccessReviewReviewerType string const ( - TypeAfterDateTime Type = "AfterDateTime" - TypeAfterDuration Type = "AfterDuration" - TypeNoExpiration Type = "NoExpiration" + AccessReviewReviewerTypeServicePrincipal AccessReviewReviewerType = "servicePrincipal" + AccessReviewReviewerTypeUser AccessReviewReviewerType = "user" ) -// PossibleTypeValues returns the possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{ - TypeAfterDateTime, - TypeAfterDuration, - TypeNoExpiration, +// PossibleAccessReviewReviewerTypeValues returns the possible values for the AccessReviewReviewerType const type. +func PossibleAccessReviewReviewerTypeValues() []AccessReviewReviewerType { + return []AccessReviewReviewerType{ + AccessReviewReviewerTypeServicePrincipal, + AccessReviewReviewerTypeUser, } } -// UserType - The type of user. -type UserType string +// AccessReviewScheduleDefinitionReviewersType - 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. +type AccessReviewScheduleDefinitionReviewersType string const ( - UserTypeGroup UserType = "Group" - UserTypeUser UserType = "User" + AccessReviewScheduleDefinitionReviewersTypeAssigned AccessReviewScheduleDefinitionReviewersType = "Assigned" + AccessReviewScheduleDefinitionReviewersTypeManagers AccessReviewScheduleDefinitionReviewersType = "Managers" + AccessReviewScheduleDefinitionReviewersTypeSelf AccessReviewScheduleDefinitionReviewersType = "Self" ) -// PossibleUserTypeValues returns the possible values for the UserType const type. -func PossibleUserTypeValues() []UserType { - return []UserType{ - UserTypeGroup, - UserTypeUser, +// PossibleAccessReviewScheduleDefinitionReviewersTypeValues returns the possible values for the AccessReviewScheduleDefinitionReviewersType const type. +func PossibleAccessReviewScheduleDefinitionReviewersTypeValues() []AccessReviewScheduleDefinitionReviewersType { + return []AccessReviewScheduleDefinitionReviewersType{ + AccessReviewScheduleDefinitionReviewersTypeAssigned, + AccessReviewScheduleDefinitionReviewersTypeManagers, + AccessReviewScheduleDefinitionReviewersTypeSelf, + } +} + +// AccessReviewScheduleDefinitionStatus - This read-only field specifies the status of an accessReview. +type AccessReviewScheduleDefinitionStatus string + +const ( + AccessReviewScheduleDefinitionStatusApplied AccessReviewScheduleDefinitionStatus = "Applied" + AccessReviewScheduleDefinitionStatusApplying AccessReviewScheduleDefinitionStatus = "Applying" + AccessReviewScheduleDefinitionStatusAutoReviewed AccessReviewScheduleDefinitionStatus = "AutoReviewed" + AccessReviewScheduleDefinitionStatusAutoReviewing AccessReviewScheduleDefinitionStatus = "AutoReviewing" + AccessReviewScheduleDefinitionStatusCompleted AccessReviewScheduleDefinitionStatus = "Completed" + AccessReviewScheduleDefinitionStatusCompleting AccessReviewScheduleDefinitionStatus = "Completing" + AccessReviewScheduleDefinitionStatusInProgress AccessReviewScheduleDefinitionStatus = "InProgress" + AccessReviewScheduleDefinitionStatusInitializing AccessReviewScheduleDefinitionStatus = "Initializing" + AccessReviewScheduleDefinitionStatusNotStarted AccessReviewScheduleDefinitionStatus = "NotStarted" + AccessReviewScheduleDefinitionStatusScheduled AccessReviewScheduleDefinitionStatus = "Scheduled" + AccessReviewScheduleDefinitionStatusStarting AccessReviewScheduleDefinitionStatus = "Starting" +) + +// PossibleAccessReviewScheduleDefinitionStatusValues returns the possible values for the AccessReviewScheduleDefinitionStatus const type. +func PossibleAccessReviewScheduleDefinitionStatusValues() []AccessReviewScheduleDefinitionStatus { + return []AccessReviewScheduleDefinitionStatus{ + AccessReviewScheduleDefinitionStatusApplied, + AccessReviewScheduleDefinitionStatusApplying, + AccessReviewScheduleDefinitionStatusAutoReviewed, + AccessReviewScheduleDefinitionStatusAutoReviewing, + AccessReviewScheduleDefinitionStatusCompleted, + AccessReviewScheduleDefinitionStatusCompleting, + AccessReviewScheduleDefinitionStatusInProgress, + AccessReviewScheduleDefinitionStatusInitializing, + AccessReviewScheduleDefinitionStatusNotStarted, + AccessReviewScheduleDefinitionStatusScheduled, + AccessReviewScheduleDefinitionStatusStarting, + } +} + +// AccessReviewScopeAssignmentState - The role assignment state eligible/active to review +type AccessReviewScopeAssignmentState string + +const ( + AccessReviewScopeAssignmentStateActive AccessReviewScopeAssignmentState = "active" + AccessReviewScopeAssignmentStateEligible AccessReviewScopeAssignmentState = "eligible" +) + +// PossibleAccessReviewScopeAssignmentStateValues returns the possible values for the AccessReviewScopeAssignmentState const type. +func PossibleAccessReviewScopeAssignmentStateValues() []AccessReviewScopeAssignmentState { + return []AccessReviewScopeAssignmentState{ + AccessReviewScopeAssignmentStateActive, + AccessReviewScopeAssignmentStateEligible, + } +} + +// AccessReviewScopePrincipalType - The identity type user/servicePrincipal to review +type AccessReviewScopePrincipalType string + +const ( + AccessReviewScopePrincipalTypeGuestUser AccessReviewScopePrincipalType = "guestUser" + AccessReviewScopePrincipalTypeRedeemedGuestUser AccessReviewScopePrincipalType = "redeemedGuestUser" + AccessReviewScopePrincipalTypeServicePrincipal AccessReviewScopePrincipalType = "servicePrincipal" + AccessReviewScopePrincipalTypeUser AccessReviewScopePrincipalType = "user" + AccessReviewScopePrincipalTypeUserGroup AccessReviewScopePrincipalType = "user,group" +) + +// PossibleAccessReviewScopePrincipalTypeValues returns the possible values for the AccessReviewScopePrincipalType const type. +func PossibleAccessReviewScopePrincipalTypeValues() []AccessReviewScopePrincipalType { + return []AccessReviewScopePrincipalType{ + AccessReviewScopePrincipalTypeGuestUser, + AccessReviewScopePrincipalTypeRedeemedGuestUser, + AccessReviewScopePrincipalTypeServicePrincipal, + AccessReviewScopePrincipalTypeUser, + AccessReviewScopePrincipalTypeUserGroup, + } +} + +// DecisionResourceType - The type of resource +type DecisionResourceType string + +const ( + DecisionResourceTypeAzureRole DecisionResourceType = "azureRole" +) + +// PossibleDecisionResourceTypeValues returns the possible values for the DecisionResourceType const type. +func PossibleDecisionResourceTypeValues() []DecisionResourceType { + return []DecisionResourceType{ + DecisionResourceTypeAzureRole, + } +} + +// DecisionTargetType - The type of decision target : User/ServicePrincipal +type DecisionTargetType string + +const ( + DecisionTargetTypeServicePrincipal DecisionTargetType = "servicePrincipal" + DecisionTargetTypeUser DecisionTargetType = "user" +) + +// PossibleDecisionTargetTypeValues returns the possible values for the DecisionTargetType const type. +func PossibleDecisionTargetTypeValues() []DecisionTargetType { + return []DecisionTargetType{ + DecisionTargetTypeServicePrincipal, + DecisionTargetTypeUser, + } +} + +// DefaultDecisionType - This specifies the behavior for the autoReview feature when an access review completes. +type DefaultDecisionType string + +const ( + DefaultDecisionTypeApprove DefaultDecisionType = "Approve" + DefaultDecisionTypeDeny DefaultDecisionType = "Deny" + DefaultDecisionTypeRecommendation DefaultDecisionType = "Recommendation" +) + +// PossibleDefaultDecisionTypeValues returns the possible values for the DefaultDecisionType const type. +func PossibleDefaultDecisionTypeValues() []DefaultDecisionType { + return []DefaultDecisionType{ + DefaultDecisionTypeApprove, + DefaultDecisionTypeDeny, + DefaultDecisionTypeRecommendation, + } +} + +// RecordAllDecisionsResult - The decision to make. Approvers can take action of Approve/Deny +type RecordAllDecisionsResult string + +const ( + RecordAllDecisionsResultApprove RecordAllDecisionsResult = "Approve" + RecordAllDecisionsResultDeny RecordAllDecisionsResult = "Deny" +) + +// PossibleRecordAllDecisionsResultValues returns the possible values for the RecordAllDecisionsResult const type. +func PossibleRecordAllDecisionsResultValues() []RecordAllDecisionsResult { + return []RecordAllDecisionsResult{ + RecordAllDecisionsResultApprove, + RecordAllDecisionsResultDeny, + } +} + +// SeverityLevel - Severity level of the alert. +type SeverityLevel string + +const ( + SeverityLevelHigh SeverityLevel = "High" + SeverityLevelLow SeverityLevel = "Low" + SeverityLevelMedium SeverityLevel = "Medium" +) + +// PossibleSeverityLevelValues returns the possible values for the SeverityLevel const type. +func PossibleSeverityLevelValues() []SeverityLevel { + return []SeverityLevel{ + SeverityLevelHigh, + SeverityLevelLow, + SeverityLevelMedium, } } diff --git a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go deleted file mode 100644 index f9217c38972c..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go +++ /dev/null @@ -1,413 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DenyAssignmentsClient contains the methods for the DenyAssignments group. -// Don't use this type directly, use NewDenyAssignmentsClient() instead. -type DenyAssignmentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDenyAssignmentsClient creates a new instance of DenyAssignmentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDenyAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DenyAssignmentsClient, error) { - cl, err := arm.NewClient(moduleName+".DenyAssignmentsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DenyAssignmentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get the specified deny assignment. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the deny assignment. -// - denyAssignmentID - The ID of the deny assignment to get. -// - options - DenyAssignmentsClientGetOptions contains the optional parameters for the DenyAssignmentsClient.Get method. -func (client *DenyAssignmentsClient) Get(ctx context.Context, scope string, denyAssignmentID string, options *DenyAssignmentsClientGetOptions) (DenyAssignmentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, denyAssignmentID, options) - if err != nil { - return DenyAssignmentsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DenyAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *DenyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, denyAssignmentID string, options *DenyAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if denyAssignmentID == "" { - return nil, errors.New("parameter denyAssignmentID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{denyAssignmentId}", url.PathEscape(denyAssignmentID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DenyAssignmentsClient) getHandleResponse(resp *http.Response) (DenyAssignmentsClientGetResponse, error) { - result := DenyAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { - return DenyAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// GetByID - Gets a deny assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - denyAssignmentID - The fully qualified deny assignment ID. For example, use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} -// for subscription level deny assignments, -// or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant level deny assignments. -// - options - DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. -func (client *DenyAssignmentsClient) GetByID(ctx context.Context, denyAssignmentID string, options *DenyAssignmentsClientGetByIDOptions) (DenyAssignmentsClientGetByIDResponse, error) { - req, err := client.getByIDCreateRequest(ctx, denyAssignmentID, options) - if err != nil { - return DenyAssignmentsClientGetByIDResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DenyAssignmentsClientGetByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientGetByIDResponse{}, runtime.NewResponseError(resp) - } - return client.getByIDHandleResponse(resp) -} - -// getByIDCreateRequest creates the GetByID request. -func (client *DenyAssignmentsClient) getByIDCreateRequest(ctx context.Context, denyAssignmentID string, options *DenyAssignmentsClientGetByIDOptions) (*policy.Request, error) { - urlPath := "/{denyAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{denyAssignmentId}", denyAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByIDHandleResponse handles the GetByID response. -func (client *DenyAssignmentsClient) getByIDHandleResponse(resp *http.Response) (DenyAssignmentsClientGetByIDResponse, error) { - result := DenyAssignmentsClientGetByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { - return DenyAssignmentsClientGetByIDResponse{}, err - } - return result, nil -} - -// NewListPager - Gets all deny assignments for the subscription. -// -// Generated from API version 2022-04-01 -// - options - DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.NewListPager -// method. -func (client *DenyAssignmentsClient) NewListPager(options *DenyAssignmentsClientListOptions) *runtime.Pager[DenyAssignmentsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListResponse]{ - More: func(page DenyAssignmentsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListResponse) (DenyAssignmentsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DenyAssignmentsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *DenyAssignmentsClient) listCreateRequest(ctx context.Context, options *DenyAssignmentsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DenyAssignmentsClient) listHandleResponse(resp *http.Response) (DenyAssignmentsClientListResponse, error) { - result := DenyAssignmentsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListResponse{}, err - } - return result, nil -} - -// NewListForResourcePager - Gets deny assignments for a resource. -// -// Generated from API version 2022-04-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceProviderNamespace - The namespace of the resource provider. -// - parentResourcePath - The parent resource identity. -// - resourceType - The resource type of the resource. -// - resourceName - The name of the resource to get deny assignments for. -// - options - DenyAssignmentsClientListForResourceOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourcePager -// method. -func (client *DenyAssignmentsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *DenyAssignmentsClientListForResourceOptions) *runtime.Pager[DenyAssignmentsClientListForResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForResourceResponse]{ - More: func(page DenyAssignmentsClientListForResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForResourceResponse) (DenyAssignmentsClientListForResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListForResourceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DenyAssignmentsClientListForResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListForResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceHandleResponse(resp) - }, - }) -} - -// listForResourceCreateRequest creates the ListForResource request. -func (client *DenyAssignmentsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *DenyAssignmentsClientListForResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceHandleResponse handles the ListForResource response. -func (client *DenyAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (DenyAssignmentsClientListForResourceResponse, error) { - result := DenyAssignmentsClientListForResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListForResourceResponse{}, err - } - return result, nil -} - -// NewListForResourceGroupPager - Gets deny assignments for a resource group. -// -// Generated from API version 2022-04-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - DenyAssignmentsClientListForResourceGroupOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourceGroupPager -// method. -func (client *DenyAssignmentsClient) NewListForResourceGroupPager(resourceGroupName string, options *DenyAssignmentsClientListForResourceGroupOptions) *runtime.Pager[DenyAssignmentsClientListForResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForResourceGroupResponse]{ - More: func(page DenyAssignmentsClientListForResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForResourceGroupResponse) (DenyAssignmentsClientListForResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListForResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DenyAssignmentsClientListForResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListForResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceGroupHandleResponse(resp) - }, - }) -} - -// listForResourceGroupCreateRequest creates the ListForResourceGroup request. -func (client *DenyAssignmentsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DenyAssignmentsClientListForResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceGroupHandleResponse handles the ListForResourceGroup response. -func (client *DenyAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (DenyAssignmentsClientListForResourceGroupResponse, error) { - result := DenyAssignmentsClientListForResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListForResourceGroupResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets deny assignments for a scope. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the deny assignments. -// - options - DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.NewListForScopePager -// method. -func (client *DenyAssignmentsClient) NewListForScopePager(scope string, options *DenyAssignmentsClientListForScopeOptions) *runtime.Pager[DenyAssignmentsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[DenyAssignmentsClientListForScopeResponse]{ - More: func(page DenyAssignmentsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DenyAssignmentsClientListForScopeResponse) (DenyAssignmentsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DenyAssignmentsClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DenyAssignmentsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DenyAssignmentsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *DenyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *DenyAssignmentsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *DenyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (DenyAssignmentsClientListForScopeResponse, error) { - result := DenyAssignmentsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go deleted file mode 100644 index 0e71ca0c31cd..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go +++ /dev/null @@ -1,368 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResource.json -func ExampleDenyAssignmentsClient_NewListForResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDenyAssignmentsClient().NewListForResourcePager("rgname", "resourceProviderNamespace", "parentResourcePath", "resourceType", "resourceName", &armauthorization.DenyAssignmentsClientListForResourceOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DenyAssignmentListResult = armauthorization.DenyAssignmentListResult{ - // Value: []*armauthorization.DenyAssignment{ - // { - // Name: to.Ptr("denyAssignmentId"), - // Type: to.Ptr("Microsoft.Authorization/denyAssignments"), - // ID: to.Ptr("/subscriptions/subId/resourcegroups/rgname/providers/resourceProviderNamespace/parentResourcePath/resourceType/resourceName/providers/Microsoft.Authorization/denyAssignments/denyAssignmentId"), - // Properties: &armauthorization.DenyAssignmentProperties{ - // Description: to.Ptr("Deny assignment description"), - // DenyAssignmentName: to.Ptr("Deny assignment name"), - // DoNotApplyToChildScopes: to.Ptr(false), - // ExcludePrincipals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType2"), - // ID: to.Ptr("principalId2"), - // }}, - // IsSystemProtected: to.Ptr(true), - // Permissions: []*armauthorization.DenyAssignmentPermission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("action")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // Principals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType1"), - // ID: to.Ptr("principalId1"), - // }}, - // Scope: to.Ptr("/subscriptions/subId/resourcegroups/rgname/providers/resourceProviderNamespace/parentResourcePath/resourceType/resourceName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResourceGroup.json -func ExampleDenyAssignmentsClient_NewListForResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDenyAssignmentsClient().NewListForResourceGroupPager("rgname", &armauthorization.DenyAssignmentsClientListForResourceGroupOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DenyAssignmentListResult = armauthorization.DenyAssignmentListResult{ - // Value: []*armauthorization.DenyAssignment{ - // { - // Name: to.Ptr("denyAssignmentId"), - // Type: to.Ptr("Microsoft.Authorization/denyAssignments"), - // ID: to.Ptr("/subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/denyAssignments/denyAssignmentId"), - // Properties: &armauthorization.DenyAssignmentProperties{ - // Description: to.Ptr("Deny assignment description"), - // DenyAssignmentName: to.Ptr("Deny assignment name"), - // DoNotApplyToChildScopes: to.Ptr(false), - // ExcludePrincipals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType2"), - // ID: to.Ptr("principalId2"), - // }}, - // IsSystemProtected: to.Ptr(true), - // Permissions: []*armauthorization.DenyAssignmentPermission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("action")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // Principals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType1"), - // ID: to.Ptr("principalId1"), - // }}, - // Scope: to.Ptr("/subscriptions/subId/resourcegroups/rgname"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllDenyAssignments.json -func ExampleDenyAssignmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDenyAssignmentsClient().NewListPager(&armauthorization.DenyAssignmentsClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DenyAssignmentListResult = armauthorization.DenyAssignmentListResult{ - // Value: []*armauthorization.DenyAssignment{ - // { - // Name: to.Ptr("denyAssignmentId"), - // Type: to.Ptr("Microsoft.Authorization/denyAssignments"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Authorization/denyAssignments/denyAssignmentId"), - // Properties: &armauthorization.DenyAssignmentProperties{ - // Description: to.Ptr("Deny assignment description"), - // DenyAssignmentName: to.Ptr("Deny assignment name"), - // DoNotApplyToChildScopes: to.Ptr(false), - // ExcludePrincipals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType2"), - // ID: to.Ptr("principalId2"), - // }}, - // IsSystemProtected: to.Ptr(true), - // Permissions: []*armauthorization.DenyAssignmentPermission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("action")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // Principals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType1"), - // ID: to.Ptr("principalId1"), - // }}, - // Scope: to.Ptr("/subscriptions/subId"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByNameId.json -func ExampleDenyAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDenyAssignmentsClient().Get(ctx, "subscriptions/subId/resourcegroups/rgname", "denyAssignmentId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DenyAssignment = armauthorization.DenyAssignment{ - // Name: to.Ptr("denyAssignmentId"), - // Type: to.Ptr("Microsoft.Authorization/denyAssignments"), - // ID: to.Ptr("/subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/denyAssignments/denyAssignmentId"), - // Properties: &armauthorization.DenyAssignmentProperties{ - // Description: to.Ptr("Deny assignment description"), - // DenyAssignmentName: to.Ptr("Deny assignment name"), - // DoNotApplyToChildScopes: to.Ptr(false), - // ExcludePrincipals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType2"), - // ID: to.Ptr("principalId2"), - // }}, - // IsSystemProtected: to.Ptr(true), - // Permissions: []*armauthorization.DenyAssignmentPermission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // }, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // Principals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType1"), - // ID: to.Ptr("principalId1"), - // }}, - // Scope: to.Ptr("/subscriptions/subId/resourcegroups/rgname"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentById.json -func ExampleDenyAssignmentsClient_GetByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDenyAssignmentsClient().GetByID(ctx, "subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/denyAssignments/daId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DenyAssignment = armauthorization.DenyAssignment{ - // Name: to.Ptr("daId"), - // Type: to.Ptr("Microsoft.Authorization/denyAssignments"), - // ID: to.Ptr("/subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/denyAssignments/daId"), - // Properties: &armauthorization.DenyAssignmentProperties{ - // Description: to.Ptr("Deny assignment description"), - // DenyAssignmentName: to.Ptr("Deny assignment name"), - // DoNotApplyToChildScopes: to.Ptr(false), - // ExcludePrincipals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType2"), - // ID: to.Ptr("principalId2"), - // }}, - // IsSystemProtected: to.Ptr(true), - // Permissions: []*armauthorization.DenyAssignmentPermission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // }, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // Principals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType1"), - // ID: to.Ptr("principalId1"), - // }}, - // Scope: to.Ptr("/subscriptions/subId/resourcegroups/rgname"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByScope.json -func ExampleDenyAssignmentsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDenyAssignmentsClient().NewListForScopePager("subscriptions/subId", &armauthorization.DenyAssignmentsClientListForScopeOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DenyAssignmentListResult = armauthorization.DenyAssignmentListResult{ - // Value: []*armauthorization.DenyAssignment{ - // { - // Name: to.Ptr("denyAssignmentId"), - // Type: to.Ptr("Microsoft.Authorization/denyAssignments"), - // ID: to.Ptr("/subscriptions/subId/providers/Microsoft.Authorization/denyAssignments/denyAssignmentId"), - // Properties: &armauthorization.DenyAssignmentProperties{ - // Description: to.Ptr("Deny assignment description"), - // DenyAssignmentName: to.Ptr("Deny assignment name"), - // DoNotApplyToChildScopes: to.Ptr(false), - // ExcludePrincipals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType2"), - // ID: to.Ptr("principalId2"), - // }}, - // IsSystemProtected: to.Ptr(true), - // Permissions: []*armauthorization.DenyAssignmentPermission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("action")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // Principals: []*armauthorization.Principal{ - // { - // Type: to.Ptr("principalType1"), - // ID: to.Ptr("principalId1"), - // }}, - // Scope: to.Ptr("/subscriptions/subId"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go deleted file mode 100644 index 92ebd41853d0..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go +++ /dev/null @@ -1,101 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// EligibleChildResourcesClient contains the methods for the EligibleChildResources group. -// Don't use this type directly, use NewEligibleChildResourcesClient() instead. -type EligibleChildResourcesClient struct { - internal *arm.Client -} - -// NewEligibleChildResourcesClient creates a new instance of EligibleChildResourcesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewEligibleChildResourcesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EligibleChildResourcesClient, error) { - cl, err := arm.NewClient(moduleName+".EligibleChildResourcesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &EligibleChildResourcesClient{ - internal: cl, - } - return client, nil -} - -// NewGetPager - Get the child resources of a resource on which user has eligible access -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy. -// - options - EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.NewGetPager -// method. -func (client *EligibleChildResourcesClient) NewGetPager(scope string, options *EligibleChildResourcesClientGetOptions) *runtime.Pager[EligibleChildResourcesClientGetResponse] { - return runtime.NewPager(runtime.PagingHandler[EligibleChildResourcesClientGetResponse]{ - More: func(page EligibleChildResourcesClientGetResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *EligibleChildResourcesClientGetResponse) (EligibleChildResourcesClientGetResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.getCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return EligibleChildResourcesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EligibleChildResourcesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EligibleChildResourcesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) - }, - }) -} - -// getCreateRequest creates the Get request. -func (client *EligibleChildResourcesClient) getCreateRequest(ctx context.Context, scope string, options *EligibleChildResourcesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/eligibleChildResources" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *EligibleChildResourcesClient) getHandleResponse(resp *http.Response) (EligibleChildResourcesClientGetResponse, error) { - result := EligibleChildResourcesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EligibleChildResourcesListResult); err != nil { - return EligibleChildResourcesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go deleted file mode 100644 index 19809f07fcc3..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json -func ExampleEligibleChildResourcesClient_NewGetPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEligibleChildResourcesClient().NewGetPager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.EligibleChildResourcesClientGetOptions{Filter: to.Ptr("resourceType+eq+'resourcegroup'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EligibleChildResourcesListResult = armauthorization.EligibleChildResourcesListResult{ - // Value: []*armauthorization.EligibleChildResource{ - // { - // Name: to.Ptr("RG-1"), - // Type: to.Ptr("resourcegroup"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-1"), - // }, - // { - // Name: to.Ptr("RG-2"), - // Type: to.Ptr("resourcegroup"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-2"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go b/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go deleted file mode 100644 index 2896f625d6d4..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// GlobalAdministratorClient contains the methods for the GlobalAdministrator group. -// Don't use this type directly, use NewGlobalAdministratorClient() instead. -type GlobalAdministratorClient struct { - internal *arm.Client -} - -// NewGlobalAdministratorClient creates a new instance of GlobalAdministratorClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewGlobalAdministratorClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GlobalAdministratorClient, error) { - cl, err := arm.NewClient(moduleName+".GlobalAdministratorClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &GlobalAdministratorClient{ - internal: cl, - } - return client, nil -} - -// ElevateAccess - Elevates access for a Global Administrator. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2015-07-01 -// - options - GlobalAdministratorClientElevateAccessOptions contains the optional parameters for the GlobalAdministratorClient.ElevateAccess -// method. -func (client *GlobalAdministratorClient) ElevateAccess(ctx context.Context, options *GlobalAdministratorClientElevateAccessOptions) (GlobalAdministratorClientElevateAccessResponse, error) { - req, err := client.elevateAccessCreateRequest(ctx, options) - if err != nil { - return GlobalAdministratorClientElevateAccessResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GlobalAdministratorClientElevateAccessResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GlobalAdministratorClientElevateAccessResponse{}, runtime.NewResponseError(resp) - } - return GlobalAdministratorClientElevateAccessResponse{}, nil -} - -// elevateAccessCreateRequest creates the ElevateAccess request. -func (client *GlobalAdministratorClient) elevateAccessCreateRequest(ctx context.Context, options *GlobalAdministratorClientElevateAccessOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Authorization/elevateAccess" - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-07-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go deleted file mode 100644 index 503426fcc294..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json -func ExampleGlobalAdministratorClient_ElevateAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGlobalAdministratorClient().ElevateAccess(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/go.mod b/sdk/resourcemanager/authorization/armauthorization/go.mod index 51b8d8ec812b..cbac66971523 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.mod +++ b/sdk/resourcemanager/authorization/armauthorization/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/authorization/armauthorization/go.sum b/sdk/resourcemanager/authorization/armauthorization/go.sum index 8ba445a8c4da..b6bd7eaad1ba 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.sum +++ b/sdk/resourcemanager/authorization/armauthorization/go.sum @@ -1,31 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/authorization/armauthorization/models.go b/sdk/resourcemanager/authorization/armauthorization/models.go index bf76234d6875..29e74db5fc65 100644 --- a/sdk/resourcemanager/authorization/armauthorization/models.go +++ b/sdk/resourcemanager/authorization/armauthorization/models.go @@ -11,1888 +11,1592 @@ package armauthorization import "time" -// ApprovalSettings - The approval settings. -type ApprovalSettings struct { - // The type of rule - ApprovalMode *ApprovalMode - - // The approval stages of the request. - ApprovalStages []*ApprovalStage +// AccessReviewActorIdentity - Details of the actor identity +type AccessReviewActorIdentity struct { + // READ-ONLY; The identity id + PrincipalID *string - // Determines whether approval is required or not. - IsApprovalRequired *bool + // READ-ONLY; The identity display name + PrincipalName *string - // Determines whether approval is required for assignment extension. - IsApprovalRequiredForExtension *bool + // READ-ONLY; The identity type : user/servicePrincipal + PrincipalType *AccessReviewActorIdentityType - // Determine whether requestor justification is required. - IsRequestorJustificationRequired *bool + // READ-ONLY; The user principal name(if valid) + UserPrincipalName *string } -// ApprovalStage - The approval stage. -type ApprovalStage struct { - // The time in days when approval request would be timed out - ApprovalStageTimeOutInDays *int32 +// AccessReviewContactedReviewer - Access Review Contacted Reviewer. +type AccessReviewContactedReviewer struct { + // Access Review Contacted Reviewer properties. + Properties *AccessReviewContactedReviewerProperties + + // READ-ONLY; The access review reviewer id. + ID *string + + // READ-ONLY; The access review reviewer id. + Name *string + + // READ-ONLY; The resource type. + Type *string +} - // The escalation approver of the request. - EscalationApprovers []*UserSet +// AccessReviewContactedReviewerListResult - List of access review contacted reviewers. +type AccessReviewContactedReviewerListResult struct { + // The URL to use for getting the next set of results. + NextLink *string - // The time in minutes when the approval request would be escalated if the primary approver does not approve - EscalationTimeInMinutes *int32 + // Access Review Contacted Reviewer. + Value []*AccessReviewContactedReviewer +} - // Determines whether approver need to provide justification for his decision. - IsApproverJustificationRequired *bool +// AccessReviewContactedReviewerProperties - Properties of access review contacted reviewer. +type AccessReviewContactedReviewerProperties struct { + // READ-ONLY; Date Time when the reviewer was contacted. + CreatedDateTime *time.Time - // The value determine whether escalation feature is enabled. - IsEscalationEnabled *bool + // READ-ONLY; The display name of the reviewer + UserDisplayName *string - // The primary approver of the request. - PrimaryApprovers []*UserSet + // READ-ONLY; The user principal name of the reviewer + UserPrincipalName *string } -// ClassicAdministrator - Classic Administrators -type ClassicAdministrator struct { - // The ID of the administrator. +// AccessReviewDecision - Access Review. +type AccessReviewDecision struct { + // Access Review Decision properties. + Properties *AccessReviewDecisionProperties + + // READ-ONLY; The access review decision id. ID *string - // The name of the administrator. + // READ-ONLY; The access review decision name. Name *string - // Properties for the classic administrator. - Properties *ClassicAdministratorProperties - - // The type of the administrator. + // READ-ONLY; The resource type. Type *string } -// ClassicAdministratorListResult - ClassicAdministrator list result information. -type ClassicAdministratorListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - - // An array of administrators. - Value []*ClassicAdministrator +// AccessReviewDecisionIdentityClassification provides polymorphic access to related types. +// Call the interface's GetAccessReviewDecisionIdentity() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AccessReviewDecisionIdentity, *AccessReviewDecisionServicePrincipalIdentity, *AccessReviewDecisionUserIdentity +type AccessReviewDecisionIdentityClassification interface { + // GetAccessReviewDecisionIdentity returns the AccessReviewDecisionIdentity content of the underlying type. + GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity } -// ClassicAdministratorProperties - Classic Administrator properties. -type ClassicAdministratorProperties struct { - // The email address of the administrator. - EmailAddress *string +// AccessReviewDecisionIdentity - Target of the decision. +type AccessReviewDecisionIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType - // The role of the administrator. - Role *string + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string + + // READ-ONLY; The id of principal whose access was reviewed. + ID *string } -// ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.NewListPager -// method. -type ClassicAdministratorsClientListOptions struct { - // placeholder for future optional parameters +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionIdentity. +func (a *AccessReviewDecisionIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return a } -// DenyAssignment - Deny Assignment -type DenyAssignment struct { - // Deny assignment properties. - Properties *DenyAssignmentProperties +// AccessReviewDecisionInsight - Access Review Decision Insight. +type AccessReviewDecisionInsight struct { + // Access Review Decision Insight properties. + Properties AccessReviewDecisionInsightPropertiesClassification - // READ-ONLY; The deny assignment ID. + // READ-ONLY; The access review insight id. ID *string - // READ-ONLY; The deny assignment name. + // READ-ONLY; The access review insight name. Name *string - // READ-ONLY; The deny assignment type. + // READ-ONLY; The resource type. Type *string } -// DenyAssignmentFilter - Deny Assignments filter -type DenyAssignmentFilter struct { - // Return deny assignment with specified name. - DenyAssignmentName *string +// AccessReviewDecisionInsightPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetAccessReviewDecisionInsightProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AccessReviewDecisionInsightProperties, *AccessReviewDecisionUserSignInInsightProperties +type AccessReviewDecisionInsightPropertiesClassification interface { + // GetAccessReviewDecisionInsightProperties returns the AccessReviewDecisionInsightProperties content of the underlying type. + GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties +} + +// AccessReviewDecisionInsightProperties - Details of the Insight. +type AccessReviewDecisionInsightProperties struct { + // REQUIRED; The type of insight + Type *AccessReviewDecisionInsightType - // Return all deny assignments where the specified principal is listed either in the principals list or exclude principals - // list of deny assignments. - GdprExportPrincipalID *string + // READ-ONLY; Date Time when the insight was created. + InsightCreatedDateTime any +} - // Return all deny assignments where the specified principal is listed in the principals list of deny assignments. - PrincipalID *string +// GetAccessReviewDecisionInsightProperties implements the AccessReviewDecisionInsightPropertiesClassification interface for +// type AccessReviewDecisionInsightProperties. +func (a *AccessReviewDecisionInsightProperties) GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties { + return a } -// DenyAssignmentListResult - Deny assignment list operation result. -type DenyAssignmentListResult struct { +// AccessReviewDecisionListResult - List of access review decisions. +type AccessReviewDecisionListResult struct { // The URL to use for getting the next set of results. NextLink *string - // Deny assignment list. - Value []*DenyAssignment + // Access Review Decision list. + Value []*AccessReviewDecision } -// DenyAssignmentPermission - Deny assignment permissions. -type DenyAssignmentPermission struct { - // Actions to which the deny assignment does not grant access. - Actions []*string - - // The conditions on the Deny assignment permission. This limits the resources it applies to. - Condition *string - - // Version of the condition. - ConditionVersion *string - - // Data actions to which the deny assignment does not grant access. - DataActions []*string - - // Actions to exclude from that the deny assignment does not grant access. - NotActions []*string - - // Data actions to exclude from that the deny assignment does not grant access. - NotDataActions []*string +// AccessReviewDecisionPrincipalResourceMembership - Target of the decision. +type AccessReviewDecisionPrincipalResourceMembership struct { + // Every decision item in an access review represents a principal's membership to a resource. This property represents details + // of the membership. Examples of this detail might be whether the principal + // has direct access or indirect access + MembershipTypes []*AccessReviewDecisionPrincipalResourceMembershipType } -// DenyAssignmentProperties - Deny assignment properties. -type DenyAssignmentProperties struct { - // The display name of the deny assignment. - DenyAssignmentName *string +// AccessReviewDecisionProperties - Approval Step. +type AccessReviewDecisionProperties struct { + // The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny + Decision *AccessReviewResult - // The description of the deny assignment. - Description *string + // This is the collection of insights for this decision item. + Insights []*AccessReviewDecisionInsight - // Determines if the deny assignment applies to child scopes. Default value is false. - DoNotApplyToChildScopes *bool + // Justification provided by approvers for their action + Justification *string - // Array of principals to which the deny assignment does not apply. - ExcludePrincipals []*Principal + // READ-ONLY; Details of the approver. + AppliedBy *AccessReviewActorIdentity - // Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. - IsSystemProtected *bool + // READ-ONLY; The date and time when the review decision was applied. + AppliedDateTime *time.Time - // An array of permissions that are denied by the deny assignment. - Permissions []*DenyAssignmentPermission + // READ-ONLY; The outcome of applying the decision. + ApplyResult *AccessReviewApplyResult - // Array of principals to which the deny assignment applies. - Principals []*Principal + // READ-ONLY; Principal associated with the decision record. Can be AccessReviewDecisionUserIdentity or AccessReviewDecisionServicePrincipalIdentity + Principal AccessReviewDecisionIdentityClassification - // The deny assignment scope. - Scope *string -} + // READ-ONLY; Details of the membership type. + PrincipalResourceMembership *AccessReviewDecisionPrincipalResourceMembership -// DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. -type DenyAssignmentsClientGetByIDOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The feature- generated recommendation shown to the reviewer. + Recommendation *AccessRecommendationType -// DenyAssignmentsClientGetOptions contains the optional parameters for the DenyAssignmentsClient.Get method. -type DenyAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Resource associated with this decision record. + Resource *AccessReviewDecisionResource -// DenyAssignmentsClientListForResourceGroupOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourceGroupPager -// method. -type DenyAssignmentsClientListForResourceGroupOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string -} + // READ-ONLY; Details of the approver. + ReviewedBy *AccessReviewActorIdentity -// DenyAssignmentsClientListForResourceOptions contains the optional parameters for the DenyAssignmentsClient.NewListForResourcePager -// method. -type DenyAssignmentsClientListForResourceOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string + // READ-ONLY; Date Time when a decision was taken. + ReviewedDateTime *time.Time } -// DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.NewListForScopePager -// method. -type DenyAssignmentsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string -} +// AccessReviewDecisionResource - Target of the decision. +type AccessReviewDecisionResource struct { + // REQUIRED; The type of resource + Type *DecisionResourceType -// DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.NewListPager method. -type DenyAssignmentsClientListOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or above the scope. Use $filter=denyAssignmentName - // eq '{name}' to search deny assignments by name at - // specified scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for the - // specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all - // deny assignments at, above and below the scope for the specified principal. This filter is different from the principalId - // filter as it returns not only those deny assignments that contain the - // specified principal is the Principals list but also those deny assignments that contain the specified principal is the - // ExcludePrincipals list. Additionally, when gdprExportPrincipalId filter is used, - // only the deny assignment name and description properties are returned. - Filter *string -} + // READ-ONLY; The display name of resource associated with a decision record. + DisplayName *string -// EligibleChildResource - Eligible child resource -type EligibleChildResource struct { - // READ-ONLY; The resource scope Id. + // READ-ONLY; The id of resource associated with a decision record. ID *string - - // READ-ONLY; The resource name. - Name *string - - // READ-ONLY; The resource type. - Type *string -} - -// EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.NewGetPager -// method. -type EligibleChildResourcesClientGetOptions struct { - // 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' - Filter *string } -// EligibleChildResourcesListResult - Eligible child resources list operation result. -type EligibleChildResourcesListResult struct { - // The URL to use for getting the next set of results. - NextLink *string +// AccessReviewDecisionServicePrincipalIdentity - Service Principal Decision Target +type AccessReviewDecisionServicePrincipalIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType - // Eligible child resource list. - Value []*EligibleChildResource -} + // READ-ONLY; The appId for the service principal entity being reviewed + AppID *string -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string - // READ-ONLY; The additional info type. - Type *string + // READ-ONLY; The id of principal whose access was reviewed. + ID *string } -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionServicePrincipalIdentity. +func (a *AccessReviewDecisionServicePrincipalIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return &AccessReviewDecisionIdentity{ + Type: a.Type, + ID: a.ID, + DisplayName: a.DisplayName, + } +} - // READ-ONLY; The error code. - Code *string +// AccessReviewDecisionUserIdentity - User Decision Target +type AccessReviewDecisionUserIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType - // READ-ONLY; The error details. - Details []*ErrorDetail + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string - // READ-ONLY; The error message. - Message *string + // READ-ONLY; The id of principal whose access was reviewed. + ID *string - // READ-ONLY; The error target. - Target *string + // READ-ONLY; The user principal name of the user whose access was reviewed. + UserPrincipalName *string } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionUserIdentity. +func (a *AccessReviewDecisionUserIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return &AccessReviewDecisionIdentity{ + Type: a.Type, + ID: a.ID, + DisplayName: a.DisplayName, + } } -type ExpandedProperties struct { - // Details of the principal - Principal *ExpandedPropertiesPrincipal +// AccessReviewDecisionUserSignInInsightProperties - User Decision Target +type AccessReviewDecisionUserSignInInsightProperties struct { + // REQUIRED; The type of insight + Type *AccessReviewDecisionInsightType - // Details of role definition - RoleDefinition *ExpandedPropertiesRoleDefinition + // READ-ONLY; Date Time when the insight was created. + InsightCreatedDateTime any - // Details of the resource scope - Scope *ExpandedPropertiesScope + // READ-ONLY; Date Time when the user signed into the tenant. + LastSignInDateTime any } -// ExpandedPropertiesPrincipal - Details of the principal -type ExpandedPropertiesPrincipal struct { - // Display name of the principal - DisplayName *string +// GetAccessReviewDecisionInsightProperties implements the AccessReviewDecisionInsightPropertiesClassification interface for +// type AccessReviewDecisionUserSignInInsightProperties. +func (a *AccessReviewDecisionUserSignInInsightProperties) GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties { + return &AccessReviewDecisionInsightProperties{ + Type: a.Type, + InsightCreatedDateTime: a.InsightCreatedDateTime, + } +} - // Email id of the principal - Email *string +// AccessReviewDefaultSettings - Access Review Default Settings. +type AccessReviewDefaultSettings struct { + // Access Review properties. + Properties *AccessReviewScheduleSettings - // Id of the principal + // READ-ONLY; The access review default settings id. This is only going to be default ID *string - // Type of the principal + // READ-ONLY; The access review default settings name. This is always going to be Access Review Default Settings + Name *string + + // READ-ONLY; The resource type. Type *string } -// ExpandedPropertiesRoleDefinition - Details of role definition -type ExpandedPropertiesRoleDefinition struct { - // Display name of the role definition - DisplayName *string - - // Id of the role definition - ID *string +// AccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Get +// method. +type AccessReviewDefaultSettingsClientGetOptions struct { + // placeholder for future optional parameters +} - // Type of the role definition - Type *string +// AccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Put +// method. +type AccessReviewDefaultSettingsClientPutOptions struct { + // placeholder for future optional parameters } -// ExpandedPropertiesScope - Details of the resource scope -type ExpandedPropertiesScope struct { - // Display name of the resource - DisplayName *string +// AccessReviewHistoryDefinition - Access Review History Definition. +type AccessReviewHistoryDefinition struct { + // Access Review History Definition properties. + Properties *AccessReviewHistoryDefinitionProperties - // Scope id of the resource + // READ-ONLY; The access review history definition id. ID *string - // Type of the resource + // READ-ONLY; The access review history definition unique id. + Name *string + + // READ-ONLY; The resource type. Type *string } -// GlobalAdministratorClientElevateAccessOptions contains the optional parameters for the GlobalAdministratorClient.ElevateAccess +// AccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.Create // method. -type GlobalAdministratorClientElevateAccessOptions struct { +type AccessReviewHistoryDefinitionClientCreateOptions struct { // placeholder for future optional parameters } -// Permission - Role definition permissions. -type Permission struct { - // Allowed actions. - Actions []*string - - // Allowed Data actions. - DataActions []*string - - // Denied actions. - NotActions []*string +// AccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.DeleteByID +// method. +type AccessReviewHistoryDefinitionClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} - // Denied Data actions. - NotDataActions []*string +// AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for the AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI +// method. +type AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions struct { + // placeholder for future optional parameters } -// PermissionGetResult - Permissions information. -type PermissionGetResult struct { +// AccessReviewHistoryDefinitionInstanceListResult - List of Access Review History Instances. +type AccessReviewHistoryDefinitionInstanceListResult struct { // The URL to use for getting the next set of results. NextLink *string - // An array of permissions. - Value []*Permission + // Access Review History Definition's Instance list. + Value []*AccessReviewHistoryInstance } -// PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.NewListForResourceGroupPager +// AccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the AccessReviewHistoryDefinitionInstancesClient.NewListPager // method. -type PermissionsClientListForResourceGroupOptions struct { +type AccessReviewHistoryDefinitionInstancesClientListOptions struct { // placeholder for future optional parameters } -// PermissionsClientListForResourceOptions contains the optional parameters for the PermissionsClient.NewListForResourcePager -// method. -type PermissionsClientListForResourceOptions struct { - // placeholder for future optional parameters -} +// AccessReviewHistoryDefinitionListResult - List of Access Review History Definitions. +type AccessReviewHistoryDefinitionListResult struct { + // The URL to use for getting the next set of results. + NextLink *string -// PolicyAssignmentProperties - Expanded info of resource scope, role definition and policy -type PolicyAssignmentProperties struct { - // Details of the policy - Policy *PolicyAssignmentPropertiesPolicy + // Access Review History Definition list. + Value []*AccessReviewHistoryDefinition +} - // Details of role definition - RoleDefinition *PolicyAssignmentPropertiesRoleDefinition +// AccessReviewHistoryDefinitionProperties - Access Review History Instances. +type AccessReviewHistoryDefinitionProperties struct { + // Collection of review decisions which the history data should be filtered on. For example if Approve and Deny are supplied + // the data will only contain review results in which the decision maker approved + // or denied a review request. + Decisions []*AccessReviewResult - // Details of the resource scope - Scope *PolicyAssignmentPropertiesScope -} + // The display name for the history definition. + DisplayName *string -// PolicyAssignmentPropertiesPolicy - Details of the policy -type PolicyAssignmentPropertiesPolicy struct { - // Id of the policy - ID *string + // Set of access review history instances for this history definition. + Instances []*AccessReviewHistoryInstance - // The last modified date time. - LastModifiedDateTime *time.Time + // A collection of scopes used when selecting review history data + Scopes []*AccessReviewScope - // READ-ONLY; The name of the entity last modified it - LastModifiedBy *Principal -} + // Recurrence settings for recurring history reports, skip for one-time reports. + Settings *AccessReviewHistoryScheduleSettings -// PolicyAssignmentPropertiesRoleDefinition - Details of role definition -type PolicyAssignmentPropertiesRoleDefinition struct { - // Display name of the role definition - DisplayName *string + // READ-ONLY; The user or other identity who created this history definition. + CreatedBy *AccessReviewActorIdentity - // Id of the role definition - ID *string + // READ-ONLY; Date time when history definition was created + CreatedDateTime *time.Time - // Type of the role definition - Type *string -} + // READ-ONLY; Date time used when selecting review data, all reviews included in data end on or before this date. For use + // only with one-time/non-recurring reports. + ReviewHistoryPeriodEndDateTime *time.Time -// PolicyAssignmentPropertiesScope - Details of the resource scope -type PolicyAssignmentPropertiesScope struct { - // Display name of the resource - DisplayName *string + // READ-ONLY; Date time used when selecting review data, all reviews included in data start on or after this date. For use + // only with one-time/non-recurring reports. + ReviewHistoryPeriodStartDateTime *time.Time - // Scope id of the resource - ID *string + // READ-ONLY; This read-only field specifies the of the requested review history data. This is either requested, in-progress, + // done or error. + Status *AccessReviewHistoryDefinitionStatus +} - // Type of the resource - Type *string +// AccessReviewHistoryDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionsClient.GetByID +// method. +type AccessReviewHistoryDefinitionsClientGetByIDOptions struct { + // placeholder for future optional parameters } -// PolicyProperties - Expanded info of resource scope -type PolicyProperties struct { - // READ-ONLY; Details of the resource scope - Scope *PolicyPropertiesScope +// AccessReviewHistoryDefinitionsClientListOptions contains the optional parameters for the AccessReviewHistoryDefinitionsClient.NewListPager +// method. +type AccessReviewHistoryDefinitionsClientListOptions struct { + // The filter to apply on the operation. Only standard filters on definition name and created date are supported + Filter *string } -// PolicyPropertiesScope - Details of the resource scope -type PolicyPropertiesScope struct { - // Display name of the resource - DisplayName *string +// AccessReviewHistoryInstance - Access Review History Definition Instance. +type AccessReviewHistoryInstance struct { + // Access Review History Definition Instance properties. + Properties *AccessReviewHistoryInstanceProperties - // Scope id of the resource + // READ-ONLY; The access review history definition instance id. ID *string - // Type of the resource + // READ-ONLY; The access review history definition instance unique id. + Name *string + + // READ-ONLY; The resource type. Type *string } -// Principal - The name of the entity last modified it -type Principal struct { - // The name of the principal made changes +// AccessReviewHistoryInstanceProperties - Access Review History Definition Instance properties. +type AccessReviewHistoryInstanceProperties struct { + // The display name for the parent history definition. DisplayName *string - // Email of principal - Email *string + // Date time when history data report expires and the associated data is deleted. + Expiration *time.Time - // The id of the principal made changes - ID *string + // Date time when the history data report is scheduled to be generated. + FulfilledDateTime *time.Time - // Type of principal such as user , group etc - Type *string -} + // Date time used when selecting review data, all reviews included in data end on or before this date. For use only with one-time/non-recurring + // reports. + ReviewHistoryPeriodEndDateTime *time.Time -// ProviderOperation - Operation -type ProviderOperation struct { - // The operation description. - Description *string + // Date time used when selecting review data, all reviews included in data start on or after this date. For use only with + // one-time/non-recurring reports. + ReviewHistoryPeriodStartDateTime *time.Time - // The operation display name. - DisplayName *string + // Date time when the history data report is scheduled to be generated. + RunDateTime *time.Time - // The dataAction flag to specify the operation type. - IsDataAction *bool + // READ-ONLY; Uri which can be used to retrieve review history data. To generate this Uri, generateDownloadUri() must be called + // for a specific accessReviewHistoryDefinitionInstance. The link expires after a 24 hour + // period. Callers can see the expiration date time by looking at the 'se' parameter in the generated uri. + DownloadURI *string - // The operation name. - Name *string + // READ-ONLY; Status of the requested review history instance data. This is either requested, in-progress, done or error. + // The state transitions are as follows - Requested -> InProgress -> Done -> Expired + Status *AccessReviewHistoryDefinitionStatus +} - // The operation origin. - Origin *string +// AccessReviewHistoryScheduleSettings - Recurrence settings of an Access Review History Definition. +type AccessReviewHistoryScheduleSettings struct { + // Access Review History Definition recurrence settings. + Pattern *AccessReviewRecurrencePattern - // The operation properties. - Properties any + // Access Review History Definition recurrence settings. + Range *AccessReviewRecurrenceRange } -// ProviderOperationsMetadata - Provider Operations metadata -type ProviderOperationsMetadata struct { - // The provider display name. - DisplayName *string +// AccessReviewInstance - Access Review Instance. +type AccessReviewInstance struct { + // Access Review properties. + Properties *AccessReviewInstanceProperties - // The provider id. + // READ-ONLY; The access review instance id. ID *string - // The provider name. + // READ-ONLY; The access review instance name. Name *string - // The provider operations. - Operations []*ProviderOperation - - // The provider resource types - ResourceTypes []*ResourceType - - // The provider type. + // READ-ONLY; The resource type. Type *string } -// ProviderOperationsMetadataClientGetOptions contains the optional parameters for the ProviderOperationsMetadataClient.Get +// AccessReviewInstanceClientAcceptRecommendationsOptions contains the optional parameters for the AccessReviewInstanceClient.AcceptRecommendations // method. -type ProviderOperationsMetadataClientGetOptions struct { - // Specifies whether to expand the values. - Expand *string +type AccessReviewInstanceClientAcceptRecommendationsOptions struct { + // placeholder for future optional parameters } -// ProviderOperationsMetadataClientListOptions contains the optional parameters for the ProviderOperationsMetadataClient.NewListPager +// AccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ApplyDecisions // method. -type ProviderOperationsMetadataClientListOptions struct { - // Specifies whether to expand the values. - Expand *string +type AccessReviewInstanceClientApplyDecisionsOptions struct { + // placeholder for future optional parameters } -// ProviderOperationsMetadataListResult - Provider operations metadata list -type ProviderOperationsMetadataListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - - // The list of providers. - Value []*ProviderOperationsMetadata +// AccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ResetDecisions +// method. +type AccessReviewInstanceClientResetDecisionsOptions struct { + // placeholder for future optional parameters } -// ResourceType - Resource Type -type ResourceType struct { - // The resource type display name. - DisplayName *string - - // The resource type name. - Name *string +// AccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the AccessReviewInstanceClient.SendReminders +// method. +type AccessReviewInstanceClientSendRemindersOptions struct { + // placeholder for future optional parameters +} - // The resource type operations. - Operations []*ProviderOperation +// AccessReviewInstanceClientStopOptions contains the optional parameters for the AccessReviewInstanceClient.Stop method. +type AccessReviewInstanceClientStopOptions struct { + // placeholder for future optional parameters } -// RoleAssignment - Role Assignments -type RoleAssignment struct { - // Role assignment properties. - Properties *RoleAssignmentProperties +// AccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the AccessReviewInstanceContactedReviewersClient.NewListPager +// method. +type AccessReviewInstanceContactedReviewersClientListOptions struct { + // placeholder for future optional parameters +} - // READ-ONLY; The role assignment ID. - ID *string +// AccessReviewInstanceDecisionsClientListOptions contains the optional parameters for the AccessReviewInstanceDecisionsClient.NewListPager +// method. +type AccessReviewInstanceDecisionsClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string +} - // READ-ONLY; The role assignment name. - Name *string +// AccessReviewInstanceListResult - List of Access Review Instances. +type AccessReviewInstanceListResult struct { + // The URL to use for getting the next set of results. + NextLink *string - // READ-ONLY; The role assignment type. - Type *string + // Access Review Instance list. + Value []*AccessReviewInstance } -// RoleAssignmentCreateParameters - Role assignment create parameters. -type RoleAssignmentCreateParameters struct { - // REQUIRED; Role assignment properties. - Properties *RoleAssignmentProperties +// AccessReviewInstanceMyDecisionsClientGetByIDOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.GetByID +// method. +type AccessReviewInstanceMyDecisionsClientGetByIDOptions struct { + // placeholder for future optional parameters } -// RoleAssignmentFilter - Role Assignments filter -type RoleAssignmentFilter struct { - // Returns role assignment of the specific principal. - PrincipalID *string +// AccessReviewInstanceMyDecisionsClientListOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.NewListPager +// method. +type AccessReviewInstanceMyDecisionsClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string } -// RoleAssignmentListResult - Role assignment list operation result. -type RoleAssignmentListResult struct { - // Role assignment list. - Value []*RoleAssignment - - // READ-ONLY; The skipToken to use for getting the next set of results. - NextLink *string +// AccessReviewInstanceMyDecisionsClientPatchOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.Patch +// method. +type AccessReviewInstanceMyDecisionsClientPatchOptions struct { + // placeholder for future optional parameters } -// RoleAssignmentProperties - Role assignment properties. -type RoleAssignmentProperties struct { - // REQUIRED; The principal ID. - PrincipalID *string +// AccessReviewInstanceProperties - Access Review Instance properties. +type AccessReviewInstanceProperties struct { + // This is the collection of backup reviewers. + BackupReviewers []*AccessReviewReviewer - // REQUIRED; The role definition ID. - RoleDefinitionID *string + // The DateTime when the review instance is scheduled to end. + EndDateTime *time.Time - // 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 - // 'foostoragecontainer' - Condition *string + // This is the collection of reviewers. + Reviewers []*AccessReviewReviewer - // Version of the condition. Currently the only accepted value is '2.0' - ConditionVersion *string + // The DateTime when the review instance is scheduled to be start. + StartDateTime *time.Time - // Id of the delegated managed identity resource - DelegatedManagedIdentityResourceID *string + // READ-ONLY; 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. + ReviewersType *AccessReviewInstanceReviewersType - // Description of role assignment - Description *string + // READ-ONLY; This read-only field specifies the status of an access review instance. + Status *AccessReviewInstanceStatus +} - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType +// AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesAssignedForMyApprovalClient.GetByID +// method. +type AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions struct { + // placeholder for future optional parameters +} - // READ-ONLY; Id of the user who created the assignment - CreatedBy *string +// AccessReviewInstancesAssignedForMyApprovalClientListOptions contains the optional parameters for the AccessReviewInstancesAssignedForMyApprovalClient.NewListPager +// method. +type AccessReviewInstancesAssignedForMyApprovalClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string +} - // READ-ONLY; Time it was created - CreatedOn *time.Time +// AccessReviewInstancesClientCreateOptions contains the optional parameters for the AccessReviewInstancesClient.Create method. +type AccessReviewInstancesClientCreateOptions struct { + // placeholder for future optional parameters +} - // READ-ONLY; The role assignment scope. - Scope *string +// AccessReviewInstancesClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesClient.GetByID +// method. +type AccessReviewInstancesClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstancesClientListOptions contains the optional parameters for the AccessReviewInstancesClient.NewListPager +// method. +type AccessReviewInstancesClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string +} - // READ-ONLY; Id of the user who updated the assignment - UpdatedBy *string +// AccessReviewRecurrencePattern - Recurrence Pattern of an Access Review Schedule Definition. +type AccessReviewRecurrencePattern struct { + // The interval for recurrence. For a quarterly review, the interval is 3 for type : absoluteMonthly. + Interval *int32 - // READ-ONLY; Time it was updated - UpdatedOn *time.Time + // The recurrence type : weekly, monthly, etc. + Type *AccessReviewRecurrencePatternType } -// RoleAssignmentSchedule - Role Assignment schedule -type RoleAssignmentSchedule struct { - // Role assignment schedule properties. - Properties *RoleAssignmentScheduleProperties +// AccessReviewRecurrenceRange - Recurrence Range of an Access Review Schedule Definition. +type AccessReviewRecurrenceRange struct { + // The DateTime when the review is scheduled to end. Required if type is endDate + EndDate *time.Time - // READ-ONLY; The role assignment schedule Id. - ID *string + // The number of times to repeat the access review. Required and must be positive if type is numbered. + NumberOfOccurrences *int32 - // READ-ONLY; The role assignment schedule name. - Name *string + // The DateTime when the review is scheduled to be start. This could be a date in the future. Required on create. + StartDate *time.Time - // READ-ONLY; The role assignment schedule type. - Type *string + // The recurrence range type. The possible values are: endDate, noEnd, numbered. + Type *AccessReviewRecurrenceRangeType } -// RoleAssignmentScheduleFilter - Role assignment schedule filter -type RoleAssignmentScheduleFilter struct { - // Returns role assignment schedule of the specific principal. - PrincipalID *string +// AccessReviewRecurrenceSettings - Recurrence Settings of an Access Review Schedule Definition. +type AccessReviewRecurrenceSettings struct { + // Access Review schedule definition recurrence pattern. + Pattern *AccessReviewRecurrencePattern - // Returns role assignment schedule of the specific role definition. - RoleDefinitionID *string + // Access Review schedule definition recurrence range. + Range *AccessReviewRecurrenceRange +} - // Returns role assignment schedule instances of the specific status. - Status *string +// AccessReviewReviewer - Descriptor for what needs to be reviewed +type AccessReviewReviewer struct { + // The id of the reviewer(user/servicePrincipal) + PrincipalID *string + + // READ-ONLY; The identity type : user/servicePrincipal + PrincipalType *AccessReviewReviewerType } -// RoleAssignmentScheduleInstance - Information about current or upcoming role assignment schedule instance -type RoleAssignmentScheduleInstance struct { - // Role assignment schedule instance properties. - Properties *RoleAssignmentScheduleInstanceProperties +// AccessReviewScheduleDefinition - Access Review Schedule Definition. +type AccessReviewScheduleDefinition struct { + // Access Review properties. + Properties *AccessReviewScheduleDefinitionProperties - // READ-ONLY; The role assignment schedule instance ID. + // READ-ONLY; The access review schedule definition id. ID *string - // READ-ONLY; The role assignment schedule instance name. + // READ-ONLY; The access review schedule definition unique id. Name *string - // READ-ONLY; The role assignment schedule instance type. + // READ-ONLY; The resource type. Type *string } -// RoleAssignmentScheduleInstanceFilter - Role assignment schedule instance filter -type RoleAssignmentScheduleInstanceFilter struct { - // Returns role assignment schedule instances of the specific principal. - PrincipalID *string - - // Returns role assignment schedule instances belonging to a specific role assignment schedule. - RoleAssignmentScheduleID *string - - // Returns role assignment schedule instances of the specific role definition. - RoleDefinitionID *string - - // Returns role assignment schedule instances of the specific status. - Status *string -} - -// RoleAssignmentScheduleInstanceListResult - Role assignment schedule instance list operation result. -type RoleAssignmentScheduleInstanceListResult struct { +// AccessReviewScheduleDefinitionListResult - List of Access Review Schedule Definitions. +type AccessReviewScheduleDefinitionListResult struct { // The URL to use for getting the next set of results. NextLink *string - // Role assignment schedule instance list. - Value []*RoleAssignmentScheduleInstance + // Access Review Schedule Definition list. + Value []*AccessReviewScheduleDefinition } -// RoleAssignmentScheduleInstanceProperties - Role assignment schedule properties with scope. -type RoleAssignmentScheduleInstanceProperties struct { - // Assignment type of the role assignment schedule - AssignmentType *AssignmentType - - // 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 - // 'foostoragecontainer' - Condition *string - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string - - // DateTime when role assignment schedule was created - CreatedOn *time.Time +// AccessReviewScheduleDefinitionProperties - Access Review. +type AccessReviewScheduleDefinitionProperties struct { + // This is the collection of backup reviewers. + BackupReviewers []*AccessReviewReviewer - // The endDateTime of the role assignment schedule instance - EndDateTime *time.Time + // The description provided by the access review creator and visible to admins. + DescriptionForAdmins *string - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties + // The description provided by the access review creator to be shown to reviewers. + DescriptionForReviewers *string - // roleEligibilityScheduleId used to activate - LinkedRoleEligibilityScheduleID *string + // The display name for the schedule definition. + DisplayName *string - // roleEligibilityScheduleInstanceId linked to this roleAssignmentScheduleInstance - LinkedRoleEligibilityScheduleInstanceID *string + // This is the collection of instances returned when one does an expand on it. + Instances []*AccessReviewInstance - // Membership type of the role assignment schedule - MemberType *MemberType + // This is the collection of reviewers. + Reviewers []*AccessReviewReviewer - // Role Assignment Id in external system - OriginRoleAssignmentID *string + // Access Review Settings. + Settings *AccessReviewScheduleSettings - // The principal ID. - PrincipalID *string + // READ-ONLY; The user or other identity who created this review. + CreatedBy *AccessReviewActorIdentity - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType + // READ-ONLY; 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. + ReviewersType *AccessReviewScheduleDefinitionReviewersType - // Id of the master role assignment schedule - RoleAssignmentScheduleID *string + // READ-ONLY; This is used to define what to include in scope of the review. The scope definition includes the resourceId + // and roleDefinitionId. + Scope *AccessReviewScope - // The role definition ID. - RoleDefinitionID *string + // READ-ONLY; This read-only field specifies the status of an accessReview. + Status *AccessReviewScheduleDefinitionStatus +} - // The role assignment schedule scope. - Scope *string +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions contains the optional parameters for the AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager +// method. +type AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string +} - // The startDateTime of the role assignment schedule instance - StartDateTime *time.Time +// AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID +// method. +type AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions struct { + // placeholder for future optional parameters +} - // The status of the role assignment schedule instance. - Status *Status +// AccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.DeleteByID +// method. +type AccessReviewScheduleDefinitionsClientDeleteByIDOptions struct { + // placeholder for future optional parameters } -// RoleAssignmentScheduleInstancesClientGetOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.Get +// AccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.GetByID // method. -type RoleAssignmentScheduleInstancesClientGetOptions struct { +type AccessReviewScheduleDefinitionsClientGetByIDOptions struct { // placeholder for future optional parameters } -// RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.NewListForScopePager +// AccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.NewListPager // method. -type RoleAssignmentScheduleInstancesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role assignment schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role assignment - // schedule instances for the user. Use $filter=asTarget() to return all role - // assignment schedule instances created for the current user. +type AccessReviewScheduleDefinitionsClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned Filter *string } -// RoleAssignmentScheduleListResult - Role assignment schedule list operation result. -type RoleAssignmentScheduleListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - - // Role assignment schedule list. - Value []*RoleAssignmentSchedule +// AccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.Stop +// method. +type AccessReviewScheduleDefinitionsClientStopOptions struct { + // placeholder for future optional parameters } -// RoleAssignmentScheduleProperties - Role assignment schedule properties with scope. -type RoleAssignmentScheduleProperties struct { - // Assignment type of the role assignment schedule - AssignmentType *AssignmentType +// AccessReviewScheduleSettings - Settings of an Access Review. +type AccessReviewScheduleSettings struct { + // 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. + AutoApplyDecisionsEnabled *bool - // 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 - // 'foostoragecontainer' - Condition *string + // This specifies the behavior for the autoReview feature when an access review completes. + DefaultDecision *DefaultDecisionType - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string + // Flag to indicate whether reviewers are required to provide a justification when reviewing access. + DefaultDecisionEnabled *bool - // DateTime when role assignment schedule was created - CreatedOn *time.Time + // The duration in days for an instance. + InstanceDurationInDays *int32 - // End DateTime when role assignment schedule - EndDateTime *time.Time + // Flag to indicate whether the reviewer is required to pass justification when recording a decision. + JustificationRequiredOnApproval *bool - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties + // Flag to indicate whether sending mails to reviewers and the review creator is enabled. + MailNotificationsEnabled *bool - // The id of roleEligibilitySchedule used to activated this roleAssignmentSchedule - LinkedRoleEligibilityScheduleID *string + // Recommendations for access reviews are calculated by looking back at 30 days of data(w.r.t the start date of the review) + // by default. However, in some scenarios, customers want to change how far back + // to look at and want to configure 60 days, 90 days, etc. instead. This setting allows customers to configure this duration. + // The value should be in ISO 8601 format + // (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be used to convert TimeSpan to a valid interval string: + // XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + RecommendationLookBackDuration *string - // Membership type of the role assignment schedule - MemberType *MemberType + // Flag to indicate whether showing recommendations to reviewers is enabled. + RecommendationsEnabled *bool - // The principal ID. - PrincipalID *string + // Access Review Settings. + Recurrence *AccessReviewRecurrenceSettings - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType + // Flag to indicate whether sending reminder emails to reviewers are enabled. + ReminderNotificationsEnabled *bool +} - // The id of roleAssignmentScheduleRequest used to create this roleAssignmentSchedule - RoleAssignmentScheduleRequestID *string +// AccessReviewScope - Descriptor for what needs to be reviewed +type AccessReviewScope struct { + // This is used to indicate the resource id(s) to exclude + ExcludeResourceID *string - // The role definition ID. - RoleDefinitionID *string + // This is used to indicate the role definition id(s) to exclude + ExcludeRoleDefinitionID *string - // The role assignment schedule scope. - Scope *string + // Flag to indicate whether to expand nested memberships or not. + ExpandNestedMemberships *bool - // Start DateTime when role assignment schedule - StartDateTime *time.Time + // Duration users are inactive for. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This + // code can be used to convert TimeSpan to a valid interval string: + // XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + InactiveDuration *string + + // Flag to indicate whether to expand nested memberships or not. + IncludeAccessBelowResource *bool + + // Flag to indicate whether to expand nested memberships or not. + IncludeInheritedAccess *bool - // The status of the role assignment schedule. - Status *Status + // READ-ONLY; The role assignment state eligible/active to review + AssignmentState *AccessReviewScopeAssignmentState - // DateTime when role assignment schedule was modified - UpdatedOn *time.Time + // READ-ONLY; The identity type user/servicePrincipal to review + PrincipalType *AccessReviewScopePrincipalType + + // READ-ONLY; ResourceId in which this review is getting created + ResourceID *string + + // READ-ONLY; This is used to indicate the role being reviewed + RoleDefinitionID *string } -// RoleAssignmentScheduleRequest - Role Assignment schedule request -type RoleAssignmentScheduleRequest struct { - // Role assignment schedule request properties. - Properties *RoleAssignmentScheduleRequestProperties +// Alert - The alert. +type Alert struct { + // Alert properties. + Properties *AlertProperties - // READ-ONLY; The role assignment schedule request ID. + // READ-ONLY; The alert ID. ID *string - // READ-ONLY; The role assignment schedule request name. + // READ-ONLY; The alert name. Name *string - // READ-ONLY; The role assignment schedule request type. + // READ-ONLY; The alert type. Type *string } -// RoleAssignmentScheduleRequestFilter - Role assignment schedule request filter -type RoleAssignmentScheduleRequestFilter struct { - // Returns role assignment requests of the specific principal. - PrincipalID *string +// AlertConfiguration - Alert configuration. +type AlertConfiguration struct { + // Alert configuration properties. + Properties AlertConfigurationPropertiesClassification - // Returns role assignment requests created by specific principal. - RequestorID *string + // READ-ONLY; The alert configuration ID. + ID *string - // Returns role assignment requests of the specific role definition. - RoleDefinitionID *string + // READ-ONLY; The alert configuration name. + Name *string - // Returns role assignment requests of specific status. - Status *string + // READ-ONLY; The alert configuration type. + Type *string } -// RoleAssignmentScheduleRequestListResult - Role assignment schedule request list operation result. -type RoleAssignmentScheduleRequestListResult struct { +// AlertConfigurationListResult - Alert configuration list operation result. +type AlertConfigurationListResult struct { // The URL to use for getting the next set of results. NextLink *string - // Role assignment schedule request list. - Value []*RoleAssignmentScheduleRequest + // Alert configuration list + Value []*AlertConfiguration } -// RoleAssignmentScheduleRequestProperties - Role assignment schedule request properties with scope. -type RoleAssignmentScheduleRequestProperties struct { - // REQUIRED; The principal ID. - PrincipalID *string - - // REQUIRED; The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc - RequestType *RequestType - - // REQUIRED; The role definition ID. - RoleDefinitionID *string - - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string - - // Justification for the role assignment - Justification *string - - // The linked role eligibility schedule id - to activate an eligibility. - LinkedRoleEligibilityScheduleID *string - - // Schedule info of the role assignment schedule - ScheduleInfo *RoleAssignmentScheduleRequestPropertiesScheduleInfo - - // The resultant role assignment schedule id or the role assignment schedule id being updated - TargetRoleAssignmentScheduleID *string - - // The role assignment schedule instance id being updated - TargetRoleAssignmentScheduleInstanceID *string - - // Ticket Info of the role assignment - TicketInfo *RoleAssignmentScheduleRequestPropertiesTicketInfo - - // READ-ONLY; The approvalId of the role assignment schedule request. - ApprovalID *string - - // READ-ONLY; DateTime when role assignment schedule request was created - CreatedOn *time.Time - - // READ-ONLY; Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties - - // READ-ONLY; The principal type of the assigned principal ID. - PrincipalType *PrincipalType - - // READ-ONLY; Id of the user who created this request - RequestorID *string - - // READ-ONLY; The role assignment schedule request scope. - Scope *string - - // READ-ONLY; The status of the role assignment schedule request. - Status *Status +// AlertConfigurationPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetAlertConfigurationProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AlertConfigurationProperties, *AzureRolesAssignedOutsidePimAlertConfigurationProperties, *DuplicateRoleCreatedAlertConfigurationProperties, +// - *TooManyOwnersAssignedToResourceAlertConfigurationProperties, *TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties +type AlertConfigurationPropertiesClassification interface { + // GetAlertConfigurationProperties returns the AlertConfigurationProperties content of the underlying type. + GetAlertConfigurationProperties() *AlertConfigurationProperties } -// RoleAssignmentScheduleRequestPropertiesScheduleInfo - Schedule info of the role assignment schedule -type RoleAssignmentScheduleRequestPropertiesScheduleInfo struct { - // Expiration of the role assignment schedule - Expiration *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration +// AlertConfigurationProperties - Alert configuration properties. +type AlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string - // Start DateTime of the role assignment schedule. - StartDateTime *time.Time -} + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool -// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role assignment schedule -type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration struct { - // Duration of the role assignment schedule in TimeSpan. - Duration *string + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition - // End DateTime of the role assignment schedule. - EndDateTime *time.Time + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string - // Type of the role assignment schedule expiration - Type *Type + // READ-ONLY; The alert scope. + Scope *string } -// RoleAssignmentScheduleRequestPropertiesTicketInfo - Ticket Info of the role assignment -type RoleAssignmentScheduleRequestPropertiesTicketInfo struct { - // Ticket number for the role assignment - TicketNumber *string - - // Ticket system name for the role assignment - TicketSystem *string +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type AlertConfigurationProperties. +func (a *AlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return a } -// RoleAssignmentScheduleRequestsClientCancelOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Cancel -// method. -type RoleAssignmentScheduleRequestsClientCancelOptions struct { +// AlertConfigurationsClientGetOptions contains the optional parameters for the AlertConfigurationsClient.Get method. +type AlertConfigurationsClientGetOptions struct { // placeholder for future optional parameters } -// RoleAssignmentScheduleRequestsClientCreateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Create +// AlertConfigurationsClientListForScopeOptions contains the optional parameters for the AlertConfigurationsClient.NewListForScopePager // method. -type RoleAssignmentScheduleRequestsClientCreateOptions struct { +type AlertConfigurationsClientListForScopeOptions struct { // placeholder for future optional parameters } -// RoleAssignmentScheduleRequestsClientGetOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Get -// method. -type RoleAssignmentScheduleRequestsClientGetOptions struct { +// AlertConfigurationsClientUpdateOptions contains the optional parameters for the AlertConfigurationsClient.Update method. +type AlertConfigurationsClientUpdateOptions struct { // placeholder for future optional parameters } -// RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.NewListForScopePager -// method. -type RoleAssignmentScheduleRequestsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule requests at or above - // the scope. Use $filter=principalId eq {id} to return all role assignment - // schedule requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all role - // assignment schedule requests requested by the current user. Use - // $filter=asTarget() to return all role assignment schedule requests created for the current user. Use $filter=asApprover() - // to return all role assignment schedule requests where the current user is an - // approver. - Filter *string -} +// AlertDefinition - Alert definition +type AlertDefinition struct { + // Alert definition properties. + Properties *AlertDefinitionProperties -// RoleAssignmentScheduleRequestsClientValidateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Validate -// method. -type RoleAssignmentScheduleRequestsClientValidateOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The alert definition ID. + ID *string -// RoleAssignmentSchedulesClientGetOptions contains the optional parameters for the RoleAssignmentSchedulesClient.Get method. -type RoleAssignmentSchedulesClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The alert definition name. + Name *string -// RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.NewListForScopePager -// method. -type RoleAssignmentSchedulesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role assignment schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role assignment - // schedules for the current user. Use $filter=asTarget() to return all role - // assignment schedules created for the current user. - Filter *string + // READ-ONLY; The alert definition type. + Type *string } -// RoleAssignmentsClientCreateByIDOptions contains the optional parameters for the RoleAssignmentsClient.CreateByID method. -type RoleAssignmentsClientCreateByIDOptions struct { - // placeholder for future optional parameters -} +// AlertDefinitionListResult - Alert definition list operation result. +type AlertDefinitionListResult struct { + // The URL to use for getting the next set of results. + NextLink *string -// RoleAssignmentsClientCreateOptions contains the optional parameters for the RoleAssignmentsClient.Create method. -type RoleAssignmentsClientCreateOptions struct { - // placeholder for future optional parameters + // Alert definition list + Value []*AlertDefinition } -// RoleAssignmentsClientDeleteByIDOptions contains the optional parameters for the RoleAssignmentsClient.DeleteByID method. -type RoleAssignmentsClientDeleteByIDOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} +// AlertDefinitionProperties - Alert definition properties. +type AlertDefinitionProperties struct { + // READ-ONLY; The alert description. + Description *string -// RoleAssignmentsClientDeleteOptions contains the optional parameters for the RoleAssignmentsClient.Delete method. -type RoleAssignmentsClientDeleteOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} + // READ-ONLY; The alert display name. + DisplayName *string -// RoleAssignmentsClientGetByIDOptions contains the optional parameters for the RoleAssignmentsClient.GetByID method. -type RoleAssignmentsClientGetByIDOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} + // READ-ONLY; The ways to prevent the alert. + HowToPrevent *string -// RoleAssignmentsClientGetOptions contains the optional parameters for the RoleAssignmentsClient.Get method. -type RoleAssignmentsClientGetOptions struct { - // Tenant ID for cross-tenant request - TenantID *string -} + // READ-ONLY; True if the alert configuration can be configured; false, otherwise. + IsConfigurable *bool -// RoleAssignmentsClientListForResourceGroupOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourceGroupPager -// method. -type RoleAssignmentsClientListForResourceGroupOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // Tenant ID for cross-tenant request - TenantID *string -} + // READ-ONLY; True if the alert can be remediated; false, otherwise. + IsRemediatable *bool -// RoleAssignmentsClientListForResourceOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourcePager -// method. -type RoleAssignmentsClientListForResourceOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // Tenant ID for cross-tenant request - TenantID *string + // READ-ONLY; The methods to mitigate the alert. + MitigationSteps *string + + // READ-ONLY; The alert scope. + Scope *string + + // READ-ONLY; Security impact of the alert. + SecurityImpact *string + + // READ-ONLY; Severity level of the alert. + SeverityLevel *SeverityLevel } -// RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.NewListForScopePager -// method. -type RoleAssignmentsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // The skipToken to apply on the operation. Use $skipToken={skiptoken} to return paged role assignments following the skipToken - // passed. Only supported on provider level calls. - SkipToken *string - // Tenant ID for cross-tenant request - TenantID *string +// AlertDefinitionsClientGetOptions contains the optional parameters for the AlertDefinitionsClient.Get method. +type AlertDefinitionsClientGetOptions struct { + // placeholder for future optional parameters } -// RoleAssignmentsClientListForSubscriptionOptions contains the optional parameters for the RoleAssignmentsClient.NewListForSubscriptionPager +// AlertDefinitionsClientListForScopeOptions contains the optional parameters for the AlertDefinitionsClient.NewListForScopePager // method. -type RoleAssignmentsClientListForSubscriptionOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId - // eq {id} to return all role assignments at, above or below the - // scope for the specified principal. - Filter *string - // Tenant ID for cross-tenant request - TenantID *string +type AlertDefinitionsClientListForScopeOptions struct { + // placeholder for future optional parameters } -// RoleDefinition - Role definition. -type RoleDefinition struct { - // Role definition properties. - Properties *RoleDefinitionProperties +// AlertIncident - Alert incident +type AlertIncident struct { + // Alert incident properties. + Properties AlertIncidentPropertiesClassification - // READ-ONLY; The role definition ID. + // READ-ONLY; The alert incident ID. ID *string - // READ-ONLY; The role definition name. + // READ-ONLY; The alert incident name. Name *string - // READ-ONLY; The role definition type. - Type *string -} - -// RoleDefinitionFilter - Role Definitions filter -type RoleDefinitionFilter struct { - // Returns role definition with the specific name. - RoleName *string - - // Returns role definition with the specific type. + // READ-ONLY; The alert incident type. Type *string } -// RoleDefinitionListResult - Role definition list operation result. -type RoleDefinitionListResult struct { +// AlertIncidentListResult - Alert incident list operation result. +type AlertIncidentListResult struct { // The URL to use for getting the next set of results. NextLink *string - // Role definition list. - Value []*RoleDefinition + // Alert incident list + Value []*AlertIncident } -// RoleDefinitionProperties - Role definition properties. -type RoleDefinitionProperties struct { - // Role definition assignable scopes. - AssignableScopes []*string - - // The role definition description. - Description *string - - // Role definition permissions. - Permissions []*Permission - - // The role name. - RoleName *string - - // The role type. - RoleType *string +// AlertIncidentPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetAlertIncidentProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AlertIncidentProperties, *AzureRolesAssignedOutsidePimAlertIncidentProperties, *DuplicateRoleCreatedAlertIncidentProperties, +// - *TooManyOwnersAssignedToResourceAlertIncidentProperties, *TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties +type AlertIncidentPropertiesClassification interface { + // GetAlertIncidentProperties returns the AlertIncidentProperties content of the underlying type. + GetAlertIncidentProperties() *AlertIncidentProperties } -// RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate -// method. -type RoleDefinitionsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters +// AlertIncidentProperties - Alert incident properties +type AlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string } -// RoleDefinitionsClientDeleteOptions contains the optional parameters for the RoleDefinitionsClient.Delete method. -type RoleDefinitionsClientDeleteOptions struct { - // placeholder for future optional parameters -} +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type AlertIncidentProperties. +func (a *AlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { return a } -// RoleDefinitionsClientGetByIDOptions contains the optional parameters for the RoleDefinitionsClient.GetByID method. -type RoleDefinitionsClientGetByIDOptions struct { +// AlertIncidentsClientGetOptions contains the optional parameters for the AlertIncidentsClient.Get method. +type AlertIncidentsClientGetOptions struct { // placeholder for future optional parameters } -// RoleDefinitionsClientGetOptions contains the optional parameters for the RoleDefinitionsClient.Get method. -type RoleDefinitionsClientGetOptions struct { +// AlertIncidentsClientListForScopeOptions contains the optional parameters for the AlertIncidentsClient.NewListForScopePager +// method. +type AlertIncidentsClientListForScopeOptions struct { // placeholder for future optional parameters } -// RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.NewListPager method. -type RoleDefinitionsClientListOptions struct { - // The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. - Filter *string +// AlertIncidentsClientRemediateOptions contains the optional parameters for the AlertIncidentsClient.Remediate method. +type AlertIncidentsClientRemediateOptions struct { + // placeholder for future optional parameters } -// RoleEligibilitySchedule - Role eligibility schedule -type RoleEligibilitySchedule struct { - // role eligibility schedule properties. - Properties *RoleEligibilityScheduleProperties - - // READ-ONLY; The role eligibility schedule Id. - ID *string - - // READ-ONLY; The role eligibility schedule name. - Name *string +// AlertListResult - Alert list operation result. +type AlertListResult struct { + // The URL to use for getting the next set of results. + NextLink *string - // READ-ONLY; The role eligibility schedule type. - Type *string + // Alert list + Value []*Alert } -// RoleEligibilityScheduleFilter - Role eligibility schedule filter -type RoleEligibilityScheduleFilter struct { - // Returns role eligibility schedule of the specific principal. - PrincipalID *string - - // Returns role eligibility schedule of the specific role definition. - RoleDefinitionID *string - - // Returns role eligibility schedule of the specific status. - Status *string +// AlertOperationClientGetOptions contains the optional parameters for the AlertOperationClient.Get method. +type AlertOperationClientGetOptions struct { + // placeholder for future optional parameters } -// RoleEligibilityScheduleInstance - Information about current or upcoming role eligibility schedule instance -type RoleEligibilityScheduleInstance struct { - // Role eligibility schedule instance properties. - Properties *RoleEligibilityScheduleInstanceProperties +// AlertOperationResult - Alert operation result +type AlertOperationResult struct { + // READ-ONLY; The created date of the alert operation. + CreatedDateTime *time.Time - // READ-ONLY; The role eligibility schedule instance ID. + // READ-ONLY; The id of the alert operation. ID *string - // READ-ONLY; The role eligibility schedule instance name. - Name *string + // READ-ONLY; The last action date of the alert operation. + LastActionDateTime *time.Time - // READ-ONLY; The role eligibility schedule instance type. - Type *string -} + // READ-ONLY; The location of the alert associated with the operation. + ResourceLocation *string -// RoleEligibilityScheduleInstanceFilter - Role eligibility schedule instance filter -type RoleEligibilityScheduleInstanceFilter struct { - // Returns role eligibility schedule instances of the specific principal. - PrincipalID *string - - // Returns role eligibility schedule instances of the specific role definition. - RoleDefinitionID *string - - // Returns role eligibility schedule instances belonging to a specific role eligibility schedule. - RoleEligibilityScheduleID *string - - // Returns role eligibility schedule instances of the specific status. + // READ-ONLY; The status of the alert operation. Status *string -} - -// RoleEligibilityScheduleInstanceListResult - Role eligibility schedule instance list operation result. -type RoleEligibilityScheduleInstanceListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - // Role eligibility schedule instance list. - Value []*RoleEligibilityScheduleInstance + // READ-ONLY; The status detail of the alert operation. + StatusDetail *string } -// RoleEligibilityScheduleInstanceProperties - Role eligibility schedule properties with scope. -type RoleEligibilityScheduleInstanceProperties struct { - // 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 - // 'foostoragecontainer' - Condition *string - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string - - // DateTime when role eligibility schedule was created - CreatedOn *time.Time - - // The endDateTime of the role eligibility schedule instance - EndDateTime *time.Time +// AlertProperties - Alert properties. +type AlertProperties struct { + // False by default; true if the alert is active. + IsActive *bool - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties + // READ-ONLY; The alert configuration. + AlertConfiguration *AlertConfiguration - // Membership type of the role eligibility schedule - MemberType *MemberType + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition - // The principal ID. - PrincipalID *string + // READ-ONLY; The alert incidents. + AlertIncidents []*AlertIncident - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType + // READ-ONLY; The number of generated incidents of the alert. + IncidentCount *int32 - // The role definition ID. - RoleDefinitionID *string + // READ-ONLY; The date time when the alert configuration was updated or new incidents were generated. + LastModifiedDateTime *time.Time - // Id of the master role eligibility schedule - RoleEligibilityScheduleID *string + // READ-ONLY; The date time when the alert was last scanned. + LastScannedDateTime *time.Time - // The role eligibility schedule scope. + // READ-ONLY; The alert scope. Scope *string +} - // The startDateTime of the role eligibility schedule instance - StartDateTime *time.Time +// AlertsClientBeginRefreshAllOptions contains the optional parameters for the AlertsClient.BeginRefreshAll method. +type AlertsClientBeginRefreshAllOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} - // The status of the role eligibility schedule instance - Status *Status +// AlertsClientBeginRefreshOptions contains the optional parameters for the AlertsClient.BeginRefresh method. +type AlertsClientBeginRefreshOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// RoleEligibilityScheduleInstancesClientGetOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.Get -// method. -type RoleEligibilityScheduleInstancesClientGetOptions struct { +// AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +type AlertsClientGetOptions struct { // placeholder for future optional parameters } -// RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.NewListForScopePager -// method. -type RoleEligibilityScheduleInstancesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role assignment schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role eligibility - // schedules for the user. Use $filter=asTarget() to return all role eligibility - // schedules created for the current user. - Filter *string +// AlertsClientListForScopeOptions contains the optional parameters for the AlertsClient.NewListForScopePager method. +type AlertsClientListForScopeOptions struct { + // placeholder for future optional parameters } -// RoleEligibilityScheduleListResult - role eligibility schedule list operation result. -type RoleEligibilityScheduleListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - - // role eligibility schedule list. - Value []*RoleEligibilitySchedule +// AlertsClientUpdateOptions contains the optional parameters for the AlertsClient.Update method. +type AlertsClientUpdateOptions struct { + // placeholder for future optional parameters } -// RoleEligibilityScheduleProperties - Role eligibility schedule properties with scope. -type RoleEligibilityScheduleProperties struct { - // 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 - // 'foostoragecontainer' - Condition *string +// AzureRolesAssignedOutsidePimAlertConfigurationProperties - The Azure roles assigned outside PIM alert configuration properties. +type AzureRolesAssignedOutsidePimAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool - // DateTime when role eligibility schedule was created - CreatedOn *time.Time + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition - // End DateTime when role eligibility schedule - EndDateTime *time.Time + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties + // READ-ONLY; The alert scope. + Scope *string +} - // Membership type of the role eligibility schedule - MemberType *MemberType +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type AzureRolesAssignedOutsidePimAlertConfigurationProperties. +func (a *AzureRolesAssignedOutsidePimAlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return &AlertConfigurationProperties{ + AlertDefinitionID: a.AlertDefinitionID, + Scope: a.Scope, + IsEnabled: a.IsEnabled, + AlertConfigurationType: a.AlertConfigurationType, + AlertDefinition: a.AlertDefinition, + } +} - // The principal ID. - PrincipalID *string +// AzureRolesAssignedOutsidePimAlertIncidentProperties - Azure roles assigned outside PIM alert incident properties. +type AzureRolesAssignedOutsidePimAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType + // READ-ONLY; The assignee display name. + AssigneeDisplayName *string - // The role definition ID. - RoleDefinitionID *string + // READ-ONLY; The assignee ID. + AssigneeID *string - // The id of roleEligibilityScheduleRequest used to create this roleAssignmentSchedule - RoleEligibilityScheduleRequestID *string + // READ-ONLY; The assignee user principal name. + AssigneeUserPrincipalName *string - // The role eligibility schedule scope. - Scope *string + // READ-ONLY; The date the assignment was activated. + AssignmentActivatedDate *time.Time - // Start DateTime when role eligibility schedule - StartDateTime *time.Time - - // The status of the role eligibility schedule. - Status *Status + // READ-ONLY; The requestor display name. + RequestorDisplayName *string - // DateTime when role eligibility schedule was modified - UpdatedOn *time.Time -} + // READ-ONLY; The requestor ID. + RequestorID *string -// RoleEligibilityScheduleRequest - Role Eligibility schedule request -type RoleEligibilityScheduleRequest struct { - // Role eligibility schedule request properties. - Properties *RoleEligibilityScheduleRequestProperties + // READ-ONLY; The requestor user principal name. + RequestorUserPrincipalName *string - // READ-ONLY; The role eligibility schedule request ID. - ID *string + // READ-ONLY; The role definition ID. + RoleDefinitionID *string - // READ-ONLY; The role eligibility schedule request name. - Name *string + // READ-ONLY; The role display name. + RoleDisplayName *string - // READ-ONLY; The role eligibility schedule request type. - Type *string + // READ-ONLY; The role template ID. + RoleTemplateID *string } -// RoleEligibilityScheduleRequestFilter - Role eligibility schedule request filter -type RoleEligibilityScheduleRequestFilter struct { - // Returns role eligibility requests of the specific principal. - PrincipalID *string +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type AzureRolesAssignedOutsidePimAlertIncidentProperties. +func (a *AzureRolesAssignedOutsidePimAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: a.AlertIncidentType, + } +} - // Returns role eligibility requests created by specific principal. - RequestorID *string +// DuplicateRoleCreatedAlertConfigurationProperties - The duplicate role created alert configuration. +type DuplicateRoleCreatedAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string - // Returns role eligibility requests of the specific role definition. - RoleDefinitionID *string + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool - // Returns role eligibility requests of specific status. - Status *string -} + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition -// RoleEligibilityScheduleRequestListResult - Role eligibility schedule request list operation result. -type RoleEligibilityScheduleRequestListResult struct { - // The URL to use for getting the next set of results. - NextLink *string + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string - // Role eligibility schedule request list. - Value []*RoleEligibilityScheduleRequest + // READ-ONLY; The alert scope. + Scope *string } -// RoleEligibilityScheduleRequestProperties - Role eligibility schedule request properties with scope. -type RoleEligibilityScheduleRequestProperties struct { - // REQUIRED; The principal ID. - PrincipalID *string +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type DuplicateRoleCreatedAlertConfigurationProperties. +func (d *DuplicateRoleCreatedAlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return &AlertConfigurationProperties{ + AlertDefinitionID: d.AlertDefinitionID, + Scope: d.Scope, + IsEnabled: d.IsEnabled, + AlertConfigurationType: d.AlertConfigurationType, + AlertDefinition: d.AlertDefinition, + } +} - // REQUIRED; The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc - RequestType *RequestType +// DuplicateRoleCreatedAlertIncidentProperties - Duplicate role created alert incident properties. +type DuplicateRoleCreatedAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string - // REQUIRED; The role definition ID. - RoleDefinitionID *string + // READ-ONLY; The duplicate roles. + DuplicateRoles *string - // The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] - // StringEqualsIgnoreCase - // 'foostoragecontainer' - Condition *string + // READ-ONLY; The reason for the incident. + Reason *string - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string + // READ-ONLY; The role name. + RoleName *string +} - // Justification for the role eligibility - Justification *string +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type DuplicateRoleCreatedAlertIncidentProperties. +func (d *DuplicateRoleCreatedAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: d.AlertIncidentType, + } +} - // Schedule info of the role eligibility schedule - ScheduleInfo *RoleEligibilityScheduleRequestPropertiesScheduleInfo +// ErrorDefinition - Error description and code explaining why an operation failed. +type ErrorDefinition struct { + // Error of the list gateway status. + Error *ErrorDefinitionProperties +} - // The resultant role eligibility schedule id or the role eligibility schedule id being updated - TargetRoleEligibilityScheduleID *string +// ErrorDefinitionProperties - Error description and code explaining why an operation failed. +type ErrorDefinitionProperties struct { + // Error code of list gateway. + Code *string - // The role eligibility schedule instance id being updated - TargetRoleEligibilityScheduleInstanceID *string + // READ-ONLY; Description of the error. + Message *string +} - // Ticket Info of the role eligibility - TicketInfo *RoleEligibilityScheduleRequestPropertiesTicketInfo +// Operation - The definition of a Microsoft.Authorization operation. +type Operation struct { + // Display of the operation + Display *OperationDisplay - // READ-ONLY; The approvalId of the role eligibility schedule request. - ApprovalID *string + // Indicates whether the operation is a data action + IsDataAction *bool - // READ-ONLY; DateTime when role eligibility schedule request was created - CreatedOn *time.Time + // Name of the operation + Name *string - // READ-ONLY; Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties + // Origin of the operation + Origin *string +} - // READ-ONLY; The principal type of the assigned principal ID. - PrincipalType *PrincipalType +// OperationDisplay - The display information for a Microsoft.Authorization operation. +type OperationDisplay struct { + // READ-ONLY; The description for the operation. + Description *string - // READ-ONLY; Id of the user who created this request - RequestorID *string + // READ-ONLY; The operation that users can perform. + Operation *string - // READ-ONLY; The role eligibility schedule request scope. - Scope *string + // READ-ONLY; The resource provider name: Microsoft.Authorization. + Provider *string - // READ-ONLY; The status of the role eligibility schedule request. - Status *Status + // READ-ONLY; The resource on which the operation is performed. + Resource *string } -// RoleEligibilityScheduleRequestPropertiesScheduleInfo - Schedule info of the role eligibility schedule -type RoleEligibilityScheduleRequestPropertiesScheduleInfo struct { - // Expiration of the role eligibility schedule - Expiration *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration +// OperationListResult - The result of a request to list Microsoft.Authorization operations. +type OperationListResult struct { + // The URI that can be used to request the next set of paged results. + NextLink *string - // Start DateTime of the role eligibility schedule. - StartDateTime *time.Time + // The collection value. + Value []*Operation } -// RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role eligibility schedule -type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration struct { - // Duration of the role eligibility schedule in TimeSpan. - Duration *string +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} - // End DateTime of the role eligibility schedule. - EndDateTime *time.Time +// RecordAllDecisionsProperties - Record All Decisions payload. +type RecordAllDecisionsProperties struct { + // The decision to make. Approvers can take action of Approve/Deny + Decision *RecordAllDecisionsResult - // Type of the role eligibility schedule expiration - Type *Type -} + // Justification provided by approvers for their action + Justification *string -// RoleEligibilityScheduleRequestPropertiesTicketInfo - Ticket Info of the role eligibility -type RoleEligibilityScheduleRequestPropertiesTicketInfo struct { - // Ticket number for the role eligibility - TicketNumber *string + // READ-ONLY; The id of principal which needs to be approved/denied. + PrincipalID *string - // Ticket system name for the role eligibility - TicketSystem *string + // READ-ONLY; The id of resource which needs to be approved/denied. + ResourceID *string } -// RoleEligibilityScheduleRequestsClientCancelOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Cancel +// ScopeAccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Get // method. -type RoleEligibilityScheduleRequestsClientCancelOptions struct { +type ScopeAccessReviewDefaultSettingsClientGetOptions struct { // placeholder for future optional parameters } -// RoleEligibilityScheduleRequestsClientCreateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Create +// ScopeAccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Put // method. -type RoleEligibilityScheduleRequestsClientCreateOptions struct { +type ScopeAccessReviewDefaultSettingsClientPutOptions struct { // placeholder for future optional parameters } -// RoleEligibilityScheduleRequestsClientGetOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Get +// ScopeAccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.Create // method. -type RoleEligibilityScheduleRequestsClientGetOptions struct { +type ScopeAccessReviewHistoryDefinitionClientCreateOptions struct { // placeholder for future optional parameters } -// RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.NewListForScopePager +// ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.DeleteByID // method. -type RoleEligibilityScheduleRequestsClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role eligibility schedule requests at or above - // the scope. Use $filter=principalId eq {id} to return all role eligibility - // schedule requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all role - // eligibility schedule requests requested by the current user. Use - // $filter=asTarget() to return all role eligibility schedule requests created for the current user. Use $filter=asApprover() - // to return all role eligibility schedule requests where the current user is an - // approver. - Filter *string +type ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI +// method. +type ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions struct { + // placeholder for future optional parameters } -// RoleEligibilityScheduleRequestsClientValidateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Validate +// ScopeAccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager // method. -type RoleEligibilityScheduleRequestsClientValidateOptions struct { +type ScopeAccessReviewHistoryDefinitionInstancesClientListOptions struct { // placeholder for future optional parameters } -// RoleEligibilitySchedulesClientGetOptions contains the optional parameters for the RoleEligibilitySchedulesClient.Get method. -type RoleEligibilitySchedulesClientGetOptions struct { +// ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionsClient.GetByID +// method. +type ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions struct { // placeholder for future optional parameters } -// RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.NewListForScopePager +// ScopeAccessReviewHistoryDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionsClient.NewListPager // method. -type RoleEligibilitySchedulesClientListForScopeOptions struct { - // The filter to apply on the operation. Use $filter=atScope() to return all role eligibility schedules at or above the scope. - // Use $filter=principalId eq {id} to return all role eligibility schedules at, - // above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role eligibility - // schedules for the user. Use $filter=asTarget() to return all role eligibility - // schedules created for the current user. +type ScopeAccessReviewHistoryDefinitionsClientListOptions struct { + // The filter to apply on the operation. Only standard filters on definition name and created date are supported Filter *string } -// RoleManagementPoliciesClientDeleteOptions contains the optional parameters for the RoleManagementPoliciesClient.Delete +// ScopeAccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ApplyDecisions // method. -type RoleManagementPoliciesClientDeleteOptions struct { +type ScopeAccessReviewInstanceClientApplyDecisionsOptions struct { // placeholder for future optional parameters } -// RoleManagementPoliciesClientGetOptions contains the optional parameters for the RoleManagementPoliciesClient.Get method. -type RoleManagementPoliciesClientGetOptions struct { +// ScopeAccessReviewInstanceClientRecordAllDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.RecordAllDecisions +// method. +type ScopeAccessReviewInstanceClientRecordAllDecisionsOptions struct { // placeholder for future optional parameters } -// RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.NewListForScopePager +// ScopeAccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ResetDecisions // method. -type RoleManagementPoliciesClientListForScopeOptions struct { +type ScopeAccessReviewInstanceClientResetDecisionsOptions struct { // placeholder for future optional parameters } -// RoleManagementPoliciesClientUpdateOptions contains the optional parameters for the RoleManagementPoliciesClient.Update +// ScopeAccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.SendReminders // method. -type RoleManagementPoliciesClientUpdateOptions struct { +type ScopeAccessReviewInstanceClientSendRemindersOptions struct { // placeholder for future optional parameters } -// RoleManagementPolicy - Role management policy -type RoleManagementPolicy struct { - // Role management policy properties. - Properties *RoleManagementPolicyProperties - - // READ-ONLY; The role management policy Id. - ID *string - - // READ-ONLY; The role management policy name. - Name *string - - // READ-ONLY; The role management policy type. - Type *string +// ScopeAccessReviewInstanceClientStopOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.Stop +// method. +type ScopeAccessReviewInstanceClientStopOptions struct { + // placeholder for future optional parameters } -// RoleManagementPolicyApprovalRule - The role management policy approval rule. -type RoleManagementPolicyApprovalRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType - - // The id of the rule. - ID *string - - // The approval setting - Setting *ApprovalSettings - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget +// ScopeAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the ScopeAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +type ScopeAccessReviewInstanceContactedReviewersClientListOptions struct { + // placeholder for future optional parameters } -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyApprovalRule. -func (r *RoleManagementPolicyApprovalRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } +// ScopeAccessReviewInstanceDecisionsClientListOptions contains the optional parameters for the ScopeAccessReviewInstanceDecisionsClient.NewListPager +// method. +type ScopeAccessReviewInstanceDecisionsClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string } -// RoleManagementPolicyAssignment - Role management policy -type RoleManagementPolicyAssignment struct { - // Role management policy properties. - Properties *RoleManagementPolicyAssignmentProperties - - // READ-ONLY; The role management policy Id. - ID *string - - // READ-ONLY; The role management policy name. - Name *string - - // READ-ONLY; The role management policy type. - Type *string +// ScopeAccessReviewInstancesClientCreateOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.Create +// method. +type ScopeAccessReviewInstancesClientCreateOptions struct { + // placeholder for future optional parameters } -// RoleManagementPolicyAssignmentListResult - Role management policy assignment list operation result. -type RoleManagementPolicyAssignmentListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - - // Role management policy assignment list. - Value []*RoleManagementPolicyAssignment +// ScopeAccessReviewInstancesClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.GetByID +// method. +type ScopeAccessReviewInstancesClientGetByIDOptions struct { + // placeholder for future optional parameters } -// RoleManagementPolicyAssignmentProperties - Role management policy assignment properties with scope. -type RoleManagementPolicyAssignmentProperties struct { - // The policy id role management policy assignment. - PolicyID *string - - // The role definition of management policy assignment. - RoleDefinitionID *string - - // The role management policy scope. - Scope *string - - // READ-ONLY; The readonly computed rule applied to the policy. - EffectiveRules []RoleManagementPolicyRuleClassification - - // READ-ONLY; Additional properties of scope, role definition and policy - PolicyAssignmentProperties *PolicyAssignmentProperties +// ScopeAccessReviewInstancesClientListOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.NewListPager +// method. +type ScopeAccessReviewInstancesClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string } -// RoleManagementPolicyAssignmentsClientCreateOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Create +// ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID // method. -type RoleManagementPolicyAssignmentsClientCreateOptions struct { +type ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions struct { // placeholder for future optional parameters } -// RoleManagementPolicyAssignmentsClientDeleteOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Delete +// ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.DeleteByID // method. -type RoleManagementPolicyAssignmentsClientDeleteOptions struct { +type ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions struct { // placeholder for future optional parameters } -// RoleManagementPolicyAssignmentsClientGetOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Get +// ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.GetByID // method. -type RoleManagementPolicyAssignmentsClientGetOptions struct { +type ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions struct { // placeholder for future optional parameters } -// RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.NewListForScopePager +// ScopeAccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.NewListPager // method. -type RoleManagementPolicyAssignmentsClientListForScopeOptions struct { - // placeholder for future optional parameters +type ScopeAccessReviewScheduleDefinitionsClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string } -// RoleManagementPolicyAuthenticationContextRule - The role management policy authentication context rule. -type RoleManagementPolicyAuthenticationContextRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType - - // The claim value. - ClaimValue *string - - // The id of the rule. - ID *string - - // The value indicating if rule is enabled. - IsEnabled *bool - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget +// ScopeAccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.Stop +// method. +type ScopeAccessReviewScheduleDefinitionsClientStopOptions struct { + // placeholder for future optional parameters } -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyAuthenticationContextRule. -func (r *RoleManagementPolicyAuthenticationContextRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } +// TenantLevelAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +type TenantLevelAccessReviewInstanceContactedReviewersClientListOptions struct { + // placeholder for future optional parameters } -// RoleManagementPolicyEnablementRule - The role management policy enablement rule. -type RoleManagementPolicyEnablementRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType - - // The list of enabled rules. - EnabledRules []*EnablementRules - - // The id of the rule. - ID *string - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget -} +// TooManyOwnersAssignedToResourceAlertConfigurationProperties - Too many owners assigned to resource alert configuration +// properties. +type TooManyOwnersAssignedToResourceAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyEnablementRule. -func (r *RoleManagementPolicyEnablementRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, - } -} + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool -// RoleManagementPolicyExpirationRule - The role management policy expiration rule. -type RoleManagementPolicyExpirationRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType + // The threshold number of owners. + ThresholdNumberOfOwners *int32 - // The id of the rule. - ID *string + // The threshold percentage of owners out of all role members. + ThresholdPercentageOfOwnersOutOfAllRoleMembers *int32 - // The value indicating whether expiration is required. - IsExpirationRequired *bool + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition - // The maximum duration of expiration in timespan. - MaximumDuration *string + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget + // READ-ONLY; The alert scope. + Scope *string } -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyExpirationRule. -func (r *RoleManagementPolicyExpirationRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type TooManyOwnersAssignedToResourceAlertConfigurationProperties. +func (t *TooManyOwnersAssignedToResourceAlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return &AlertConfigurationProperties{ + AlertDefinitionID: t.AlertDefinitionID, + Scope: t.Scope, + IsEnabled: t.IsEnabled, + AlertConfigurationType: t.AlertConfigurationType, + AlertDefinition: t.AlertDefinition, } } -// RoleManagementPolicyListResult - Role management policy list operation result. -type RoleManagementPolicyListResult struct { - // The URL to use for getting the next set of results. - NextLink *string - - // Role management policy list. - Value []*RoleManagementPolicy -} - -// RoleManagementPolicyNotificationRule - The role management policy notification rule. -type RoleManagementPolicyNotificationRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType - - // The id of the rule. - ID *string - - // Determines if the notification will be sent to the recipient type specified in the policy rule. - IsDefaultRecipientsEnabled *bool - - // The notification level. - NotificationLevel *NotificationLevel - - // The list of notification recipients. - NotificationRecipients []*string - - // The type of notification. - NotificationType *NotificationDeliveryMechanism +// TooManyOwnersAssignedToResourceAlertIncidentProperties - Too many owners assigned to resource alert incident properties. +type TooManyOwnersAssignedToResourceAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string - // The recipient type. - RecipientType *RecipientType + // READ-ONLY; The assignee name. + AssigneeName *string - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget + // READ-ONLY; The assignee type. + AssigneeType *string } -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyNotificationRule. -func (r *RoleManagementPolicyNotificationRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { - return &RoleManagementPolicyRule{ - ID: r.ID, - RuleType: r.RuleType, - Target: r.Target, +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type TooManyOwnersAssignedToResourceAlertIncidentProperties. +func (t *TooManyOwnersAssignedToResourceAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: t.AlertIncidentType, } } -// RoleManagementPolicyProperties - Role management policy properties with scope. -type RoleManagementPolicyProperties struct { - // The role management policy description. - Description *string - - // The role management policy display name. - DisplayName *string - - // The role management policy is default policy. - IsOrganizationDefault *bool - - // The rule applied to the policy. - Rules []RoleManagementPolicyRuleClassification +// TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties - Too many permanent owners assigned to resource alert +// configuration properties. +type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string - // The role management policy scope. - Scope *string - - // READ-ONLY; The readonly computed rule applied to the policy. - EffectiveRules []RoleManagementPolicyRuleClassification - - // READ-ONLY; The name of the entity last modified it - LastModifiedBy *Principal - - // READ-ONLY; The last modified date time. - LastModifiedDateTime *time.Time + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool - // READ-ONLY; Additional properties of scope - PolicyProperties *PolicyProperties -} + // The threshold number of permanent owners. + ThresholdNumberOfPermanentOwners *int32 -// RoleManagementPolicyRuleClassification provides polymorphic access to related types. -// Call the interface's GetRoleManagementPolicyRule() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *RoleManagementPolicyApprovalRule, *RoleManagementPolicyAuthenticationContextRule, *RoleManagementPolicyEnablementRule, -// - *RoleManagementPolicyExpirationRule, *RoleManagementPolicyNotificationRule, *RoleManagementPolicyRule -type RoleManagementPolicyRuleClassification interface { - // GetRoleManagementPolicyRule returns the RoleManagementPolicyRule content of the underlying type. - GetRoleManagementPolicyRule() *RoleManagementPolicyRule -} + // The threshold percentage of permanent owners out of all owners. + ThresholdPercentageOfPermanentOwnersOutOfAllOwners *int32 -// RoleManagementPolicyRule - The role management policy rule. -type RoleManagementPolicyRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition - // The id of the rule. - ID *string + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget + // READ-ONLY; The alert scope. + Scope *string } -// GetRoleManagementPolicyRule implements the RoleManagementPolicyRuleClassification interface for type RoleManagementPolicyRule. -func (r *RoleManagementPolicyRule) GetRoleManagementPolicyRule() *RoleManagementPolicyRule { return r } - -// RoleManagementPolicyRuleTarget - The role management policy rule target. -type RoleManagementPolicyRuleTarget struct { - // The caller of the setting. - Caller *string - - // The list of enforced settings. - EnforcedSettings []*string - - // The list of inheritable settings. - InheritableSettings []*string - - // The assignment level to which rule is applied. - Level *string - - // The type of operation. - Operations []*string - - // The list of target objects. - TargetObjects []*string +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties. +func (t *TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return &AlertConfigurationProperties{ + AlertDefinitionID: t.AlertDefinitionID, + Scope: t.Scope, + IsEnabled: t.IsEnabled, + AlertConfigurationType: t.AlertConfigurationType, + AlertDefinition: t.AlertDefinition, + } } -// UserSet - The detail of a user. -type UserSet struct { - // The description of the user. - Description *string +// TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties - Too many permanent owners assigned to resource alert +// incident properties. +type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string - // The object id of the user. - ID *string - - // The value indicating whether the user is a backup fallback approver - IsBackup *bool - - // The type of user. - UserType *UserType -} - -// ValidationResponse - Validation response -type ValidationResponse struct { - // Failed validation result details - ErrorInfo *ValidationResponseErrorInfo + // READ-ONLY; The assignee name. + AssigneeName *string - // READ-ONLY; Whether or not validation succeeded - IsValid *bool + // READ-ONLY; The assignee type. + AssigneeType *string } -// ValidationResponseErrorInfo - Failed validation result details -type ValidationResponseErrorInfo struct { - // READ-ONLY; Error code indicating why validation failed - Code *string - - // READ-ONLY; Message indicating why validation failed - Message *string +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties. +func (t *TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: t.AlertIncidentType, + } } diff --git a/sdk/resourcemanager/authorization/armauthorization/models_serde.go b/sdk/resourcemanager/authorization/armauthorization/models_serde.go index 8d74c31974b4..df2611a038f4 100644 --- a/sdk/resourcemanager/authorization/armauthorization/models_serde.go +++ b/sdk/resourcemanager/authorization/armauthorization/models_serde.go @@ -16,19 +16,18 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ApprovalSettings. -func (a ApprovalSettings) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewActorIdentity. +func (a AccessReviewActorIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "approvalMode", a.ApprovalMode) - populate(objectMap, "approvalStages", a.ApprovalStages) - populate(objectMap, "isApprovalRequired", a.IsApprovalRequired) - populate(objectMap, "isApprovalRequiredForExtension", a.IsApprovalRequiredForExtension) - populate(objectMap, "isRequestorJustificationRequired", a.IsRequestorJustificationRequired) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "principalName", a.PrincipalName) + populate(objectMap, "principalType", a.PrincipalType) + populate(objectMap, "userPrincipalName", a.UserPrincipalName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ApprovalSettings. -func (a *ApprovalSettings) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewActorIdentity. +func (a *AccessReviewActorIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -36,20 +35,17 @@ func (a *ApprovalSettings) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "approvalMode": - err = unpopulate(val, "ApprovalMode", &a.ApprovalMode) - delete(rawMsg, key) - case "approvalStages": - err = unpopulate(val, "ApprovalStages", &a.ApprovalStages) + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) delete(rawMsg, key) - case "isApprovalRequired": - err = unpopulate(val, "IsApprovalRequired", &a.IsApprovalRequired) + case "principalName": + err = unpopulate(val, "PrincipalName", &a.PrincipalName) delete(rawMsg, key) - case "isApprovalRequiredForExtension": - err = unpopulate(val, "IsApprovalRequiredForExtension", &a.IsApprovalRequiredForExtension) + case "principalType": + err = unpopulate(val, "PrincipalType", &a.PrincipalType) delete(rawMsg, key) - case "isRequestorJustificationRequired": - err = unpopulate(val, "IsRequestorJustificationRequired", &a.IsRequestorJustificationRequired) + case "userPrincipalName": + err = unpopulate(val, "UserPrincipalName", &a.UserPrincipalName) delete(rawMsg, key) } if err != nil { @@ -59,20 +55,18 @@ func (a *ApprovalSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ApprovalStage. -func (a ApprovalStage) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewContactedReviewer. +func (a AccessReviewContactedReviewer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "approvalStageTimeOutInDays", a.ApprovalStageTimeOutInDays) - populate(objectMap, "escalationApprovers", a.EscalationApprovers) - populate(objectMap, "escalationTimeInMinutes", a.EscalationTimeInMinutes) - populate(objectMap, "isApproverJustificationRequired", a.IsApproverJustificationRequired) - populate(objectMap, "isEscalationEnabled", a.IsEscalationEnabled) - populate(objectMap, "primaryApprovers", a.PrimaryApprovers) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ApprovalStage. -func (a *ApprovalStage) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewContactedReviewer. +func (a *AccessReviewContactedReviewer) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -80,23 +74,48 @@ func (a *ApprovalStage) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "approvalStageTimeOutInDays": - err = unpopulate(val, "ApprovalStageTimeOutInDays", &a.ApprovalStageTimeOutInDays) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "escalationApprovers": - err = unpopulate(val, "EscalationApprovers", &a.EscalationApprovers) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "escalationTimeInMinutes": - err = unpopulate(val, "EscalationTimeInMinutes", &a.EscalationTimeInMinutes) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "isApproverJustificationRequired": - err = unpopulate(val, "IsApproverJustificationRequired", &a.IsApproverJustificationRequired) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) - case "isEscalationEnabled": - err = unpopulate(val, "IsEscalationEnabled", &a.IsEscalationEnabled) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessReviewContactedReviewerListResult. +func (a AccessReviewContactedReviewerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewContactedReviewerListResult. +func (a *AccessReviewContactedReviewerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "primaryApprovers": - err = unpopulate(val, "PrimaryApprovers", &a.PrimaryApprovers) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { @@ -106,3265 +125,2184 @@ func (a *ApprovalStage) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ClassicAdministrator. -func (c ClassicAdministrator) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewContactedReviewerProperties. +func (a AccessReviewContactedReviewerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) + populateTimeRFC3339(objectMap, "createdDateTime", a.CreatedDateTime) + populate(objectMap, "userDisplayName", a.UserDisplayName) + populate(objectMap, "userPrincipalName", a.UserPrincipalName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministrator. -func (c *ClassicAdministrator) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewContactedReviewerProperties. +func (a *AccessReviewContactedReviewerProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &a.CreatedDateTime) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "userDisplayName": + err = unpopulate(val, "UserDisplayName", &a.UserDisplayName) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "userPrincipalName": + err = unpopulate(val, "UserPrincipalName", &a.UserPrincipalName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClassicAdministratorListResult. -func (c ClassicAdministratorListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecision. +func (a AccessReviewDecision) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministratorListResult. -func (c *ClassicAdministratorListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecision. +func (a *AccessReviewDecision) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ClassicAdministratorProperties. -func (c ClassicAdministratorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionIdentity. +func (a AccessReviewDecisionIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "emailAddress", c.EmailAddress) - populate(objectMap, "role", c.Role) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "id", a.ID) + objectMap["type"] = a.Type return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministratorProperties. -func (c *ClassicAdministratorProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionIdentity. +func (a *AccessReviewDecisionIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &c.EmailAddress) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "role": - err = unpopulate(val, "Role", &c.Role) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DenyAssignment. -func (d DenyAssignment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionInsight. +func (a AccessReviewDecisionInsight) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignment. -func (d *DenyAssignment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionInsight. +func (a *AccessReviewDecisionInsight) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &d.ID) + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &d.Name) + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &d.Properties) + a.Properties, err = unmarshalAccessReviewDecisionInsightPropertiesClassification(val) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &d.Type) + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentFilter. -func (d DenyAssignmentFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionInsightProperties. +func (a AccessReviewDecisionInsightProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) - populate(objectMap, "gdprExportPrincipalId", d.GdprExportPrincipalID) - populate(objectMap, "principalId", d.PrincipalID) + populateAny(objectMap, "insightCreatedDateTime", a.InsightCreatedDateTime) + objectMap["type"] = a.Type return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentFilter. -func (d *DenyAssignmentFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionInsightProperties. +func (a *AccessReviewDecisionInsightProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "denyAssignmentName": - err = unpopulate(val, "DenyAssignmentName", &d.DenyAssignmentName) - delete(rawMsg, key) - case "gdprExportPrincipalId": - err = unpopulate(val, "GdprExportPrincipalID", &d.GdprExportPrincipalID) + case "insightCreatedDateTime": + err = unpopulate(val, "InsightCreatedDateTime", &a.InsightCreatedDateTime) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentListResult. -func (d DenyAssignmentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionListResult. +func (a AccessReviewDecisionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentListResult. -func (d *DenyAssignmentListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionListResult. +func (a *AccessReviewDecisionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &d.Value) + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentPermission. -func (d DenyAssignmentPermission) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionPrincipalResourceMembership. +func (a AccessReviewDecisionPrincipalResourceMembership) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actions", d.Actions) - populate(objectMap, "condition", d.Condition) - populate(objectMap, "conditionVersion", d.ConditionVersion) - populate(objectMap, "dataActions", d.DataActions) - populate(objectMap, "notActions", d.NotActions) - populate(objectMap, "notDataActions", d.NotDataActions) + populate(objectMap, "membershipTypes", a.MembershipTypes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentPermission. -func (d *DenyAssignmentPermission) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionPrincipalResourceMembership. +func (a *AccessReviewDecisionPrincipalResourceMembership) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "actions": - err = unpopulate(val, "Actions", &d.Actions) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &d.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &d.ConditionVersion) - delete(rawMsg, key) - case "dataActions": - err = unpopulate(val, "DataActions", &d.DataActions) - delete(rawMsg, key) - case "notActions": - err = unpopulate(val, "NotActions", &d.NotActions) - delete(rawMsg, key) - case "notDataActions": - err = unpopulate(val, "NotDataActions", &d.NotDataActions) + case "membershipTypes": + err = unpopulate(val, "MembershipTypes", &a.MembershipTypes) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DenyAssignmentProperties. -func (d DenyAssignmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionProperties. +func (a AccessReviewDecisionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) - populate(objectMap, "description", d.Description) - populate(objectMap, "doNotApplyToChildScopes", d.DoNotApplyToChildScopes) - populate(objectMap, "excludePrincipals", d.ExcludePrincipals) - populate(objectMap, "isSystemProtected", d.IsSystemProtected) - populate(objectMap, "permissions", d.Permissions) - populate(objectMap, "principals", d.Principals) - populate(objectMap, "scope", d.Scope) + populate(objectMap, "appliedBy", a.AppliedBy) + populateTimeRFC3339(objectMap, "appliedDateTime", a.AppliedDateTime) + populate(objectMap, "applyResult", a.ApplyResult) + populate(objectMap, "decision", a.Decision) + populate(objectMap, "insights", a.Insights) + populate(objectMap, "justification", a.Justification) + populate(objectMap, "principal", a.Principal) + populate(objectMap, "principalResourceMembership", a.PrincipalResourceMembership) + populate(objectMap, "recommendation", a.Recommendation) + populate(objectMap, "resource", a.Resource) + populate(objectMap, "reviewedBy", a.ReviewedBy) + populateTimeRFC3339(objectMap, "reviewedDateTime", a.ReviewedDateTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DenyAssignmentProperties. -func (d *DenyAssignmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionProperties. +func (a *AccessReviewDecisionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "denyAssignmentName": - err = unpopulate(val, "DenyAssignmentName", &d.DenyAssignmentName) + case "appliedBy": + err = unpopulate(val, "AppliedBy", &a.AppliedBy) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) + case "appliedDateTime": + err = unpopulateTimeRFC3339(val, "AppliedDateTime", &a.AppliedDateTime) + delete(rawMsg, key) + case "applyResult": + err = unpopulate(val, "ApplyResult", &a.ApplyResult) delete(rawMsg, key) - case "doNotApplyToChildScopes": - err = unpopulate(val, "DoNotApplyToChildScopes", &d.DoNotApplyToChildScopes) + case "decision": + err = unpopulate(val, "Decision", &a.Decision) delete(rawMsg, key) - case "excludePrincipals": - err = unpopulate(val, "ExcludePrincipals", &d.ExcludePrincipals) + case "insights": + err = unpopulate(val, "Insights", &a.Insights) delete(rawMsg, key) - case "isSystemProtected": - err = unpopulate(val, "IsSystemProtected", &d.IsSystemProtected) + case "justification": + err = unpopulate(val, "Justification", &a.Justification) delete(rawMsg, key) - case "permissions": - err = unpopulate(val, "Permissions", &d.Permissions) + case "principal": + a.Principal, err = unmarshalAccessReviewDecisionIdentityClassification(val) delete(rawMsg, key) - case "principals": - err = unpopulate(val, "Principals", &d.Principals) + case "principalResourceMembership": + err = unpopulate(val, "PrincipalResourceMembership", &a.PrincipalResourceMembership) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &d.Scope) + case "recommendation": + err = unpopulate(val, "Recommendation", &a.Recommendation) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &a.Resource) + delete(rawMsg, key) + case "reviewedBy": + err = unpopulate(val, "ReviewedBy", &a.ReviewedBy) + delete(rawMsg, key) + case "reviewedDateTime": + err = unpopulateTimeRFC3339(val, "ReviewedDateTime", &a.ReviewedDateTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EligibleChildResource. -func (e EligibleChildResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionResource. +func (a AccessReviewDecisionResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "id", a.ID) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResource. -func (e *EligibleChildResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionResource. +func (a *AccessReviewDecisionResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EligibleChildResourcesListResult. -func (e EligibleChildResourcesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionServicePrincipalIdentity. +func (a AccessReviewDecisionServicePrincipalIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "appId", a.AppID) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "id", a.ID) + objectMap["type"] = DecisionTargetTypeServicePrincipal return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResourcesListResult. -func (e *EligibleChildResourcesListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionServicePrincipalIdentity. +func (a *AccessReviewDecisionServicePrincipalIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) + case "appId": + err = unpopulate(val, "AppID", &a.AppID) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionUserIdentity. +func (a AccessReviewDecisionUserIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "id", a.ID) + objectMap["type"] = DecisionTargetTypeUser + populate(objectMap, "userPrincipalName", a.UserPrincipalName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionUserIdentity. +func (a *AccessReviewDecisionUserIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "userPrincipalName": + err = unpopulate(val, "UserPrincipalName", &a.UserPrincipalName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionUserSignInInsightProperties. +func (a AccessReviewDecisionUserSignInInsightProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populateAny(objectMap, "insightCreatedDateTime", a.InsightCreatedDateTime) + populateAny(objectMap, "lastSignInDateTime", a.LastSignInDateTime) + objectMap["type"] = AccessReviewDecisionInsightTypeUserSignInInsight return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDecisionUserSignInInsightProperties. +func (a *AccessReviewDecisionUserSignInInsightProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + case "insightCreatedDateTime": + err = unpopulate(val, "InsightCreatedDateTime", &a.InsightCreatedDateTime) delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "lastSignInDateTime": + err = unpopulate(val, "LastSignInDateTime", &a.LastSignInDateTime) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDefaultSettings. +func (a AccessReviewDefaultSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewDefaultSettings. +func (a *AccessReviewDefaultSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExpandedProperties. -func (e ExpandedProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinition. +func (a AccessReviewHistoryDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principal", e.Principal) - populate(objectMap, "roleDefinition", e.RoleDefinition) - populate(objectMap, "scope", e.Scope) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedProperties. -func (e *ExpandedProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewHistoryDefinition. +func (a *AccessReviewHistoryDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "principal": - err = unpopulate(val, "Principal", &e.Principal) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "roleDefinition": - err = unpopulate(val, "RoleDefinition", &e.RoleDefinition) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &e.Scope) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesPrincipal. -func (e ExpandedPropertiesPrincipal) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinitionInstanceListResult. +func (a AccessReviewHistoryDefinitionInstanceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "email", e.Email) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesPrincipal. -func (e *ExpandedPropertiesPrincipal) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewHistoryDefinitionInstanceListResult. +func (a *AccessReviewHistoryDefinitionInstanceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) - delete(rawMsg, key) - case "email": - err = unpopulate(val, "Email", &e.Email) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesRoleDefinition. -func (e ExpandedPropertiesRoleDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinitionListResult. +func (a AccessReviewHistoryDefinitionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesRoleDefinition. -func (e *ExpandedPropertiesRoleDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewHistoryDefinitionListResult. +func (a *AccessReviewHistoryDefinitionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExpandedPropertiesScope. -func (e ExpandedPropertiesScope) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinitionProperties. +func (a AccessReviewHistoryDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) + populate(objectMap, "createdBy", a.CreatedBy) + populateTimeRFC3339(objectMap, "createdDateTime", a.CreatedDateTime) + populate(objectMap, "decisions", a.Decisions) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "instances", a.Instances) + populateTimeRFC3339(objectMap, "reviewHistoryPeriodEndDateTime", a.ReviewHistoryPeriodEndDateTime) + populateTimeRFC3339(objectMap, "reviewHistoryPeriodStartDateTime", a.ReviewHistoryPeriodStartDateTime) + populate(objectMap, "scopes", a.Scopes) + populate(objectMap, "settings", a.Settings) + populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExpandedPropertiesScope. -func (e *ExpandedPropertiesScope) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewHistoryDefinitionProperties. +func (a *AccessReviewHistoryDefinitionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { + case "createdBy": + err = unpopulate(val, "CreatedBy", &a.CreatedBy) + delete(rawMsg, key) + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &a.CreatedDateTime) + delete(rawMsg, key) + case "decisions": + err = unpopulate(val, "Decisions", &a.Decisions) + delete(rawMsg, key) case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) + case "instances": + err = unpopulate(val, "Instances", &a.Instances) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "reviewHistoryPeriodEndDateTime": + err = unpopulateTimeRFC3339(val, "ReviewHistoryPeriodEndDateTime", &a.ReviewHistoryPeriodEndDateTime) + delete(rawMsg, key) + case "reviewHistoryPeriodStartDateTime": + err = unpopulateTimeRFC3339(val, "ReviewHistoryPeriodStartDateTime", &a.ReviewHistoryPeriodStartDateTime) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &a.Scopes) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &a.Settings) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Permission. -func (p Permission) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryInstance. +func (a AccessReviewHistoryInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actions", p.Actions) - populate(objectMap, "dataActions", p.DataActions) - populate(objectMap, "notActions", p.NotActions) - populate(objectMap, "notDataActions", p.NotDataActions) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Permission. -func (p *Permission) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewHistoryInstance. +func (a *AccessReviewHistoryInstance) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "actions": - err = unpopulate(val, "Actions", &p.Actions) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "dataActions": - err = unpopulate(val, "DataActions", &p.DataActions) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "notActions": - err = unpopulate(val, "NotActions", &p.NotActions) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "notDataActions": - err = unpopulate(val, "NotDataActions", &p.NotDataActions) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PermissionGetResult. -func (p PermissionGetResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryInstanceProperties. +func (a AccessReviewHistoryInstanceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "downloadUri", a.DownloadURI) + populateTimeRFC3339(objectMap, "expiration", a.Expiration) + populateTimeRFC3339(objectMap, "fulfilledDateTime", a.FulfilledDateTime) + populateTimeRFC3339(objectMap, "reviewHistoryPeriodEndDateTime", a.ReviewHistoryPeriodEndDateTime) + populateTimeRFC3339(objectMap, "reviewHistoryPeriodStartDateTime", a.ReviewHistoryPeriodStartDateTime) + populateTimeRFC3339(objectMap, "runDateTime", a.RunDateTime) + populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PermissionGetResult. -func (p *PermissionGetResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewHistoryInstanceProperties. +func (a *AccessReviewHistoryInstanceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "downloadUri": + err = unpopulate(val, "DownloadURI", &a.DownloadURI) + delete(rawMsg, key) + case "expiration": + err = unpopulateTimeRFC3339(val, "Expiration", &a.Expiration) + delete(rawMsg, key) + case "fulfilledDateTime": + err = unpopulateTimeRFC3339(val, "FulfilledDateTime", &a.FulfilledDateTime) + delete(rawMsg, key) + case "reviewHistoryPeriodEndDateTime": + err = unpopulateTimeRFC3339(val, "ReviewHistoryPeriodEndDateTime", &a.ReviewHistoryPeriodEndDateTime) + delete(rawMsg, key) + case "reviewHistoryPeriodStartDateTime": + err = unpopulateTimeRFC3339(val, "ReviewHistoryPeriodStartDateTime", &a.ReviewHistoryPeriodStartDateTime) + delete(rawMsg, key) + case "runDateTime": + err = unpopulateTimeRFC3339(val, "RunDateTime", &a.RunDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentProperties. -func (p PolicyAssignmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryScheduleSettings. +func (a AccessReviewHistoryScheduleSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "policy", p.Policy) - populate(objectMap, "roleDefinition", p.RoleDefinition) - populate(objectMap, "scope", p.Scope) + populate(objectMap, "pattern", a.Pattern) + populate(objectMap, "range", a.Range) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentProperties. -func (p *PolicyAssignmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewHistoryScheduleSettings. +func (a *AccessReviewHistoryScheduleSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "policy": - err = unpopulate(val, "Policy", &p.Policy) + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) delete(rawMsg, key) - case "roleDefinition": - err = unpopulate(val, "RoleDefinition", &p.RoleDefinition) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &p.Scope) + case "range": + err = unpopulate(val, "Range", &a.Range) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesPolicy. -func (p PolicyAssignmentPropertiesPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewInstance. +func (a AccessReviewInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populateTimeRFC3339(objectMap, "lastModifiedDateTime", p.LastModifiedDateTime) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesPolicy. -func (p *PolicyAssignmentPropertiesPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewInstance. +func (a *AccessReviewInstance) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "lastModifiedDateTime": - err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &p.LastModifiedDateTime) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesRoleDefinition. -func (p PolicyAssignmentPropertiesRoleDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewInstanceListResult. +func (a AccessReviewInstanceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesRoleDefinition. -func (p *PolicyAssignmentPropertiesRoleDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewInstanceListResult. +func (a *AccessReviewInstanceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyAssignmentPropertiesScope. -func (p PolicyAssignmentPropertiesScope) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewInstanceProperties. +func (a AccessReviewInstanceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) + populate(objectMap, "backupReviewers", a.BackupReviewers) + populateTimeRFC3339(objectMap, "endDateTime", a.EndDateTime) + populate(objectMap, "reviewers", a.Reviewers) + populate(objectMap, "reviewersType", a.ReviewersType) + populateTimeRFC3339(objectMap, "startDateTime", a.StartDateTime) + populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyAssignmentPropertiesScope. -func (p *PolicyAssignmentPropertiesScope) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewInstanceProperties. +func (a *AccessReviewInstanceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) + case "backupReviewers": + err = unpopulate(val, "BackupReviewers", &a.BackupReviewers) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "endDateTime": + err = unpopulateTimeRFC3339(val, "EndDateTime", &a.EndDateTime) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "reviewers": + err = unpopulate(val, "Reviewers", &a.Reviewers) + delete(rawMsg, key) + case "reviewersType": + err = unpopulate(val, "ReviewersType", &a.ReviewersType) + delete(rawMsg, key) + case "startDateTime": + err = unpopulateTimeRFC3339(val, "StartDateTime", &a.StartDateTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyProperties. -func (p PolicyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewRecurrencePattern. +func (a AccessReviewRecurrencePattern) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "scope", p.Scope) + populate(objectMap, "interval", a.Interval) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyProperties. -func (p *PolicyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewRecurrencePattern. +func (a *AccessReviewRecurrencePattern) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "scope": - err = unpopulate(val, "Scope", &p.Scope) + case "interval": + err = unpopulate(val, "Interval", &a.Interval) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyPropertiesScope. -func (p PolicyPropertiesScope) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewRecurrenceRange. +func (a AccessReviewRecurrenceRange) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) + populateTimeRFC3339(objectMap, "endDate", a.EndDate) + populate(objectMap, "numberOfOccurrences", a.NumberOfOccurrences) + populateTimeRFC3339(objectMap, "startDate", a.StartDate) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyPropertiesScope. -func (p *PolicyPropertiesScope) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewRecurrenceRange. +func (a *AccessReviewRecurrenceRange) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &a.EndDate) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "numberOfOccurrences": + err = unpopulate(val, "NumberOfOccurrences", &a.NumberOfOccurrences) + delete(rawMsg, key) + case "startDate": + err = unpopulateTimeRFC3339(val, "StartDate", &a.StartDate) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Principal. -func (p Principal) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewRecurrenceSettings. +func (a AccessReviewRecurrenceSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "email", p.Email) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) + populate(objectMap, "pattern", a.Pattern) + populate(objectMap, "range", a.Range) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Principal. -func (p *Principal) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewRecurrenceSettings. +func (a *AccessReviewRecurrenceSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "email": - err = unpopulate(val, "Email", &p.Email) + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "range": + err = unpopulate(val, "Range", &a.Range) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProviderOperation. -func (p ProviderOperation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewReviewer. +func (a AccessReviewReviewer) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "isDataAction", p.IsDataAction) - populate(objectMap, "name", p.Name) - populate(objectMap, "origin", p.Origin) - populateAny(objectMap, "properties", p.Properties) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "principalType", a.PrincipalType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperation. -func (p *ProviderOperation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewReviewer. +func (a *AccessReviewReviewer) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &p.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &p.Origin) + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "principalType": + err = unpopulate(val, "PrincipalType", &a.PrincipalType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProviderOperationsMetadata. -func (p ProviderOperationsMetadata) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleDefinition. +func (a AccessReviewScheduleDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "operations", p.Operations) - populate(objectMap, "resourceTypes", p.ResourceTypes) - populate(objectMap, "type", p.Type) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperationsMetadata. -func (p *ProviderOperationsMetadata) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewScheduleDefinition. +func (a *AccessReviewScheduleDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &p.Operations) + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "resourceTypes": - err = unpopulate(val, "ResourceTypes", &p.ResourceTypes) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ProviderOperationsMetadataListResult. -func (p ProviderOperationsMetadataListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleDefinitionListResult. +func (a AccessReviewScheduleDefinitionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderOperationsMetadataListResult. -func (p *ProviderOperationsMetadataListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewScheduleDefinitionListResult. +func (a *AccessReviewScheduleDefinitionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &p.Value) + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceType. -func (r ResourceType) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleDefinitionProperties. +func (a AccessReviewScheduleDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", r.DisplayName) - populate(objectMap, "name", r.Name) - populate(objectMap, "operations", r.Operations) + populate(objectMap, "backupReviewers", a.BackupReviewers) + populate(objectMap, "createdBy", a.CreatedBy) + populate(objectMap, "descriptionForAdmins", a.DescriptionForAdmins) + populate(objectMap, "descriptionForReviewers", a.DescriptionForReviewers) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "instances", a.Instances) + populate(objectMap, "reviewers", a.Reviewers) + populate(objectMap, "reviewersType", a.ReviewersType) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "settings", a.Settings) + populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceType. -func (r *ResourceType) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewScheduleDefinitionProperties. +func (a *AccessReviewScheduleDefinitionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &r.DisplayName) + case "backupReviewers": + err = unpopulate(val, "BackupReviewers", &a.BackupReviewers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "createdBy": + err = unpopulate(val, "CreatedBy", &a.CreatedBy) delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &r.Operations) + case "descriptionForAdmins": + err = unpopulate(val, "DescriptionForAdmins", &a.DescriptionForAdmins) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignment. -func (r RoleAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignment. -func (r *RoleAssignment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "descriptionForReviewers": + err = unpopulate(val, "DescriptionForReviewers", &a.DescriptionForReviewers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "instances": + err = unpopulate(val, "Instances", &a.Instances) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "reviewers": + err = unpopulate(val, "Reviewers", &a.Reviewers) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentCreateParameters. -func (r RoleAssignmentCreateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", r.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentCreateParameters. -func (r *RoleAssignmentCreateParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "reviewersType": + err = unpopulate(val, "ReviewersType", &a.ReviewersType) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentFilter. -func (r RoleAssignmentFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentFilter. -func (r *RoleAssignmentFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentListResult. -func (r RoleAssignmentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentListResult. -func (r *RoleAssignmentListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "settings": + err = unpopulate(val, "Settings", &a.Settings) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentProperties. -func (r RoleAssignmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleSettings. +func (a AccessReviewScheduleSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdBy", r.CreatedBy) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populate(objectMap, "delegatedManagedIdentityResourceId", r.DelegatedManagedIdentityResourceID) - populate(objectMap, "description", r.Description) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) - populate(objectMap, "updatedBy", r.UpdatedBy) - populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) + populate(objectMap, "autoApplyDecisionsEnabled", a.AutoApplyDecisionsEnabled) + populate(objectMap, "defaultDecision", a.DefaultDecision) + populate(objectMap, "defaultDecisionEnabled", a.DefaultDecisionEnabled) + populate(objectMap, "instanceDurationInDays", a.InstanceDurationInDays) + populate(objectMap, "justificationRequiredOnApproval", a.JustificationRequiredOnApproval) + populate(objectMap, "mailNotificationsEnabled", a.MailNotificationsEnabled) + populate(objectMap, "recommendationLookBackDuration", a.RecommendationLookBackDuration) + populate(objectMap, "recommendationsEnabled", a.RecommendationsEnabled) + populate(objectMap, "recurrence", a.Recurrence) + populate(objectMap, "reminderNotificationsEnabled", a.ReminderNotificationsEnabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentProperties. -func (r *RoleAssignmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewScheduleSettings. +func (a *AccessReviewScheduleSettings) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) + case "autoApplyDecisionsEnabled": + err = unpopulate(val, "AutoApplyDecisionsEnabled", &a.AutoApplyDecisionsEnabled) delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + case "defaultDecision": + err = unpopulate(val, "DefaultDecision", &a.DefaultDecision) delete(rawMsg, key) - case "delegatedManagedIdentityResourceId": - err = unpopulate(val, "DelegatedManagedIdentityResourceID", &r.DelegatedManagedIdentityResourceID) + case "defaultDecisionEnabled": + err = unpopulate(val, "DefaultDecisionEnabled", &a.DefaultDecisionEnabled) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &r.Description) + case "instanceDurationInDays": + err = unpopulate(val, "InstanceDurationInDays", &a.InstanceDurationInDays) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) + case "justificationRequiredOnApproval": + err = unpopulate(val, "JustificationRequiredOnApproval", &a.JustificationRequiredOnApproval) delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) + case "mailNotificationsEnabled": + err = unpopulate(val, "MailNotificationsEnabled", &a.MailNotificationsEnabled) delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + case "recommendationLookBackDuration": + err = unpopulate(val, "RecommendationLookBackDuration", &a.RecommendationLookBackDuration) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) + case "recommendationsEnabled": + err = unpopulate(val, "RecommendationsEnabled", &a.RecommendationsEnabled) delete(rawMsg, key) - case "updatedBy": - err = unpopulate(val, "UpdatedBy", &r.UpdatedBy) + case "recurrence": + err = unpopulate(val, "Recurrence", &a.Recurrence) delete(rawMsg, key) - case "updatedOn": - err = unpopulateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) + case "reminderNotificationsEnabled": + err = unpopulate(val, "ReminderNotificationsEnabled", &a.ReminderNotificationsEnabled) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentSchedule. -func (r RoleAssignmentSchedule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScope. +func (a AccessReviewScope) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "assignmentState", a.AssignmentState) + populate(objectMap, "excludeResourceId", a.ExcludeResourceID) + populate(objectMap, "excludeRoleDefinitionId", a.ExcludeRoleDefinitionID) + populate(objectMap, "expandNestedMemberships", a.ExpandNestedMemberships) + populate(objectMap, "inactiveDuration", a.InactiveDuration) + populate(objectMap, "includeAccessBelowResource", a.IncludeAccessBelowResource) + populate(objectMap, "includeInheritedAccess", a.IncludeInheritedAccess) + populate(objectMap, "principalType", a.PrincipalType) + populate(objectMap, "resourceId", a.ResourceID) + populate(objectMap, "roleDefinitionId", a.RoleDefinitionID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentSchedule. -func (r *RoleAssignmentSchedule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewScope. +func (a *AccessReviewScope) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "assignmentState": + err = unpopulate(val, "AssignmentState", &a.AssignmentState) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "excludeResourceId": + err = unpopulate(val, "ExcludeResourceID", &a.ExcludeResourceID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "excludeRoleDefinitionId": + err = unpopulate(val, "ExcludeRoleDefinitionID", &a.ExcludeRoleDefinitionID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "expandNestedMemberships": + err = unpopulate(val, "ExpandNestedMemberships", &a.ExpandNestedMemberships) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleFilter. -func (r RoleAssignmentScheduleFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleFilter. -func (r *RoleAssignmentScheduleFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) + case "inactiveDuration": + err = unpopulate(val, "InactiveDuration", &a.InactiveDuration) delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + case "includeAccessBelowResource": + err = unpopulate(val, "IncludeAccessBelowResource", &a.IncludeAccessBelowResource) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + case "includeInheritedAccess": + err = unpopulate(val, "IncludeInheritedAccess", &a.IncludeInheritedAccess) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &a.PrincipalType) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) + delete(rawMsg, key) + case "roleDefinitionId": + err = unpopulate(val, "RoleDefinitionID", &a.RoleDefinitionID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstance. -func (r RoleAssignmentScheduleInstance) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Alert. +func (a Alert) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstance. -func (r *RoleAssignmentScheduleInstance) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Alert. +func (a *Alert) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &r.ID) + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &r.Properties) + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceFilter. -func (r RoleAssignmentScheduleInstanceFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleAssignmentScheduleId", r.RoleAssignmentScheduleID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceFilter. -func (r *RoleAssignmentScheduleInstanceFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "roleAssignmentScheduleId": - err = unpopulate(val, "RoleAssignmentScheduleID", &r.RoleAssignmentScheduleID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceListResult. -func (r RoleAssignmentScheduleInstanceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceListResult. -func (r *RoleAssignmentScheduleInstanceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleInstanceProperties. -func (r RoleAssignmentScheduleInstanceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertConfiguration. +func (a AlertConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assignmentType", r.AssignmentType) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) - populate(objectMap, "linkedRoleEligibilityScheduleInstanceId", r.LinkedRoleEligibilityScheduleInstanceID) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "originRoleAssignmentId", r.OriginRoleAssignmentID) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleAssignmentScheduleId", r.RoleAssignmentScheduleID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleInstanceProperties. -func (r *RoleAssignmentScheduleInstanceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertConfiguration. +func (a *AlertConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "assignmentType": - err = unpopulate(val, "AssignmentType", &r.AssignmentType) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleInstanceId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleInstanceID", &r.LinkedRoleEligibilityScheduleInstanceID) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "originRoleAssignmentId": - err = unpopulate(val, "OriginRoleAssignmentID", &r.OriginRoleAssignmentID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleAssignmentScheduleId": - err = unpopulate(val, "RoleAssignmentScheduleID", &r.RoleAssignmentScheduleID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + case "properties": + a.Properties, err = unmarshalAlertConfigurationPropertiesClassification(val) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleListResult. -func (r RoleAssignmentScheduleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleListResult. -func (r *RoleAssignmentScheduleListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleProperties. -func (r RoleAssignmentScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assignmentType", r.AssignmentType) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleAssignmentScheduleRequestId", r.RoleAssignmentScheduleRequestID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) - populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleProperties. -func (r *RoleAssignmentScheduleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assignmentType": - err = unpopulate(val, "AssignmentType", &r.AssignmentType) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleAssignmentScheduleRequestId": - err = unpopulate(val, "RoleAssignmentScheduleRequestID", &r.RoleAssignmentScheduleRequestID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "updatedOn": - err = unpopulateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequest. -func (r RoleAssignmentScheduleRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequest. -func (r *RoleAssignmentScheduleRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestFilter. -func (r RoleAssignmentScheduleRequestFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestFilter. -func (r *RoleAssignmentScheduleRequestFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestListResult. -func (r RoleAssignmentScheduleRequestListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestListResult. -func (r *RoleAssignmentScheduleRequestListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestProperties. -func (r RoleAssignmentScheduleRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "approvalId", r.ApprovalID) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "justification", r.Justification) - populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "requestType", r.RequestType) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scheduleInfo", r.ScheduleInfo) - populate(objectMap, "scope", r.Scope) - populate(objectMap, "status", r.Status) - populate(objectMap, "targetRoleAssignmentScheduleId", r.TargetRoleAssignmentScheduleID) - populate(objectMap, "targetRoleAssignmentScheduleInstanceId", r.TargetRoleAssignmentScheduleInstanceID) - populate(objectMap, "ticketInfo", r.TicketInfo) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestProperties. -func (r *RoleAssignmentScheduleRequestProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "approvalId": - err = unpopulate(val, "ApprovalID", &r.ApprovalID) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "justification": - err = unpopulate(val, "Justification", &r.Justification) - delete(rawMsg, key) - case "linkedRoleEligibilityScheduleId": - err = unpopulate(val, "LinkedRoleEligibilityScheduleID", &r.LinkedRoleEligibilityScheduleID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "requestType": - err = unpopulate(val, "RequestType", &r.RequestType) - delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "scheduleInfo": - err = unpopulate(val, "ScheduleInfo", &r.ScheduleInfo) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "targetRoleAssignmentScheduleId": - err = unpopulate(val, "TargetRoleAssignmentScheduleID", &r.TargetRoleAssignmentScheduleID) - delete(rawMsg, key) - case "targetRoleAssignmentScheduleInstanceId": - err = unpopulate(val, "TargetRoleAssignmentScheduleInstanceID", &r.TargetRoleAssignmentScheduleInstanceID) - delete(rawMsg, key) - case "ticketInfo": - err = unpopulate(val, "TicketInfo", &r.TicketInfo) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. -func (r RoleAssignmentScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "expiration", r.Expiration) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfo. -func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expiration": - err = unpopulate(val, "Expiration", &r.Expiration) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. -func (r RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "duration", r.Duration) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration. -func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, "Duration", &r.Duration) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. -func (r RoleAssignmentScheduleRequestPropertiesTicketInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ticketNumber", r.TicketNumber) - populate(objectMap, "ticketSystem", r.TicketSystem) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleAssignmentScheduleRequestPropertiesTicketInfo. -func (r *RoleAssignmentScheduleRequestPropertiesTicketInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ticketNumber": - err = unpopulate(val, "TicketNumber", &r.TicketNumber) - delete(rawMsg, key) - case "ticketSystem": - err = unpopulate(val, "TicketSystem", &r.TicketSystem) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinition. -func (r RoleDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinition. -func (r *RoleDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionFilter. -func (r RoleDefinitionFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "roleName", r.RoleName) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionFilter. -func (r *RoleDefinitionFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "roleName": - err = unpopulate(val, "RoleName", &r.RoleName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionListResult. -func (r RoleDefinitionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionListResult. -func (r *RoleDefinitionListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleDefinitionProperties. -func (r RoleDefinitionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assignableScopes", r.AssignableScopes) - populate(objectMap, "description", r.Description) - populate(objectMap, "permissions", r.Permissions) - populate(objectMap, "roleName", r.RoleName) - populate(objectMap, "type", r.RoleType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleDefinitionProperties. -func (r *RoleDefinitionProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assignableScopes": - err = unpopulate(val, "AssignableScopes", &r.AssignableScopes) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "permissions": - err = unpopulate(val, "Permissions", &r.Permissions) - delete(rawMsg, key) - case "roleName": - err = unpopulate(val, "RoleName", &r.RoleName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "RoleType", &r.RoleType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilitySchedule. -func (r RoleEligibilitySchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilitySchedule. -func (r *RoleEligibilitySchedule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleFilter. -func (r RoleEligibilityScheduleFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleFilter. -func (r *RoleEligibilityScheduleFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstance. -func (r RoleEligibilityScheduleInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstance. -func (r *RoleEligibilityScheduleInstance) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceFilter. -func (r RoleEligibilityScheduleInstanceFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "roleEligibilityScheduleId", r.RoleEligibilityScheduleID) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceFilter. -func (r *RoleEligibilityScheduleInstanceFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "roleEligibilityScheduleId": - err = unpopulate(val, "RoleEligibilityScheduleID", &r.RoleEligibilityScheduleID) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceListResult. -func (r RoleEligibilityScheduleInstanceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceListResult. -func (r *RoleEligibilityScheduleInstanceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleInstanceProperties. -func (r RoleEligibilityScheduleInstanceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "roleEligibilityScheduleId", r.RoleEligibilityScheduleID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleInstanceProperties. -func (r *RoleEligibilityScheduleInstanceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "roleEligibilityScheduleId": - err = unpopulate(val, "RoleEligibilityScheduleID", &r.RoleEligibilityScheduleID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleListResult. -func (r RoleEligibilityScheduleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleListResult. -func (r *RoleEligibilityScheduleListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleProperties. -func (r RoleEligibilityScheduleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "memberType", r.MemberType) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "roleEligibilityScheduleRequestId", r.RoleEligibilityScheduleRequestID) - populate(objectMap, "scope", r.Scope) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) - populate(objectMap, "status", r.Status) - populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleProperties. -func (r *RoleEligibilityScheduleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "memberType": - err = unpopulate(val, "MemberType", &r.MemberType) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) - delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) - delete(rawMsg, key) - case "roleEligibilityScheduleRequestId": - err = unpopulate(val, "RoleEligibilityScheduleRequestID", &r.RoleEligibilityScheduleRequestID) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertConfigurationListResult. +func (a AlertConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertConfigurationListResult. +func (a *AlertConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "updatedOn": - err = unpopulateTimeRFC3339(val, "UpdatedOn", &r.UpdatedOn) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequest. -func (r RoleEligibilityScheduleRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertConfigurationProperties. +func (a AlertConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + objectMap["alertConfigurationType"] = a.AlertConfigurationType + populate(objectMap, "alertDefinition", a.AlertDefinition) + populate(objectMap, "alertDefinitionId", a.AlertDefinitionID) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "scope", a.Scope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequest. -func (r *RoleEligibilityScheduleRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertConfigurationProperties. +func (a *AlertConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &a.AlertConfigurationType) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &a.AlertDefinition) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "alertDefinitionId": + err = unpopulate(val, "AlertDefinitionID", &a.AlertDefinitionID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestFilter. -func (r RoleEligibilityScheduleRequestFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertDefinition. +func (a AlertDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestFilter. -func (r *RoleEligibilityScheduleRequestFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertDefinition. +func (a *AlertDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestListResult. -func (r RoleEligibilityScheduleRequestListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertDefinitionListResult. +func (a AlertDefinitionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestListResult. -func (r *RoleEligibilityScheduleRequestListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertDefinitionListResult. +func (a *AlertDefinitionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &r.Value) + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestProperties. -func (r RoleEligibilityScheduleRequestProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertDefinitionProperties. +func (a AlertDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "approvalId", r.ApprovalID) - populate(objectMap, "condition", r.Condition) - populate(objectMap, "conditionVersion", r.ConditionVersion) - populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) - populate(objectMap, "expandedProperties", r.ExpandedProperties) - populate(objectMap, "justification", r.Justification) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "principalType", r.PrincipalType) - populate(objectMap, "requestType", r.RequestType) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scheduleInfo", r.ScheduleInfo) - populate(objectMap, "scope", r.Scope) - populate(objectMap, "status", r.Status) - populate(objectMap, "targetRoleEligibilityScheduleId", r.TargetRoleEligibilityScheduleID) - populate(objectMap, "targetRoleEligibilityScheduleInstanceId", r.TargetRoleEligibilityScheduleInstanceID) - populate(objectMap, "ticketInfo", r.TicketInfo) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "howToPrevent", a.HowToPrevent) + populate(objectMap, "isConfigurable", a.IsConfigurable) + populate(objectMap, "isRemediatable", a.IsRemediatable) + populate(objectMap, "mitigationSteps", a.MitigationSteps) + populate(objectMap, "scope", a.Scope) + populate(objectMap, "securityImpact", a.SecurityImpact) + populate(objectMap, "severityLevel", a.SeverityLevel) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestProperties. -func (r *RoleEligibilityScheduleRequestProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertDefinitionProperties. +func (a *AlertDefinitionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "approvalId": - err = unpopulate(val, "ApprovalID", &r.ApprovalID) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &r.Condition) - delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) - delete(rawMsg, key) - case "expandedProperties": - err = unpopulate(val, "ExpandedProperties", &r.ExpandedProperties) - delete(rawMsg, key) - case "justification": - err = unpopulate(val, "Justification", &r.Justification) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) + case "description": + err = unpopulate(val, "Description", &a.Description) delete(rawMsg, key) - case "principalType": - err = unpopulate(val, "PrincipalType", &r.PrincipalType) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "requestType": - err = unpopulate(val, "RequestType", &r.RequestType) + case "howToPrevent": + err = unpopulate(val, "HowToPrevent", &a.HowToPrevent) delete(rawMsg, key) - case "requestorId": - err = unpopulate(val, "RequestorID", &r.RequestorID) + case "isConfigurable": + err = unpopulate(val, "IsConfigurable", &a.IsConfigurable) delete(rawMsg, key) - case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + case "isRemediatable": + err = unpopulate(val, "IsRemediatable", &a.IsRemediatable) delete(rawMsg, key) - case "scheduleInfo": - err = unpopulate(val, "ScheduleInfo", &r.ScheduleInfo) + case "mitigationSteps": + err = unpopulate(val, "MitigationSteps", &a.MitigationSteps) delete(rawMsg, key) case "scope": - err = unpopulate(val, "Scope", &r.Scope) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) + err = unpopulate(val, "Scope", &a.Scope) delete(rawMsg, key) - case "targetRoleEligibilityScheduleId": - err = unpopulate(val, "TargetRoleEligibilityScheduleID", &r.TargetRoleEligibilityScheduleID) + case "securityImpact": + err = unpopulate(val, "SecurityImpact", &a.SecurityImpact) delete(rawMsg, key) - case "targetRoleEligibilityScheduleInstanceId": - err = unpopulate(val, "TargetRoleEligibilityScheduleInstanceID", &r.TargetRoleEligibilityScheduleInstanceID) - delete(rawMsg, key) - case "ticketInfo": - err = unpopulate(val, "TicketInfo", &r.TicketInfo) + case "severityLevel": + err = unpopulate(val, "SeverityLevel", &a.SeverityLevel) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfo. -func (r RoleEligibilityScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertIncident. +func (a AlertIncident) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "expiration", r.Expiration) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfo. -func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertIncident. +func (a *AlertIncident) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "expiration": - err = unpopulate(val, "Expiration", &r.Expiration) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &r.StartDateTime) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + a.Properties, err = unmarshalAlertIncidentPropertiesClassification(val) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration. -func (r RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertIncidentListResult. +func (a AlertIncidentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "duration", r.Duration) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "type", r.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration. -func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertIncidentListResult. +func (a *AlertIncidentListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "duration": - err = unpopulate(val, "Duration", &r.Duration) - delete(rawMsg, key) - case "endDateTime": - err = unpopulateTimeRFC3339(val, "EndDateTime", &r.EndDateTime) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleEligibilityScheduleRequestPropertiesTicketInfo. -func (r RoleEligibilityScheduleRequestPropertiesTicketInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertIncidentProperties. +func (a AlertIncidentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ticketNumber", r.TicketNumber) - populate(objectMap, "ticketSystem", r.TicketSystem) + objectMap["alertIncidentType"] = a.AlertIncidentType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleEligibilityScheduleRequestPropertiesTicketInfo. -func (r *RoleEligibilityScheduleRequestPropertiesTicketInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertIncidentProperties. +func (a *AlertIncidentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "ticketNumber": - err = unpopulate(val, "TicketNumber", &r.TicketNumber) - delete(rawMsg, key) - case "ticketSystem": - err = unpopulate(val, "TicketSystem", &r.TicketSystem) + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &a.AlertIncidentType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicy. -func (r RoleManagementPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertListResult. +func (a AlertListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicy. -func (r *RoleManagementPolicy) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertListResult. +func (a *AlertListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyApprovalRule. -func (r RoleManagementPolicyApprovalRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertOperationResult. +func (a AlertOperationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule - populate(objectMap, "setting", r.Setting) - populate(objectMap, "target", r.Target) + populateTimeRFC3339(objectMap, "createdDateTime", a.CreatedDateTime) + populate(objectMap, "id", a.ID) + populateTimeRFC3339(objectMap, "lastActionDateTime", a.LastActionDateTime) + populate(objectMap, "resourceLocation", a.ResourceLocation) + populate(objectMap, "status", a.Status) + populate(objectMap, "statusDetail", a.StatusDetail) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyApprovalRule. -func (r *RoleManagementPolicyApprovalRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertOperationResult. +func (a *AlertOperationResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &a.CreatedDateTime) + delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &r.ID) + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "lastActionDateTime": + err = unpopulateTimeRFC3339(val, "LastActionDateTime", &a.LastActionDateTime) delete(rawMsg, key) - case "setting": - err = unpopulate(val, "Setting", &r.Setting) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &a.ResourceLocation) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "statusDetail": + err = unpopulate(val, "StatusDetail", &a.StatusDetail) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignment. -func (r RoleManagementPolicyAssignment) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertProperties. +func (a AlertProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) + populate(objectMap, "alertConfiguration", a.AlertConfiguration) + populate(objectMap, "alertDefinition", a.AlertDefinition) + populate(objectMap, "alertIncidents", a.AlertIncidents) + populate(objectMap, "incidentCount", a.IncidentCount) + populate(objectMap, "isActive", a.IsActive) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", a.LastModifiedDateTime) + populateTimeRFC3339(objectMap, "lastScannedDateTime", a.LastScannedDateTime) + populate(objectMap, "scope", a.Scope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignment. -func (r *RoleManagementPolicyAssignment) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties. +func (a *AlertProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "alertConfiguration": + err = unpopulate(val, "AlertConfiguration", &a.AlertConfiguration) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &a.AlertDefinition) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) + case "alertIncidents": + err = unpopulate(val, "AlertIncidents", &a.AlertIncidents) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + case "incidentCount": + err = unpopulate(val, "IncidentCount", &a.IncidentCount) + delete(rawMsg, key) + case "isActive": + err = unpopulate(val, "IsActive", &a.IsActive) + delete(rawMsg, key) + case "lastModifiedDateTime": + err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &a.LastModifiedDateTime) + delete(rawMsg, key) + case "lastScannedDateTime": + err = unpopulateTimeRFC3339(val, "LastScannedDateTime", &a.LastScannedDateTime) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignmentListResult. -func (r RoleManagementPolicyAssignmentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureRolesAssignedOutsidePimAlertConfigurationProperties. +func (a AzureRolesAssignedOutsidePimAlertConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + objectMap["alertConfigurationType"] = "AzureRolesAssignedOutsidePimAlertConfiguration" + populate(objectMap, "alertDefinition", a.AlertDefinition) + populate(objectMap, "alertDefinitionId", a.AlertDefinitionID) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "scope", a.Scope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignmentListResult. -func (r *RoleManagementPolicyAssignmentListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureRolesAssignedOutsidePimAlertConfigurationProperties. +func (a *AzureRolesAssignedOutsidePimAlertConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &a.AlertConfigurationType) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &a.AlertDefinition) + delete(rawMsg, key) + case "alertDefinitionId": + err = unpopulate(val, "AlertDefinitionID", &a.AlertDefinitionID) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignmentProperties. -func (r RoleManagementPolicyAssignmentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureRolesAssignedOutsidePimAlertIncidentProperties. +func (a AzureRolesAssignedOutsidePimAlertIncidentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "effectiveRules", r.EffectiveRules) - populate(objectMap, "policyAssignmentProperties", r.PolicyAssignmentProperties) - populate(objectMap, "policyId", r.PolicyID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "scope", r.Scope) + objectMap["alertIncidentType"] = "AzureRolesAssignedOutsidePimAlertIncident" + populate(objectMap, "assigneeDisplayName", a.AssigneeDisplayName) + populate(objectMap, "assigneeId", a.AssigneeID) + populate(objectMap, "assigneeUserPrincipalName", a.AssigneeUserPrincipalName) + populateTimeRFC3339(objectMap, "assignmentActivatedDate", a.AssignmentActivatedDate) + populate(objectMap, "requestorDisplayName", a.RequestorDisplayName) + populate(objectMap, "requestorId", a.RequestorID) + populate(objectMap, "requestorUserPrincipalName", a.RequestorUserPrincipalName) + populate(objectMap, "roleDefinitionId", a.RoleDefinitionID) + populate(objectMap, "roleDisplayName", a.RoleDisplayName) + populate(objectMap, "roleTemplateId", a.RoleTemplateID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAssignmentProperties. -func (r *RoleManagementPolicyAssignmentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureRolesAssignedOutsidePimAlertIncidentProperties. +func (a *AzureRolesAssignedOutsidePimAlertIncidentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "effectiveRules": - r.EffectiveRules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &a.AlertIncidentType) + delete(rawMsg, key) + case "assigneeDisplayName": + err = unpopulate(val, "AssigneeDisplayName", &a.AssigneeDisplayName) delete(rawMsg, key) - case "policyAssignmentProperties": - err = unpopulate(val, "PolicyAssignmentProperties", &r.PolicyAssignmentProperties) + case "assigneeId": + err = unpopulate(val, "AssigneeID", &a.AssigneeID) delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &r.PolicyID) + case "assigneeUserPrincipalName": + err = unpopulate(val, "AssigneeUserPrincipalName", &a.AssigneeUserPrincipalName) + delete(rawMsg, key) + case "assignmentActivatedDate": + err = unpopulateTimeRFC3339(val, "AssignmentActivatedDate", &a.AssignmentActivatedDate) + delete(rawMsg, key) + case "requestorDisplayName": + err = unpopulate(val, "RequestorDisplayName", &a.RequestorDisplayName) + delete(rawMsg, key) + case "requestorId": + err = unpopulate(val, "RequestorID", &a.RequestorID) + delete(rawMsg, key) + case "requestorUserPrincipalName": + err = unpopulate(val, "RequestorUserPrincipalName", &a.RequestorUserPrincipalName) delete(rawMsg, key) case "roleDefinitionId": - err = unpopulate(val, "RoleDefinitionID", &r.RoleDefinitionID) + err = unpopulate(val, "RoleDefinitionID", &a.RoleDefinitionID) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) + case "roleDisplayName": + err = unpopulate(val, "RoleDisplayName", &a.RoleDisplayName) + delete(rawMsg, key) + case "roleTemplateId": + err = unpopulate(val, "RoleTemplateID", &a.RoleTemplateID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAuthenticationContextRule. -func (r RoleManagementPolicyAuthenticationContextRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DuplicateRoleCreatedAlertConfigurationProperties. +func (d DuplicateRoleCreatedAlertConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "claimValue", r.ClaimValue) - populate(objectMap, "id", r.ID) - populate(objectMap, "isEnabled", r.IsEnabled) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule - populate(objectMap, "target", r.Target) + objectMap["alertConfigurationType"] = "DuplicateRoleCreatedAlertConfiguration" + populate(objectMap, "alertDefinition", d.AlertDefinition) + populate(objectMap, "alertDefinitionId", d.AlertDefinitionID) + populate(objectMap, "isEnabled", d.IsEnabled) + populate(objectMap, "scope", d.Scope) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyAuthenticationContextRule. -func (r *RoleManagementPolicyAuthenticationContextRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DuplicateRoleCreatedAlertConfigurationProperties. +func (d *DuplicateRoleCreatedAlertConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "claimValue": - err = unpopulate(val, "ClaimValue", &r.ClaimValue) + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &d.AlertConfigurationType) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &d.AlertDefinition) delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &r.IsEnabled) + case "alertDefinitionId": + err = unpopulate(val, "AlertDefinitionID", &d.AlertDefinitionID) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &d.IsEnabled) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "scope": + err = unpopulate(val, "Scope", &d.Scope) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyEnablementRule. -func (r RoleManagementPolicyEnablementRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DuplicateRoleCreatedAlertIncidentProperties. +func (d DuplicateRoleCreatedAlertIncidentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabledRules", r.EnabledRules) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule - populate(objectMap, "target", r.Target) + objectMap["alertIncidentType"] = "DuplicateRoleCreatedAlertIncident" + populate(objectMap, "duplicateRoles", d.DuplicateRoles) + populate(objectMap, "reason", d.Reason) + populate(objectMap, "roleName", d.RoleName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyEnablementRule. -func (r *RoleManagementPolicyEnablementRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DuplicateRoleCreatedAlertIncidentProperties. +func (d *DuplicateRoleCreatedAlertIncidentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "enabledRules": - err = unpopulate(val, "EnabledRules", &r.EnabledRules) + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &d.AlertIncidentType) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) + case "duplicateRoles": + err = unpopulate(val, "DuplicateRoles", &d.DuplicateRoles) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "reason": + err = unpopulate(val, "Reason", &d.Reason) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "roleName": + err = unpopulate(val, "RoleName", &d.RoleName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyExpirationRule. -func (r RoleManagementPolicyExpirationRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "isExpirationRequired", r.IsExpirationRequired) - populate(objectMap, "maximumDuration", r.MaximumDuration) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule - populate(objectMap, "target", r.Target) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyExpirationRule. -func (r *RoleManagementPolicyExpirationRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. +func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "isExpirationRequired": - err = unpopulate(val, "IsExpirationRequired", &r.IsExpirationRequired) - delete(rawMsg, key) - case "maximumDuration": - err = unpopulate(val, "MaximumDuration", &r.MaximumDuration) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyListResult. -func (r RoleManagementPolicyListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinitionProperties. +func (e ErrorDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyListResult. -func (r *RoleManagementPolicyListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinitionProperties. +func (e *ErrorDefinitionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyNotificationRule. -func (r RoleManagementPolicyNotificationRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "isDefaultRecipientsEnabled", r.IsDefaultRecipientsEnabled) - populate(objectMap, "notificationLevel", r.NotificationLevel) - populate(objectMap, "notificationRecipients", r.NotificationRecipients) - populate(objectMap, "notificationType", r.NotificationType) - populate(objectMap, "recipientType", r.RecipientType) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule - populate(objectMap, "target", r.Target) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyNotificationRule. -func (r *RoleManagementPolicyNotificationRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "isDefaultRecipientsEnabled": - err = unpopulate(val, "IsDefaultRecipientsEnabled", &r.IsDefaultRecipientsEnabled) + case "display": + err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) - case "notificationLevel": - err = unpopulate(val, "NotificationLevel", &r.NotificationLevel) - delete(rawMsg, key) - case "notificationRecipients": - err = unpopulate(val, "NotificationRecipients", &r.NotificationRecipients) - delete(rawMsg, key) - case "notificationType": - err = unpopulate(val, "NotificationType", &r.NotificationType) - delete(rawMsg, key) - case "recipientType": - err = unpopulate(val, "RecipientType", &r.RecipientType) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyProperties. -func (r RoleManagementPolicyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", r.Description) - populate(objectMap, "displayName", r.DisplayName) - populate(objectMap, "effectiveRules", r.EffectiveRules) - populate(objectMap, "isOrganizationDefault", r.IsOrganizationDefault) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populateTimeRFC3339(objectMap, "lastModifiedDateTime", r.LastModifiedDateTime) - populate(objectMap, "policyProperties", r.PolicyProperties) - populate(objectMap, "rules", r.Rules) - populate(objectMap, "scope", r.Scope) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyProperties. -func (r *RoleManagementPolicyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { case "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &r.DisplayName) - delete(rawMsg, key) - case "effectiveRules": - r.EffectiveRules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) - delete(rawMsg, key) - case "isOrganizationDefault": - err = unpopulate(val, "IsOrganizationDefault", &r.IsOrganizationDefault) + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) - case "lastModifiedDateTime": - err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &r.LastModifiedDateTime) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) - case "policyProperties": - err = unpopulate(val, "PolicyProperties", &r.PolicyProperties) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) - case "rules": - r.Rules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &r.Scope) + case "value": + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyRule. -func (r RoleManagementPolicyRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecordAllDecisionsProperties. +func (r RecordAllDecisionsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = r.RuleType - populate(objectMap, "target", r.Target) + populate(objectMap, "decision", r.Decision) + populate(objectMap, "justification", r.Justification) + populate(objectMap, "principalId", r.PrincipalID) + populate(objectMap, "resourceId", r.ResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyRule. -func (r *RoleManagementPolicyRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecordAllDecisionsProperties. +func (r *RecordAllDecisionsProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3372,14 +2310,17 @@ func (r *RoleManagementPolicyRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) + case "decision": + err = unpopulate(val, "Decision", &r.Decision) + delete(rawMsg, key) + case "justification": + err = unpopulate(val, "Justification", &r.Justification) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + case "resourceId": + err = unpopulate(val, "ResourceID", &r.ResourceID) delete(rawMsg, key) } if err != nil { @@ -3389,149 +2330,173 @@ func (r *RoleManagementPolicyRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyRuleTarget. -func (r RoleManagementPolicyRuleTarget) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TooManyOwnersAssignedToResourceAlertConfigurationProperties. +func (t TooManyOwnersAssignedToResourceAlertConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "caller", r.Caller) - populate(objectMap, "enforcedSettings", r.EnforcedSettings) - populate(objectMap, "inheritableSettings", r.InheritableSettings) - populate(objectMap, "level", r.Level) - populate(objectMap, "operations", r.Operations) - populate(objectMap, "targetObjects", r.TargetObjects) + objectMap["alertConfigurationType"] = "TooManyOwnersAssignedToResourceAlertConfiguration" + populate(objectMap, "alertDefinition", t.AlertDefinition) + populate(objectMap, "alertDefinitionId", t.AlertDefinitionID) + populate(objectMap, "isEnabled", t.IsEnabled) + populate(objectMap, "scope", t.Scope) + populate(objectMap, "thresholdNumberOfOwners", t.ThresholdNumberOfOwners) + populate(objectMap, "thresholdPercentageOfOwnersOutOfAllRoleMembers", t.ThresholdPercentageOfOwnersOutOfAllRoleMembers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RoleManagementPolicyRuleTarget. -func (r *RoleManagementPolicyRuleTarget) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TooManyOwnersAssignedToResourceAlertConfigurationProperties. +func (t *TooManyOwnersAssignedToResourceAlertConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "caller": - err = unpopulate(val, "Caller", &r.Caller) + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &t.AlertConfigurationType) + delete(rawMsg, key) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &t.AlertDefinition) delete(rawMsg, key) - case "enforcedSettings": - err = unpopulate(val, "EnforcedSettings", &r.EnforcedSettings) + case "alertDefinitionId": + err = unpopulate(val, "AlertDefinitionID", &t.AlertDefinitionID) delete(rawMsg, key) - case "inheritableSettings": - err = unpopulate(val, "InheritableSettings", &r.InheritableSettings) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &t.IsEnabled) delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &r.Level) + case "scope": + err = unpopulate(val, "Scope", &t.Scope) delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &r.Operations) + case "thresholdNumberOfOwners": + err = unpopulate(val, "ThresholdNumberOfOwners", &t.ThresholdNumberOfOwners) delete(rawMsg, key) - case "targetObjects": - err = unpopulate(val, "TargetObjects", &r.TargetObjects) + case "thresholdPercentageOfOwnersOutOfAllRoleMembers": + err = unpopulate(val, "ThresholdPercentageOfOwnersOutOfAllRoleMembers", &t.ThresholdPercentageOfOwnersOutOfAllRoleMembers) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserSet. -func (u UserSet) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TooManyOwnersAssignedToResourceAlertIncidentProperties. +func (t TooManyOwnersAssignedToResourceAlertIncidentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", u.Description) - populate(objectMap, "id", u.ID) - populate(objectMap, "isBackup", u.IsBackup) - populate(objectMap, "userType", u.UserType) + objectMap["alertIncidentType"] = "TooManyOwnersAssignedToResourceAlertIncident" + populate(objectMap, "assigneeName", t.AssigneeName) + populate(objectMap, "assigneeType", t.AssigneeType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserSet. -func (u *UserSet) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TooManyOwnersAssignedToResourceAlertIncidentProperties. +func (t *TooManyOwnersAssignedToResourceAlertIncidentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &u.Description) + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &t.AlertIncidentType) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &u.ID) - delete(rawMsg, key) - case "isBackup": - err = unpopulate(val, "IsBackup", &u.IsBackup) + case "assigneeName": + err = unpopulate(val, "AssigneeName", &t.AssigneeName) delete(rawMsg, key) - case "userType": - err = unpopulate(val, "UserType", &u.UserType) + case "assigneeType": + err = unpopulate(val, "AssigneeType", &t.AssigneeType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidationResponse. -func (v ValidationResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties. +func (t TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "errorInfo", v.ErrorInfo) - populate(objectMap, "isValid", v.IsValid) + objectMap["alertConfigurationType"] = "TooManyPermanentOwnersAssignedToResourceAlertConfiguration" + populate(objectMap, "alertDefinition", t.AlertDefinition) + populate(objectMap, "alertDefinitionId", t.AlertDefinitionID) + populate(objectMap, "isEnabled", t.IsEnabled) + populate(objectMap, "scope", t.Scope) + populate(objectMap, "thresholdNumberOfPermanentOwners", t.ThresholdNumberOfPermanentOwners) + populate(objectMap, "thresholdPercentageOfPermanentOwnersOutOfAllOwners", t.ThresholdPercentageOfPermanentOwnersOutOfAllOwners) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResponse. -func (v *ValidationResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties. +func (t *TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "errorInfo": - err = unpopulate(val, "ErrorInfo", &v.ErrorInfo) + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &t.AlertConfigurationType) + delete(rawMsg, key) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &t.AlertDefinition) + delete(rawMsg, key) + case "alertDefinitionId": + err = unpopulate(val, "AlertDefinitionID", &t.AlertDefinitionID) delete(rawMsg, key) - case "isValid": - err = unpopulate(val, "IsValid", &v.IsValid) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &t.IsEnabled) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &t.Scope) + delete(rawMsg, key) + case "thresholdNumberOfPermanentOwners": + err = unpopulate(val, "ThresholdNumberOfPermanentOwners", &t.ThresholdNumberOfPermanentOwners) + delete(rawMsg, key) + case "thresholdPercentageOfPermanentOwnersOutOfAllOwners": + err = unpopulate(val, "ThresholdPercentageOfPermanentOwnersOutOfAllOwners", &t.ThresholdPercentageOfPermanentOwnersOutOfAllOwners) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ValidationResponseErrorInfo. -func (v ValidationResponseErrorInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties. +func (t TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", v.Code) - populate(objectMap, "message", v.Message) + objectMap["alertIncidentType"] = "TooManyPermanentOwnersAssignedToResourceAlertIncident" + populate(objectMap, "assigneeName", t.AssigneeName) + populate(objectMap, "assigneeType", t.AssigneeType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationResponseErrorInfo. -func (v *ValidationResponseErrorInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties. +func (t *TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &v.Code) + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &t.AlertIncidentType) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &v.Message) + case "assigneeName": + err = unpopulate(val, "AssigneeName", &t.AssigneeName) + delete(rawMsg, key) + case "assigneeType": + err = unpopulate(val, "AssigneeType", &t.AssigneeType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil diff --git a/sdk/resourcemanager/authorization/armauthorization/operations_client.go b/sdk/resourcemanager/authorization/armauthorization/operations_client.go new file mode 100644 index 000000000000..16714e533be3 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/operations_client.go @@ -0,0 +1,94 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the operations available from this provider. +// +// Generated from API version 2021-12-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/permissions_client.go b/sdk/resourcemanager/authorization/armauthorization/permissions_client.go deleted file mode 100644 index 017e852c8368..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client.go +++ /dev/null @@ -1,186 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PermissionsClient contains the methods for the Permissions group. -// Don't use this type directly, use NewPermissionsClient() instead. -type PermissionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPermissionsClient creates a new instance of PermissionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPermissionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PermissionsClient, error) { - cl, err := arm.NewClient(moduleName+".PermissionsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PermissionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListForResourcePager - Gets all permissions the caller has for a resource. -// -// Generated from API version 2022-04-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceProviderNamespace - The namespace of the resource provider. -// - parentResourcePath - The parent resource identity. -// - resourceType - The resource type of the resource. -// - resourceName - The name of the resource to get the permissions for. -// - options - PermissionsClientListForResourceOptions contains the optional parameters for the PermissionsClient.NewListForResourcePager -// method. -func (client *PermissionsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *PermissionsClientListForResourceOptions) *runtime.Pager[PermissionsClientListForResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[PermissionsClientListForResourceResponse]{ - More: func(page PermissionsClientListForResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PermissionsClientListForResourceResponse) (PermissionsClientListForResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PermissionsClientListForResourceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PermissionsClientListForResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PermissionsClientListForResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceHandleResponse(resp) - }, - }) -} - -// listForResourceCreateRequest creates the ListForResource request. -func (client *PermissionsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, options *PermissionsClientListForResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceHandleResponse handles the ListForResource response. -func (client *PermissionsClient) listForResourceHandleResponse(resp *http.Response) (PermissionsClientListForResourceResponse, error) { - result := PermissionsClientListForResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { - return PermissionsClientListForResourceResponse{}, err - } - return result, nil -} - -// NewListForResourceGroupPager - Gets all permissions the caller has for a resource group. -// -// Generated from API version 2022-04-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.NewListForResourceGroupPager -// method. -func (client *PermissionsClient) NewListForResourceGroupPager(resourceGroupName string, options *PermissionsClientListForResourceGroupOptions) *runtime.Pager[PermissionsClientListForResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[PermissionsClientListForResourceGroupResponse]{ - More: func(page PermissionsClientListForResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PermissionsClientListForResourceGroupResponse) (PermissionsClientListForResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PermissionsClientListForResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PermissionsClientListForResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PermissionsClientListForResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceGroupHandleResponse(resp) - }, - }) -} - -// listForResourceGroupCreateRequest creates the ListForResourceGroup request. -func (client *PermissionsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PermissionsClientListForResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceGroupHandleResponse handles the ListForResourceGroup response. -func (client *PermissionsClient) listForResourceGroupHandleResponse(resp *http.Response) (PermissionsClientListForResourceGroupResponse, error) { - result := PermissionsClientListForResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { - return PermissionsClientListForResourceGroupResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go deleted file mode 100644 index 2a95750de5e4..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetPermissions.json -func ExamplePermissionsClient_NewListForResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListForResourceGroupPager("rgname", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionGetResult = armauthorization.PermissionGetResult{ - // Value: []*armauthorization.Permission{ - // { - // Actions: []*string{ - // }, - // DataActions: []*string{ - // }, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetResourcePermissions.json -func ExamplePermissionsClient_NewListForResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPermissionsClient().NewListForResourcePager("rgname", "rpnamespace", "parentResourcePath", "resourceType", "resourceName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PermissionGetResult = armauthorization.PermissionGetResult{ - // Value: []*armauthorization.Permission{ - // { - // Actions: []*string{ - // }, - // NotActions: []*string{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go b/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go index 9785c4d86b04..99f767cba8ee 100644 --- a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go +++ b/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go @@ -11,7 +11,7 @@ package armauthorization import "encoding/json" -func unmarshalRoleManagementPolicyRuleClassification(rawMsg json.RawMessage) (RoleManagementPolicyRuleClassification, error) { +func unmarshalAccessReviewDecisionIdentityClassification(rawMsg json.RawMessage) (AccessReviewDecisionIdentityClassification, error) { if rawMsg == nil { return nil, nil } @@ -19,39 +19,80 @@ func unmarshalRoleManagementPolicyRuleClassification(rawMsg json.RawMessage) (Ro if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b RoleManagementPolicyRuleClassification - switch m["ruleType"] { - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule): - b = &RoleManagementPolicyApprovalRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule): - b = &RoleManagementPolicyAuthenticationContextRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule): - b = &RoleManagementPolicyEnablementRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule): - b = &RoleManagementPolicyExpirationRule{} - case string(RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule): - b = &RoleManagementPolicyNotificationRule{} + var b AccessReviewDecisionIdentityClassification + switch m["type"] { + case string(DecisionTargetTypeServicePrincipal): + b = &AccessReviewDecisionServicePrincipalIdentity{} + case string(DecisionTargetTypeUser): + b = &AccessReviewDecisionUserIdentity{} default: - b = &RoleManagementPolicyRule{} + b = &AccessReviewDecisionIdentity{} } return b, json.Unmarshal(rawMsg, b) } -func unmarshalRoleManagementPolicyRuleClassificationArray(rawMsg json.RawMessage) ([]RoleManagementPolicyRuleClassification, error) { +func unmarshalAccessReviewDecisionInsightPropertiesClassification(rawMsg json.RawMessage) (AccessReviewDecisionInsightPropertiesClassification, error) { if rawMsg == nil { return nil, nil } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AccessReviewDecisionInsightPropertiesClassification + switch m["type"] { + case string(AccessReviewDecisionInsightTypeUserSignInInsight): + b = &AccessReviewDecisionUserSignInInsightProperties{} + default: + b = &AccessReviewDecisionInsightProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAlertConfigurationPropertiesClassification(rawMsg json.RawMessage) (AlertConfigurationPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - fArray := make([]RoleManagementPolicyRuleClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalRoleManagementPolicyRuleClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f + var b AlertConfigurationPropertiesClassification + switch m["alertConfigurationType"] { + case "AzureRolesAssignedOutsidePimAlertConfiguration": + b = &AzureRolesAssignedOutsidePimAlertConfigurationProperties{} + case "DuplicateRoleCreatedAlertConfiguration": + b = &DuplicateRoleCreatedAlertConfigurationProperties{} + case "TooManyOwnersAssignedToResourceAlertConfiguration": + b = &TooManyOwnersAssignedToResourceAlertConfigurationProperties{} + case "TooManyPermanentOwnersAssignedToResourceAlertConfiguration": + b = &TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties{} + default: + b = &AlertConfigurationProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAlertIncidentPropertiesClassification(rawMsg json.RawMessage) (AlertIncidentPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil } - return fArray, nil + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AlertIncidentPropertiesClassification + switch m["alertIncidentType"] { + case "AzureRolesAssignedOutsidePimAlertIncident": + b = &AzureRolesAssignedOutsidePimAlertIncidentProperties{} + case "DuplicateRoleCreatedAlertIncident": + b = &DuplicateRoleCreatedAlertIncidentProperties{} + case "TooManyOwnersAssignedToResourceAlertIncident": + b = &TooManyOwnersAssignedToResourceAlertIncidentProperties{} + case "TooManyPermanentOwnersAssignedToResourceAlertIncident": + b = &TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties{} + default: + b = &AlertIncidentProperties{} + } + return b, json.Unmarshal(rawMsg, b) } diff --git a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go b/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go deleted file mode 100644 index d95adefa6110..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go +++ /dev/null @@ -1,148 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// ProviderOperationsMetadataClient contains the methods for the ProviderOperationsMetadata group. -// Don't use this type directly, use NewProviderOperationsMetadataClient() instead. -type ProviderOperationsMetadataClient struct { - internal *arm.Client -} - -// NewProviderOperationsMetadataClient creates a new instance of ProviderOperationsMetadataClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewProviderOperationsMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderOperationsMetadataClient, error) { - cl, err := arm.NewClient(moduleName+".ProviderOperationsMetadataClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProviderOperationsMetadataClient{ - internal: cl, - } - return client, nil -} - -// Get - Gets provider operations metadata for the specified resource provider. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - resourceProviderNamespace - The namespace of the resource provider. -// - options - ProviderOperationsMetadataClientGetOptions contains the optional parameters for the ProviderOperationsMetadataClient.Get -// method. -func (client *ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, options *ProviderOperationsMetadataClientGetOptions) (ProviderOperationsMetadataClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceProviderNamespace, options) - if err != nil { - return ProviderOperationsMetadataClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProviderOperationsMetadataClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProviderOperationsMetadataClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ProviderOperationsMetadataClient) getCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProviderOperationsMetadataClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}" - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProviderOperationsMetadataClient) getHandleResponse(resp *http.Response) (ProviderOperationsMetadataClientGetResponse, error) { - result := ProviderOperationsMetadataClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadata); err != nil { - return ProviderOperationsMetadataClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets provider operations metadata for all resource providers. -// -// Generated from API version 2022-04-01 -// - options - ProviderOperationsMetadataClientListOptions contains the optional parameters for the ProviderOperationsMetadataClient.NewListPager -// method. -func (client *ProviderOperationsMetadataClient) NewListPager(options *ProviderOperationsMetadataClientListOptions) *runtime.Pager[ProviderOperationsMetadataClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ProviderOperationsMetadataClientListResponse]{ - More: func(page ProviderOperationsMetadataClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ProviderOperationsMetadataClientListResponse) (ProviderOperationsMetadataClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ProviderOperationsMetadataClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProviderOperationsMetadataClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ProviderOperationsMetadataClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *ProviderOperationsMetadataClient) listCreateRequest(ctx context.Context, options *ProviderOperationsMetadataClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Authorization/providerOperations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.Expand != nil { - reqQP.Set("$expand", *options.Expand) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ProviderOperationsMetadataClient) listHandleResponse(resp *http.Response) (ProviderOperationsMetadataClientListResponse, error) { - result := ProviderOperationsMetadataClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadataListResult); err != nil { - return ProviderOperationsMetadataClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go deleted file mode 100644 index e9566f71cf55..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetProviderOperationsRP.json -func ExampleProviderOperationsMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderOperationsMetadataClient().Get(ctx, "resourceProviderNamespace", &armauthorization.ProviderOperationsMetadataClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ProviderOperationsMetadata = armauthorization.ProviderOperationsMetadata{ - // Name: to.Ptr("name"), - // Type: to.Ptr("type"), - // DisplayName: to.Ptr("displayName"), - // ID: to.Ptr("id"), - // ResourceTypes: []*armauthorization.ResourceType{ - // { - // Name: to.Ptr("name"), - // DisplayName: to.Ptr("name"), - // Operations: []*armauthorization.ProviderOperation{ - // }, - // }}, - // Operations: []*armauthorization.ProviderOperation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllProviderOperations.json -func ExampleProviderOperationsMetadataClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProviderOperationsMetadataClient().NewListPager(&armauthorization.ProviderOperationsMetadataClientListOptions{Expand: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProviderOperationsMetadataListResult = armauthorization.ProviderOperationsMetadataListResult{ - // Value: []*armauthorization.ProviderOperationsMetadata{ - // { - // Name: to.Ptr("name"), - // Type: to.Ptr("type"), - // DisplayName: to.Ptr("displayName"), - // ID: to.Ptr("id"), - // ResourceTypes: []*armauthorization.ResourceType{ - // { - // Name: to.Ptr("name"), - // DisplayName: to.Ptr("name"), - // Operations: []*armauthorization.ProviderOperation{ - // }, - // }}, - // Operations: []*armauthorization.ProviderOperation{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/response_types.go b/sdk/resourcemanager/authorization/armauthorization/response_types.go index 6085555aa696..f165236501f6 100644 --- a/sdk/resourcemanager/authorization/armauthorization/response_types.go +++ b/sdk/resourcemanager/authorization/armauthorization/response_types.go @@ -9,272 +9,342 @@ package armauthorization -// ClassicAdministratorsClientListResponse contains the response from method ClassicAdministratorsClient.NewListPager. -type ClassicAdministratorsClientListResponse struct { - ClassicAdministratorListResult +// AccessReviewDefaultSettingsClientGetResponse contains the response from method AccessReviewDefaultSettingsClient.Get. +type AccessReviewDefaultSettingsClientGetResponse struct { + AccessReviewDefaultSettings } -// DenyAssignmentsClientGetByIDResponse contains the response from method DenyAssignmentsClient.GetByID. -type DenyAssignmentsClientGetByIDResponse struct { - DenyAssignment +// AccessReviewDefaultSettingsClientPutResponse contains the response from method AccessReviewDefaultSettingsClient.Put. +type AccessReviewDefaultSettingsClientPutResponse struct { + AccessReviewDefaultSettings } -// DenyAssignmentsClientGetResponse contains the response from method DenyAssignmentsClient.Get. -type DenyAssignmentsClientGetResponse struct { - DenyAssignment +// AccessReviewHistoryDefinitionClientCreateResponse contains the response from method AccessReviewHistoryDefinitionClient.Create. +type AccessReviewHistoryDefinitionClientCreateResponse struct { + AccessReviewHistoryDefinition } -// DenyAssignmentsClientListForResourceGroupResponse contains the response from method DenyAssignmentsClient.NewListForResourceGroupPager. -type DenyAssignmentsClientListForResourceGroupResponse struct { - DenyAssignmentListResult +// AccessReviewHistoryDefinitionClientDeleteByIDResponse contains the response from method AccessReviewHistoryDefinitionClient.DeleteByID. +type AccessReviewHistoryDefinitionClientDeleteByIDResponse struct { + // placeholder for future response values } -// DenyAssignmentsClientListForResourceResponse contains the response from method DenyAssignmentsClient.NewListForResourcePager. -type DenyAssignmentsClientListForResourceResponse struct { - DenyAssignmentListResult +// AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse contains the response from method AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI. +type AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse struct { + AccessReviewHistoryInstance } -// DenyAssignmentsClientListForScopeResponse contains the response from method DenyAssignmentsClient.NewListForScopePager. -type DenyAssignmentsClientListForScopeResponse struct { - DenyAssignmentListResult +// AccessReviewHistoryDefinitionInstancesClientListResponse contains the response from method AccessReviewHistoryDefinitionInstancesClient.NewListPager. +type AccessReviewHistoryDefinitionInstancesClientListResponse struct { + AccessReviewHistoryDefinitionInstanceListResult } -// DenyAssignmentsClientListResponse contains the response from method DenyAssignmentsClient.NewListPager. -type DenyAssignmentsClientListResponse struct { - DenyAssignmentListResult +// AccessReviewHistoryDefinitionsClientGetByIDResponse contains the response from method AccessReviewHistoryDefinitionsClient.GetByID. +type AccessReviewHistoryDefinitionsClientGetByIDResponse struct { + AccessReviewHistoryDefinition } -// EligibleChildResourcesClientGetResponse contains the response from method EligibleChildResourcesClient.NewGetPager. -type EligibleChildResourcesClientGetResponse struct { - EligibleChildResourcesListResult +// AccessReviewHistoryDefinitionsClientListResponse contains the response from method AccessReviewHistoryDefinitionsClient.NewListPager. +type AccessReviewHistoryDefinitionsClientListResponse struct { + AccessReviewHistoryDefinitionListResult } -// GlobalAdministratorClientElevateAccessResponse contains the response from method GlobalAdministratorClient.ElevateAccess. -type GlobalAdministratorClientElevateAccessResponse struct { +// AccessReviewInstanceClientAcceptRecommendationsResponse contains the response from method AccessReviewInstanceClient.AcceptRecommendations. +type AccessReviewInstanceClientAcceptRecommendationsResponse struct { // placeholder for future response values } -// PermissionsClientListForResourceGroupResponse contains the response from method PermissionsClient.NewListForResourceGroupPager. -type PermissionsClientListForResourceGroupResponse struct { - PermissionGetResult +// AccessReviewInstanceClientApplyDecisionsResponse contains the response from method AccessReviewInstanceClient.ApplyDecisions. +type AccessReviewInstanceClientApplyDecisionsResponse struct { + // placeholder for future response values } -// PermissionsClientListForResourceResponse contains the response from method PermissionsClient.NewListForResourcePager. -type PermissionsClientListForResourceResponse struct { - PermissionGetResult +// AccessReviewInstanceClientResetDecisionsResponse contains the response from method AccessReviewInstanceClient.ResetDecisions. +type AccessReviewInstanceClientResetDecisionsResponse struct { + // placeholder for future response values } -// ProviderOperationsMetadataClientGetResponse contains the response from method ProviderOperationsMetadataClient.Get. -type ProviderOperationsMetadataClientGetResponse struct { - ProviderOperationsMetadata +// AccessReviewInstanceClientSendRemindersResponse contains the response from method AccessReviewInstanceClient.SendReminders. +type AccessReviewInstanceClientSendRemindersResponse struct { + // placeholder for future response values } -// ProviderOperationsMetadataClientListResponse contains the response from method ProviderOperationsMetadataClient.NewListPager. -type ProviderOperationsMetadataClientListResponse struct { - ProviderOperationsMetadataListResult +// AccessReviewInstanceClientStopResponse contains the response from method AccessReviewInstanceClient.Stop. +type AccessReviewInstanceClientStopResponse struct { + // placeholder for future response values } -// RoleAssignmentScheduleInstancesClientGetResponse contains the response from method RoleAssignmentScheduleInstancesClient.Get. -type RoleAssignmentScheduleInstancesClientGetResponse struct { - RoleAssignmentScheduleInstance +// AccessReviewInstanceContactedReviewersClientListResponse contains the response from method AccessReviewInstanceContactedReviewersClient.NewListPager. +type AccessReviewInstanceContactedReviewersClientListResponse struct { + AccessReviewContactedReviewerListResult } -// RoleAssignmentScheduleInstancesClientListForScopeResponse contains the response from method RoleAssignmentScheduleInstancesClient.NewListForScopePager. -type RoleAssignmentScheduleInstancesClientListForScopeResponse struct { - RoleAssignmentScheduleInstanceListResult +// AccessReviewInstanceDecisionsClientListResponse contains the response from method AccessReviewInstanceDecisionsClient.NewListPager. +type AccessReviewInstanceDecisionsClientListResponse struct { + AccessReviewDecisionListResult } -// RoleAssignmentScheduleRequestsClientCancelResponse contains the response from method RoleAssignmentScheduleRequestsClient.Cancel. -type RoleAssignmentScheduleRequestsClientCancelResponse struct { - // placeholder for future response values +// AccessReviewInstanceMyDecisionsClientGetByIDResponse contains the response from method AccessReviewInstanceMyDecisionsClient.GetByID. +type AccessReviewInstanceMyDecisionsClientGetByIDResponse struct { + AccessReviewDecision +} + +// AccessReviewInstanceMyDecisionsClientListResponse contains the response from method AccessReviewInstanceMyDecisionsClient.NewListPager. +type AccessReviewInstanceMyDecisionsClientListResponse struct { + AccessReviewDecisionListResult +} + +// AccessReviewInstanceMyDecisionsClientPatchResponse contains the response from method AccessReviewInstanceMyDecisionsClient.Patch. +type AccessReviewInstanceMyDecisionsClientPatchResponse struct { + AccessReviewDecision +} + +// AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse contains the response from method AccessReviewInstancesAssignedForMyApprovalClient.GetByID. +type AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse struct { + AccessReviewInstance +} + +// AccessReviewInstancesAssignedForMyApprovalClientListResponse contains the response from method AccessReviewInstancesAssignedForMyApprovalClient.NewListPager. +type AccessReviewInstancesAssignedForMyApprovalClientListResponse struct { + AccessReviewInstanceListResult +} + +// AccessReviewInstancesClientCreateResponse contains the response from method AccessReviewInstancesClient.Create. +type AccessReviewInstancesClientCreateResponse struct { + AccessReviewInstance +} + +// AccessReviewInstancesClientGetByIDResponse contains the response from method AccessReviewInstancesClient.GetByID. +type AccessReviewInstancesClientGetByIDResponse struct { + AccessReviewInstance +} + +// AccessReviewInstancesClientListResponse contains the response from method AccessReviewInstancesClient.NewListPager. +type AccessReviewInstancesClientListResponse struct { + AccessReviewInstanceListResult +} + +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse contains the response from method AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager. +type AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse struct { + AccessReviewScheduleDefinitionListResult } -// RoleAssignmentScheduleRequestsClientCreateResponse contains the response from method RoleAssignmentScheduleRequestsClient.Create. -type RoleAssignmentScheduleRequestsClientCreateResponse struct { - RoleAssignmentScheduleRequest +// AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse contains the response from method AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID. +type AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse struct { + AccessReviewScheduleDefinition } -// RoleAssignmentScheduleRequestsClientGetResponse contains the response from method RoleAssignmentScheduleRequestsClient.Get. -type RoleAssignmentScheduleRequestsClientGetResponse struct { - RoleAssignmentScheduleRequest +// AccessReviewScheduleDefinitionsClientDeleteByIDResponse contains the response from method AccessReviewScheduleDefinitionsClient.DeleteByID. +type AccessReviewScheduleDefinitionsClientDeleteByIDResponse struct { + // placeholder for future response values } -// RoleAssignmentScheduleRequestsClientListForScopeResponse contains the response from method RoleAssignmentScheduleRequestsClient.NewListForScopePager. -type RoleAssignmentScheduleRequestsClientListForScopeResponse struct { - RoleAssignmentScheduleRequestListResult +// AccessReviewScheduleDefinitionsClientGetByIDResponse contains the response from method AccessReviewScheduleDefinitionsClient.GetByID. +type AccessReviewScheduleDefinitionsClientGetByIDResponse struct { + AccessReviewScheduleDefinition } -// RoleAssignmentScheduleRequestsClientValidateResponse contains the response from method RoleAssignmentScheduleRequestsClient.Validate. -type RoleAssignmentScheduleRequestsClientValidateResponse struct { - RoleAssignmentScheduleRequest +// AccessReviewScheduleDefinitionsClientListResponse contains the response from method AccessReviewScheduleDefinitionsClient.NewListPager. +type AccessReviewScheduleDefinitionsClientListResponse struct { + AccessReviewScheduleDefinitionListResult } -// RoleAssignmentSchedulesClientGetResponse contains the response from method RoleAssignmentSchedulesClient.Get. -type RoleAssignmentSchedulesClientGetResponse struct { - RoleAssignmentSchedule +// AccessReviewScheduleDefinitionsClientStopResponse contains the response from method AccessReviewScheduleDefinitionsClient.Stop. +type AccessReviewScheduleDefinitionsClientStopResponse struct { + // placeholder for future response values } -// RoleAssignmentSchedulesClientListForScopeResponse contains the response from method RoleAssignmentSchedulesClient.NewListForScopePager. -type RoleAssignmentSchedulesClientListForScopeResponse struct { - RoleAssignmentScheduleListResult +// AlertConfigurationsClientGetResponse contains the response from method AlertConfigurationsClient.Get. +type AlertConfigurationsClientGetResponse struct { + AlertConfiguration } -// RoleAssignmentsClientCreateByIDResponse contains the response from method RoleAssignmentsClient.CreateByID. -type RoleAssignmentsClientCreateByIDResponse struct { - RoleAssignment +// AlertConfigurationsClientListForScopeResponse contains the response from method AlertConfigurationsClient.NewListForScopePager. +type AlertConfigurationsClientListForScopeResponse struct { + AlertConfigurationListResult } -// RoleAssignmentsClientCreateResponse contains the response from method RoleAssignmentsClient.Create. -type RoleAssignmentsClientCreateResponse struct { - RoleAssignment +// AlertConfigurationsClientUpdateResponse contains the response from method AlertConfigurationsClient.Update. +type AlertConfigurationsClientUpdateResponse struct { + // placeholder for future response values } -// RoleAssignmentsClientDeleteByIDResponse contains the response from method RoleAssignmentsClient.DeleteByID. -type RoleAssignmentsClientDeleteByIDResponse struct { - RoleAssignment +// AlertDefinitionsClientGetResponse contains the response from method AlertDefinitionsClient.Get. +type AlertDefinitionsClientGetResponse struct { + AlertDefinition } -// RoleAssignmentsClientDeleteResponse contains the response from method RoleAssignmentsClient.Delete. -type RoleAssignmentsClientDeleteResponse struct { - RoleAssignment +// AlertDefinitionsClientListForScopeResponse contains the response from method AlertDefinitionsClient.NewListForScopePager. +type AlertDefinitionsClientListForScopeResponse struct { + AlertDefinitionListResult } -// RoleAssignmentsClientGetByIDResponse contains the response from method RoleAssignmentsClient.GetByID. -type RoleAssignmentsClientGetByIDResponse struct { - RoleAssignment +// AlertIncidentsClientGetResponse contains the response from method AlertIncidentsClient.Get. +type AlertIncidentsClientGetResponse struct { + AlertIncident } -// RoleAssignmentsClientGetResponse contains the response from method RoleAssignmentsClient.Get. -type RoleAssignmentsClientGetResponse struct { - RoleAssignment +// AlertIncidentsClientListForScopeResponse contains the response from method AlertIncidentsClient.NewListForScopePager. +type AlertIncidentsClientListForScopeResponse struct { + AlertIncidentListResult } -// RoleAssignmentsClientListForResourceGroupResponse contains the response from method RoleAssignmentsClient.NewListForResourceGroupPager. -type RoleAssignmentsClientListForResourceGroupResponse struct { - RoleAssignmentListResult +// AlertIncidentsClientRemediateResponse contains the response from method AlertIncidentsClient.Remediate. +type AlertIncidentsClientRemediateResponse struct { + // placeholder for future response values } -// RoleAssignmentsClientListForResourceResponse contains the response from method RoleAssignmentsClient.NewListForResourcePager. -type RoleAssignmentsClientListForResourceResponse struct { - RoleAssignmentListResult +// AlertOperationClientGetResponse contains the response from method AlertOperationClient.Get. +type AlertOperationClientGetResponse struct { + AlertOperationResult } -// RoleAssignmentsClientListForScopeResponse contains the response from method RoleAssignmentsClient.NewListForScopePager. -type RoleAssignmentsClientListForScopeResponse struct { - RoleAssignmentListResult +// AlertsClientGetResponse contains the response from method AlertsClient.Get. +type AlertsClientGetResponse struct { + Alert } -// RoleAssignmentsClientListForSubscriptionResponse contains the response from method RoleAssignmentsClient.NewListForSubscriptionPager. -type RoleAssignmentsClientListForSubscriptionResponse struct { - RoleAssignmentListResult +// AlertsClientListForScopeResponse contains the response from method AlertsClient.NewListForScopePager. +type AlertsClientListForScopeResponse struct { + AlertListResult } -// RoleDefinitionsClientCreateOrUpdateResponse contains the response from method RoleDefinitionsClient.CreateOrUpdate. -type RoleDefinitionsClientCreateOrUpdateResponse struct { - RoleDefinition +// AlertsClientRefreshAllResponse contains the response from method AlertsClient.BeginRefreshAll. +type AlertsClientRefreshAllResponse struct { + AlertOperationResult } -// RoleDefinitionsClientDeleteResponse contains the response from method RoleDefinitionsClient.Delete. -type RoleDefinitionsClientDeleteResponse struct { - RoleDefinition +// AlertsClientRefreshResponse contains the response from method AlertsClient.BeginRefresh. +type AlertsClientRefreshResponse struct { + AlertOperationResult } -// RoleDefinitionsClientGetByIDResponse contains the response from method RoleDefinitionsClient.GetByID. -type RoleDefinitionsClientGetByIDResponse struct { - RoleDefinition +// AlertsClientUpdateResponse contains the response from method AlertsClient.Update. +type AlertsClientUpdateResponse struct { + // placeholder for future response values } -// RoleDefinitionsClientGetResponse contains the response from method RoleDefinitionsClient.Get. -type RoleDefinitionsClientGetResponse struct { - RoleDefinition +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + OperationListResult } -// RoleDefinitionsClientListResponse contains the response from method RoleDefinitionsClient.NewListPager. -type RoleDefinitionsClientListResponse struct { - RoleDefinitionListResult +// ScopeAccessReviewDefaultSettingsClientGetResponse contains the response from method ScopeAccessReviewDefaultSettingsClient.Get. +type ScopeAccessReviewDefaultSettingsClientGetResponse struct { + AccessReviewDefaultSettings } -// RoleEligibilityScheduleInstancesClientGetResponse contains the response from method RoleEligibilityScheduleInstancesClient.Get. -type RoleEligibilityScheduleInstancesClientGetResponse struct { - RoleEligibilityScheduleInstance +// ScopeAccessReviewDefaultSettingsClientPutResponse contains the response from method ScopeAccessReviewDefaultSettingsClient.Put. +type ScopeAccessReviewDefaultSettingsClientPutResponse struct { + AccessReviewDefaultSettings } -// RoleEligibilityScheduleInstancesClientListForScopeResponse contains the response from method RoleEligibilityScheduleInstancesClient.NewListForScopePager. -type RoleEligibilityScheduleInstancesClientListForScopeResponse struct { - RoleEligibilityScheduleInstanceListResult +// ScopeAccessReviewHistoryDefinitionClientCreateResponse contains the response from method ScopeAccessReviewHistoryDefinitionClient.Create. +type ScopeAccessReviewHistoryDefinitionClientCreateResponse struct { + AccessReviewHistoryDefinition } -// RoleEligibilityScheduleRequestsClientCancelResponse contains the response from method RoleEligibilityScheduleRequestsClient.Cancel. -type RoleEligibilityScheduleRequestsClientCancelResponse struct { +// ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse contains the response from method ScopeAccessReviewHistoryDefinitionClient.DeleteByID. +type ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse struct { // placeholder for future response values } -// RoleEligibilityScheduleRequestsClientCreateResponse contains the response from method RoleEligibilityScheduleRequestsClient.Create. -type RoleEligibilityScheduleRequestsClientCreateResponse struct { - RoleEligibilityScheduleRequest +// ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse contains the response from method ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI. +type ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse struct { + AccessReviewHistoryInstance } -// RoleEligibilityScheduleRequestsClientGetResponse contains the response from method RoleEligibilityScheduleRequestsClient.Get. -type RoleEligibilityScheduleRequestsClientGetResponse struct { - RoleEligibilityScheduleRequest +// ScopeAccessReviewHistoryDefinitionInstancesClientListResponse contains the response from method ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager. +type ScopeAccessReviewHistoryDefinitionInstancesClientListResponse struct { + AccessReviewHistoryDefinitionInstanceListResult } -// RoleEligibilityScheduleRequestsClientListForScopeResponse contains the response from method RoleEligibilityScheduleRequestsClient.NewListForScopePager. -type RoleEligibilityScheduleRequestsClientListForScopeResponse struct { - RoleEligibilityScheduleRequestListResult +// ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse contains the response from method ScopeAccessReviewHistoryDefinitionsClient.GetByID. +type ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse struct { + AccessReviewHistoryDefinition } -// RoleEligibilityScheduleRequestsClientValidateResponse contains the response from method RoleEligibilityScheduleRequestsClient.Validate. -type RoleEligibilityScheduleRequestsClientValidateResponse struct { - RoleEligibilityScheduleRequest +// ScopeAccessReviewHistoryDefinitionsClientListResponse contains the response from method ScopeAccessReviewHistoryDefinitionsClient.NewListPager. +type ScopeAccessReviewHistoryDefinitionsClientListResponse struct { + AccessReviewHistoryDefinitionListResult +} + +// ScopeAccessReviewInstanceClientApplyDecisionsResponse contains the response from method ScopeAccessReviewInstanceClient.ApplyDecisions. +type ScopeAccessReviewInstanceClientApplyDecisionsResponse struct { + // placeholder for future response values +} + +// ScopeAccessReviewInstanceClientRecordAllDecisionsResponse contains the response from method ScopeAccessReviewInstanceClient.RecordAllDecisions. +type ScopeAccessReviewInstanceClientRecordAllDecisionsResponse struct { + // placeholder for future response values } -// RoleEligibilitySchedulesClientGetResponse contains the response from method RoleEligibilitySchedulesClient.Get. -type RoleEligibilitySchedulesClientGetResponse struct { - RoleEligibilitySchedule +// ScopeAccessReviewInstanceClientResetDecisionsResponse contains the response from method ScopeAccessReviewInstanceClient.ResetDecisions. +type ScopeAccessReviewInstanceClientResetDecisionsResponse struct { + // placeholder for future response values } -// RoleEligibilitySchedulesClientListForScopeResponse contains the response from method RoleEligibilitySchedulesClient.NewListForScopePager. -type RoleEligibilitySchedulesClientListForScopeResponse struct { - RoleEligibilityScheduleListResult +// ScopeAccessReviewInstanceClientSendRemindersResponse contains the response from method ScopeAccessReviewInstanceClient.SendReminders. +type ScopeAccessReviewInstanceClientSendRemindersResponse struct { + // placeholder for future response values } -// RoleManagementPoliciesClientDeleteResponse contains the response from method RoleManagementPoliciesClient.Delete. -type RoleManagementPoliciesClientDeleteResponse struct { +// ScopeAccessReviewInstanceClientStopResponse contains the response from method ScopeAccessReviewInstanceClient.Stop. +type ScopeAccessReviewInstanceClientStopResponse struct { // placeholder for future response values } -// RoleManagementPoliciesClientGetResponse contains the response from method RoleManagementPoliciesClient.Get. -type RoleManagementPoliciesClientGetResponse struct { - RoleManagementPolicy +// ScopeAccessReviewInstanceContactedReviewersClientListResponse contains the response from method ScopeAccessReviewInstanceContactedReviewersClient.NewListPager. +type ScopeAccessReviewInstanceContactedReviewersClientListResponse struct { + AccessReviewContactedReviewerListResult +} + +// ScopeAccessReviewInstanceDecisionsClientListResponse contains the response from method ScopeAccessReviewInstanceDecisionsClient.NewListPager. +type ScopeAccessReviewInstanceDecisionsClientListResponse struct { + AccessReviewDecisionListResult +} + +// ScopeAccessReviewInstancesClientCreateResponse contains the response from method ScopeAccessReviewInstancesClient.Create. +type ScopeAccessReviewInstancesClientCreateResponse struct { + AccessReviewInstance } -// RoleManagementPoliciesClientListForScopeResponse contains the response from method RoleManagementPoliciesClient.NewListForScopePager. -type RoleManagementPoliciesClientListForScopeResponse struct { - RoleManagementPolicyListResult +// ScopeAccessReviewInstancesClientGetByIDResponse contains the response from method ScopeAccessReviewInstancesClient.GetByID. +type ScopeAccessReviewInstancesClientGetByIDResponse struct { + AccessReviewInstance } -// RoleManagementPoliciesClientUpdateResponse contains the response from method RoleManagementPoliciesClient.Update. -type RoleManagementPoliciesClientUpdateResponse struct { - RoleManagementPolicy +// ScopeAccessReviewInstancesClientListResponse contains the response from method ScopeAccessReviewInstancesClient.NewListPager. +type ScopeAccessReviewInstancesClientListResponse struct { + AccessReviewInstanceListResult } -// RoleManagementPolicyAssignmentsClientCreateResponse contains the response from method RoleManagementPolicyAssignmentsClient.Create. -type RoleManagementPolicyAssignmentsClientCreateResponse struct { - RoleManagementPolicyAssignment +// ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse contains the response from method ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID. +type ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse struct { + AccessReviewScheduleDefinition } -// RoleManagementPolicyAssignmentsClientDeleteResponse contains the response from method RoleManagementPolicyAssignmentsClient.Delete. -type RoleManagementPolicyAssignmentsClientDeleteResponse struct { +// ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse contains the response from method ScopeAccessReviewScheduleDefinitionsClient.DeleteByID. +type ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse struct { // placeholder for future response values } -// RoleManagementPolicyAssignmentsClientGetResponse contains the response from method RoleManagementPolicyAssignmentsClient.Get. -type RoleManagementPolicyAssignmentsClientGetResponse struct { - RoleManagementPolicyAssignment +// ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse contains the response from method ScopeAccessReviewScheduleDefinitionsClient.GetByID. +type ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse struct { + AccessReviewScheduleDefinition +} + +// ScopeAccessReviewScheduleDefinitionsClientListResponse contains the response from method ScopeAccessReviewScheduleDefinitionsClient.NewListPager. +type ScopeAccessReviewScheduleDefinitionsClientListResponse struct { + AccessReviewScheduleDefinitionListResult +} + +// ScopeAccessReviewScheduleDefinitionsClientStopResponse contains the response from method ScopeAccessReviewScheduleDefinitionsClient.Stop. +type ScopeAccessReviewScheduleDefinitionsClientStopResponse struct { + // placeholder for future response values } -// RoleManagementPolicyAssignmentsClientListForScopeResponse contains the response from method RoleManagementPolicyAssignmentsClient.NewListForScopePager. -type RoleManagementPolicyAssignmentsClientListForScopeResponse struct { - RoleManagementPolicyAssignmentListResult +// TenantLevelAccessReviewInstanceContactedReviewersClientListResponse contains the response from method TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager. +type TenantLevelAccessReviewInstanceContactedReviewersClientListResponse struct { + AccessReviewContactedReviewerListResult } diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go deleted file mode 100644 index 2380bbf28e0b..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go +++ /dev/null @@ -1,644 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleAssignmentsClient contains the methods for the RoleAssignments group. -// Don't use this type directly, use NewRoleAssignmentsClient() instead. -type RoleAssignmentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewRoleAssignmentsClient creates a new instance of RoleAssignmentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentsClient, error) { - cl, err := arm.NewClient(moduleName+".RoleAssignmentsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or update a role assignment by scope and name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// - roleAssignmentName - The name of the role assignment. It can be any valid GUID. -// - parameters - Parameters for the role assignment. -// - options - RoleAssignmentsClientCreateOptions contains the optional parameters for the RoleAssignmentsClient.Create method. -func (client *RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateOptions) (RoleAssignmentsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, scope, roleAssignmentName, parameters, options) - if err != nil { - return RoleAssignmentsClientCreateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return RoleAssignmentsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *RoleAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createHandleResponse handles the Create response. -func (client *RoleAssignmentsClient) createHandleResponse(resp *http.Response) (RoleAssignmentsClientCreateResponse, error) { - result := RoleAssignmentsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientCreateResponse{}, err - } - return result, nil -} - -// CreateByID - Create or update a role assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ -// - parameters - Parameters for the role assignment. -// - options - RoleAssignmentsClientCreateByIDOptions contains the optional parameters for the RoleAssignmentsClient.CreateByID -// method. -func (client *RoleAssignmentsClient) CreateByID(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateByIDOptions) (RoleAssignmentsClientCreateByIDResponse, error) { - req, err := client.createByIDCreateRequest(ctx, roleAssignmentID, parameters, options) - if err != nil { - return RoleAssignmentsClientCreateByIDResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientCreateByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return RoleAssignmentsClientCreateByIDResponse{}, runtime.NewResponseError(resp) - } - return client.createByIDHandleResponse(resp) -} - -// createByIDCreateRequest creates the CreateByID request. -func (client *RoleAssignmentsClient) createByIDCreateRequest(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsClientCreateByIDOptions) (*policy.Request, error) { - urlPath := "/{roleAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createByIDHandleResponse handles the CreateByID response. -func (client *RoleAssignmentsClient) createByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientCreateByIDResponse, error) { - result := RoleAssignmentsClientCreateByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientCreateByIDResponse{}, err - } - return result, nil -} - -// Delete - Delete a role assignment by scope and name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// - roleAssignmentName - The name of the role assignment. It can be any valid GUID. -// - options - RoleAssignmentsClientDeleteOptions contains the optional parameters for the RoleAssignmentsClient.Delete method. -func (client *RoleAssignmentsClient) Delete(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientDeleteOptions) (RoleAssignmentsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleAssignmentName, options) - if err != nil { - return RoleAssignmentsClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleAssignmentsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return client.deleteHandleResponse(resp) -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *RoleAssignmentsClient) deleteHandleResponse(resp *http.Response) (RoleAssignmentsClientDeleteResponse, error) { - result := RoleAssignmentsClientDeleteResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientDeleteResponse{}, err - } - return result, nil -} - -// DeleteByID - Delete a role assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ -// - options - RoleAssignmentsClientDeleteByIDOptions contains the optional parameters for the RoleAssignmentsClient.DeleteByID -// method. -func (client *RoleAssignmentsClient) DeleteByID(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientDeleteByIDOptions) (RoleAssignmentsClientDeleteByIDResponse, error) { - req, err := client.deleteByIDCreateRequest(ctx, roleAssignmentID, options) - if err != nil { - return RoleAssignmentsClientDeleteByIDResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientDeleteByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleAssignmentsClientDeleteByIDResponse{}, runtime.NewResponseError(resp) - } - return client.deleteByIDHandleResponse(resp) -} - -// deleteByIDCreateRequest creates the DeleteByID request. -func (client *RoleAssignmentsClient) deleteByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientDeleteByIDOptions) (*policy.Request, error) { - urlPath := "/{roleAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteByIDHandleResponse handles the DeleteByID response. -func (client *RoleAssignmentsClient) deleteByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientDeleteByIDResponse, error) { - result := RoleAssignmentsClientDeleteByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientDeleteByIDResponse{}, err - } - return result, nil -} - -// Get - Get a role assignment by scope and name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// - roleAssignmentName - The name of the role assignment. It can be any valid GUID. -// - options - RoleAssignmentsClientGetOptions contains the optional parameters for the RoleAssignmentsClient.Get method. -func (client *RoleAssignmentsClient) Get(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientGetOptions) (RoleAssignmentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleAssignmentName, options) - if err != nil { - return RoleAssignmentsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleAssignmentsClient) getHandleResponse(resp *http.Response) (RoleAssignmentsClientGetResponse, error) { - result := RoleAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// GetByID - Get a role assignment by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - roleAssignmentID - The fully qualified ID of the role assignment including scope, resource name, and resource type. Format: -// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: -// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ -// - options - RoleAssignmentsClientGetByIDOptions contains the optional parameters for the RoleAssignmentsClient.GetByID method. -func (client *RoleAssignmentsClient) GetByID(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientGetByIDOptions) (RoleAssignmentsClientGetByIDResponse, error) { - req, err := client.getByIDCreateRequest(ctx, roleAssignmentID, options) - if err != nil { - return RoleAssignmentsClientGetByIDResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientGetByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientGetByIDResponse{}, runtime.NewResponseError(resp) - } - return client.getByIDHandleResponse(resp) -} - -// getByIDCreateRequest creates the GetByID request. -func (client *RoleAssignmentsClient) getByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsClientGetByIDOptions) (*policy.Request, error) { - urlPath := "/{roleAssignmentId}" - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByIDHandleResponse handles the GetByID response. -func (client *RoleAssignmentsClient) getByIDHandleResponse(resp *http.Response) (RoleAssignmentsClientGetByIDResponse, error) { - result := RoleAssignmentsClientGetByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsClientGetByIDResponse{}, err - } - return result, nil -} - -// NewListForResourcePager - List all role assignments that apply to a resource. -// -// Generated from API version 2022-04-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - resourceProviderNamespace - The namespace of the resource provider. -// - resourceType - The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). -// - resourceName - The resource name. -// - options - RoleAssignmentsClientListForResourceOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourcePager -// method. -func (client *RoleAssignmentsClient) NewListForResourcePager(resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *RoleAssignmentsClientListForResourceOptions) *runtime.Pager[RoleAssignmentsClientListForResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForResourceResponse]{ - More: func(page RoleAssignmentsClientListForResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForResourceResponse) (RoleAssignmentsClientListForResourceResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceCreateRequest(ctx, resourceGroupName, resourceProviderNamespace, resourceType, resourceName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForResourceResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientListForResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceHandleResponse(resp) - }, - }) -} - -// listForResourceCreateRequest creates the ListForResource request. -func (client *RoleAssignmentsClient) listForResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, options *RoleAssignmentsClientListForResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", resourceName) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceHandleResponse handles the ListForResource response. -func (client *RoleAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (RoleAssignmentsClientListForResourceResponse, error) { - result := RoleAssignmentsClientListForResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForResourceResponse{}, err - } - return result, nil -} - -// NewListForResourceGroupPager - List all role assignments that apply to a resource group. -// -// Generated from API version 2022-04-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - RoleAssignmentsClientListForResourceGroupOptions contains the optional parameters for the RoleAssignmentsClient.NewListForResourceGroupPager -// method. -func (client *RoleAssignmentsClient) NewListForResourceGroupPager(resourceGroupName string, options *RoleAssignmentsClientListForResourceGroupOptions) *runtime.Pager[RoleAssignmentsClientListForResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForResourceGroupResponse]{ - More: func(page RoleAssignmentsClientListForResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForResourceGroupResponse) (RoleAssignmentsClientListForResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientListForResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listForResourceGroupHandleResponse(resp) - }, - }) -} - -// listForResourceGroupCreateRequest creates the ListForResourceGroup request. -func (client *RoleAssignmentsClient) listForResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *RoleAssignmentsClientListForResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForResourceGroupHandleResponse handles the ListForResourceGroup response. -func (client *RoleAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (RoleAssignmentsClientListForResourceGroupResponse, error) { - result := RoleAssignmentsClientListForResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForResourceGroupResponse{}, err - } - return result, nil -} - -// NewListForScopePager - List all role assignments that apply to a scope. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the operation or resource. Valid scopes are: subscription (format: '/subscriptions/{subscriptionId}'), -// resource group (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: -// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' -// - options - RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.NewListForScopePager -// method. -func (client *RoleAssignmentsClient) NewListForScopePager(scope string, options *RoleAssignmentsClientListForScopeOptions) *runtime.Pager[RoleAssignmentsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForScopeResponse]{ - More: func(page RoleAssignmentsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForScopeResponse) (RoleAssignmentsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - if options != nil && options.SkipToken != nil { - unencodedParams = append(unencodedParams, "$skipToken="+*options.SkipToken) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentsClientListForScopeResponse, error) { - result := RoleAssignmentsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForScopeResponse{}, err - } - return result, nil -} - -// NewListForSubscriptionPager - List all role assignments that apply to a subscription. -// -// Generated from API version 2022-04-01 -// - options - RoleAssignmentsClientListForSubscriptionOptions contains the optional parameters for the RoleAssignmentsClient.NewListForSubscriptionPager -// method. -func (client *RoleAssignmentsClient) NewListForSubscriptionPager(options *RoleAssignmentsClientListForSubscriptionOptions) *runtime.Pager[RoleAssignmentsClientListForSubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentsClientListForSubscriptionResponse]{ - More: func(page RoleAssignmentsClientListForSubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentsClientListForSubscriptionResponse) (RoleAssignmentsClientListForSubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForSubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentsClientListForSubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentsClientListForSubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentsClientListForSubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listForSubscriptionHandleResponse(resp) - }, - }) -} - -// listForSubscriptionCreateRequest creates the ListForSubscription request. -func (client *RoleAssignmentsClient) listForSubscriptionCreateRequest(ctx context.Context, options *RoleAssignmentsClientListForSubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - if options != nil && options.TenantID != nil { - reqQP.Set("tenantId", *options.TenantID) - } - req.Raw().URL.RawQuery = reqQP.Encode() - unencodedParams := []string{req.Raw().URL.RawQuery} - if options != nil && options.Filter != nil { - unencodedParams = append(unencodedParams, "$filter="+*options.Filter) - } - req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForSubscriptionHandleResponse handles the ListForSubscription response. -func (client *RoleAssignmentsClient) listForSubscriptionHandleResponse(resp *http.Response) (RoleAssignmentsClientListForSubscriptionResponse, error) { - result := RoleAssignmentsClientListForSubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsClientListForSubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go deleted file mode 100644 index 81bceceffe6c..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go +++ /dev/null @@ -1,489 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForSubscription.json -func ExampleRoleAssignmentsClient_NewListForSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListForSubscriptionPager(&armauthorization.RoleAssignmentsClientListForSubscriptionOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armauthorization.RoleAssignmentListResult{ - // Value: []*armauthorization.RoleAssignment{ - // { - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResourceGroup.json -func ExampleRoleAssignmentsClient_NewListForResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListForResourceGroupPager("testrg", &armauthorization.RoleAssignmentsClientListForResourceGroupOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armauthorization.RoleAssignmentListResult{ - // Value: []*armauthorization.RoleAssignment{ - // { - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // }, - // { - // Name: to.Ptr("96786e4b-dede-4c2e-8736-8ab911987f08"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.Authorization/roleAssignments/96786e4b-dede-4c2e-8736-8ab911987f08"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResource.json -func ExampleRoleAssignmentsClient_NewListForResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListForResourcePager("testrg", "Microsoft.DocumentDb", "databaseAccounts", "test-db-account", &armauthorization.RoleAssignmentsClientListForResourceOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armauthorization.RoleAssignmentListResult{ - // Value: []*armauthorization.RoleAssignment{ - // { - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // }, - // { - // Name: to.Ptr("96786e4b-dede-4c2e-8736-8ab911987f08"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.Authorization/roleAssignments/96786e4b-dede-4c2e-8736-8ab911987f08"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg"), - // }, - // }, - // { - // Name: to.Ptr("05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Get.json -func ExampleRoleAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().Get(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", "b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientGetOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResource.json -func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().Create(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", "05c5a614-a7d6-4502-b150-c2fb455033ff", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResourceGroup.json -func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().Create(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg", "05c5a614-a7d6-4502-b150-c2fb455033ff", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForSubscription.json -func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().Create(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", "05c5a614-a7d6-4502-b150-c2fb455033ff", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Delete.json -func ExampleRoleAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().Delete(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", "b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientDeleteOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForScope.json -func ExampleRoleAssignmentsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentsClient().NewListForScopePager("subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", &armauthorization.RoleAssignmentsClientListForScopeOptions{Filter: nil, - TenantID: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentListResult = armauthorization.RoleAssignmentListResult{ - // Value: []*armauthorization.RoleAssignment{ - // { - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_GetById.json -func ExampleRoleAssignmentsClient_GetByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().GetByID(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientGetByIDOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateById.json -func ExampleRoleAssignmentsClient_CreateByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().CreateByID(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", armauthorization.RoleAssignmentCreateParameters{ - Properties: &armauthorization.RoleAssignmentProperties{ - PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_DeleteById.json -func ExampleRoleAssignmentsClient_DeleteByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentsClient().DeleteByID(ctx, "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747", &armauthorization.RoleAssignmentsClientDeleteByIDOptions{TenantID: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignment = armauthorization.RoleAssignment{ - // Name: to.Ptr("b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Type: to.Ptr("Microsoft.Authorization/roleAssignments"), - // ID: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/b0f43c54-e787-4862-89b1-a653fa9cf747"), - // Properties: &armauthorization.RoleAssignmentProperties{ - // PrincipalID: to.Ptr("ce2ce14e-85d7-4629-bdbc-454d0519d987"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d"), - // Scope: to.Ptr("/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"), - // }, - // } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go deleted file mode 100644 index a075a48037f6..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleAssignmentScheduleInstancesClient contains the methods for the RoleAssignmentScheduleInstances group. -// Don't use this type directly, use NewRoleAssignmentScheduleInstancesClient() instead. -type RoleAssignmentScheduleInstancesClient struct { - internal *arm.Client -} - -// NewRoleAssignmentScheduleInstancesClient creates a new instance of RoleAssignmentScheduleInstancesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleAssignmentScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentScheduleInstancesClient, error) { - cl, err := arm.NewClient(moduleName+".RoleAssignmentScheduleInstancesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentScheduleInstancesClient{ - internal: cl, - } - return client, nil -} - -// Get - Gets the specified role assignment schedule instance. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignments schedules. -// - roleAssignmentScheduleInstanceName - The name (hash of schedule name + time) of the role assignment schedule to get. -// - options - RoleAssignmentScheduleInstancesClientGetOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.Get -// method. -func (client *RoleAssignmentScheduleInstancesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string, options *RoleAssignmentScheduleInstancesClientGetOptions) (RoleAssignmentScheduleInstancesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleInstanceName, options) - if err != nil { - return RoleAssignmentScheduleInstancesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentScheduleInstancesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleInstancesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleAssignmentScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string, options *RoleAssignmentScheduleInstancesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleInstanceName == "" { - return nil, errors.New("parameter roleAssignmentScheduleInstanceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleInstanceName}", url.PathEscape(roleAssignmentScheduleInstanceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleAssignmentScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesClientGetResponse, error) { - result := RoleAssignmentScheduleInstancesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstance); err != nil { - return RoleAssignmentScheduleInstancesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role assignment schedule instances of a role assignment schedule. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignment schedule. -// - options - RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.NewListForScopePager -// method. -func (client *RoleAssignmentScheduleInstancesClient) NewListForScopePager(scope string, options *RoleAssignmentScheduleInstancesClientListForScopeOptions) *runtime.Pager[RoleAssignmentScheduleInstancesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentScheduleInstancesClientListForScopeResponse]{ - More: func(page RoleAssignmentScheduleInstancesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentScheduleInstancesClientListForScopeResponse) (RoleAssignmentScheduleInstancesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleAssignmentScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentScheduleInstancesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleAssignmentScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesClientListForScopeResponse, error) { - result := RoleAssignmentScheduleInstancesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstanceListResult); err != nil { - return RoleAssignmentScheduleInstancesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go deleted file mode 100644 index a42559a020dc..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go +++ /dev/null @@ -1,149 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleInstancesByScope.json -func ExampleRoleAssignmentScheduleInstancesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentScheduleInstancesClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentScheduleInstancesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentScheduleInstanceListResult = armauthorization.RoleAssignmentScheduleInstanceListResult{ - // Value: []*armauthorization.RoleAssignmentScheduleInstance{ - // { - // Name: to.Ptr("ed9b8180-cef7-4c77-a63c-b8566ecfc412"), - // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleInstances/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), - // Properties: &armauthorization.RoleAssignmentScheduleInstanceProperties{ - // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T05:35:17.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // LinkedRoleEligibilityScheduleInstanceID: to.Ptr("21e4b59a-0499-4fe0-a3c3-43a3055b773a"), - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // OriginRoleAssignmentID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleAssignments/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusAccepted), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleInstanceByName.json -func ExampleRoleAssignmentScheduleInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentScheduleInstancesClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "ed9b8180-cef7-4c77-a63c-b8566ecfc412", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentScheduleInstance = armauthorization.RoleAssignmentScheduleInstance{ - // Name: to.Ptr("ed9b8180-cef7-4c77-a63c-b8566ecfc412"), - // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleInstances/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), - // Properties: &armauthorization.RoleAssignmentScheduleInstanceProperties{ - // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T05:35:17.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // LinkedRoleEligibilityScheduleInstanceID: to.Ptr("21e4b59a-0499-4fe0-a3c3-43a3055b773a"), - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // OriginRoleAssignmentID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleAssignments/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusAccepted), - // }, - // } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go deleted file mode 100644 index 08733fdd3847..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go +++ /dev/null @@ -1,305 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleAssignmentScheduleRequestsClient contains the methods for the RoleAssignmentScheduleRequests group. -// Don't use this type directly, use NewRoleAssignmentScheduleRequestsClient() instead. -type RoleAssignmentScheduleRequestsClient struct { - internal *arm.Client -} - -// NewRoleAssignmentScheduleRequestsClient creates a new instance of RoleAssignmentScheduleRequestsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleAssignmentScheduleRequestsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentScheduleRequestsClient, error) { - cl, err := arm.NewClient(moduleName+".RoleAssignmentScheduleRequestsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentScheduleRequestsClient{ - internal: cl, - } - return client, nil -} - -// Cancel - Cancels a pending role assignment schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignment request to cancel. -// - roleAssignmentScheduleRequestName - The name of the role assignment request to cancel. -// - options - RoleAssignmentScheduleRequestsClientCancelOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Cancel -// method. -func (client *RoleAssignmentScheduleRequestsClient) Cancel(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientCancelOptions) (RoleAssignmentScheduleRequestsClientCancelResponse, error) { - req, err := client.cancelCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, options) - if err != nil { - return RoleAssignmentScheduleRequestsClientCancelResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentScheduleRequestsClientCancelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleRequestsClientCancelResponse{}, runtime.NewResponseError(resp) - } - return RoleAssignmentScheduleRequestsClientCancelResponse{}, nil -} - -// cancelCreateRequest creates the Cancel request. -func (client *RoleAssignmentScheduleRequestsClient) cancelCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientCancelOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleRequestName == "" { - return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Create - Creates a role assignment schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignment schedule request to create. The scope can be any REST resource instance. For example, -// use '/subscriptions/{subscription-id}/' for a subscription, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' -// for a resource. -// - roleAssignmentScheduleRequestName - A GUID for the role assignment to create. The name must be unique and different for -// each role assignment. -// - parameters - Parameters for the role assignment schedule request. -// - options - RoleAssignmentScheduleRequestsClientCreateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Create -// method. -func (client *RoleAssignmentScheduleRequestsClient) Create(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientCreateOptions) (RoleAssignmentScheduleRequestsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, parameters, options) - if err != nil { - return RoleAssignmentScheduleRequestsClientCreateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentScheduleRequestsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return RoleAssignmentScheduleRequestsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *RoleAssignmentScheduleRequestsClient) createCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleRequestName == "" { - return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createHandleResponse handles the Create response. -func (client *RoleAssignmentScheduleRequestsClient) createHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientCreateResponse, error) { - result := RoleAssignmentScheduleRequestsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { - return RoleAssignmentScheduleRequestsClientCreateResponse{}, err - } - return result, nil -} - -// Get - Get the specified role assignment schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignment schedule request. -// - roleAssignmentScheduleRequestName - The name (guid) of the role assignment schedule request to get. -// - options - RoleAssignmentScheduleRequestsClientGetOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Get -// method. -func (client *RoleAssignmentScheduleRequestsClient) Get(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientGetOptions) (RoleAssignmentScheduleRequestsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, options) - if err != nil { - return RoleAssignmentScheduleRequestsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentScheduleRequestsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleRequestsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleAssignmentScheduleRequestsClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleRequestName == "" { - return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleAssignmentScheduleRequestsClient) getHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientGetResponse, error) { - result := RoleAssignmentScheduleRequestsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { - return RoleAssignmentScheduleRequestsClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role assignment schedule requests for a scope. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignments schedule requests. -// - options - RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.NewListForScopePager -// method. -func (client *RoleAssignmentScheduleRequestsClient) NewListForScopePager(scope string, options *RoleAssignmentScheduleRequestsClientListForScopeOptions) *runtime.Pager[RoleAssignmentScheduleRequestsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentScheduleRequestsClientListForScopeResponse]{ - More: func(page RoleAssignmentScheduleRequestsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentScheduleRequestsClientListForScopeResponse) (RoleAssignmentScheduleRequestsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentScheduleRequestsClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentScheduleRequestsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleRequestsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleAssignmentScheduleRequestsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentScheduleRequestsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleAssignmentScheduleRequestsClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientListForScopeResponse, error) { - result := RoleAssignmentScheduleRequestsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequestListResult); err != nil { - return RoleAssignmentScheduleRequestsClientListForScopeResponse{}, err - } - return result, nil -} - -// Validate - Validates a new role assignment schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignment request to validate. -// - roleAssignmentScheduleRequestName - The name of the role assignment request to validate. -// - parameters - Parameters for the role assignment schedule request. -// - options - RoleAssignmentScheduleRequestsClientValidateOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.Validate -// method. -func (client *RoleAssignmentScheduleRequestsClient) Validate(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientValidateOptions) (RoleAssignmentScheduleRequestsClientValidateResponse, error) { - req, err := client.validateCreateRequest(ctx, scope, roleAssignmentScheduleRequestName, parameters, options) - if err != nil { - return RoleAssignmentScheduleRequestsClientValidateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentScheduleRequestsClientValidateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentScheduleRequestsClientValidateResponse{}, runtime.NewResponseError(resp) - } - return client.validateHandleResponse(resp) -} - -// validateCreateRequest creates the Validate request. -func (client *RoleAssignmentScheduleRequestsClient) validateCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsClientValidateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/validate" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleRequestName == "" { - return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleRequestName}", url.PathEscape(roleAssignmentScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// validateHandleResponse handles the Validate response. -func (client *RoleAssignmentScheduleRequestsClient) validateHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsClientValidateResponse, error) { - result := RoleAssignmentScheduleRequestsClientValidateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { - return RoleAssignmentScheduleRequestsClientValidateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go deleted file mode 100644 index e80073b299cc..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go +++ /dev/null @@ -1,290 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleAssignmentScheduleRequest.json -func ExampleRoleAssignmentScheduleRequestsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentScheduleRequestsClient().Create(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", armauthorization.RoleAssignmentScheduleRequest{ - Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeSelfActivate), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("PT8H"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleRequestByName.json -func ExampleRoleAssignmentScheduleRequestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentScheduleRequestsClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentScheduleRequest = armauthorization.RoleAssignmentScheduleRequest{ - // Name: to.Ptr("fea7a502-9a96-4806-a26f-eee560e52045"), - // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), - // Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RequestType: to.Ptr(armauthorization.RequestTypeSelfActivate), - // RequestorID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // ScheduleInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfo{ - // Expiration: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration{ - // Type: to.Ptr(armauthorization.TypeAfterDuration), - // Duration: to.Ptr("PT8H"), - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // TargetRoleAssignmentScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // TicketInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesTicketInfo{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleRequestByScope.json -func ExampleRoleAssignmentScheduleRequestsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentScheduleRequestsClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentScheduleRequestsClientListForScopeOptions{Filter: to.Ptr("assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentScheduleRequestListResult = armauthorization.RoleAssignmentScheduleRequestListResult{ - // Value: []*armauthorization.RoleAssignmentScheduleRequest{ - // { - // Name: to.Ptr("fea7a502-9a96-4806-a26f-eee560e52045"), - // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), - // Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RequestType: to.Ptr(armauthorization.RequestTypeSelfActivate), - // RequestorID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // ScheduleInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfo{ - // Expiration: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration{ - // Type: to.Ptr(armauthorization.TypeAfterDuration), - // Duration: to.Ptr("PT8H"), - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // TargetRoleAssignmentScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // TicketInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesTicketInfo{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/CancelRoleAssignmentScheduleRequestByName.json -func ExampleRoleAssignmentScheduleRequestsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleAssignmentScheduleRequestsClient().Cancel(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/ValidateRoleAssignmentScheduleRequestByName.json -func ExampleRoleAssignmentScheduleRequestsClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentScheduleRequestsClient().Validate(ctx, "subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "fea7a502-9a96-4806-a26f-eee560e52045", armauthorization.RoleAssignmentScheduleRequest{ - Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeSelfActivate), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("PT8H"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentScheduleRequest = armauthorization.RoleAssignmentScheduleRequest{ - // Name: to.Ptr("fea7a502-9a96-4806-a26f-eee560e52045"), - // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), - // Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RequestType: to.Ptr(armauthorization.RequestTypeSelfActivate), - // RequestorID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // ScheduleInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfo{ - // Expiration: &armauthorization.RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration{ - // Type: to.Ptr(armauthorization.TypeAfterDuration), - // Duration: to.Ptr("PT8H"), - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // TargetRoleAssignmentScheduleID: to.Ptr("c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), - // TicketInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesTicketInfo{ - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go deleted file mode 100644 index 0951657afeed..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleAssignmentSchedulesClient contains the methods for the RoleAssignmentSchedules group. -// Don't use this type directly, use NewRoleAssignmentSchedulesClient() instead. -type RoleAssignmentSchedulesClient struct { - internal *arm.Client -} - -// NewRoleAssignmentSchedulesClient creates a new instance of RoleAssignmentSchedulesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleAssignmentSchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleAssignmentSchedulesClient, error) { - cl, err := arm.NewClient(moduleName+".RoleAssignmentSchedulesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentSchedulesClient{ - internal: cl, - } - return client, nil -} - -// Get - Get the specified role assignment schedule for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignment schedule. -// - roleAssignmentScheduleName - The name (guid) of the role assignment schedule to get. -// - options - RoleAssignmentSchedulesClientGetOptions contains the optional parameters for the RoleAssignmentSchedulesClient.Get -// method. -func (client *RoleAssignmentSchedulesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleName string, options *RoleAssignmentSchedulesClientGetOptions) (RoleAssignmentSchedulesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleAssignmentScheduleName, options) - if err != nil { - return RoleAssignmentSchedulesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentSchedulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentSchedulesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleAssignmentSchedulesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleName string, options *RoleAssignmentSchedulesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentScheduleName == "" { - return nil, errors.New("parameter roleAssignmentScheduleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentScheduleName}", url.PathEscape(roleAssignmentScheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleAssignmentSchedulesClient) getHandleResponse(resp *http.Response) (RoleAssignmentSchedulesClientGetResponse, error) { - result := RoleAssignmentSchedulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentSchedule); err != nil { - return RoleAssignmentSchedulesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role assignment schedules for a resource scope. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role assignments schedules. -// - options - RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.NewListForScopePager -// method. -func (client *RoleAssignmentSchedulesClient) NewListForScopePager(scope string, options *RoleAssignmentSchedulesClientListForScopeOptions) *runtime.Pager[RoleAssignmentSchedulesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleAssignmentSchedulesClientListForScopeResponse]{ - More: func(page RoleAssignmentSchedulesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleAssignmentSchedulesClientListForScopeResponse) (RoleAssignmentSchedulesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleAssignmentSchedulesClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleAssignmentSchedulesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleAssignmentSchedulesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleAssignmentSchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentSchedulesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleAssignmentSchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentSchedulesClientListForScopeResponse, error) { - result := RoleAssignmentSchedulesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleListResult); err != nil { - return RoleAssignmentSchedulesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go deleted file mode 100644 index 4e0005d52e66..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go +++ /dev/null @@ -1,147 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleByName.json -func ExampleRoleAssignmentSchedulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleAssignmentSchedulesClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "c9e264ff-3133-4776-a81a-ebc7c33c8ec6", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleAssignmentSchedule = armauthorization.RoleAssignmentSchedule{ - // Name: to.Ptr("c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), - // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentSchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), - // Properties: &armauthorization.RoleAssignmentScheduleProperties{ - // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T05:35:17.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentSchedulesByScope.json -func ExampleRoleAssignmentSchedulesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleAssignmentSchedulesClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentSchedulesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleAssignmentScheduleListResult = armauthorization.RoleAssignmentScheduleListResult{ - // Value: []*armauthorization.RoleAssignmentSchedule{ - // { - // Name: to.Ptr("c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), - // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentSchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), - // Properties: &armauthorization.RoleAssignmentScheduleProperties{ - // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T05:35:17.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go deleted file mode 100644 index b63a06cd91f5..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go +++ /dev/null @@ -1,302 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleDefinitionsClient contains the methods for the RoleDefinitions group. -// Don't use this type directly, use NewRoleDefinitionsClient() instead. -type RoleDefinitionsClient struct { - internal *arm.Client -} - -// NewRoleDefinitionsClient creates a new instance of RoleDefinitionsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleDefinitionsClient, error) { - cl, err := arm.NewClient(moduleName+".RoleDefinitionsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleDefinitionsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a role definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the role definition. -// - roleDefinitionID - The ID of the role definition. -// - roleDefinition - The values for the role definition. -// - options - RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate -// method. -func (client *RoleDefinitionsClient) CreateOrUpdate(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsClientCreateOrUpdateOptions) (RoleDefinitionsClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, scope, roleDefinitionID, roleDefinition, options) - if err != nil { - return RoleDefinitionsClientCreateOrUpdateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleDefinitionsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return RoleDefinitionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RoleDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleDefinitionID == "" { - return nil, errors.New("parameter roleDefinitionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, roleDefinition) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *RoleDefinitionsClient) createOrUpdateHandleResponse(resp *http.Response) (RoleDefinitionsClientCreateOrUpdateResponse, error) { - result := RoleDefinitionsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a role definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the role definition. -// - roleDefinitionID - The ID of the role definition to delete. -// - options - RoleDefinitionsClientDeleteOptions contains the optional parameters for the RoleDefinitionsClient.Delete method. -func (client *RoleDefinitionsClient) Delete(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientDeleteOptions) (RoleDefinitionsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleDefinitionID, options) - if err != nil { - return RoleDefinitionsClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleDefinitionsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleDefinitionsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return client.deleteHandleResponse(resp) -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleDefinitionsClient) deleteCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleDefinitionID == "" { - return nil, errors.New("parameter roleDefinitionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// deleteHandleResponse handles the Delete response. -func (client *RoleDefinitionsClient) deleteHandleResponse(resp *http.Response) (RoleDefinitionsClientDeleteResponse, error) { - result := RoleDefinitionsClientDeleteResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientDeleteResponse{}, err - } - return result, nil -} - -// Get - Get role definition by name (GUID). -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the role definition. -// - roleDefinitionID - The ID of the role definition. -// - options - RoleDefinitionsClientGetOptions contains the optional parameters for the RoleDefinitionsClient.Get method. -func (client *RoleDefinitionsClient) Get(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientGetOptions) (RoleDefinitionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleDefinitionID, options) - if err != nil { - return RoleDefinitionsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleDefinitionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleDefinitionsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleDefinitionsClient) getCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleDefinitionID == "" { - return nil, errors.New("parameter roleDefinitionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleDefinitionId}", url.PathEscape(roleDefinitionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleDefinitionsClient) getHandleResponse(resp *http.Response) (RoleDefinitionsClientGetResponse, error) { - result := RoleDefinitionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientGetResponse{}, err - } - return result, nil -} - -// GetByID - Gets a role definition by ID. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-04-01 -// - roleID - The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} -// for subscription level role definitions, or -// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions. -// - options - RoleDefinitionsClientGetByIDOptions contains the optional parameters for the RoleDefinitionsClient.GetByID method. -func (client *RoleDefinitionsClient) GetByID(ctx context.Context, roleID string, options *RoleDefinitionsClientGetByIDOptions) (RoleDefinitionsClientGetByIDResponse, error) { - req, err := client.getByIDCreateRequest(ctx, roleID, options) - if err != nil { - return RoleDefinitionsClientGetByIDResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleDefinitionsClientGetByIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) - } - return client.getByIDHandleResponse(resp) -} - -// getByIDCreateRequest creates the GetByID request. -func (client *RoleDefinitionsClient) getByIDCreateRequest(ctx context.Context, roleID string, options *RoleDefinitionsClientGetByIDOptions) (*policy.Request, error) { - urlPath := "/{roleId}" - urlPath = strings.ReplaceAll(urlPath, "{roleId}", roleID) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getByIDHandleResponse handles the GetByID response. -func (client *RoleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (RoleDefinitionsClientGetByIDResponse, error) { - result := RoleDefinitionsClientGetByIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsClientGetByIDResponse{}, err - } - return result, nil -} - -// NewListPager - Get all role definitions that are applicable at scope and above. -// -// Generated from API version 2022-04-01 -// - scope - The scope of the role definition. -// - options - RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.NewListPager -// method. -func (client *RoleDefinitionsClient) NewListPager(scope string, options *RoleDefinitionsClientListOptions) *runtime.Pager[RoleDefinitionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleDefinitionsClientListResponse]{ - More: func(page RoleDefinitionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleDefinitionsClientListResponse) (RoleDefinitionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleDefinitionsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleDefinitionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleDefinitionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *RoleDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *RoleDefinitionsClientListOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2022-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *RoleDefinitionsClient) listHandleResponse(resp *http.Response) (RoleDefinitionsClientListResponse, error) { - result := RoleDefinitionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinitionListResult); err != nil { - return RoleDefinitionsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go deleted file mode 100644 index 7a333c84336b..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go +++ /dev/null @@ -1,215 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/DeleteRoleDefinition.json -func ExampleRoleDefinitionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionsClient().Delete(ctx, "scope", "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armauthorization.RoleDefinition{ - // Name: to.Ptr("roleDefinitionId"), - // Type: to.Ptr("Microsoft.Authorization/roleDefinitions"), - // ID: to.Ptr("/subscriptions/subID/providers/Microsoft.Authorization/roleDefinitions/roleDefinitionId"), - // Properties: &armauthorization.RoleDefinitionProperties{ - // RoleType: to.Ptr("roletype"), - // Description: to.Ptr("Role description"), - // AssignableScopes: []*string{ - // to.Ptr("/subscriptions/subId")}, - // Permissions: []*armauthorization.Permission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("dataAction")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Role name"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionByName.json -func ExampleRoleDefinitionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionsClient().Get(ctx, "scope", "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armauthorization.RoleDefinition{ - // Name: to.Ptr("roleDefinitionId"), - // Type: to.Ptr("Microsoft.Authorization/roleDefinitions"), - // ID: to.Ptr("/subscriptions/subID/providers/Microsoft.Authorization/roleDefinitions/roleDefinitionId"), - // Properties: &armauthorization.RoleDefinitionProperties{ - // RoleType: to.Ptr("roletype"), - // Description: to.Ptr("Role description"), - // AssignableScopes: []*string{ - // to.Ptr("/subscriptions/subId")}, - // Permissions: []*armauthorization.Permission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("dataAction")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Role name"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/PutRoleDefinition.json -func ExampleRoleDefinitionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleDefinitionsClient().CreateOrUpdate(ctx, "scope", "roleDefinitionId", armauthorization.RoleDefinition{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionAtScope.json -func ExampleRoleDefinitionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleDefinitionsClient().NewListPager("scope", &armauthorization.RoleDefinitionsClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleDefinitionListResult = armauthorization.RoleDefinitionListResult{ - // Value: []*armauthorization.RoleDefinition{ - // { - // Name: to.Ptr("roleDefinitionId"), - // Type: to.Ptr("Microsoft.Authorization/roleDefinitions"), - // ID: to.Ptr("/subscriptions/subID/providers/Microsoft.Authorization/roleDefinitions/roleDefinitionId"), - // Properties: &armauthorization.RoleDefinitionProperties{ - // RoleType: to.Ptr("roletype"), - // Description: to.Ptr("Role description"), - // AssignableScopes: []*string{ - // to.Ptr("/subscriptions/subId")}, - // Permissions: []*armauthorization.Permission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("dataAction")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Role name"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionById.json -func ExampleRoleDefinitionsClient_GetByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleDefinitionsClient().GetByID(ctx, "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleDefinition = armauthorization.RoleDefinition{ - // Name: to.Ptr("roleDefinitionId"), - // Type: to.Ptr("Microsoft.Authorization/roleDefinitions"), - // ID: to.Ptr("/subscriptions/subID/providers/Microsoft.Authorization/roleDefinitions/roleDefinitionId"), - // Properties: &armauthorization.RoleDefinitionProperties{ - // RoleType: to.Ptr("roletype"), - // Description: to.Ptr("Role description"), - // AssignableScopes: []*string{ - // to.Ptr("/subscriptions/subId")}, - // Permissions: []*armauthorization.Permission{ - // { - // Actions: []*string{ - // to.Ptr("action")}, - // DataActions: []*string{ - // to.Ptr("dataAction")}, - // NotActions: []*string{ - // }, - // NotDataActions: []*string{ - // }, - // }}, - // RoleName: to.Ptr("Role name"), - // }, - // } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go deleted file mode 100644 index 67cda0be90f9..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleEligibilityScheduleInstancesClient contains the methods for the RoleEligibilityScheduleInstances group. -// Don't use this type directly, use NewRoleEligibilityScheduleInstancesClient() instead. -type RoleEligibilityScheduleInstancesClient struct { - internal *arm.Client -} - -// NewRoleEligibilityScheduleInstancesClient creates a new instance of RoleEligibilityScheduleInstancesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleEligibilityScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilityScheduleInstancesClient, error) { - cl, err := arm.NewClient(moduleName+".RoleEligibilityScheduleInstancesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleEligibilityScheduleInstancesClient{ - internal: cl, - } - return client, nil -} - -// Get - Gets the specified role eligibility schedule instance. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility schedules. -// - roleEligibilityScheduleInstanceName - The name (hash of schedule name + time) of the role eligibility schedule to get. -// - options - RoleEligibilityScheduleInstancesClientGetOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.Get -// method. -func (client *RoleEligibilityScheduleInstancesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string, options *RoleEligibilityScheduleInstancesClientGetOptions) (RoleEligibilityScheduleInstancesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleInstanceName, options) - if err != nil { - return RoleEligibilityScheduleInstancesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilityScheduleInstancesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleInstancesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleEligibilityScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string, options *RoleEligibilityScheduleInstancesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleInstanceName == "" { - return nil, errors.New("parameter roleEligibilityScheduleInstanceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleInstanceName}", url.PathEscape(roleEligibilityScheduleInstanceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleEligibilityScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesClientGetResponse, error) { - result := RoleEligibilityScheduleInstancesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstance); err != nil { - return RoleEligibilityScheduleInstancesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role eligibility schedule instances of a role eligibility schedule. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility schedule. -// - options - RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.NewListForScopePager -// method. -func (client *RoleEligibilityScheduleInstancesClient) NewListForScopePager(scope string, options *RoleEligibilityScheduleInstancesClientListForScopeOptions) *runtime.Pager[RoleEligibilityScheduleInstancesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleEligibilityScheduleInstancesClientListForScopeResponse]{ - More: func(page RoleEligibilityScheduleInstancesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleEligibilityScheduleInstancesClientListForScopeResponse) (RoleEligibilityScheduleInstancesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleEligibilityScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleInstancesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleEligibilityScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesClientListForScopeResponse, error) { - result := RoleEligibilityScheduleInstancesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstanceListResult); err != nil { - return RoleEligibilityScheduleInstancesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go deleted file mode 100644 index 7715f6a28c74..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go +++ /dev/null @@ -1,141 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleInstancesByScope.json -func ExampleRoleEligibilityScheduleInstancesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleEligibilityScheduleInstancesClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilityScheduleInstancesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleEligibilityScheduleInstanceListResult = armauthorization.RoleEligibilityScheduleInstanceListResult{ - // Value: []*armauthorization.RoleEligibilityScheduleInstance{ - // { - // Name: to.Ptr("21e4b59a-0499-4fe0-a3c3-43a3055b773a"), - // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleInstances/21e4b59a-0499-4fe0-a3c3-43a3055b773a"), - // Properties: &armauthorization.RoleEligibilityScheduleInstanceProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T00:32:36.86Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-10T00:31:41.477Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T00:32:36.86Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleInstanceByName.json -func ExampleRoleEligibilityScheduleInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleEligibilityScheduleInstancesClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "21e4b59a-0499-4fe0-a3c3-43a3055b773a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleEligibilityScheduleInstance = armauthorization.RoleEligibilityScheduleInstance{ - // Name: to.Ptr("21e4b59a-0499-4fe0-a3c3-43a3055b773a"), - // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleInstances/21e4b59a-0499-4fe0-a3c3-43a3055b773a"), - // Properties: &armauthorization.RoleEligibilityScheduleInstanceProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T00:32:36.86Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-10T00:31:41.477Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T00:32:36.86Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // }, - // } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go deleted file mode 100644 index 6e9f899172aa..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go +++ /dev/null @@ -1,304 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleEligibilityScheduleRequestsClient contains the methods for the RoleEligibilityScheduleRequests group. -// Don't use this type directly, use NewRoleEligibilityScheduleRequestsClient() instead. -type RoleEligibilityScheduleRequestsClient struct { - internal *arm.Client -} - -// NewRoleEligibilityScheduleRequestsClient creates a new instance of RoleEligibilityScheduleRequestsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleEligibilityScheduleRequestsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilityScheduleRequestsClient, error) { - cl, err := arm.NewClient(moduleName+".RoleEligibilityScheduleRequestsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleEligibilityScheduleRequestsClient{ - internal: cl, - } - return client, nil -} - -// Cancel - Cancels a pending role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility request to cancel. -// - roleEligibilityScheduleRequestName - The name of the role eligibility request to cancel. -// - options - RoleEligibilityScheduleRequestsClientCancelOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Cancel -// method. -func (client *RoleEligibilityScheduleRequestsClient) Cancel(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientCancelOptions) (RoleEligibilityScheduleRequestsClientCancelResponse, error) { - req, err := client.cancelCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientCancelResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientCancelResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientCancelResponse{}, runtime.NewResponseError(resp) - } - return RoleEligibilityScheduleRequestsClientCancelResponse{}, nil -} - -// cancelCreateRequest creates the Cancel request. -func (client *RoleEligibilityScheduleRequestsClient) cancelCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientCancelOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Create - Creates a role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility schedule request to create. The scope can be any REST resource instance. For -// example, use '/subscriptions/{subscription-id}/' for a subscription, -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and -// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' -// for a resource. -// - roleEligibilityScheduleRequestName - The name of the role eligibility to create. It can be any valid GUID. -// - parameters - Parameters for the role eligibility schedule request. -// - options - RoleEligibilityScheduleRequestsClientCreateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Create -// method. -func (client *RoleEligibilityScheduleRequestsClient) Create(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientCreateOptions) (RoleEligibilityScheduleRequestsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, parameters, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *RoleEligibilityScheduleRequestsClient) createCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createHandleResponse handles the Create response. -func (client *RoleEligibilityScheduleRequestsClient) createHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientCreateResponse, error) { - result := RoleEligibilityScheduleRequestsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsClientCreateResponse{}, err - } - return result, nil -} - -// Get - Get the specified role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility schedule request. -// - roleEligibilityScheduleRequestName - The name (guid) of the role eligibility schedule request to get. -// - options - RoleEligibilityScheduleRequestsClientGetOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Get -// method. -func (client *RoleEligibilityScheduleRequestsClient) Get(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientGetOptions) (RoleEligibilityScheduleRequestsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleEligibilityScheduleRequestsClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleEligibilityScheduleRequestsClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientGetResponse, error) { - result := RoleEligibilityScheduleRequestsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role eligibility schedule requests for a scope. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility schedule requests. -// - options - RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.NewListForScopePager -// method. -func (client *RoleEligibilityScheduleRequestsClient) NewListForScopePager(scope string, options *RoleEligibilityScheduleRequestsClientListForScopeOptions) *runtime.Pager[RoleEligibilityScheduleRequestsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleEligibilityScheduleRequestsClientListForScopeResponse]{ - More: func(page RoleEligibilityScheduleRequestsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleEligibilityScheduleRequestsClientListForScopeResponse) (RoleEligibilityScheduleRequestsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleEligibilityScheduleRequestsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleRequestsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleEligibilityScheduleRequestsClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientListForScopeResponse, error) { - result := RoleEligibilityScheduleRequestsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequestListResult); err != nil { - return RoleEligibilityScheduleRequestsClientListForScopeResponse{}, err - } - return result, nil -} - -// Validate - Validates a new role eligibility schedule request. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility request to validate. -// - roleEligibilityScheduleRequestName - The name of the role eligibility request to validate. -// - parameters - Parameters for the role eligibility schedule request. -// - options - RoleEligibilityScheduleRequestsClientValidateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Validate -// method. -func (client *RoleEligibilityScheduleRequestsClient) Validate(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientValidateOptions) (RoleEligibilityScheduleRequestsClientValidateResponse, error) { - req, err := client.validateCreateRequest(ctx, scope, roleEligibilityScheduleRequestName, parameters, options) - if err != nil { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, runtime.NewResponseError(resp) - } - return client.validateHandleResponse(resp) -} - -// validateCreateRequest creates the Validate request. -func (client *RoleEligibilityScheduleRequestsClient) validateCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsClientValidateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/validate" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleRequestName == "" { - return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleRequestName}", url.PathEscape(roleEligibilityScheduleRequestName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// validateHandleResponse handles the Validate response. -func (client *RoleEligibilityScheduleRequestsClient) validateHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsClientValidateResponse, error) { - result := RoleEligibilityScheduleRequestsClientValidateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsClientValidateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go deleted file mode 100644 index 0a2717a109e1..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go +++ /dev/null @@ -1,288 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleEligibilityScheduleRequest.json -func ExampleRoleEligibilityScheduleRequestsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleEligibilityScheduleRequestsClient().Create(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", armauthorization.RoleEligibilityScheduleRequest{ - Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeAdminAssign), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("P365D"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleRequestByName.json -func ExampleRoleEligibilityScheduleRequestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleEligibilityScheduleRequestsClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleEligibilityScheduleRequest = armauthorization.RoleEligibilityScheduleRequest{ - // Name: to.Ptr("64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:32:27.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RequestType: to.Ptr(armauthorization.RequestTypeAdminAssign), - // RequestorID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // ScheduleInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfo{ - // Expiration: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration{ - // Type: to.Ptr(armauthorization.TypeAfterDuration), - // Duration: to.Ptr("P365D"), - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t}()), - // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // TargetRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // TicketInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesTicketInfo{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleRequestByScope.json -func ExampleRoleEligibilityScheduleRequestsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleEligibilityScheduleRequestsClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilityScheduleRequestsClientListForScopeOptions{Filter: to.Ptr("assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleEligibilityScheduleRequestListResult = armauthorization.RoleEligibilityScheduleRequestListResult{ - // Value: []*armauthorization.RoleEligibilityScheduleRequest{ - // { - // Name: to.Ptr("64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:32:27.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RequestType: to.Ptr(armauthorization.RequestTypeAdminAssign), - // RequestorID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // ScheduleInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfo{ - // Expiration: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration{ - // Type: to.Ptr(armauthorization.TypeAfterDuration), - // Duration: to.Ptr("P365D"), - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t}()), - // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // TargetRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // TicketInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesTicketInfo{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/CancelRoleEligibilityScheduleRequestByName.json -func ExampleRoleEligibilityScheduleRequestsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleEligibilityScheduleRequestsClient().Cancel(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/ValidateRoleEligibilityScheduleRequestByName.json -func ExampleRoleEligibilityScheduleRequestsClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleEligibilityScheduleRequestsClient().Validate(ctx, "subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "64caffb6-55c0-4deb-a585-68e948ea1ad6", armauthorization.RoleEligibilityScheduleRequest{ - Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ - Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - ConditionVersion: to.Ptr("1.0"), - PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - RequestType: to.Ptr(armauthorization.RequestTypeAdminAssign), - RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - ScheduleInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfo{ - Expiration: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration{ - Type: to.Ptr(armauthorization.TypeAfterDuration), - Duration: to.Ptr("P365D"), - }, - StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t }()), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleEligibilityScheduleRequest = armauthorization.RoleEligibilityScheduleRequest{ - // Name: to.Ptr("64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:32:27.91Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RequestType: to.Ptr(armauthorization.RequestTypeAdminAssign), - // RequestorID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // ScheduleInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfo{ - // Expiration: &armauthorization.RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration{ - // Type: to.Ptr(armauthorization.TypeAfterDuration), - // Duration: to.Ptr("P365D"), - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t}()), - // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // TargetRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // TicketInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesTicketInfo{ - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go deleted file mode 100644 index 2477e7657164..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleEligibilitySchedulesClient contains the methods for the RoleEligibilitySchedules group. -// Don't use this type directly, use NewRoleEligibilitySchedulesClient() instead. -type RoleEligibilitySchedulesClient struct { - internal *arm.Client -} - -// NewRoleEligibilitySchedulesClient creates a new instance of RoleEligibilitySchedulesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleEligibilitySchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleEligibilitySchedulesClient, error) { - cl, err := arm.NewClient(moduleName+".RoleEligibilitySchedulesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleEligibilitySchedulesClient{ - internal: cl, - } - return client, nil -} - -// Get - Get the specified role eligibility schedule for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility schedule. -// - roleEligibilityScheduleName - The name (guid) of the role eligibility schedule to get. -// - options - RoleEligibilitySchedulesClientGetOptions contains the optional parameters for the RoleEligibilitySchedulesClient.Get -// method. -func (client *RoleEligibilitySchedulesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleName string, options *RoleEligibilitySchedulesClientGetOptions) (RoleEligibilitySchedulesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleEligibilityScheduleName, options) - if err != nil { - return RoleEligibilitySchedulesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilitySchedulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilitySchedulesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleEligibilitySchedulesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleName string, options *RoleEligibilitySchedulesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleEligibilityScheduleName == "" { - return nil, errors.New("parameter roleEligibilityScheduleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleEligibilityScheduleName}", url.PathEscape(roleEligibilityScheduleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleEligibilitySchedulesClient) getHandleResponse(resp *http.Response) (RoleEligibilitySchedulesClientGetResponse, error) { - result := RoleEligibilitySchedulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilitySchedule); err != nil { - return RoleEligibilitySchedulesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role eligibility schedules for a resource scope. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role eligibility schedules. -// - options - RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.NewListForScopePager -// method. -func (client *RoleEligibilitySchedulesClient) NewListForScopePager(scope string, options *RoleEligibilitySchedulesClientListForScopeOptions) *runtime.Pager[RoleEligibilitySchedulesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleEligibilitySchedulesClientListForScopeResponse]{ - More: func(page RoleEligibilitySchedulesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleEligibilitySchedulesClientListForScopeResponse) (RoleEligibilitySchedulesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleEligibilitySchedulesClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleEligibilitySchedulesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleEligibilitySchedulesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleEligibilitySchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilitySchedulesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleEligibilitySchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilitySchedulesClientListForScopeResponse, error) { - result := RoleEligibilitySchedulesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleListResult); err != nil { - return RoleEligibilitySchedulesClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go deleted file mode 100644 index 9496908540ef..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go +++ /dev/null @@ -1,143 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleByName.json -func ExampleRoleEligibilitySchedulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleEligibilitySchedulesClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", "b1477448-2cc6-4ceb-93b4-54a202a89413", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleEligibilitySchedule = armauthorization.RoleEligibilitySchedule{ - // Name: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Type: to.Ptr("Microsoft.Authorization/RoleEligibilitySchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Properties: &armauthorization.RoleEligibilityScheduleProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:33:06.3Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-09T21:32:28.49Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:33:14.557Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T22:27:00.513Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilitySchedulesByScope.json -func ExampleRoleEligibilitySchedulesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleEligibilitySchedulesClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilitySchedulesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleEligibilityScheduleListResult = armauthorization.RoleEligibilityScheduleListResult{ - // Value: []*armauthorization.RoleEligibilitySchedule{ - // { - // Name: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Type: to.Ptr("Microsoft.Authorization/RoleEligibilitySchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Properties: &armauthorization.RoleEligibilityScheduleProperties{ - // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), - // ConditionVersion: to.Ptr("1.0"), - // CreatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:33:06.3Z"); return t}()), - // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-09T21:32:28.49Z"); return t}()), - // ExpandedProperties: &armauthorization.ExpandedProperties{ - // Principal: &armauthorization.ExpandedPropertiesPrincipal{ - // Type: to.Ptr("User"), - // DisplayName: to.Ptr("User Account"), - // Email: to.Ptr("user@my-tenant.com"), - // ID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // }, - // RoleDefinition: &armauthorization.ExpandedPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("Contributor"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // }, - // Scope: &armauthorization.ExpandedPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // }, - // }, - // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), - // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:33:14.557Z"); return t}()), - // Status: to.Ptr(armauthorization.StatusProvisioned), - // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T22:27:00.513Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go deleted file mode 100644 index f4be0e309829..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go +++ /dev/null @@ -1,245 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleManagementPoliciesClient contains the methods for the RoleManagementPolicies group. -// Don't use this type directly, use NewRoleManagementPoliciesClient() instead. -type RoleManagementPoliciesClient struct { - internal *arm.Client -} - -// NewRoleManagementPoliciesClient creates a new instance of RoleManagementPoliciesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleManagementPoliciesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleManagementPoliciesClient, error) { - cl, err := arm.NewClient(moduleName+".RoleManagementPoliciesClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleManagementPoliciesClient{ - internal: cl, - } - return client, nil -} - -// Delete - Delete a role management policy -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy to upsert. -// - roleManagementPolicyName - The name (guid) of the role management policy to upsert. -// - options - RoleManagementPoliciesClientDeleteOptions contains the optional parameters for the RoleManagementPoliciesClient.Delete -// method. -func (client *RoleManagementPoliciesClient) Delete(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientDeleteOptions) (RoleManagementPoliciesClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleManagementPolicyName, options) - if err != nil { - return RoleManagementPoliciesClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPoliciesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleManagementPoliciesClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return RoleManagementPoliciesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleManagementPoliciesClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyName == "" { - return nil, errors.New("parameter roleManagementPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get the specified role management policy for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy. -// - roleManagementPolicyName - The name (guid) of the role management policy to get. -// - options - RoleManagementPoliciesClientGetOptions contains the optional parameters for the RoleManagementPoliciesClient.Get -// method. -func (client *RoleManagementPoliciesClient) Get(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientGetOptions) (RoleManagementPoliciesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleManagementPolicyName, options) - if err != nil { - return RoleManagementPoliciesClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPoliciesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPoliciesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleManagementPoliciesClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyName == "" { - return nil, errors.New("parameter roleManagementPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleManagementPoliciesClient) getHandleResponse(resp *http.Response) (RoleManagementPoliciesClientGetResponse, error) { - result := RoleManagementPoliciesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { - return RoleManagementPoliciesClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role management policies for a resource scope. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy. -// - options - RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.NewListForScopePager -// method. -func (client *RoleManagementPoliciesClient) NewListForScopePager(scope string, options *RoleManagementPoliciesClientListForScopeOptions) *runtime.Pager[RoleManagementPoliciesClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleManagementPoliciesClientListForScopeResponse]{ - More: func(page RoleManagementPoliciesClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleManagementPoliciesClientListForScopeResponse) (RoleManagementPoliciesClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleManagementPoliciesClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPoliciesClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPoliciesClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleManagementPoliciesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPoliciesClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleManagementPoliciesClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPoliciesClientListForScopeResponse, error) { - result := RoleManagementPoliciesClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyListResult); err != nil { - return RoleManagementPoliciesClientListForScopeResponse{}, err - } - return result, nil -} - -// Update - Update a role management policy -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy to upsert. -// - roleManagementPolicyName - The name (guid) of the role management policy to upsert. -// - parameters - Parameters for the role management policy. -// - options - RoleManagementPoliciesClientUpdateOptions contains the optional parameters for the RoleManagementPoliciesClient.Update -// method. -func (client *RoleManagementPoliciesClient) Update(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy, options *RoleManagementPoliciesClientUpdateOptions) (RoleManagementPoliciesClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, scope, roleManagementPolicyName, parameters, options) - if err != nil { - return RoleManagementPoliciesClientUpdateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPoliciesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPoliciesClientUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *RoleManagementPoliciesClient) updateCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy, options *RoleManagementPoliciesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyName == "" { - return nil, errors.New("parameter roleManagementPolicyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyName}", url.PathEscape(roleManagementPolicyName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// updateHandleResponse handles the Update response. -func (client *RoleManagementPoliciesClient) updateHandleResponse(resp *http.Response) (RoleManagementPoliciesClientUpdateResponse, error) { - result := RoleManagementPoliciesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { - return RoleManagementPoliciesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go deleted file mode 100644 index c4bbd901092c..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go +++ /dev/null @@ -1,2632 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyByName.json -func ExampleRoleManagementPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleManagementPoliciesClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleManagementPolicy = armauthorization.RoleManagementPolicy{ - // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Properties: &armauthorization.RoleManagementPolicyProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // IsOrganizationDefault: to.Ptr(false), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T02:54:27.167+00:00"); return t}()), - // PolicyProperties: &armauthorization.PolicyProperties{ - // Scope: &armauthorization.PolicyPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PatchPartialRoleManagementPolicy.json -func ExampleRoleManagementPoliciesClient_Update_patchPartialRoleManagementPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleManagementPoliciesClient().Update(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", armauthorization.RoleManagementPolicy{ - Properties: &armauthorization.RoleManagementPolicyProperties{ - Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(false), - MaximumDuration: to.Ptr("P180D"), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleManagementPolicy = armauthorization.RoleManagementPolicy{ - // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Properties: &armauthorization.RoleManagementPolicyProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P180D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication)}, - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // IsOrganizationDefault: to.Ptr(false), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T16:35:27.91+00:00"); return t}()), - // PolicyProperties: &armauthorization.PolicyProperties{ - // Scope: &armauthorization.PolicyPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P180D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication)}, - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PatchRoleManagementPolicy.json -func ExampleRoleManagementPoliciesClient_Update_patchRoleManagementPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleManagementPoliciesClient().Update(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", armauthorization.RoleManagementPolicy{ - Properties: &armauthorization.RoleManagementPolicyProperties{ - Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(false), - MaximumDuration: to.Ptr("P180D"), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("requestor_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("approver_admin_eligible@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - }, - &armauthorization.RoleManagementPolicyEnablementRule{ - ID: to.Ptr("Enablement_Admin_Eligibility"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Eligibility"), - Operations: []*string{ - to.Ptr("All")}, - }, - EnabledRules: []*armauthorization.EnablementRules{}, - }, - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(false), - MaximumDuration: to.Ptr("P90D"), - }, - &armauthorization.RoleManagementPolicyEnablementRule{ - ID: to.Ptr("Enablement_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - EnabledRules: []*armauthorization.EnablementRules{ - to.Ptr(armauthorization.EnablementRulesJustification), - to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication)}, - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_admin_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("requestor_admin_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Approver_Admin_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("Admin"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("approver_admin_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - }, - &armauthorization.RoleManagementPolicyExpirationRule{ - ID: to.Ptr("Expiration_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsExpirationRequired: to.Ptr(true), - MaximumDuration: to.Ptr("PT7H"), - }, - &armauthorization.RoleManagementPolicyEnablementRule{ - ID: to.Ptr("Enablement_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - EnabledRules: []*armauthorization.EnablementRules{ - to.Ptr(armauthorization.EnablementRulesJustification), - to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - to.Ptr(armauthorization.EnablementRulesTicketing)}, - }, - &armauthorization.RoleManagementPolicyApprovalRule{ - ID: to.Ptr("Approval_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - Setting: &armauthorization.ApprovalSettings{ - ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - ApprovalStages: []*armauthorization.ApprovalStage{ - { - ApprovalStageTimeOutInDays: to.Ptr[int32](1), - EscalationTimeInMinutes: to.Ptr[int32](0), - IsApproverJustificationRequired: to.Ptr(true), - IsEscalationEnabled: to.Ptr(false), - PrimaryApprovers: []*armauthorization.UserSet{ - { - Description: to.Ptr("amansw_new_group"), - ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - IsBackup: to.Ptr(false), - UserType: to.Ptr(armauthorization.UserTypeGroup), - }, - { - Description: to.Ptr("amansw_group"), - ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - IsBackup: to.Ptr(false), - UserType: to.Ptr(armauthorization.UserTypeGroup), - }}, - }}, - IsApprovalRequired: to.Ptr(true), - IsApprovalRequiredForExtension: to.Ptr(false), - IsRequestorJustificationRequired: to.Ptr(true), - }, - }, - &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - ClaimValue: to.Ptr(""), - IsEnabled: to.Ptr(false), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("admin_enduser_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(false), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationRecipients: []*string{ - to.Ptr("requestor_enduser_member@test.com")}, - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - }, - &armauthorization.RoleManagementPolicyNotificationRule{ - ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - Target: &armauthorization.RoleManagementPolicyRuleTarget{ - Caller: to.Ptr("EndUser"), - Level: to.Ptr("Assignment"), - Operations: []*string{ - to.Ptr("All")}, - }, - IsDefaultRecipientsEnabled: to.Ptr(true), - NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleManagementPolicy = armauthorization.RoleManagementPolicy{ - // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Properties: &armauthorization.RoleManagementPolicyProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P180D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication)}, - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // IsOrganizationDefault: to.Ptr(false), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T16:35:27.91+00:00"); return t}()), - // PolicyProperties: &armauthorization.PolicyProperties{ - // Scope: &armauthorization.PolicyPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P180D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication)}, - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/DeleteRoleManagementPolicy.json -func ExampleRoleManagementPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleManagementPoliciesClient().Delete(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "570c3619-7688-4b34-b290-2b8bb3ccab2a", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyByScope.json -func ExampleRoleManagementPoliciesClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleManagementPoliciesClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleManagementPolicyListResult = armauthorization.RoleManagementPolicyListResult{ - // Value: []*armauthorization.RoleManagementPolicy{ - // { - // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), - // Properties: &armauthorization.RoleManagementPolicyProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // IsOrganizationDefault: to.Ptr(false), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T02:54:27.167+00:00"); return t}()), - // PolicyProperties: &armauthorization.PolicyProperties{ - // Scope: &armauthorization.PolicyPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // Rules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go deleted file mode 100644 index 43f0a3b629f8..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go +++ /dev/null @@ -1,245 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// RoleManagementPolicyAssignmentsClient contains the methods for the RoleManagementPolicyAssignments group. -// Don't use this type directly, use NewRoleManagementPolicyAssignmentsClient() instead. -type RoleManagementPolicyAssignmentsClient struct { - internal *arm.Client -} - -// NewRoleManagementPolicyAssignmentsClient creates a new instance of RoleManagementPolicyAssignmentsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewRoleManagementPolicyAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RoleManagementPolicyAssignmentsClient, error) { - cl, err := arm.NewClient(moduleName+".RoleManagementPolicyAssignmentsClient", moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &RoleManagementPolicyAssignmentsClient{ - internal: cl, - } - return client, nil -} - -// Create - Create a role management policy assignment -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy assignment to upsert. -// - roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to upsert. -// - parameters - Parameters for the role management policy assignment. -// - options - RoleManagementPolicyAssignmentsClientCreateOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Create -// method. -func (client *RoleManagementPolicyAssignmentsClient) Create(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment, options *RoleManagementPolicyAssignmentsClientCreateOptions) (RoleManagementPolicyAssignmentsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, parameters, options) - if err != nil { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, runtime.NewResponseError(resp) - } - return client.createHandleResponse(resp) -} - -// createCreateRequest creates the Create request. -func (client *RoleManagementPolicyAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment, options *RoleManagementPolicyAssignmentsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyAssignmentName == "" { - return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// createHandleResponse handles the Create response. -func (client *RoleManagementPolicyAssignmentsClient) createHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientCreateResponse, error) { - result := RoleManagementPolicyAssignmentsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { - return RoleManagementPolicyAssignmentsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a role management policy assignment -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy assignment to delete. -// - roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to delete. -// - options - RoleManagementPolicyAssignmentsClientDeleteOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Delete -// method. -func (client *RoleManagementPolicyAssignmentsClient) Delete(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientDeleteOptions) (RoleManagementPolicyAssignmentsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, options) - if err != nil { - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return RoleManagementPolicyAssignmentsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *RoleManagementPolicyAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyAssignmentName == "" { - return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get the specified role management policy assignment for a resource scope -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy. -// - roleManagementPolicyAssignmentName - The name of format {guid_guid} the role management policy assignment to get. -// - options - RoleManagementPolicyAssignmentsClientGetOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.Get -// method. -func (client *RoleManagementPolicyAssignmentsClient) Get(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientGetOptions) (RoleManagementPolicyAssignmentsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, scope, roleManagementPolicyAssignmentName, options) - if err != nil { - return RoleManagementPolicyAssignmentsClientGetResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPolicyAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *RoleManagementPolicyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleManagementPolicyAssignmentName == "" { - return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{roleManagementPolicyAssignmentName}", url.PathEscape(roleManagementPolicyAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *RoleManagementPolicyAssignmentsClient) getHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientGetResponse, error) { - result := RoleManagementPolicyAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { - return RoleManagementPolicyAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// NewListForScopePager - Gets role management assignment policies for a resource scope. -// -// Generated from API version 2020-10-01 -// - scope - The scope of the role management policy. -// - options - RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.NewListForScopePager -// method. -func (client *RoleManagementPolicyAssignmentsClient) NewListForScopePager(scope string, options *RoleManagementPolicyAssignmentsClientListForScopeOptions) *runtime.Pager[RoleManagementPolicyAssignmentsClientListForScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[RoleManagementPolicyAssignmentsClientListForScopeResponse]{ - More: func(page RoleManagementPolicyAssignmentsClientListForScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *RoleManagementPolicyAssignmentsClientListForScopeResponse) (RoleManagementPolicyAssignmentsClientListForScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listForScopeCreateRequest(ctx, scope, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listForScopeHandleResponse(resp) - }, - }) -} - -// listForScopeCreateRequest creates the ListForScope request. -func (client *RoleManagementPolicyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPolicyAssignmentsClientListForScopeOptions) (*policy.Request, error) { - urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments" - urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listForScopeHandleResponse handles the ListForScope response. -func (client *RoleManagementPolicyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsClientListForScopeResponse, error) { - result := RoleManagementPolicyAssignmentsClientListForScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignmentListResult); err != nil { - return RoleManagementPolicyAssignmentsClientListForScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go deleted file mode 100644 index e89561c80bf3..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go +++ /dev/null @@ -1,695 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armauthorization_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyAssignmentByName.json -func ExampleRoleManagementPolicyAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRoleManagementPolicyAssignmentsClient().Get(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RoleManagementPolicyAssignment = armauthorization.RoleManagementPolicyAssignment{ - // Name: to.Ptr("b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicyAssignment"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicyAssignment/b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Properties: &armauthorization.RoleManagementPolicyAssignmentProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // PolicyAssignmentProperties: &armauthorization.PolicyAssignmentProperties{ - // Policy: &armauthorization.PolicyAssignmentPropertiesPolicy{ - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // }, - // RoleDefinition: &armauthorization.PolicyAssignmentPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("FHIR Data Converter"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // }, - // Scope: &armauthorization.PolicyAssignmentPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // PolicyID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleManagementPolicyAssignment.json -func ExampleRoleManagementPolicyAssignmentsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleManagementPolicyAssignmentsClient().Create(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24", armauthorization.RoleManagementPolicyAssignment{ - Properties: &armauthorization.RoleManagementPolicyAssignmentProperties{ - PolicyID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/DeleteRoleManagementPolicyAssignment.json -func ExampleRoleManagementPolicyAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewRoleManagementPolicyAssignmentsClient().Delete(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyAssignmentByScope.json -func ExampleRoleManagementPolicyAssignmentsClient_NewListForScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armauthorization.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRoleManagementPolicyAssignmentsClient().NewListForScopePager("providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RoleManagementPolicyAssignmentListResult = armauthorization.RoleManagementPolicyAssignmentListResult{ - // Value: []*armauthorization.RoleManagementPolicyAssignment{ - // { - // Name: to.Ptr("b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicyAssignment"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicyAssignment/b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Properties: &armauthorization.RoleManagementPolicyAssignmentProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // PolicyAssignmentProperties: &armauthorization.PolicyAssignmentProperties{ - // Policy: &armauthorization.PolicyAssignmentPropertiesPolicy{ - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // }, - // RoleDefinition: &armauthorization.PolicyAssignmentPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("FHIR Data Converter"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // }, - // Scope: &armauthorization.PolicyAssignmentPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // PolicyID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go new file mode 100644 index 000000000000..a5c0ca19e225 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go @@ -0,0 +1,141 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewDefaultSettingsClient contains the methods for the ScopeAccessReviewDefaultSettings group. +// Don't use this type directly, use NewScopeAccessReviewDefaultSettingsClient() instead. +type ScopeAccessReviewDefaultSettingsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewDefaultSettingsClient creates a new instance of ScopeAccessReviewDefaultSettingsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewDefaultSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewDefaultSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewDefaultSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewDefaultSettingsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - options - ScopeAccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Get +// method. +func (client *ScopeAccessReviewDefaultSettingsClient) Get(ctx context.Context, scope string, options *ScopeAccessReviewDefaultSettingsClientGetOptions) (ScopeAccessReviewDefaultSettingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, options) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ScopeAccessReviewDefaultSettingsClient) getCreateRequest(ctx context.Context, scope string, options *ScopeAccessReviewDefaultSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ScopeAccessReviewDefaultSettingsClient) getHandleResponse(resp *http.Response) (ScopeAccessReviewDefaultSettingsClientGetResponse, error) { + result := ScopeAccessReviewDefaultSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, err + } + return result, nil +} + +// Put - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - properties - Access review schedule settings. +// - options - ScopeAccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Put +// method. +func (client *ScopeAccessReviewDefaultSettingsClient) Put(ctx context.Context, scope string, properties AccessReviewScheduleSettings, options *ScopeAccessReviewDefaultSettingsClientPutOptions) (ScopeAccessReviewDefaultSettingsClientPutResponse, error) { + req, err := client.putCreateRequest(ctx, scope, properties, options) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, runtime.NewResponseError(resp) + } + return client.putHandleResponse(resp) +} + +// putCreateRequest creates the Put request. +func (client *ScopeAccessReviewDefaultSettingsClient) putCreateRequest(ctx context.Context, scope string, properties AccessReviewScheduleSettings, options *ScopeAccessReviewDefaultSettingsClientPutOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// putHandleResponse handles the Put response. +func (client *ScopeAccessReviewDefaultSettingsClient) putHandleResponse(resp *http.Response) (ScopeAccessReviewDefaultSettingsClientPutResponse, error) { + result := ScopeAccessReviewDefaultSettingsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go new file mode 100644 index 000000000000..79512fa437c2 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go @@ -0,0 +1,142 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionClient contains the methods for the ScopeAccessReviewHistoryDefinition group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionClient() instead. +type ScopeAccessReviewHistoryDefinitionClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionClient creates a new instance of ScopeAccessReviewHistoryDefinitionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionClient{ + internal: cl, + } + return client, nil +} + +// Create - Create a scheduled or one-time Access Review History Definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - properties - Access review history definition properties. +// - options - ScopeAccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.Create +// method. +func (client *ScopeAccessReviewHistoryDefinitionClient) Create(ctx context.Context, scope string, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *ScopeAccessReviewHistoryDefinitionClientCreateOptions) (ScopeAccessReviewHistoryDefinitionClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, scope, historyDefinitionID, properties, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *ScopeAccessReviewHistoryDefinitionClient) createCreateRequest(ctx context.Context, scope string, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *ScopeAccessReviewHistoryDefinitionClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *ScopeAccessReviewHistoryDefinitionClient) createHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionClientCreateResponse, error) { + result := ScopeAccessReviewHistoryDefinitionClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete an access review history definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - options - ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.DeleteByID +// method. +func (client *ScopeAccessReviewHistoryDefinitionClient) DeleteByID(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions) (ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, scope, historyDefinitionID, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *ScopeAccessReviewHistoryDefinitionClient) deleteByIDCreateRequest(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client.go new file mode 100644 index 000000000000..d8d2047786e1 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client.go @@ -0,0 +1,102 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionInstanceClient contains the methods for the ScopeAccessReviewHistoryDefinitionInstance group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionInstanceClient() instead. +type ScopeAccessReviewHistoryDefinitionInstanceClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionInstanceClient creates a new instance of ScopeAccessReviewHistoryDefinitionInstanceClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionInstanceClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionInstanceClient{ + internal: cl, + } + return client, nil +} + +// GenerateDownloadURI - Generates a uri which can be used to retrieve review history data. This URI has a TTL of 1 day and +// can be retrieved by fetching the accessReviewHistoryDefinition object. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - instanceID - The id of the access review history definition instance to generate a URI for. +// - options - ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for +// the ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI method. +func (client *ScopeAccessReviewHistoryDefinitionInstanceClient) GenerateDownloadURI(ctx context.Context, scope string, historyDefinitionID string, instanceID string, options *ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + req, err := client.generateDownloadURICreateRequest(ctx, scope, historyDefinitionID, instanceID, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, runtime.NewResponseError(resp) + } + return client.generateDownloadURIHandleResponse(resp) +} + +// generateDownloadURICreateRequest creates the GenerateDownloadURI request. +func (client *ScopeAccessReviewHistoryDefinitionInstanceClient) generateDownloadURICreateRequest(ctx context.Context, scope string, historyDefinitionID string, instanceID string, options *ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generateDownloadURIHandleResponse handles the GenerateDownloadURI response. +func (client *ScopeAccessReviewHistoryDefinitionInstanceClient) generateDownloadURIHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + result := ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryInstance); err != nil { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go new file mode 100644 index 000000000000..52c94ed14d51 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionInstancesClient contains the methods for the ScopeAccessReviewHistoryDefinitionInstances group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionInstancesClient() instead. +type ScopeAccessReviewHistoryDefinitionInstancesClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionInstancesClient creates a new instance of ScopeAccessReviewHistoryDefinitionInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionInstancesClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review history definition instances by definition Id +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - options - ScopeAccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager +// method. +func (client *ScopeAccessReviewHistoryDefinitionInstancesClient) NewListPager(scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewHistoryDefinitionInstancesClientListResponse]{ + More: func(page ScopeAccessReviewHistoryDefinitionInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewHistoryDefinitionInstancesClientListResponse) (ScopeAccessReviewHistoryDefinitionInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, historyDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewHistoryDefinitionInstancesClient) listCreateRequest(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewHistoryDefinitionInstancesClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionInstancesClientListResponse, error) { + result := ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionInstanceListResult); err != nil { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go new file mode 100644 index 000000000000..b8bf9f260cd7 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go @@ -0,0 +1,163 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionsClient contains the methods for the ScopeAccessReviewHistoryDefinitions group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionsClient() instead. +type ScopeAccessReviewHistoryDefinitionsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionsClient creates a new instance of ScopeAccessReviewHistoryDefinitionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionsClient{ + internal: cl, + } + return client, nil +} + +// GetByID - Get access review history definition by definition Id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - options - ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionsClient.GetByID +// method. +func (client *ScopeAccessReviewHistoryDefinitionsClient) GetByID(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions) (ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scope, historyDefinitionID, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ScopeAccessReviewHistoryDefinitionsClient) getByIDCreateRequest(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ScopeAccessReviewHistoryDefinitionsClient) getByIDHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + result := ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the accessReviewHistoryDefinitions available from this provider, definition instances are only available +// for 30 days after creation. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - options - ScopeAccessReviewHistoryDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionsClient.NewListPager +// method. +func (client *ScopeAccessReviewHistoryDefinitionsClient) NewListPager(scope string, options *ScopeAccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewHistoryDefinitionsClientListResponse]{ + More: func(page ScopeAccessReviewHistoryDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewHistoryDefinitionsClientListResponse) (ScopeAccessReviewHistoryDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewHistoryDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *ScopeAccessReviewHistoryDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewHistoryDefinitionsClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionsClientListResponse, error) { + result := ScopeAccessReviewHistoryDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionListResult); err != nil { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go new file mode 100644 index 000000000000..7c16cf46147b --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go @@ -0,0 +1,293 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstanceClient contains the methods for the ScopeAccessReviewInstance group. +// Don't use this type directly, use NewScopeAccessReviewInstanceClient() instead. +type ScopeAccessReviewInstanceClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstanceClient creates a new instance of ScopeAccessReviewInstanceClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstanceClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceClient{ + internal: cl, + } + return client, nil +} + +// ApplyDecisions - An action to apply all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ApplyDecisions +// method. +func (client *ScopeAccessReviewInstanceClient) ApplyDecisions(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientApplyDecisionsOptions) (ScopeAccessReviewInstanceClientApplyDecisionsResponse, error) { + req, err := client.applyDecisionsCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, nil +} + +// applyDecisionsCreateRequest creates the ApplyDecisions request. +func (client *ScopeAccessReviewInstanceClient) applyDecisionsCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientApplyDecisionsOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// RecordAllDecisions - An action to approve/deny all decisions for a review with certain filters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - properties - Record all decisions payload. +// - options - ScopeAccessReviewInstanceClientRecordAllDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.RecordAllDecisions +// method. +func (client *ScopeAccessReviewInstanceClient) RecordAllDecisions(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties RecordAllDecisionsProperties, options *ScopeAccessReviewInstanceClientRecordAllDecisionsOptions) (ScopeAccessReviewInstanceClientRecordAllDecisionsResponse, error) { + req, err := client.recordAllDecisionsCreateRequest(ctx, scope, scheduleDefinitionID, id, properties, options) + if err != nil { + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, nil +} + +// recordAllDecisionsCreateRequest creates the RecordAllDecisions request. +func (client *ScopeAccessReviewInstanceClient) recordAllDecisionsCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties RecordAllDecisionsProperties, options *ScopeAccessReviewInstanceClientRecordAllDecisionsOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// ResetDecisions - An action to reset all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ResetDecisions +// method. +func (client *ScopeAccessReviewInstanceClient) ResetDecisions(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientResetDecisionsOptions) (ScopeAccessReviewInstanceClientResetDecisionsResponse, error) { + req, err := client.resetDecisionsCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, nil +} + +// resetDecisionsCreateRequest creates the ResetDecisions request. +func (client *ScopeAccessReviewInstanceClient) resetDecisionsCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientResetDecisionsOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// SendReminders - An action to send reminders for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.SendReminders +// method. +func (client *ScopeAccessReviewInstanceClient) SendReminders(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientSendRemindersOptions) (ScopeAccessReviewInstanceClientSendRemindersResponse, error) { + req, err := client.sendRemindersCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, nil +} + +// sendRemindersCreateRequest creates the SendReminders request. +func (client *ScopeAccessReviewInstanceClient) sendRemindersCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientSendRemindersOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Stop - An action to stop an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientStopOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.Stop +// method. +func (client *ScopeAccessReviewInstanceClient) Stop(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientStopOptions) (ScopeAccessReviewInstanceClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientStopResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ScopeAccessReviewInstanceClient) stopCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientStopOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go new file mode 100644 index 000000000000..73f574406ea4 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstanceContactedReviewersClient contains the methods for the ScopeAccessReviewInstanceContactedReviewers group. +// Don't use this type directly, use NewScopeAccessReviewInstanceContactedReviewersClient() instead. +type ScopeAccessReviewInstanceContactedReviewersClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstanceContactedReviewersClient creates a new instance of ScopeAccessReviewInstanceContactedReviewersClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstanceContactedReviewersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstanceContactedReviewersClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstanceContactedReviewersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceContactedReviewersClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance contacted reviewers +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the ScopeAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +func (client *ScopeAccessReviewInstanceContactedReviewersClient) NewListPager(scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceContactedReviewersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewInstanceContactedReviewersClientListResponse]{ + More: func(page ScopeAccessReviewInstanceContactedReviewersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewInstanceContactedReviewersClientListResponse) (ScopeAccessReviewInstanceContactedReviewersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewInstanceContactedReviewersClient) listCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceContactedReviewersClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewInstanceContactedReviewersClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewInstanceContactedReviewersClientListResponse, error) { + result := ScopeAccessReviewInstanceContactedReviewersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewContactedReviewerListResult); err != nil { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go new file mode 100644 index 000000000000..8011cdd080e8 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go @@ -0,0 +1,118 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstanceDecisionsClient contains the methods for the ScopeAccessReviewInstanceDecisions group. +// Don't use this type directly, use NewScopeAccessReviewInstanceDecisionsClient() instead. +type ScopeAccessReviewInstanceDecisionsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstanceDecisionsClient creates a new instance of ScopeAccessReviewInstanceDecisionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstanceDecisionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstanceDecisionsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstanceDecisionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceDecisionsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance decisions +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceDecisionsClientListOptions contains the optional parameters for the ScopeAccessReviewInstanceDecisionsClient.NewListPager +// method. +func (client *ScopeAccessReviewInstanceDecisionsClient) NewListPager(scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceDecisionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewInstanceDecisionsClientListResponse]{ + More: func(page ScopeAccessReviewInstanceDecisionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewInstanceDecisionsClientListResponse) (ScopeAccessReviewInstanceDecisionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewInstanceDecisionsClient) listCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceDecisionsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewInstanceDecisionsClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewInstanceDecisionsClientListResponse, error) { + result := ScopeAccessReviewInstanceDecisionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go new file mode 100644 index 000000000000..ce8c57e2a179 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go @@ -0,0 +1,232 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstancesClient contains the methods for the ScopeAccessReviewInstances group. +// Don't use this type directly, use NewScopeAccessReviewInstancesClient() instead. +type ScopeAccessReviewInstancesClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstancesClient creates a new instance of ScopeAccessReviewInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstancesClient{ + internal: cl, + } + return client, nil +} + +// Create - Update access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - properties - Access review instance properties. +// - options - ScopeAccessReviewInstancesClientCreateOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.Create +// method. +func (client *ScopeAccessReviewInstancesClient) Create(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *ScopeAccessReviewInstancesClientCreateOptions) (ScopeAccessReviewInstancesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, scope, scheduleDefinitionID, id, properties, options) + if err != nil { + return ScopeAccessReviewInstancesClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstancesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstancesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *ScopeAccessReviewInstancesClient) createCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *ScopeAccessReviewInstancesClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *ScopeAccessReviewInstancesClient) createHandleResponse(resp *http.Response) (ScopeAccessReviewInstancesClientCreateResponse, error) { + result := ScopeAccessReviewInstancesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return ScopeAccessReviewInstancesClientCreateResponse{}, err + } + return result, nil +} + +// GetByID - Get access review instances +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstancesClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.GetByID +// method. +func (client *ScopeAccessReviewInstancesClient) GetByID(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstancesClientGetByIDOptions) (ScopeAccessReviewInstancesClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ScopeAccessReviewInstancesClient) getByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstancesClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ScopeAccessReviewInstancesClient) getByIDHandleResponse(resp *http.Response) (ScopeAccessReviewInstancesClientGetByIDResponse, error) { + result := ScopeAccessReviewInstancesClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review instances +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewInstancesClientListOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.NewListPager +// method. +func (client *ScopeAccessReviewInstancesClient) NewListPager(scope string, scheduleDefinitionID string, options *ScopeAccessReviewInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewInstancesClientListResponse]{ + More: func(page ScopeAccessReviewInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewInstancesClientListResponse) (ScopeAccessReviewInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, scheduleDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewInstancesClient) listCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewInstancesClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewInstancesClientListResponse, error) { + result := ScopeAccessReviewInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { + return ScopeAccessReviewInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go new file mode 100644 index 000000000000..1e9a906f6f06 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go @@ -0,0 +1,307 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewScheduleDefinitionsClient contains the methods for the ScopeAccessReviewScheduleDefinitions group. +// Don't use this type directly, use NewScopeAccessReviewScheduleDefinitionsClient() instead. +type ScopeAccessReviewScheduleDefinitionsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewScheduleDefinitionsClient creates a new instance of ScopeAccessReviewScheduleDefinitionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewScheduleDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewScheduleDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewScheduleDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewScheduleDefinitionsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdateByID - Create or Update access review schedule definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - properties - Access review schedule definition properties. +// - options - ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the +// ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) CreateOrUpdateByID(ctx context.Context, scope string, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + req, err := client.createOrUpdateByIDCreateRequest(ctx, scope, scheduleDefinitionID, properties, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateByIDHandleResponse(resp) +} + +// createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) createOrUpdateByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createOrUpdateByIDHandleResponse handles the CreateOrUpdateByID response. +func (client *ScopeAccessReviewScheduleDefinitionsClient) createOrUpdateByIDHandleResponse(resp *http.Response) (ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + result := ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete access review schedule definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.DeleteByID +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) DeleteByID(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, scope, scheduleDefinitionID, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) deleteByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetByID - Get single access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.GetByID +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) GetByID(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scope, scheduleDefinitionID, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) getByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ScopeAccessReviewScheduleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + result := ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review schedule definitions +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - options - ScopeAccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.NewListPager +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) NewListPager(scope string, options *ScopeAccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewScheduleDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewScheduleDefinitionsClientListResponse]{ + More: func(page ScopeAccessReviewScheduleDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewScheduleDefinitionsClientListResponse) (ScopeAccessReviewScheduleDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *ScopeAccessReviewScheduleDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewScheduleDefinitionsClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewScheduleDefinitionsClientListResponse, error) { + result := ScopeAccessReviewScheduleDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, err + } + return result, nil +} + +// Stop - Stop access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.Stop +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) Stop(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientStopOptions) (ScopeAccessReviewScheduleDefinitionsClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scope, scheduleDefinitionID, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) stopCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientStopOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go b/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go new file mode 100644 index 000000000000..90b6d12c8235 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TenantLevelAccessReviewInstanceContactedReviewersClient contains the methods for the TenantLevelAccessReviewInstanceContactedReviewers group. +// Don't use this type directly, use NewTenantLevelAccessReviewInstanceContactedReviewersClient() instead. +type TenantLevelAccessReviewInstanceContactedReviewersClient struct { + internal *arm.Client +} + +// NewTenantLevelAccessReviewInstanceContactedReviewersClient creates a new instance of TenantLevelAccessReviewInstanceContactedReviewersClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTenantLevelAccessReviewInstanceContactedReviewersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantLevelAccessReviewInstanceContactedReviewersClient, error) { + cl, err := arm.NewClient(moduleName+".TenantLevelAccessReviewInstanceContactedReviewersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TenantLevelAccessReviewInstanceContactedReviewersClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance contacted reviewers +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - TenantLevelAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +func (client *TenantLevelAccessReviewInstanceContactedReviewersClient) NewListPager(scheduleDefinitionID string, id string, options *TenantLevelAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[TenantLevelAccessReviewInstanceContactedReviewersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TenantLevelAccessReviewInstanceContactedReviewersClientListResponse]{ + More: func(page TenantLevelAccessReviewInstanceContactedReviewersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TenantLevelAccessReviewInstanceContactedReviewersClientListResponse) (TenantLevelAccessReviewInstanceContactedReviewersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *TenantLevelAccessReviewInstanceContactedReviewersClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *TenantLevelAccessReviewInstanceContactedReviewersClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TenantLevelAccessReviewInstanceContactedReviewersClient) listHandleResponse(resp *http.Response) (TenantLevelAccessReviewInstanceContactedReviewersClientListResponse, error) { + result := TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewContactedReviewerListResult); err != nil { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + return result, nil +}