diff --git a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md index f6c870ebef77..8ceda2d7f5ae 100644 --- a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md +++ b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md @@ -1,5 +1,428 @@ # Release History +## 3.0.0-beta.1 (2023-02-15) +### Breaking Changes + +- Type alias `ApprovalMode` has been removed +- Type alias `AssignmentType` has been removed +- Type alias `EnablementRules` has been removed +- Type alias `MemberType` has been removed +- Type alias `NotificationDeliveryMechanism` has been removed +- Type alias `NotificationLevel` has been removed +- Type alias `PrincipalType` has been removed +- Type alias `RecipientType` has been removed +- Type alias `RequestType` has been removed +- Type alias `RoleManagementPolicyRuleType` has been removed +- Type alias `Status` has been removed +- Type alias `Type` has been removed +- Type alias `UserType` has been removed +- Function `NewClassicAdministratorsClient` has been removed +- Function `*ClassicAdministratorsClient.NewListPager` 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 `ClassicAdministratorsClient` has been removed +- Struct `CloudError` has been removed +- Struct `CloudErrorBody` 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 `DenyAssignmentsClient` has been removed +- Struct `EligibleChildResource` has been removed +- Struct `EligibleChildResourcesClient` 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 `GlobalAdministratorClient` has been removed +- Struct `Permission` has been removed +- Struct `PermissionGetResult` has been removed +- Struct `PermissionsClient` 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 `ProviderOperationsMetadataClient` 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 `RoleAssignmentScheduleInstancesClient` 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 `RoleAssignmentScheduleRequestsClient` has been removed +- Struct `RoleAssignmentSchedulesClient` has been removed +- Struct `RoleAssignmentsClient` has been removed +- Struct `RoleDefinition` has been removed +- Struct `RoleDefinitionFilter` has been removed +- Struct `RoleDefinitionListResult` has been removed +- Struct `RoleDefinitionProperties` has been removed +- Struct `RoleDefinitionsClient` 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 `RoleEligibilityScheduleInstancesClient` 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 `RoleEligibilityScheduleRequestsClient` has been removed +- Struct `RoleEligibilitySchedulesClient` has been removed +- Struct `RoleManagementPoliciesClient` 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 `RoleManagementPolicyAssignmentsClient` 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 type alias `AccessRecommendationType` with values `AccessRecommendationTypeApprove`, `AccessRecommendationTypeDeny`, `AccessRecommendationTypeNoInfoAvailable` +- New type alias `AccessReviewActorIdentityType` with values `AccessReviewActorIdentityTypeServicePrincipal`, `AccessReviewActorIdentityTypeUser` +- New type alias `AccessReviewApplyResult` with values `AccessReviewApplyResultAppliedSuccessfully`, `AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound`, `AccessReviewApplyResultAppliedWithUnknownFailure`, `AccessReviewApplyResultApplyNotSupported`, `AccessReviewApplyResultApplying`, `AccessReviewApplyResultNew` +- New type alias `AccessReviewDecisionInsightType` with values `AccessReviewDecisionInsightTypeUserSignInInsight` +- New type alias `AccessReviewDecisionPrincipalResourceMembershipType` with values `AccessReviewDecisionPrincipalResourceMembershipTypeDirect`, `AccessReviewDecisionPrincipalResourceMembershipTypeIndirect` +- New type alias `AccessReviewHistoryDefinitionStatus` with values `AccessReviewHistoryDefinitionStatusDone`, `AccessReviewHistoryDefinitionStatusError`, `AccessReviewHistoryDefinitionStatusInProgress`, `AccessReviewHistoryDefinitionStatusRequested` +- New type alias `AccessReviewInstanceReviewersType` with values `AccessReviewInstanceReviewersTypeAssigned`, `AccessReviewInstanceReviewersTypeManagers`, `AccessReviewInstanceReviewersTypeSelf` +- New type alias `AccessReviewInstanceStatus` with values `AccessReviewInstanceStatusApplied`, `AccessReviewInstanceStatusApplying`, `AccessReviewInstanceStatusAutoReviewed`, `AccessReviewInstanceStatusAutoReviewing`, `AccessReviewInstanceStatusCompleted`, `AccessReviewInstanceStatusCompleting`, `AccessReviewInstanceStatusInProgress`, `AccessReviewInstanceStatusInitializing`, `AccessReviewInstanceStatusNotStarted`, `AccessReviewInstanceStatusScheduled`, `AccessReviewInstanceStatusStarting` +- New type alias `AccessReviewRecurrencePatternType` with values `AccessReviewRecurrencePatternTypeAbsoluteMonthly`, `AccessReviewRecurrencePatternTypeWeekly` +- New type alias `AccessReviewRecurrenceRangeType` with values `AccessReviewRecurrenceRangeTypeEndDate`, `AccessReviewRecurrenceRangeTypeNoEnd`, `AccessReviewRecurrenceRangeTypeNumbered` +- New type alias `AccessReviewResult` with values `AccessReviewResultApprove`, `AccessReviewResultDeny`, `AccessReviewResultDontKnow`, `AccessReviewResultNotNotified`, `AccessReviewResultNotReviewed` +- New type alias `AccessReviewReviewerType` with values `AccessReviewReviewerTypeServicePrincipal`, `AccessReviewReviewerTypeUser` +- New type alias `AccessReviewScheduleDefinitionReviewersType` with values `AccessReviewScheduleDefinitionReviewersTypeAssigned`, `AccessReviewScheduleDefinitionReviewersTypeManagers`, `AccessReviewScheduleDefinitionReviewersTypeSelf` +- New type alias `AccessReviewScheduleDefinitionStatus` with values `AccessReviewScheduleDefinitionStatusApplied`, `AccessReviewScheduleDefinitionStatusApplying`, `AccessReviewScheduleDefinitionStatusAutoReviewed`, `AccessReviewScheduleDefinitionStatusAutoReviewing`, `AccessReviewScheduleDefinitionStatusCompleted`, `AccessReviewScheduleDefinitionStatusCompleting`, `AccessReviewScheduleDefinitionStatusInProgress`, `AccessReviewScheduleDefinitionStatusInitializing`, `AccessReviewScheduleDefinitionStatusNotStarted`, `AccessReviewScheduleDefinitionStatusScheduled`, `AccessReviewScheduleDefinitionStatusStarting` +- New type alias `AccessReviewScopeAssignmentState` with values `AccessReviewScopeAssignmentStateActive`, `AccessReviewScopeAssignmentStateEligible` +- New type alias `AccessReviewScopePrincipalType` with values `AccessReviewScopePrincipalTypeGuestUser`, `AccessReviewScopePrincipalTypeRedeemedGuestUser`, `AccessReviewScopePrincipalTypeServicePrincipal`, `AccessReviewScopePrincipalTypeUser`, `AccessReviewScopePrincipalTypeUserGroup` +- New type alias `DecisionResourceType` with values `DecisionResourceTypeAzureRole` +- New type alias `DecisionTargetType` with values `DecisionTargetTypeServicePrincipal`, `DecisionTargetTypeUser` +- New type alias `DefaultDecisionType` with values `DefaultDecisionTypeApprove`, `DefaultDecisionTypeDeny`, `DefaultDecisionTypeRecommendation` +- New type alias `RecordAllDecisionsResult` with values `RecordAllDecisionsResultApprove`, `RecordAllDecisionsResultDeny` +- New type alias `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 `*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 `AccessReviewDefaultSettingsClient` +- New struct `AccessReviewHistoryDefinition` +- New struct `AccessReviewHistoryDefinitionClient` +- New struct `AccessReviewHistoryDefinitionInstanceClient` +- New struct `AccessReviewHistoryDefinitionInstanceListResult` +- New struct `AccessReviewHistoryDefinitionInstancesClient` +- New struct `AccessReviewHistoryDefinitionListResult` +- New struct `AccessReviewHistoryDefinitionProperties` +- New struct `AccessReviewHistoryDefinitionsClient` +- New struct `AccessReviewHistoryInstance` +- New struct `AccessReviewHistoryInstanceProperties` +- New struct `AccessReviewHistoryScheduleSettings` +- New struct `AccessReviewInstance` +- New struct `AccessReviewInstanceClient` +- New struct `AccessReviewInstanceContactedReviewersClient` +- New struct `AccessReviewInstanceDecisionsClient` +- New struct `AccessReviewInstanceListResult` +- New struct `AccessReviewInstanceMyDecisionsClient` +- New struct `AccessReviewInstanceProperties` +- New struct `AccessReviewInstancesAssignedForMyApprovalClient` +- New struct `AccessReviewInstancesClient` +- New struct `AccessReviewRecurrencePattern` +- New struct `AccessReviewRecurrenceRange` +- New struct `AccessReviewRecurrenceSettings` +- New struct `AccessReviewReviewer` +- New struct `AccessReviewScheduleDefinition` +- New struct `AccessReviewScheduleDefinitionListResult` +- New struct `AccessReviewScheduleDefinitionProperties` +- New struct `AccessReviewScheduleDefinitionsAssignedForMyApprovalClient` +- New struct `AccessReviewScheduleDefinitionsClient` +- New struct `AccessReviewScheduleSettings` +- New struct `AccessReviewScope` +- New struct `Alert` +- New struct `AlertConfiguration` +- New struct `AlertConfigurationListResult` +- New struct `AlertConfigurationsClient` +- New struct `AlertDefinition` +- New struct `AlertDefinitionListResult` +- New struct `AlertDefinitionProperties` +- New struct `AlertDefinitionsClient` +- New struct `AlertIncident` +- New struct `AlertIncidentListResult` +- New struct `AlertIncidentsClient` +- New struct `AlertListResult` +- New struct `AlertOperationClient` +- New struct `AlertOperationResult` +- New struct `AlertProperties` +- New struct `AlertsClient` +- 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 `OperationsClient` +- New struct `RecordAllDecisionsProperties` +- New struct `ScopeAccessReviewDefaultSettingsClient` +- New struct `ScopeAccessReviewHistoryDefinitionClient` +- New struct `ScopeAccessReviewHistoryDefinitionInstanceClient` +- New struct `ScopeAccessReviewHistoryDefinitionInstancesClient` +- New struct `ScopeAccessReviewHistoryDefinitionsClient` +- New struct `ScopeAccessReviewInstanceClient` +- New struct `ScopeAccessReviewInstanceContactedReviewersClient` +- New struct `ScopeAccessReviewInstanceDecisionsClient` +- New struct `ScopeAccessReviewInstancesClient` +- New struct `ScopeAccessReviewScheduleDefinitionsClient` +- New struct `TenantLevelAccessReviewInstanceContactedReviewersClient` +- New struct `TooManyOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyOwnersAssignedToResourceAlertIncidentProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties` + + ## 2.0.0 (2022-09-26) ### Breaking Changes diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go new file mode 100644 index 000000000000..cfbc4cf72c20 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go @@ -0,0 +1,153 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewDefaultSettingsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..c148a42485ed --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go @@ -0,0 +1,154 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..0b8fc81787af --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionInstanceClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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..3e7e4d23a7ff --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go @@ -0,0 +1,121 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionInstancesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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..6cb545dfc7d2 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go @@ -0,0 +1,175 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..f4e3fd3402d2 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go @@ -0,0 +1,297 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..7ca3744e0f21 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,126 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceContactedReviewersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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..afe68cee4725 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go @@ -0,0 +1,131 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceDecisionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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..c361a6b952f3 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go @@ -0,0 +1,243 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceMyDecisionsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..54abd1ace487 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go @@ -0,0 +1,243 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstancesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..d732e13f5318 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go @@ -0,0 +1,173 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstancesAssignedForMyApprovalClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..ea2bda847290 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go @@ -0,0 +1,316 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + subscriptionID string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewScheduleDefinitionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..153215937a88 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go @@ -0,0 +1,112 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AccessReviewScheduleDefinitionsAssignedForMyApprovalClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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..062b912d2c8b --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go @@ -0,0 +1,201 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AlertConfigurationsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..52b16327d1f3 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go @@ -0,0 +1,161 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AlertDefinitionsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..122a457bd24b --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go @@ -0,0 +1,206 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AlertIncidentsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..a22b09d90b6e --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go @@ -0,0 +1,98 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AlertOperationClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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..e7c71d6c15ba --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alerts_client.go @@ -0,0 +1,309 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AlertsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl, &runtime.NewPollerOptions[AlertsClientRefreshResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AlertsClientRefreshResponse](options.ResumeToken, client.pl, 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.pl.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.host, 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.pl, &runtime.NewPollerOptions[AlertsClientRefreshAllResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AlertsClientRefreshAllResponse](options.ResumeToken, client.pl, 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.pl.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.host, 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.pl.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.host, 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 a7e5cb832c6f..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.0.0 -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 dfc92dd43fa5..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client.go +++ /dev/null @@ -1,116 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - subscriptionID string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ClassicAdministratorsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// NewListPager - Gets service administrator, account administrator, and co-administrators for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2015-07-01 -// options - ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.List -// 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.pl.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.host, 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 c008a51a674a..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go +++ /dev/null @@ -1,41 +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. - -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/tree/main/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() - client, err := armauthorization.NewClassicAdministratorsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/constants.go b/sdk/resourcemanager/authorization/armauthorization/constants.go index f28e67ac0c06..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.0.0" + 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 66127128cd4f..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client.go +++ /dev/null @@ -1,421 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - subscriptionID string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &DenyAssignmentsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - 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.pl.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.host, 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// options - DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.List 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// 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.ListForResource -// 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// 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.ListForResourceGroup -// 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the deny assignments. -// options - DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.ListForScope -// 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.pl.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.host, 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 9d3ef8a61444..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go +++ /dev/null @@ -1,151 +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. - -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/tree/main/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() - client, err := armauthorization.NewDenyAssignmentsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourcePager("rgname", "resourceProviderNamespace", "parentResourcePath", "resourceType", "resourceName", &armauthorization.DenyAssignmentsClientListForResourceOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewDenyAssignmentsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourceGroupPager("rgname", &armauthorization.DenyAssignmentsClientListForResourceGroupOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewDenyAssignmentsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armauthorization.DenyAssignmentsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewDenyAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "subscriptions/subId/resourcegroups/rgname", "denyAssignmentId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewDenyAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByID(ctx, "subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/denyAssignments/daId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewDenyAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("subscriptions/subId", &armauthorization.DenyAssignmentsClientListForScopeOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go deleted file mode 100644 index 00f478ac0592..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go +++ /dev/null @@ -1,112 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &EligibleChildResourcesClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// NewGetPager - Get the child resources of a resource on which user has eligible access -// 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. -// options - EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.Get -// 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.pl.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.host, 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 d28ff6bc3fb1..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go +++ /dev/null @@ -1,42 +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. - -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/tree/main/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() - client, err := armauthorization.NewEligibleChildResourcesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetPager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.EligibleChildResourcesClientGetOptions{Filter: to.Ptr("resourceType+eq+'resourcegroup'")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go b/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go deleted file mode 100644 index 0f47371780fe..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client.go +++ /dev/null @@ -1,84 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &GlobalAdministratorClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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 4718333191da..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go +++ /dev/null @@ -1,34 +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. - -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/tree/main/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() - client, err := armauthorization.NewGlobalAdministratorClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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 51545c66c9f6..a36dfaa9f4e2 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.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // 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 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.sum +++ b/sdk/resourcemanager/authorization/armauthorization/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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 v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +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.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -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 4a5cc29a13c1..a1eb7db702da 100644 --- a/sdk/resourcemanager/authorization/armauthorization/models.go +++ b/sdk/resourcemanager/authorization/armauthorization/models.go @@ -11,1898 +11,1592 @@ package armauthorization import "time" -// ApprovalSettings - The approval settings. -type ApprovalSettings struct { - // The type of rule - ApprovalMode *ApprovalMode `json:"approvalMode,omitempty"` +// AccessReviewActorIdentity - Details of the actor identity +type AccessReviewActorIdentity struct { + // READ-ONLY; The identity id + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` - // The approval stages of the request. - ApprovalStages []*ApprovalStage `json:"approvalStages,omitempty"` + // READ-ONLY; The identity display name + PrincipalName *string `json:"principalName,omitempty" azure:"ro"` - // Determines whether approval is required or not. - IsApprovalRequired *bool `json:"isApprovalRequired,omitempty"` + // READ-ONLY; The identity type : user/servicePrincipal + PrincipalType *AccessReviewActorIdentityType `json:"principalType,omitempty" azure:"ro"` - // Determines whether approval is required for assignment extension. - IsApprovalRequiredForExtension *bool `json:"isApprovalRequiredForExtension,omitempty"` - - // Determine whether requestor justification is required. - IsRequestorJustificationRequired *bool `json:"isRequestorJustificationRequired,omitempty"` + // READ-ONLY; The user principal name(if valid) + UserPrincipalName *string `json:"userPrincipalName,omitempty" azure:"ro"` } -// ApprovalStage - The approval stage. -type ApprovalStage struct { - // The time in days when approval request would be timed out - ApprovalStageTimeOutInDays *int32 `json:"approvalStageTimeOutInDays,omitempty"` +// AccessReviewContactedReviewer - Access Review Contacted Reviewer. +type AccessReviewContactedReviewer struct { + // Access Review Contacted Reviewer properties. + Properties *AccessReviewContactedReviewerProperties `json:"properties,omitempty"` - // The escalation approver of the request. - EscalationApprovers []*UserSet `json:"escalationApprovers,omitempty"` + // READ-ONLY; The access review reviewer id. + ID *string `json:"id,omitempty" azure:"ro"` - // The time in minutes when the approval request would be escalated if the primary approver does not approve - EscalationTimeInMinutes *int32 `json:"escalationTimeInMinutes,omitempty"` + // READ-ONLY; The access review reviewer id. + Name *string `json:"name,omitempty" azure:"ro"` - // Determines whether approver need to provide justification for his decision. - IsApproverJustificationRequired *bool `json:"isApproverJustificationRequired,omitempty"` + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} - // The value determine whether escalation feature is enabled. - IsEscalationEnabled *bool `json:"isEscalationEnabled,omitempty"` +// AccessReviewContactedReviewerListResult - List of access review contacted reviewers. +type AccessReviewContactedReviewerListResult struct { + // The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` - // The primary approver of the request. - PrimaryApprovers []*UserSet `json:"primaryApprovers,omitempty"` + // Access Review Contacted Reviewer. + Value []*AccessReviewContactedReviewer `json:"value,omitempty"` } -// ClassicAdministrator - Classic Administrators -type ClassicAdministrator struct { - // The ID of the administrator. - ID *string `json:"id,omitempty"` +// AccessReviewContactedReviewerProperties - Properties of access review contacted reviewer. +type AccessReviewContactedReviewerProperties struct { + // READ-ONLY; Date Time when the reviewer was contacted. + CreatedDateTime *time.Time `json:"createdDateTime,omitempty" azure:"ro"` - // The name of the administrator. - Name *string `json:"name,omitempty"` - - // Properties for the classic administrator. - Properties *ClassicAdministratorProperties `json:"properties,omitempty"` + // READ-ONLY; The display name of the reviewer + UserDisplayName *string `json:"userDisplayName,omitempty" azure:"ro"` - // The type of the administrator. - Type *string `json:"type,omitempty"` + // READ-ONLY; The user principal name of the reviewer + UserPrincipalName *string `json:"userPrincipalName,omitempty" azure:"ro"` } -// ClassicAdministratorListResult - ClassicAdministrator list result information. -type ClassicAdministratorListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` +// AccessReviewDecision - Access Review. +type AccessReviewDecision struct { + // Access Review Decision properties. + Properties *AccessReviewDecisionProperties `json:"properties,omitempty"` - // An array of administrators. - Value []*ClassicAdministrator `json:"value,omitempty"` -} + // READ-ONLY; The access review decision id. + ID *string `json:"id,omitempty" azure:"ro"` -// ClassicAdministratorProperties - Classic Administrator properties. -type ClassicAdministratorProperties struct { - // The email address of the administrator. - EmailAddress *string `json:"emailAddress,omitempty"` + // READ-ONLY; The access review decision name. + Name *string `json:"name,omitempty" azure:"ro"` - // The role of the administrator. - Role *string `json:"role,omitempty"` + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` } -// ClassicAdministratorsClientListOptions contains the optional parameters for the ClassicAdministratorsClient.List method. -type ClassicAdministratorsClientListOptions struct { - // placeholder for future optional parameters +// 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 } -// CloudError - An error response from the service. -type CloudError struct { - // An error response from the service. - Error *CloudErrorBody `json:"error,omitempty"` -} +// AccessReviewDecisionIdentity - Target of the decision. +type AccessReviewDecisionIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType `json:"type,omitempty"` -// CloudErrorBody - An error response from the service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; The id of principal whose access was reviewed. + ID *string `json:"id,omitempty" azure:"ro"` +} - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` +// 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 `json:"properties,omitempty"` +// AccessReviewDecisionInsight - Access Review Decision Insight. +type AccessReviewDecisionInsight struct { + // Access Review Decision Insight properties. + Properties AccessReviewDecisionInsightPropertiesClassification `json:"properties,omitempty"` - // READ-ONLY; The deny assignment ID. + // READ-ONLY; The access review insight id. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; The deny assignment name. + // READ-ONLY; The access review insight name. Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The deny assignment type. + // READ-ONLY; The resource type. Type *string `json:"type,omitempty" azure:"ro"` } -// DenyAssignmentFilter - Deny Assignments filter -type DenyAssignmentFilter struct { - // Return deny assignment with specified name. - DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` +// 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 +} - // Return all deny assignments where the specified principal is listed either in the principals list or exclude principals - // list of deny assignments. - GdprExportPrincipalID *string `json:"gdprExportPrincipalId,omitempty"` +// AccessReviewDecisionInsightProperties - Details of the Insight. +type AccessReviewDecisionInsightProperties struct { + // REQUIRED; The type of insight + Type *AccessReviewDecisionInsightType `json:"type,omitempty"` - // Return all deny assignments where the specified principal is listed in the principals list of deny assignments. - PrincipalID *string `json:"principalId,omitempty"` + // READ-ONLY; Date Time when the insight was created. + InsightCreatedDateTime any `json:"insightCreatedDateTime,omitempty" azure:"ro"` } -// DenyAssignmentListResult - Deny assignment list operation result. -type DenyAssignmentListResult struct { +// GetAccessReviewDecisionInsightProperties implements the AccessReviewDecisionInsightPropertiesClassification interface for +// type AccessReviewDecisionInsightProperties. +func (a *AccessReviewDecisionInsightProperties) GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties { + return a +} + +// AccessReviewDecisionListResult - List of access review decisions. +type AccessReviewDecisionListResult struct { // The URL to use for getting the next set of results. NextLink *string `json:"nextLink,omitempty"` - // Deny assignment list. - Value []*DenyAssignment `json:"value,omitempty"` + // Access Review Decision list. + Value []*AccessReviewDecision `json:"value,omitempty"` } -// DenyAssignmentPermission - Deny assignment permissions. -type DenyAssignmentPermission struct { - // Actions to which the deny assignment does not grant access. - Actions []*string `json:"actions,omitempty"` - - // The conditions on the Deny assignment permission. This limits the resources it applies to. - Condition *string `json:"condition,omitempty"` +// 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 `json:"membershipTypes,omitempty"` +} - // Version of the condition. - ConditionVersion *string `json:"conditionVersion,omitempty"` +// 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 `json:"decision,omitempty"` - // Data actions to which the deny assignment does not grant access. - DataActions []*string `json:"dataActions,omitempty"` + // This is the collection of insights for this decision item. + Insights []*AccessReviewDecisionInsight `json:"insights,omitempty"` - // Actions to exclude from that the deny assignment does not grant access. - NotActions []*string `json:"notActions,omitempty"` + // Justification provided by approvers for their action + Justification *string `json:"justification,omitempty"` - // Data actions to exclude from that the deny assignment does not grant access. - NotDataActions []*string `json:"notDataActions,omitempty"` -} + // READ-ONLY; Details of the approver. + AppliedBy *AccessReviewActorIdentity `json:"appliedBy,omitempty" azure:"ro"` -// DenyAssignmentProperties - Deny assignment properties. -type DenyAssignmentProperties struct { - // The display name of the deny assignment. - DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` + // READ-ONLY; The date and time when the review decision was applied. + AppliedDateTime *time.Time `json:"appliedDateTime,omitempty" azure:"ro"` - // The description of the deny assignment. - Description *string `json:"description,omitempty"` + // READ-ONLY; The outcome of applying the decision. + ApplyResult *AccessReviewApplyResult `json:"applyResult,omitempty" azure:"ro"` - // Determines if the deny assignment applies to child scopes. Default value is false. - DoNotApplyToChildScopes *bool `json:"doNotApplyToChildScopes,omitempty"` + // READ-ONLY; Principal associated with the decision record. Can be AccessReviewDecisionUserIdentity or AccessReviewDecisionServicePrincipalIdentity + Principal AccessReviewDecisionIdentityClassification `json:"principal,omitempty" azure:"ro"` - // Array of principals to which the deny assignment does not apply. - ExcludePrincipals []*Principal `json:"excludePrincipals,omitempty"` + // READ-ONLY; Details of the membership type. + PrincipalResourceMembership *AccessReviewDecisionPrincipalResourceMembership `json:"principalResourceMembership,omitempty" azure:"ro"` - // Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. - IsSystemProtected *bool `json:"isSystemProtected,omitempty"` + // READ-ONLY; The feature- generated recommendation shown to the reviewer. + Recommendation *AccessRecommendationType `json:"recommendation,omitempty" azure:"ro"` - // An array of permissions that are denied by the deny assignment. - Permissions []*DenyAssignmentPermission `json:"permissions,omitempty"` + // READ-ONLY; Resource associated with this decision record. + Resource *AccessReviewDecisionResource `json:"resource,omitempty" azure:"ro"` - // Array of principals to which the deny assignment applies. - Principals []*Principal `json:"principals,omitempty"` + // READ-ONLY; Details of the approver. + ReviewedBy *AccessReviewActorIdentity `json:"reviewedBy,omitempty" azure:"ro"` - // The deny assignment scope. - Scope *string `json:"scope,omitempty"` + // READ-ONLY; Date Time when a decision was taken. + ReviewedDateTime *time.Time `json:"reviewedDateTime,omitempty" azure:"ro"` } -// DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. -type DenyAssignmentsClientGetByIDOptions struct { - // placeholder for future optional parameters -} +// AccessReviewDecisionResource - Target of the decision. +type AccessReviewDecisionResource struct { + // REQUIRED; The type of resource + Type *DecisionResourceType `json:"type,omitempty"` -// DenyAssignmentsClientGetOptions contains the optional parameters for the DenyAssignmentsClient.Get method. -type DenyAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The display name of resource associated with a decision record. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` -// DenyAssignmentsClientListForResourceGroupOptions contains the optional parameters for the DenyAssignmentsClient.ListForResourceGroup -// 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; The id of resource associated with a decision record. + ID *string `json:"id,omitempty" azure:"ro"` } -// DenyAssignmentsClientListForResourceOptions contains the optional parameters for the DenyAssignmentsClient.ListForResource -// 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 -} +// AccessReviewDecisionServicePrincipalIdentity - Service Principal Decision Target +type AccessReviewDecisionServicePrincipalIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType `json:"type,omitempty"` -// DenyAssignmentsClientListForScopeOptions contains the optional parameters for the DenyAssignmentsClient.ListForScope 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 -} + // READ-ONLY; The appId for the service principal entity being reviewed + AppID *string `json:"appId,omitempty" azure:"ro"` -// DenyAssignmentsClientListOptions contains the optional parameters for the DenyAssignmentsClient.List 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 the user whose access was reviewed. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` -// EligibleChildResource - Eligible child resource -type EligibleChildResource struct { - // READ-ONLY; The resource scope Id. + // READ-ONLY; The id of principal whose access was reviewed. ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The resource name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The resource type. - Type *string `json:"type,omitempty" azure:"ro"` } -// EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.Get 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 +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionServicePrincipalIdentity. +func (a *AccessReviewDecisionServicePrincipalIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return &AccessReviewDecisionIdentity{ + Type: a.Type, + ID: a.ID, + DisplayName: a.DisplayName, + } } -// EligibleChildResourcesListResult - Eligible child resources list operation result. -type EligibleChildResourcesListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` +// AccessReviewDecisionUserIdentity - User Decision Target +type AccessReviewDecisionUserIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType `json:"type,omitempty"` - // Eligible child resource list. - Value []*EligibleChildResource `json:"value,omitempty"` -} + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + // READ-ONLY; The id of principal whose access was reviewed. + ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; The additional info type. - Type *string `json:"type,omitempty" azure:"ro"` + // READ-ONLY; The user principal name of the user whose access was reviewed. + UserPrincipalName *string `json:"userPrincipalName,omitempty" azure:"ro"` } -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` - - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; The error details. - Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` - - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` - - // READ-ONLY; The error target. - Target *string `json:"target,omitempty" azure:"ro"` +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionUserIdentity. +func (a *AccessReviewDecisionUserIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return &AccessReviewDecisionIdentity{ + Type: a.Type, + ID: a.ID, + DisplayName: a.DisplayName, + } } -// 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 `json:"error,omitempty"` -} +// AccessReviewDecisionUserSignInInsightProperties - User Decision Target +type AccessReviewDecisionUserSignInInsightProperties struct { + // REQUIRED; The type of insight + Type *AccessReviewDecisionInsightType `json:"type,omitempty"` -type ExpandedProperties struct { - // Details of the principal - Principal *ExpandedPropertiesPrincipal `json:"principal,omitempty"` + // READ-ONLY; Date Time when the insight was created. + InsightCreatedDateTime any `json:"insightCreatedDateTime,omitempty" azure:"ro"` - // Details of role definition - RoleDefinition *ExpandedPropertiesRoleDefinition `json:"roleDefinition,omitempty"` + // READ-ONLY; Date Time when the user signed into the tenant. + LastSignInDateTime any `json:"lastSignInDateTime,omitempty" azure:"ro"` +} - // Details of the resource scope - Scope *ExpandedPropertiesScope `json:"scope,omitempty"` +// GetAccessReviewDecisionInsightProperties implements the AccessReviewDecisionInsightPropertiesClassification interface for +// type AccessReviewDecisionUserSignInInsightProperties. +func (a *AccessReviewDecisionUserSignInInsightProperties) GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties { + return &AccessReviewDecisionInsightProperties{ + Type: a.Type, + InsightCreatedDateTime: a.InsightCreatedDateTime, + } } -// ExpandedPropertiesPrincipal - Details of the principal -type ExpandedPropertiesPrincipal struct { - // Display name of the principal - DisplayName *string `json:"displayName,omitempty"` +// AccessReviewDefaultSettings - Access Review Default Settings. +type AccessReviewDefaultSettings struct { + // Access Review properties. + Properties *AccessReviewScheduleSettings `json:"properties,omitempty"` - // Email id of the principal - Email *string `json:"email,omitempty"` + // READ-ONLY; The access review default settings id. This is only going to be default + ID *string `json:"id,omitempty" azure:"ro"` - // Id of the principal - ID *string `json:"id,omitempty"` + // READ-ONLY; The access review default settings name. This is always going to be Access Review Default Settings + Name *string `json:"name,omitempty" azure:"ro"` - // Type of the principal - Type *string `json:"type,omitempty"` + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` } -// ExpandedPropertiesRoleDefinition - Details of role definition -type ExpandedPropertiesRoleDefinition struct { - // Display name of the role definition - DisplayName *string `json:"displayName,omitempty"` - - // Id of the role definition - ID *string `json:"id,omitempty"` +// 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 `json:"type,omitempty"` +// 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 `json:"displayName,omitempty"` +// AccessReviewHistoryDefinition - Access Review History Definition. +type AccessReviewHistoryDefinition struct { + // Access Review History Definition properties. + Properties *AccessReviewHistoryDefinitionProperties `json:"properties,omitempty"` - // Scope id of the resource - ID *string `json:"id,omitempty"` + // READ-ONLY; The access review history definition id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The access review history definition unique id. + Name *string `json:"name,omitempty" azure:"ro"` - // Type of the resource - Type *string `json:"type,omitempty"` + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` } -// 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 `json:"actions,omitempty"` - - // Allowed Data actions. - DataActions []*string `json:"dataActions,omitempty"` - - // Denied actions. - NotActions []*string `json:"notActions,omitempty"` +// AccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.DeleteByID +// method. +type AccessReviewHistoryDefinitionClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} - // Denied Data actions. - NotDataActions []*string `json:"notDataActions,omitempty"` +// 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 `json:"nextLink,omitempty"` - // An array of permissions. - Value []*Permission `json:"value,omitempty"` + // Access Review History Definition's Instance list. + Value []*AccessReviewHistoryInstance `json:"value,omitempty"` } -// PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.ListForResourceGroup +// 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.ListForResource 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 `json:"nextLink,omitempty"` -// PolicyAssignmentProperties - Expanded info of resource scope, role definition and policy -type PolicyAssignmentProperties struct { - // Details of the policy - Policy *PolicyAssignmentPropertiesPolicy `json:"policy,omitempty"` + // Access Review History Definition list. + Value []*AccessReviewHistoryDefinition `json:"value,omitempty"` +} - // Details of role definition - RoleDefinition *PolicyAssignmentPropertiesRoleDefinition `json:"roleDefinition,omitempty"` +// 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 `json:"decisions,omitempty"` - // Details of the resource scope - Scope *PolicyAssignmentPropertiesScope `json:"scope,omitempty"` -} + // The display name for the history definition. + DisplayName *string `json:"displayName,omitempty"` -// PolicyAssignmentPropertiesPolicy - Details of the policy -type PolicyAssignmentPropertiesPolicy struct { - // Id of the policy - ID *string `json:"id,omitempty"` + // Set of access review history instances for this history definition. + Instances []*AccessReviewHistoryInstance `json:"instances,omitempty"` - // The last modified date time. - LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty"` + // A collection of scopes used when selecting review history data + Scopes []*AccessReviewScope `json:"scopes,omitempty"` - // READ-ONLY; The name of the entity last modified it - LastModifiedBy *Principal `json:"lastModifiedBy,omitempty" azure:"ro"` -} + // Recurrence settings for recurring history reports, skip for one-time reports. + Settings *AccessReviewHistoryScheduleSettings `json:"settings,omitempty"` -// PolicyAssignmentPropertiesRoleDefinition - Details of role definition -type PolicyAssignmentPropertiesRoleDefinition struct { - // Display name of the role definition - DisplayName *string `json:"displayName,omitempty"` + // READ-ONLY; The user or other identity who created this history definition. + CreatedBy *AccessReviewActorIdentity `json:"createdBy,omitempty" azure:"ro"` - // Id of the role definition - ID *string `json:"id,omitempty"` + // READ-ONLY; Date time when history definition was created + CreatedDateTime *time.Time `json:"createdDateTime,omitempty" azure:"ro"` - // Type of the role definition - Type *string `json:"type,omitempty"` -} + // 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 `json:"reviewHistoryPeriodEndDateTime,omitempty" azure:"ro"` -// PolicyAssignmentPropertiesScope - Details of the resource scope -type PolicyAssignmentPropertiesScope struct { - // Display name of the resource - DisplayName *string `json:"displayName,omitempty"` + // 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 `json:"reviewHistoryPeriodStartDateTime,omitempty" azure:"ro"` - // Scope id of the resource - ID *string `json:"id,omitempty"` + // 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 `json:"status,omitempty" azure:"ro"` +} - // Type of the resource - Type *string `json:"type,omitempty"` +// 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 `json:"scope,omitempty" azure:"ro"` +// 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 `json:"displayName,omitempty"` +// AccessReviewHistoryInstance - Access Review History Definition Instance. +type AccessReviewHistoryInstance struct { + // Access Review History Definition Instance properties. + Properties *AccessReviewHistoryInstanceProperties `json:"properties,omitempty"` + + // READ-ONLY; The access review history definition instance id. + ID *string `json:"id,omitempty" azure:"ro"` - // Scope id of the resource - ID *string `json:"id,omitempty"` + // READ-ONLY; The access review history definition instance unique id. + Name *string `json:"name,omitempty" azure:"ro"` - // Type of the resource - Type *string `json:"type,omitempty"` + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` } -// 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 `json:"displayName,omitempty"` - // Email of principal - Email *string `json:"email,omitempty"` + // Date time when history data report expires and the associated data is deleted. + Expiration *time.Time `json:"expiration,omitempty"` - // The id of the principal made changes - ID *string `json:"id,omitempty"` + // Date time when the history data report is scheduled to be generated. + FulfilledDateTime *time.Time `json:"fulfilledDateTime,omitempty"` - // Type of principal such as user , group etc - Type *string `json:"type,omitempty"` -} + // 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 `json:"reviewHistoryPeriodEndDateTime,omitempty"` -// ProviderOperation - Operation -type ProviderOperation struct { - // The operation description. - Description *string `json:"description,omitempty"` + // 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 `json:"reviewHistoryPeriodStartDateTime,omitempty"` - // The operation display name. - DisplayName *string `json:"displayName,omitempty"` - - // The dataAction flag to specify the operation type. - IsDataAction *bool `json:"isDataAction,omitempty"` + // Date time when the history data report is scheduled to be generated. + RunDateTime *time.Time `json:"runDateTime,omitempty"` - // The operation name. - Name *string `json:"name,omitempty"` + // 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 `json:"downloadUri,omitempty" azure:"ro"` - // The operation origin. - Origin *string `json:"origin,omitempty"` - - // The operation properties. - Properties interface{} `json:"properties,omitempty"` + // 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 `json:"status,omitempty" azure:"ro"` } -// ProviderOperationsMetadata - Provider Operations metadata -type ProviderOperationsMetadata struct { - // The provider display name. - DisplayName *string `json:"displayName,omitempty"` +// AccessReviewHistoryScheduleSettings - Recurrence settings of an Access Review History Definition. +type AccessReviewHistoryScheduleSettings struct { + // Access Review History Definition recurrence settings. + Pattern *AccessReviewRecurrencePattern `json:"pattern,omitempty"` - // The provider id. - ID *string `json:"id,omitempty"` + // Access Review History Definition recurrence settings. + Range *AccessReviewRecurrenceRange `json:"range,omitempty"` +} - // The provider name. - Name *string `json:"name,omitempty"` +// AccessReviewInstance - Access Review Instance. +type AccessReviewInstance struct { + // Access Review properties. + Properties *AccessReviewInstanceProperties `json:"properties,omitempty"` - // The provider operations. - Operations []*ProviderOperation `json:"operations,omitempty"` + // READ-ONLY; The access review instance id. + ID *string `json:"id,omitempty" azure:"ro"` - // The provider resource types - ResourceTypes []*ResourceType `json:"resourceTypes,omitempty"` + // READ-ONLY; The access review instance name. + Name *string `json:"name,omitempty" azure:"ro"` - // The provider type. - Type *string `json:"type,omitempty"` + // READ-ONLY; The resource type. + Type *string `json:"type,omitempty" azure:"ro"` } -// 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.List +// 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 `json:"nextLink,omitempty"` - - // The list of providers. - Value []*ProviderOperationsMetadata `json:"value,omitempty"` +// 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 `json:"displayName,omitempty"` - - // The resource type name. - Name *string `json:"name,omitempty"` +// AccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the AccessReviewInstanceClient.SendReminders +// method. +type AccessReviewInstanceClientSendRemindersOptions struct { + // placeholder for future optional parameters +} - // The resource type operations. - Operations []*ProviderOperation `json:"operations,omitempty"` +// 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 `json:"properties,omitempty"` +// 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 `json:"id,omitempty" azure:"ro"` +// 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 `json:"name,omitempty" azure:"ro"` +// AccessReviewInstanceListResult - List of Access Review Instances. +type AccessReviewInstanceListResult struct { + // The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` - // READ-ONLY; The role assignment type. - Type *string `json:"type,omitempty" azure:"ro"` + // Access Review Instance list. + Value []*AccessReviewInstance `json:"value,omitempty"` } -// RoleAssignmentCreateParameters - Role assignment create parameters. -type RoleAssignmentCreateParameters struct { - // REQUIRED; Role assignment properties. - Properties *RoleAssignmentProperties `json:"properties,omitempty"` +// 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 `json:"principalId,omitempty"` +// 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 `json:"value,omitempty"` - - // READ-ONLY; The skipToken to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` +// 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 `json:"principalId,omitempty"` +// AccessReviewInstanceProperties - Access Review Instance properties. +type AccessReviewInstanceProperties struct { + // This is the collection of backup reviewers. + BackupReviewers []*AccessReviewReviewer `json:"backupReviewers,omitempty"` - // REQUIRED; The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // The DateTime when the review instance is scheduled to end. + EndDateTime *time.Time `json:"endDateTime,omitempty"` - // 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 `json:"condition,omitempty"` + // This is the collection of reviewers. + Reviewers []*AccessReviewReviewer `json:"reviewers,omitempty"` - // Version of the condition. Currently the only accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` + // The DateTime when the review instance is scheduled to be start. + StartDateTime *time.Time `json:"startDateTime,omitempty"` - // Id of the delegated managed identity resource - DelegatedManagedIdentityResourceID *string `json:"delegatedManagedIdentityResourceId,omitempty"` + // 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 `json:"reviewersType,omitempty" azure:"ro"` - // Description of role assignment - Description *string `json:"description,omitempty"` + // READ-ONLY; This read-only field specifies the status of an access review instance. + Status *AccessReviewInstanceStatus `json:"status,omitempty" azure:"ro"` +} - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` +// 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 `json:"createdBy,omitempty" azure:"ro"` +// 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 `json:"createdOn,omitempty" azure:"ro"` +// 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 `json:"scope,omitempty" azure:"ro"` +// AccessReviewInstancesClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesClient.GetByID +// method. +type AccessReviewInstancesClientGetByIDOptions struct { + // placeholder for future optional parameters +} - // READ-ONLY; Id of the user who updated the assignment - UpdatedBy *string `json:"updatedBy,omitempty" azure:"ro"` +// 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 +} + +// 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 `json:"interval,omitempty"` - // READ-ONLY; Time it was updated - UpdatedOn *time.Time `json:"updatedOn,omitempty" azure:"ro"` + // The recurrence type : weekly, monthly, etc. + Type *AccessReviewRecurrencePatternType `json:"type,omitempty"` } -// RoleAssignmentSchedule - Role Assignment schedule -type RoleAssignmentSchedule struct { - // Role assignment schedule properties. - Properties *RoleAssignmentScheduleProperties `json:"properties,omitempty"` +// 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 `json:"endDate,omitempty"` - // READ-ONLY; The role assignment schedule Id. - ID *string `json:"id,omitempty" azure:"ro"` + // The number of times to repeat the access review. Required and must be positive if type is numbered. + NumberOfOccurrences *int32 `json:"numberOfOccurrences,omitempty"` - // READ-ONLY; The role assignment schedule name. - Name *string `json:"name,omitempty" azure:"ro"` + // The DateTime when the review is scheduled to be start. This could be a date in the future. Required on create. + StartDate *time.Time `json:"startDate,omitempty"` - // READ-ONLY; The role assignment schedule type. - Type *string `json:"type,omitempty" azure:"ro"` + // The recurrence range type. The possible values are: endDate, noEnd, numbered. + Type *AccessReviewRecurrenceRangeType `json:"type,omitempty"` } -// RoleAssignmentScheduleFilter - Role assignment schedule filter -type RoleAssignmentScheduleFilter struct { - // Returns role assignment schedule of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` +// AccessReviewRecurrenceSettings - Recurrence Settings of an Access Review Schedule Definition. +type AccessReviewRecurrenceSettings struct { + // Access Review schedule definition recurrence pattern. + Pattern *AccessReviewRecurrencePattern `json:"pattern,omitempty"` + + // Access Review schedule definition recurrence range. + Range *AccessReviewRecurrenceRange `json:"range,omitempty"` +} - // Returns role assignment schedule of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` +// AccessReviewReviewer - Descriptor for what needs to be reviewed +type AccessReviewReviewer struct { + // The id of the reviewer(user/servicePrincipal) + PrincipalID *string `json:"principalId,omitempty"` - // Returns role assignment schedule instances of the specific status. - Status *string `json:"status,omitempty"` + // READ-ONLY; The identity type : user/servicePrincipal + PrincipalType *AccessReviewReviewerType `json:"principalType,omitempty" azure:"ro"` } -// RoleAssignmentScheduleInstance - Information about current or upcoming role assignment schedule instance -type RoleAssignmentScheduleInstance struct { - // Role assignment schedule instance properties. - Properties *RoleAssignmentScheduleInstanceProperties `json:"properties,omitempty"` +// AccessReviewScheduleDefinition - Access Review Schedule Definition. +type AccessReviewScheduleDefinition struct { + // Access Review properties. + Properties *AccessReviewScheduleDefinitionProperties `json:"properties,omitempty"` - // READ-ONLY; The role assignment schedule instance ID. + // READ-ONLY; The access review schedule definition id. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; The role assignment schedule instance name. + // READ-ONLY; The access review schedule definition unique id. Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The role assignment schedule instance type. + // READ-ONLY; The resource type. Type *string `json:"type,omitempty" azure:"ro"` } -// RoleAssignmentScheduleInstanceFilter - Role assignment schedule instance filter -type RoleAssignmentScheduleInstanceFilter struct { - // Returns role assignment schedule instances of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` - - // Returns role assignment schedule instances belonging to a specific role assignment schedule. - RoleAssignmentScheduleID *string `json:"roleAssignmentScheduleId,omitempty"` - - // Returns role assignment schedule instances of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Returns role assignment schedule instances of the specific status. - Status *string `json:"status,omitempty"` -} - -// 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 `json:"nextLink,omitempty"` - // Role assignment schedule instance list. - Value []*RoleAssignmentScheduleInstance `json:"value,omitempty"` + // Access Review Schedule Definition list. + Value []*AccessReviewScheduleDefinition `json:"value,omitempty"` } -// RoleAssignmentScheduleInstanceProperties - Role assignment schedule properties with scope. -type RoleAssignmentScheduleInstanceProperties struct { - // Assignment type of the role assignment schedule - AssignmentType *AssignmentType `json:"assignmentType,omitempty"` - - // 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 `json:"condition,omitempty"` +// AccessReviewScheduleDefinitionProperties - Access Review. +type AccessReviewScheduleDefinitionProperties struct { + // This is the collection of backup reviewers. + BackupReviewers []*AccessReviewReviewer `json:"backupReviewers,omitempty"` - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` + // The description provided by the access review creator and visible to admins. + DescriptionForAdmins *string `json:"descriptionForAdmins,omitempty"` - // DateTime when role assignment schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` + // The description provided by the access review creator to be shown to reviewers. + DescriptionForReviewers *string `json:"descriptionForReviewers,omitempty"` - // The endDateTime of the role assignment schedule instance - EndDateTime *time.Time `json:"endDateTime,omitempty"` - - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` + // The display name for the schedule definition. + DisplayName *string `json:"displayName,omitempty"` - // roleEligibilityScheduleId used to activate - LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` + // This is the collection of instances returned when one does an expand on it. + Instances []*AccessReviewInstance `json:"instances,omitempty"` - // roleEligibilityScheduleInstanceId linked to this roleAssignmentScheduleInstance - LinkedRoleEligibilityScheduleInstanceID *string `json:"linkedRoleEligibilityScheduleInstanceId,omitempty"` + // This is the collection of reviewers. + Reviewers []*AccessReviewReviewer `json:"reviewers,omitempty"` - // Membership type of the role assignment schedule - MemberType *MemberType `json:"memberType,omitempty"` + // Access Review Settings. + Settings *AccessReviewScheduleSettings `json:"settings,omitempty"` - // Role Assignment Id in external system - OriginRoleAssignmentID *string `json:"originRoleAssignmentId,omitempty"` + // READ-ONLY; The user or other identity who created this review. + CreatedBy *AccessReviewActorIdentity `json:"createdBy,omitempty" azure:"ro"` - // The principal ID. - PrincipalID *string `json:"principalId,omitempty"` + // 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 `json:"reviewersType,omitempty" azure:"ro"` - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` + // 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 `json:"scope,omitempty" azure:"ro"` - // Id of the master role assignment schedule - RoleAssignmentScheduleID *string `json:"roleAssignmentScheduleId,omitempty"` - - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // READ-ONLY; This read-only field specifies the status of an accessReview. + Status *AccessReviewScheduleDefinitionStatus `json:"status,omitempty" azure:"ro"` +} - // The role assignment schedule scope. - Scope *string `json:"scope,omitempty"` +// 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 `json:"startDateTime,omitempty"` +// 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 `json:"status,omitempty"` +// 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.ListForScope +// 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 `json:"nextLink,omitempty"` - - // Role assignment schedule list. - Value []*RoleAssignmentSchedule `json:"value,omitempty"` +// 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 `json:"assignmentType,omitempty"` +// 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 `json:"autoApplyDecisionsEnabled,omitempty"` - // 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 `json:"condition,omitempty"` + // This specifies the behavior for the autoReview feature when an access review completes. + DefaultDecision *DefaultDecisionType `json:"defaultDecision,omitempty"` - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` + // Flag to indicate whether reviewers are required to provide a justification when reviewing access. + DefaultDecisionEnabled *bool `json:"defaultDecisionEnabled,omitempty"` - // DateTime when role assignment schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` + // The duration in days for an instance. + InstanceDurationInDays *int32 `json:"instanceDurationInDays,omitempty"` - // End DateTime when role assignment schedule - EndDateTime *time.Time `json:"endDateTime,omitempty"` + // Flag to indicate whether the reviewer is required to pass justification when recording a decision. + JustificationRequiredOnApproval *bool `json:"justificationRequiredOnApproval,omitempty"` - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` + // Flag to indicate whether sending mails to reviewers and the review creator is enabled. + MailNotificationsEnabled *bool `json:"mailNotificationsEnabled,omitempty"` - // The id of roleEligibilitySchedule used to activated this roleAssignmentSchedule - LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` + // 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 `json:"recommendationLookBackDuration,omitempty"` - // Membership type of the role assignment schedule - MemberType *MemberType `json:"memberType,omitempty"` + // Flag to indicate whether showing recommendations to reviewers is enabled. + RecommendationsEnabled *bool `json:"recommendationsEnabled,omitempty"` - // The principal ID. - PrincipalID *string `json:"principalId,omitempty"` + // Access Review Settings. + Recurrence *AccessReviewRecurrenceSettings `json:"recurrence,omitempty"` + + // Flag to indicate whether sending reminder emails to reviewers are enabled. + ReminderNotificationsEnabled *bool `json:"reminderNotificationsEnabled,omitempty"` +} - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` +// AccessReviewScope - Descriptor for what needs to be reviewed +type AccessReviewScope struct { + // This is used to indicate the resource id(s) to exclude + ExcludeResourceID *string `json:"excludeResourceId,omitempty"` - // The id of roleAssignmentScheduleRequest used to create this roleAssignmentSchedule - RoleAssignmentScheduleRequestID *string `json:"roleAssignmentScheduleRequestId,omitempty"` + // This is used to indicate the role definition id(s) to exclude + ExcludeRoleDefinitionID *string `json:"excludeRoleDefinitionId,omitempty"` - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // Flag to indicate whether to expand nested memberships or not. + ExpandNestedMemberships *bool `json:"expandNestedMemberships,omitempty"` - // The role assignment schedule scope. - Scope *string `json:"scope,omitempty"` + // 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 `json:"inactiveDuration,omitempty"` - // Start DateTime when role assignment schedule - StartDateTime *time.Time `json:"startDateTime,omitempty"` + // Flag to indicate whether to expand nested memberships or not. + IncludeAccessBelowResource *bool `json:"includeAccessBelowResource,omitempty"` + + // Flag to indicate whether to expand nested memberships or not. + IncludeInheritedAccess *bool `json:"includeInheritedAccess,omitempty"` + + // READ-ONLY; The role assignment state eligible/active to review + AssignmentState *AccessReviewScopeAssignmentState `json:"assignmentState,omitempty" azure:"ro"` - // The status of the role assignment schedule. - Status *Status `json:"status,omitempty"` + // READ-ONLY; The identity type user/servicePrincipal to review + PrincipalType *AccessReviewScopePrincipalType `json:"principalType,omitempty" azure:"ro"` - // DateTime when role assignment schedule was modified - UpdatedOn *time.Time `json:"updatedOn,omitempty"` + // READ-ONLY; ResourceId in which this review is getting created + ResourceID *string `json:"resourceId,omitempty" azure:"ro"` + + // READ-ONLY; This is used to indicate the role being reviewed + RoleDefinitionID *string `json:"roleDefinitionId,omitempty" azure:"ro"` } -// RoleAssignmentScheduleRequest - Role Assignment schedule request -type RoleAssignmentScheduleRequest struct { - // Role assignment schedule request properties. - Properties *RoleAssignmentScheduleRequestProperties `json:"properties,omitempty"` +// Alert - The alert. +type Alert struct { + // Alert properties. + Properties *AlertProperties `json:"properties,omitempty"` - // READ-ONLY; The role assignment schedule request ID. + // READ-ONLY; The alert ID. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; The role assignment schedule request name. + // READ-ONLY; The alert name. Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The role assignment schedule request type. + // READ-ONLY; The alert type. Type *string `json:"type,omitempty" azure:"ro"` } -// RoleAssignmentScheduleRequestFilter - Role assignment schedule request filter -type RoleAssignmentScheduleRequestFilter struct { - // Returns role assignment requests of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` +// AlertConfiguration - Alert configuration. +type AlertConfiguration struct { + // Alert configuration properties. + Properties AlertConfigurationPropertiesClassification `json:"properties,omitempty"` - // Returns role assignment requests created by specific principal. - RequestorID *string `json:"requestorId,omitempty"` + // READ-ONLY; The alert configuration ID. + ID *string `json:"id,omitempty" azure:"ro"` - // Returns role assignment requests of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // READ-ONLY; The alert configuration name. + Name *string `json:"name,omitempty" azure:"ro"` - // Returns role assignment requests of specific status. - Status *string `json:"status,omitempty"` + // READ-ONLY; The alert configuration type. + Type *string `json:"type,omitempty" azure:"ro"` } -// 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 `json:"nextLink,omitempty"` - // Role assignment schedule request list. - Value []*RoleAssignmentScheduleRequest `json:"value,omitempty"` + // Alert configuration list + Value []*AlertConfiguration `json:"value,omitempty"` } -// RoleAssignmentScheduleRequestProperties - Role assignment schedule request properties with scope. -type RoleAssignmentScheduleRequestProperties struct { - // REQUIRED; The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - - // REQUIRED; The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc - RequestType *RequestType `json:"requestType,omitempty"` - - // REQUIRED; The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // 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 `json:"condition,omitempty"` - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // Justification for the role assignment - Justification *string `json:"justification,omitempty"` - - // The linked role eligibility schedule id - to activate an eligibility. - LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` - - // Schedule info of the role assignment schedule - ScheduleInfo *RoleAssignmentScheduleRequestPropertiesScheduleInfo `json:"scheduleInfo,omitempty"` - - // The resultant role assignment schedule id or the role assignment schedule id being updated - TargetRoleAssignmentScheduleID *string `json:"targetRoleAssignmentScheduleId,omitempty"` - - // The role assignment schedule instance id being updated - TargetRoleAssignmentScheduleInstanceID *string `json:"targetRoleAssignmentScheduleInstanceId,omitempty"` - - // Ticket Info of the role assignment - TicketInfo *RoleAssignmentScheduleRequestPropertiesTicketInfo `json:"ticketInfo,omitempty"` - - // READ-ONLY; The approvalId of the role assignment schedule request. - ApprovalID *string `json:"approvalId,omitempty" azure:"ro"` - - // READ-ONLY; DateTime when role assignment schedule request was created - CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` - - // READ-ONLY; Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty" azure:"ro"` - - // READ-ONLY; The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty" azure:"ro"` - - // READ-ONLY; Id of the user who created this request - RequestorID *string `json:"requestorId,omitempty" azure:"ro"` - - // READ-ONLY; The role assignment schedule request scope. - Scope *string `json:"scope,omitempty" azure:"ro"` - - // READ-ONLY; The status of the role assignment schedule request. - Status *Status `json:"status,omitempty" azure:"ro"` +// 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 `json:"expiration,omitempty"` +// AlertConfigurationProperties - Alert configuration properties. +type AlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string `json:"alertConfigurationType,omitempty"` - // Start DateTime of the role assignment schedule. - StartDateTime *time.Time `json:"startDateTime,omitempty"` -} + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool `json:"isEnabled,omitempty"` -// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role assignment schedule -type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration struct { - // Duration of the role assignment schedule in TimeSpan. - Duration *string `json:"duration,omitempty"` + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition `json:"alertDefinition,omitempty" azure:"ro"` - // End DateTime of the role assignment schedule. - EndDateTime *time.Time `json:"endDateTime,omitempty"` + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string `json:"alertDefinitionId,omitempty" azure:"ro"` - // Type of the role assignment schedule expiration - Type *Type `json:"type,omitempty"` + // READ-ONLY; The alert scope. + Scope *string `json:"scope,omitempty" azure:"ro"` } -// RoleAssignmentScheduleRequestPropertiesTicketInfo - Ticket Info of the role assignment -type RoleAssignmentScheduleRequestPropertiesTicketInfo struct { - // Ticket number for the role assignment - TicketNumber *string `json:"ticketNumber,omitempty"` - - // Ticket system name for the role assignment - TicketSystem *string `json:"ticketSystem,omitempty"` +// 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.ListForScope -// 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 `json:"properties,omitempty"` -// 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 `json:"id,omitempty" azure:"ro"` -// 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 `json:"name,omitempty" azure:"ro"` -// RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.ListForScope -// 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 `json:"type,omitempty" azure:"ro"` } -// 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 `json:"nextLink,omitempty"` -// RoleAssignmentsClientCreateOptions contains the optional parameters for the RoleAssignmentsClient.Create method. -type RoleAssignmentsClientCreateOptions struct { - // placeholder for future optional parameters + // Alert definition list + Value []*AlertDefinition `json:"value,omitempty"` } -// 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 `json:"description,omitempty" azure:"ro"` -// 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 `json:"displayName,omitempty" azure:"ro"` -// 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 `json:"howToPrevent,omitempty" azure:"ro"` -// 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 `json:"isConfigurable,omitempty" azure:"ro"` -// RoleAssignmentsClientListForResourceGroupOptions contains the optional parameters for the RoleAssignmentsClient.ListForResourceGroup -// 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 `json:"isRemediatable,omitempty" azure:"ro"` -// RoleAssignmentsClientListForResourceOptions contains the optional parameters for the RoleAssignmentsClient.ListForResource -// 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 `json:"mitigationSteps,omitempty" azure:"ro"` + + // READ-ONLY; The alert scope. + Scope *string `json:"scope,omitempty" azure:"ro"` + + // READ-ONLY; Security impact of the alert. + SecurityImpact *string `json:"securityImpact,omitempty" azure:"ro"` + + // READ-ONLY; Severity level of the alert. + SeverityLevel *SeverityLevel `json:"severityLevel,omitempty" azure:"ro"` } -// RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.ListForScope 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.ListForSubscription +// 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 `json:"properties,omitempty"` +// AlertIncident - Alert incident +type AlertIncident struct { + // Alert incident properties. + Properties AlertIncidentPropertiesClassification `json:"properties,omitempty"` - // READ-ONLY; The role definition ID. + // READ-ONLY; The alert incident ID. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; The role definition name. + // READ-ONLY; The alert incident name. Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The role definition type. + // READ-ONLY; The alert incident type. Type *string `json:"type,omitempty" azure:"ro"` } -// RoleDefinitionFilter - Role Definitions filter -type RoleDefinitionFilter struct { - // Returns role definition with the specific name. - RoleName *string `json:"roleName,omitempty"` - - // Returns role definition with the specific type. - Type *string `json:"type,omitempty"` -} - -// 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 `json:"nextLink,omitempty"` - // Role definition list. - Value []*RoleDefinition `json:"value,omitempty"` + // Alert incident list + Value []*AlertIncident `json:"value,omitempty"` } -// RoleDefinitionProperties - Role definition properties. -type RoleDefinitionProperties struct { - // Role definition assignable scopes. - AssignableScopes []*string `json:"assignableScopes,omitempty"` - - // The role definition description. - Description *string `json:"description,omitempty"` +// 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 +} - // Role definition permissions. - Permissions []*Permission `json:"permissions,omitempty"` +// AlertIncidentProperties - Alert incident properties +type AlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string `json:"alertIncidentType,omitempty"` +} - // The role name. - RoleName *string `json:"roleName,omitempty"` +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type AlertIncidentProperties. +func (a *AlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { return a } - // The role type. - RoleType *string `json:"type,omitempty"` +// AlertIncidentsClientGetOptions contains the optional parameters for the AlertIncidentsClient.Get method. +type AlertIncidentsClientGetOptions struct { + // placeholder for future optional parameters } -// RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate +// AlertIncidentsClientListForScopeOptions contains the optional parameters for the AlertIncidentsClient.NewListForScopePager // method. -type RoleDefinitionsClientCreateOrUpdateOptions struct { +type AlertIncidentsClientListForScopeOptions struct { // placeholder for future optional parameters } -// RoleDefinitionsClientDeleteOptions contains the optional parameters for the RoleDefinitionsClient.Delete method. -type RoleDefinitionsClientDeleteOptions struct { +// AlertIncidentsClientRemediateOptions contains the optional parameters for the AlertIncidentsClient.Remediate method. +type AlertIncidentsClientRemediateOptions struct { // placeholder for future optional parameters } -// RoleDefinitionsClientGetByIDOptions contains the optional parameters for the RoleDefinitionsClient.GetByID method. -type RoleDefinitionsClientGetByIDOptions struct { - // placeholder for future optional parameters -} +// AlertListResult - Alert list operation result. +type AlertListResult struct { + // The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` -// RoleDefinitionsClientGetOptions contains the optional parameters for the RoleDefinitionsClient.Get method. -type RoleDefinitionsClientGetOptions struct { - // placeholder for future optional parameters + // Alert list + Value []*Alert `json:"value,omitempty"` } -// RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.List method. -type RoleDefinitionsClientListOptions struct { - // The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. - Filter *string +// AlertOperationClientGetOptions contains the optional parameters for the AlertOperationClient.Get method. +type AlertOperationClientGetOptions struct { + // placeholder for future optional parameters } -// RoleEligibilitySchedule - Role eligibility schedule -type RoleEligibilitySchedule struct { - // role eligibility schedule properties. - Properties *RoleEligibilityScheduleProperties `json:"properties,omitempty"` +// AlertOperationResult - Alert operation result +type AlertOperationResult struct { + // READ-ONLY; The created date of the alert operation. + CreatedDateTime *time.Time `json:"createdDateTime,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule Id. + // READ-ONLY; The id of the alert operation. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role eligibility schedule type. - Type *string `json:"type,omitempty" azure:"ro"` -} + // READ-ONLY; The last action date of the alert operation. + LastActionDateTime *time.Time `json:"lastActionDateTime,omitempty" azure:"ro"` -// RoleEligibilityScheduleFilter - Role eligibility schedule filter -type RoleEligibilityScheduleFilter struct { - // Returns role eligibility schedule of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` + // READ-ONLY; The location of the alert associated with the operation. + ResourceLocation *string `json:"resourceLocation,omitempty" azure:"ro"` - // Returns role eligibility schedule of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // READ-ONLY; The status of the alert operation. + Status *string `json:"status,omitempty" azure:"ro"` - // Returns role eligibility schedule of the specific status. - Status *string `json:"status,omitempty"` + // READ-ONLY; The status detail of the alert operation. + StatusDetail *string `json:"statusDetail,omitempty" azure:"ro"` } -// RoleEligibilityScheduleInstance - Information about current or upcoming role eligibility schedule instance -type RoleEligibilityScheduleInstance struct { - // Role eligibility schedule instance properties. - Properties *RoleEligibilityScheduleInstanceProperties `json:"properties,omitempty"` +// AlertProperties - Alert properties. +type AlertProperties struct { + // False by default; true if the alert is active. + IsActive *bool `json:"isActive,omitempty"` - // READ-ONLY; The role eligibility schedule instance ID. - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; The alert configuration. + AlertConfiguration *AlertConfiguration `json:"alertConfiguration,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule instance name. - Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition `json:"alertDefinition,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule instance type. - Type *string `json:"type,omitempty" azure:"ro"` -} + // READ-ONLY; The alert incidents. + AlertIncidents []*AlertIncident `json:"alertIncidents,omitempty" azure:"ro"` -// RoleEligibilityScheduleInstanceFilter - Role eligibility schedule instance filter -type RoleEligibilityScheduleInstanceFilter struct { - // Returns role eligibility schedule instances of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` + // READ-ONLY; The number of generated incidents of the alert. + IncidentCount *int32 `json:"incidentCount,omitempty" azure:"ro"` - // Returns role eligibility schedule instances of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // READ-ONLY; The date time when the alert configuration was updated or new incidents were generated. + LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty" azure:"ro"` - // Returns role eligibility schedule instances belonging to a specific role eligibility schedule. - RoleEligibilityScheduleID *string `json:"roleEligibilityScheduleId,omitempty"` + // READ-ONLY; The date time when the alert was last scanned. + LastScannedDateTime *time.Time `json:"lastScannedDateTime,omitempty" azure:"ro"` - // Returns role eligibility schedule instances of the specific status. - Status *string `json:"status,omitempty"` + // READ-ONLY; The alert scope. + Scope *string `json:"scope,omitempty" azure:"ro"` } -// RoleEligibilityScheduleInstanceListResult - Role eligibility schedule instance list operation result. -type RoleEligibilityScheduleInstanceListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` - - // Role eligibility schedule instance list. - Value []*RoleEligibilityScheduleInstance `json:"value,omitempty"` +// AlertsClientBeginRefreshAllOptions contains the optional parameters for the AlertsClient.BeginRefreshAll method. +type AlertsClientBeginRefreshAllOptions struct { + // Resumes the LRO from the provided token. + ResumeToken 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 `json:"condition,omitempty"` - - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` - - // DateTime when role eligibility schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` - - // The endDateTime of the role eligibility schedule instance - EndDateTime *time.Time `json:"endDateTime,omitempty"` - - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` - - // Membership type of the role eligibility schedule - MemberType *MemberType `json:"memberType,omitempty"` - - // The principal ID. - PrincipalID *string `json:"principalId,omitempty"` - - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` - - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // Id of the master role eligibility schedule - RoleEligibilityScheduleID *string `json:"roleEligibilityScheduleId,omitempty"` - - // The role eligibility schedule scope. - Scope *string `json:"scope,omitempty"` - - // The startDateTime of the role eligibility schedule instance - StartDateTime *time.Time `json:"startDateTime,omitempty"` - - // The status of the role eligibility schedule instance - Status *Status `json:"status,omitempty"` +// 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.ListForScope -// 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 `json:"nextLink,omitempty"` - - // role eligibility schedule list. - Value []*RoleEligibilitySchedule `json:"value,omitempty"` +// 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 `json:"condition,omitempty"` +// AzureRolesAssignedOutsidePimAlertConfigurationProperties - The Azure roles assigned outside PIM alert configuration properties. +type AzureRolesAssignedOutsidePimAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string `json:"alertConfigurationType,omitempty"` - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool `json:"isEnabled,omitempty"` - // DateTime when role eligibility schedule was created - CreatedOn *time.Time `json:"createdOn,omitempty"` + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition `json:"alertDefinition,omitempty" azure:"ro"` - // End DateTime when role eligibility schedule - EndDateTime *time.Time `json:"endDateTime,omitempty"` + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string `json:"alertDefinitionId,omitempty" azure:"ro"` - // Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` + // READ-ONLY; The alert scope. + Scope *string `json:"scope,omitempty" azure:"ro"` +} - // Membership type of the role eligibility schedule - MemberType *MemberType `json:"memberType,omitempty"` +// 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 `json:"principalId,omitempty"` +// AzureRolesAssignedOutsidePimAlertIncidentProperties - Azure roles assigned outside PIM alert incident properties. +type AzureRolesAssignedOutsidePimAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string `json:"alertIncidentType,omitempty"` - // The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty"` + // READ-ONLY; The assignee display name. + AssigneeDisplayName *string `json:"assigneeDisplayName,omitempty" azure:"ro"` - // The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // READ-ONLY; The assignee ID. + AssigneeID *string `json:"assigneeId,omitempty" azure:"ro"` - // The id of roleEligibilityScheduleRequest used to create this roleAssignmentSchedule - RoleEligibilityScheduleRequestID *string `json:"roleEligibilityScheduleRequestId,omitempty"` + // READ-ONLY; The assignee user principal name. + AssigneeUserPrincipalName *string `json:"assigneeUserPrincipalName,omitempty" azure:"ro"` - // The role eligibility schedule scope. - Scope *string `json:"scope,omitempty"` + // READ-ONLY; The date the assignment was activated. + AssignmentActivatedDate *time.Time `json:"assignmentActivatedDate,omitempty" azure:"ro"` - // Start DateTime when role eligibility schedule - StartDateTime *time.Time `json:"startDateTime,omitempty"` + // READ-ONLY; The requestor display name. + RequestorDisplayName *string `json:"requestorDisplayName,omitempty" azure:"ro"` - // The status of the role eligibility schedule. - Status *Status `json:"status,omitempty"` - - // DateTime when role eligibility schedule was modified - UpdatedOn *time.Time `json:"updatedOn,omitempty"` -} + // READ-ONLY; The requestor ID. + RequestorID *string `json:"requestorId,omitempty" azure:"ro"` -// RoleEligibilityScheduleRequest - Role Eligibility schedule request -type RoleEligibilityScheduleRequest struct { - // Role eligibility schedule request properties. - Properties *RoleEligibilityScheduleRequestProperties `json:"properties,omitempty"` + // READ-ONLY; The requestor user principal name. + RequestorUserPrincipalName *string `json:"requestorUserPrincipalName,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule request ID. - ID *string `json:"id,omitempty" azure:"ro"` + // READ-ONLY; The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule request name. - Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; The role display name. + RoleDisplayName *string `json:"roleDisplayName,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule request type. - Type *string `json:"type,omitempty" azure:"ro"` + // READ-ONLY; The role template ID. + RoleTemplateID *string `json:"roleTemplateId,omitempty" azure:"ro"` } -// RoleEligibilityScheduleRequestFilter - Role eligibility schedule request filter -type RoleEligibilityScheduleRequestFilter struct { - // Returns role eligibility requests of the specific principal. - PrincipalID *string `json:"principalId,omitempty"` +// 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 `json:"requestorId,omitempty"` +// DuplicateRoleCreatedAlertConfigurationProperties - The duplicate role created alert configuration. +type DuplicateRoleCreatedAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string `json:"alertConfigurationType,omitempty"` - // Returns role eligibility requests of the specific role definition. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool `json:"isEnabled,omitempty"` - // Returns role eligibility requests of specific status. - Status *string `json:"status,omitempty"` -} + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition `json:"alertDefinition,omitempty" azure:"ro"` -// RoleEligibilityScheduleRequestListResult - Role eligibility schedule request list operation result. -type RoleEligibilityScheduleRequestListResult struct { - // The URL to use for getting the next set of results. - NextLink *string `json:"nextLink,omitempty"` + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string `json:"alertDefinitionId,omitempty" azure:"ro"` - // Role eligibility schedule request list. - Value []*RoleEligibilityScheduleRequest `json:"value,omitempty"` + // READ-ONLY; The alert scope. + Scope *string `json:"scope,omitempty" azure:"ro"` } -// RoleEligibilityScheduleRequestProperties - Role eligibility schedule request properties with scope. -type RoleEligibilityScheduleRequestProperties struct { - // REQUIRED; The principal ID. - PrincipalID *string `json:"principalId,omitempty"` +// 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 `json:"requestType,omitempty"` +// DuplicateRoleCreatedAlertIncidentProperties - Duplicate role created alert incident properties. +type DuplicateRoleCreatedAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string `json:"alertIncidentType,omitempty"` - // REQUIRED; The role definition ID. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // READ-ONLY; The duplicate roles. + DuplicateRoles *string `json:"duplicateRoles,omitempty" azure:"ro"` - // 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 `json:"condition,omitempty"` + // READ-ONLY; The reason for the incident. + Reason *string `json:"reason,omitempty" azure:"ro"` - // Version of the condition. Currently accepted value is '2.0' - ConditionVersion *string `json:"conditionVersion,omitempty"` + // READ-ONLY; The role name. + RoleName *string `json:"roleName,omitempty" azure:"ro"` +} - // Justification for the role eligibility - Justification *string `json:"justification,omitempty"` +// 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 `json:"scheduleInfo,omitempty"` +// ErrorDefinition - Error description and code explaining why an operation failed. +type ErrorDefinition struct { + // Error of the list gateway status. + Error *ErrorDefinitionProperties `json:"error,omitempty"` +} - // The resultant role eligibility schedule id or the role eligibility schedule id being updated - TargetRoleEligibilityScheduleID *string `json:"targetRoleEligibilityScheduleId,omitempty"` +// ErrorDefinitionProperties - Error description and code explaining why an operation failed. +type ErrorDefinitionProperties struct { + // Error code of list gateway. + Code *string `json:"code,omitempty"` - // The role eligibility schedule instance id being updated - TargetRoleEligibilityScheduleInstanceID *string `json:"targetRoleEligibilityScheduleInstanceId,omitempty"` + // READ-ONLY; Description of the error. + Message *string `json:"message,omitempty" azure:"ro"` +} - // Ticket Info of the role eligibility - TicketInfo *RoleEligibilityScheduleRequestPropertiesTicketInfo `json:"ticketInfo,omitempty"` +// Operation - The definition of a Microsoft.Authorization operation. +type Operation struct { + // Display of the operation + Display *OperationDisplay `json:"display,omitempty"` - // READ-ONLY; The approvalId of the role eligibility schedule request. - ApprovalID *string `json:"approvalId,omitempty" azure:"ro"` + // Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` - // READ-ONLY; DateTime when role eligibility schedule request was created - CreatedOn *time.Time `json:"createdOn,omitempty" azure:"ro"` + // Name of the operation + Name *string `json:"name,omitempty"` - // READ-ONLY; Additional properties of principal, scope and role definition - ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty" azure:"ro"` + // Origin of the operation + Origin *string `json:"origin,omitempty"` +} - // READ-ONLY; The principal type of the assigned principal ID. - PrincipalType *PrincipalType `json:"principalType,omitempty" azure:"ro"` +// OperationDisplay - The display information for a Microsoft.Authorization operation. +type OperationDisplay struct { + // READ-ONLY; The description for the operation. + Description *string `json:"description,omitempty" azure:"ro"` - // READ-ONLY; Id of the user who created this request - RequestorID *string `json:"requestorId,omitempty" azure:"ro"` + // READ-ONLY; The operation that users can perform. + Operation *string `json:"operation,omitempty" azure:"ro"` - // READ-ONLY; The role eligibility schedule request scope. - Scope *string `json:"scope,omitempty" azure:"ro"` + // READ-ONLY; The resource provider name: Microsoft.Authorization. + Provider *string `json:"provider,omitempty" azure:"ro"` - // READ-ONLY; The status of the role eligibility schedule request. - Status *Status `json:"status,omitempty" azure:"ro"` + // READ-ONLY; The resource on which the operation is performed. + Resource *string `json:"resource,omitempty" azure:"ro"` } -// RoleEligibilityScheduleRequestPropertiesScheduleInfo - Schedule info of the role eligibility schedule -type RoleEligibilityScheduleRequestPropertiesScheduleInfo struct { - // Expiration of the role eligibility schedule - Expiration *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration `json:"expiration,omitempty"` +// 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 `json:"nextLink,omitempty"` - // Start DateTime of the role eligibility schedule. - StartDateTime *time.Time `json:"startDateTime,omitempty"` + // The collection value. + Value []*Operation `json:"value,omitempty"` } -// RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration - Expiration of the role eligibility schedule -type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration struct { - // Duration of the role eligibility schedule in TimeSpan. - Duration *string `json:"duration,omitempty"` +// 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 `json:"endDateTime,omitempty"` +// RecordAllDecisionsProperties - Record All Decisions payload. +type RecordAllDecisionsProperties struct { + // The decision to make. Approvers can take action of Approve/Deny + Decision *RecordAllDecisionsResult `json:"decision,omitempty"` - // Type of the role eligibility schedule expiration - Type *Type `json:"type,omitempty"` -} + // Justification provided by approvers for their action + Justification *string `json:"justification,omitempty"` -// RoleEligibilityScheduleRequestPropertiesTicketInfo - Ticket Info of the role eligibility -type RoleEligibilityScheduleRequestPropertiesTicketInfo struct { - // Ticket number for the role eligibility - TicketNumber *string `json:"ticketNumber,omitempty"` + // READ-ONLY; The id of principal which needs to be approved/denied. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` - // Ticket system name for the role eligibility - TicketSystem *string `json:"ticketSystem,omitempty"` + // READ-ONLY; The id of resource which needs to be approved/denied. + ResourceID *string `json:"resourceId,omitempty" azure:"ro"` } -// 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.ListForScope +// 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 } -// RoleEligibilityScheduleRequestsClientValidateOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.Validate +// ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI // method. -type RoleEligibilityScheduleRequestsClientValidateOptions struct { +type ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions struct { // placeholder for future optional parameters } -// RoleEligibilitySchedulesClientGetOptions contains the optional parameters for the RoleEligibilitySchedulesClient.Get method. -type RoleEligibilitySchedulesClientGetOptions struct { +// ScopeAccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager +// method. +type ScopeAccessReviewHistoryDefinitionInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.ListForScope +// 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.ListForScope +// 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 `json:"properties,omitempty"` - - // READ-ONLY; The role management policy Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy type. - Type *string `json:"type,omitempty" azure:"ro"` +// 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 `json:"ruleType,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The approval setting - Setting *ApprovalSettings `json:"setting,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` +// 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 `json:"properties,omitempty"` - - // READ-ONLY; The role management policy Id. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The role management policy type. - Type *string `json:"type,omitempty" azure:"ro"` +// 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 `json:"nextLink,omitempty"` - - // Role management policy assignment list. - Value []*RoleManagementPolicyAssignment `json:"value,omitempty"` +// 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 `json:"policyId,omitempty"` - - // The role definition of management policy assignment. - RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` - - // The role management policy scope. - Scope *string `json:"scope,omitempty"` - - // READ-ONLY; The readonly computed rule applied to the policy. - EffectiveRules []RoleManagementPolicyRuleClassification `json:"effectiveRules,omitempty" azure:"ro"` - - // READ-ONLY; Additional properties of scope, role definition and policy - PolicyAssignmentProperties *PolicyAssignmentProperties `json:"policyAssignmentProperties,omitempty" azure:"ro"` +// 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.ListForScope +// 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 `json:"ruleType,omitempty"` - - // The claim value. - ClaimValue *string `json:"claimValue,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The value indicating if rule is enabled. - IsEnabled *bool `json:"isEnabled,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` +// 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 `json:"ruleType,omitempty"` - - // The list of enabled rules. - EnabledRules []*EnablementRules `json:"enabledRules,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` -} +// TooManyOwnersAssignedToResourceAlertConfigurationProperties - Too many owners assigned to resource alert configuration +// properties. +type TooManyOwnersAssignedToResourceAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string `json:"alertConfigurationType,omitempty"` -// 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 `json:"isEnabled,omitempty"` -// RoleManagementPolicyExpirationRule - The role management policy expiration rule. -type RoleManagementPolicyExpirationRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` + // The threshold number of owners. + ThresholdNumberOfOwners *int32 `json:"thresholdNumberOfOwners,omitempty"` - // The id of the rule. - ID *string `json:"id,omitempty"` + // The threshold percentage of owners out of all role members. + ThresholdPercentageOfOwnersOutOfAllRoleMembers *int32 `json:"thresholdPercentageOfOwnersOutOfAllRoleMembers,omitempty"` - // The value indicating whether expiration is required. - IsExpirationRequired *bool `json:"isExpirationRequired,omitempty"` + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition `json:"alertDefinition,omitempty" azure:"ro"` - // The maximum duration of expiration in timespan. - MaximumDuration *string `json:"maximumDuration,omitempty"` + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string `json:"alertDefinitionId,omitempty" azure:"ro"` - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // READ-ONLY; The alert scope. + Scope *string `json:"scope,omitempty" azure:"ro"` } -// 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 `json:"nextLink,omitempty"` - - // Role management policy list. - Value []*RoleManagementPolicy `json:"value,omitempty"` -} - -// RoleManagementPolicyNotificationRule - The role management policy notification rule. -type RoleManagementPolicyNotificationRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` - - // The id of the rule. - ID *string `json:"id,omitempty"` +// TooManyOwnersAssignedToResourceAlertIncidentProperties - Too many owners assigned to resource alert incident properties. +type TooManyOwnersAssignedToResourceAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string `json:"alertIncidentType,omitempty"` - // Determines if the notification will be sent to the recipient type specified in the policy rule. - IsDefaultRecipientsEnabled *bool `json:"isDefaultRecipientsEnabled,omitempty"` + // READ-ONLY; The assignee name. + AssigneeName *string `json:"assigneeName,omitempty" azure:"ro"` - // The notification level. - NotificationLevel *NotificationLevel `json:"notificationLevel,omitempty"` - - // The list of notification recipients. - NotificationRecipients []*string `json:"notificationRecipients,omitempty"` - - // The type of notification. - NotificationType *NotificationDeliveryMechanism `json:"notificationType,omitempty"` - - // The recipient type. - RecipientType *RecipientType `json:"recipientType,omitempty"` - - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // READ-ONLY; The assignee type. + AssigneeType *string `json:"assigneeType,omitempty" azure:"ro"` } -// 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 `json:"description,omitempty"` - - // The role management policy display name. - DisplayName *string `json:"displayName,omitempty"` - - // The role management policy is default policy. - IsOrganizationDefault *bool `json:"isOrganizationDefault,omitempty"` - - // The rule applied to the policy. - Rules []RoleManagementPolicyRuleClassification `json:"rules,omitempty"` +// TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties - Too many permanent owners assigned to resource alert +// configuration properties. +type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string `json:"alertConfigurationType,omitempty"` - // The role management policy scope. - Scope *string `json:"scope,omitempty"` - - // READ-ONLY; The readonly computed rule applied to the policy. - EffectiveRules []RoleManagementPolicyRuleClassification `json:"effectiveRules,omitempty" azure:"ro"` - - // READ-ONLY; The name of the entity last modified it - LastModifiedBy *Principal `json:"lastModifiedBy,omitempty" azure:"ro"` - - // READ-ONLY; The last modified date time. - LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty" azure:"ro"` + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool `json:"isEnabled,omitempty"` - // READ-ONLY; Additional properties of scope - PolicyProperties *PolicyProperties `json:"policyProperties,omitempty" azure:"ro"` -} + // The threshold number of permanent owners. + ThresholdNumberOfPermanentOwners *int32 `json:"thresholdNumberOfPermanentOwners,omitempty"` -// 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 `json:"thresholdPercentageOfPermanentOwnersOutOfAllOwners,omitempty"` -// RoleManagementPolicyRule - The role management policy rule. -type RoleManagementPolicyRule struct { - // REQUIRED; The type of rule - RuleType *RoleManagementPolicyRuleType `json:"ruleType,omitempty"` + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition `json:"alertDefinition,omitempty" azure:"ro"` - // The id of the rule. - ID *string `json:"id,omitempty"` + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string `json:"alertDefinitionId,omitempty" azure:"ro"` - // The target of the current rule. - Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // READ-ONLY; The alert scope. + Scope *string `json:"scope,omitempty" azure:"ro"` } -// 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 `json:"caller,omitempty"` - - // The list of enforced settings. - EnforcedSettings []*string `json:"enforcedSettings,omitempty"` - - // The list of inheritable settings. - InheritableSettings []*string `json:"inheritableSettings,omitempty"` - - // The assignment level to which rule is applied. - Level *string `json:"level,omitempty"` - - // The type of operation. - Operations []*string `json:"operations,omitempty"` - - // The list of target objects. - TargetObjects []*string `json:"targetObjects,omitempty"` +// 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 `json:"description,omitempty"` +// TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties - Too many permanent owners assigned to resource alert +// incident properties. +type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string `json:"alertIncidentType,omitempty"` - // The object id of the user. - ID *string `json:"id,omitempty"` + // READ-ONLY; The assignee name. + AssigneeName *string `json:"assigneeName,omitempty" azure:"ro"` - // The value indicating whether the user is a backup fallback approver - IsBackup *bool `json:"isBackup,omitempty"` - - // The type of user. - UserType *UserType `json:"userType,omitempty"` -} - -// ValidationResponse - Validation response -type ValidationResponse struct { - // Failed validation result details - ErrorInfo *ValidationResponseErrorInfo `json:"errorInfo,omitempty"` - - // READ-ONLY; Whether or not validation succeeded - IsValid *bool `json:"isValid,omitempty" azure:"ro"` + // READ-ONLY; The assignee type. + AssigneeType *string `json:"assigneeType,omitempty" azure:"ro"` } -// ValidationResponseErrorInfo - Failed validation result details -type ValidationResponseErrorInfo struct { - // READ-ONLY; Error code indicating why validation failed - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; Message indicating why validation failed - Message *string `json:"message,omitempty" azure:"ro"` +// 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 43a3bf4d23c5..a9e4ef878247 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewActorIdentity. +func (a AccessReviewActorIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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,3370 +55,2254 @@ func (a *ApprovalSettings) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ApprovalStage. -func (a ApprovalStage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewContactedReviewer. +func (a AccessReviewContactedReviewer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) } - for key, val := range rawMsg { - var err error - switch key { - case "approvalStageTimeOutInDays": - err = unpopulate(val, "ApprovalStageTimeOutInDays", &a.ApprovalStageTimeOutInDays) - delete(rawMsg, key) - case "escalationApprovers": - err = unpopulate(val, "EscalationApprovers", &a.EscalationApprovers) - delete(rawMsg, key) - case "escalationTimeInMinutes": - err = unpopulate(val, "EscalationTimeInMinutes", &a.EscalationTimeInMinutes) - delete(rawMsg, key) - case "isApproverJustificationRequired": - err = unpopulate(val, "IsApproverJustificationRequired", &a.IsApproverJustificationRequired) - delete(rawMsg, key) - case "isEscalationEnabled": - err = unpopulate(val, "IsEscalationEnabled", &a.IsEscalationEnabled) - delete(rawMsg, key) - case "primaryApprovers": - err = unpopulate(val, "PrimaryApprovers", &a.PrimaryApprovers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ClassicAdministrator. -func (c ClassicAdministrator) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ClassicAdministrator. -func (c *ClassicAdministrator) 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) - } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &c.ID) + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.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 ClassicAdministratorListResult. -func (c ClassicAdministratorListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) +// 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 ClassicAdministratorListResult. -func (c *ClassicAdministratorListResult) UnmarshalJSON(data []byte) error { +// 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", 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) + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &c.Value) + err = unpopulate(val, "Value", &a.Value) 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "emailAddress", c.EmailAddress) - populate(objectMap, "role", c.Role) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewContactedReviewerProperties. +func (a AccessReviewContactedReviewerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 ClassicAdministratorProperties. -func (c *ClassicAdministratorProperties) 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 "emailAddress": - err = unpopulate(val, "EmailAddress", &c.EmailAddress) + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &a.CreatedDateTime) delete(rawMsg, key) - case "role": - err = unpopulate(val, "Role", &c.Role) + case "userDisplayName": + err = unpopulate(val, "UserDisplayName", &a.UserDisplayName) + delete(rawMsg, key) + 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 CloudError. -func (c CloudError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", c.Error) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecision. +func (a AccessReviewDecision) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 CloudError. -func (c *CloudError) 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 "error": - err = unpopulate(val, "Error", &c.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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. -func (c CloudErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", c.Code) - populate(objectMap, "message", c.Message) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionIdentity. +func (a AccessReviewDecisionIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 CloudErrorBody. -func (c *CloudErrorBody) 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 "code": - err = unpopulate(val, "Code", &c.Code) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &c.Message) + 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", 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionInsight. +func (a AccessReviewDecisionInsight) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) - populate(objectMap, "gdprExportPrincipalId", d.GdprExportPrincipalID) - populate(objectMap, "principalId", d.PrincipalID) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionInsightProperties. +func (a AccessReviewDecisionInsightProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(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) + case "insightCreatedDateTime": + err = unpopulate(val, "InsightCreatedDateTime", &a.InsightCreatedDateTime) delete(rawMsg, key) - case "gdprExportPrincipalId": - err = unpopulate(val, "GdprExportPrincipalID", &d.GdprExportPrincipalID) - 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionListResult. +func (a AccessReviewDecisionListResult) 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 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionPrincipalResourceMembership. +func (a AccessReviewDecisionPrincipalResourceMembership) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionProperties. +func (a AccessReviewDecisionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 "decision": + err = unpopulate(val, "Decision", &a.Decision) delete(rawMsg, key) - case "doNotApplyToChildScopes": - err = unpopulate(val, "DoNotApplyToChildScopes", &d.DoNotApplyToChildScopes) + case "insights": + err = unpopulate(val, "Insights", &a.Insights) delete(rawMsg, key) - case "excludePrincipals": - err = unpopulate(val, "ExcludePrincipals", &d.ExcludePrincipals) + case "justification": + err = unpopulate(val, "Justification", &a.Justification) delete(rawMsg, key) - case "isSystemProtected": - err = unpopulate(val, "IsSystemProtected", &d.IsSystemProtected) + case "principal": + a.Principal, err = unmarshalAccessReviewDecisionIdentityClassification(val) delete(rawMsg, key) - case "permissions": - err = unpopulate(val, "Permissions", &d.Permissions) + case "principalResourceMembership": + err = unpopulate(val, "PrincipalResourceMembership", &a.PrincipalResourceMembership) delete(rawMsg, key) - case "principals": - err = unpopulate(val, "Principals", &d.Principals) + case "recommendation": + err = unpopulate(val, "Recommendation", &a.Recommendation) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &d.Scope) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "type", e.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionResource. +func (a AccessReviewDecisionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionServicePrincipalIdentity. +func (a AccessReviewDecisionServicePrincipalIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "info", &e.Info) - populate(objectMap, "type", e.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionUserIdentity. +func (a AccessReviewDecisionUserIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionUserSignInInsightProperties. +func (a AccessReviewDecisionUserSignInInsightProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "insightCreatedDateTime", &a.InsightCreatedDateTime) + populate(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) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) + case "insightCreatedDateTime": + err = unpopulate(val, "InsightCreatedDateTime", &a.InsightCreatedDateTime) 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", e.Error) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDefaultSettings. +func (a AccessReviewDefaultSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principal", e.Principal) - populate(objectMap, "roleDefinition", e.RoleDefinition) - populate(objectMap, "scope", e.Scope) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinition. +func (a AccessReviewHistoryDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 "roleDefinition": - err = unpopulate(val, "RoleDefinition", &e.RoleDefinition) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &e.Scope) + 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 ExpandedPropertiesPrincipal. -func (e ExpandedPropertiesPrincipal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "email", e.Email) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinitionInstanceListResult. +func (a AccessReviewHistoryDefinitionInstanceListResult) 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 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinitionListResult. +func (a AccessReviewHistoryDefinitionListResult) 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 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "id", e.ID) - populate(objectMap, "type", e.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryDefinitionProperties. +func (a AccessReviewHistoryDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", p.Actions) - populate(objectMap, "dataActions", p.DataActions) - populate(objectMap, "notActions", p.NotActions) - populate(objectMap, "notDataActions", p.NotDataActions) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryInstance. +func (a AccessReviewHistoryInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryInstanceProperties. +func (a AccessReviewHistoryInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "policy", p.Policy) - populate(objectMap, "roleDefinition", p.RoleDefinition) - populate(objectMap, "scope", p.Scope) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewHistoryScheduleSettings. +func (a AccessReviewHistoryScheduleSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) - delete(rawMsg, key) - case "roleDefinition": - err = unpopulate(val, "RoleDefinition", &p.RoleDefinition) + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populateTimeRFC3339(objectMap, "lastModifiedDateTime", p.LastModifiedDateTime) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewInstance. +func (a AccessReviewInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewInstanceListResult. +func (a AccessReviewInstanceListResult) 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 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewInstanceProperties. +func (a AccessReviewInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "scope", p.Scope) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewRecurrencePattern. +func (a AccessReviewRecurrencePattern) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewRecurrenceRange. +func (a AccessReviewRecurrenceRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "email", p.Email) - populate(objectMap, "id", p.ID) - populate(objectMap, "type", p.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewRecurrenceSettings. +func (a AccessReviewRecurrenceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) 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) { - objectMap := make(map[string]interface{}) - 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) - populate(objectMap, "properties", &p.Properties) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewReviewer. +func (a AccessReviewReviewer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleDefinition. +func (a AccessReviewScheduleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "operations": - err = unpopulate(val, "Operations", &p.Operations) - 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleDefinitionListResult. +func (a AccessReviewScheduleDefinitionListResult) 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 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "displayName", r.DisplayName) - populate(objectMap, "name", r.Name) - populate(objectMap, "operations", r.Operations) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleDefinitionProperties. +func (a AccessReviewScheduleDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScheduleSettings. +func (a AccessReviewScheduleSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) + case "autoApplyDecisionsEnabled": + err = unpopulate(val, "AutoApplyDecisionsEnabled", &a.AutoApplyDecisionsEnabled) delete(rawMsg, key) - case "conditionVersion": - err = unpopulate(val, "ConditionVersion", &r.ConditionVersion) + case "defaultDecision": + err = unpopulate(val, "DefaultDecision", &a.DefaultDecision) delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) - delete(rawMsg, key) - case "createdOn": - err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + case "defaultDecisionEnabled": + err = unpopulate(val, "DefaultDecisionEnabled", &a.DefaultDecisionEnabled) delete(rawMsg, key) - case "delegatedManagedIdentityResourceId": - err = unpopulate(val, "DelegatedManagedIdentityResourceID", &r.DelegatedManagedIdentityResourceID) - 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) +// MarshalJSON implements the json.Marshaller interface for type AccessReviewScope. +func (a AccessReviewScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]interface{}) - 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) +// MarshalJSON implements the json.Marshaller interface for type Alert. +func (a Alert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]interface{}) - 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) + err = unpopulate(val, "Type", &a.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 RoleAssignmentScheduleInstanceListResult. -func (r RoleAssignmentScheduleInstanceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) - 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AlertConfiguration. +func (a AlertConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 nil -} - -// MarshalJSON implements the json.Marshaller interface for type RoleAssignmentScheduleListResult. -func (r RoleAssignmentScheduleListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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]interface{}) - 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 fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) +// MarshalJSON implements the json.Marshaller interface for type AlertConfigurationProperties. +func (a AlertConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "requestorId", r.RequestorID) - populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) - populate(objectMap, "status", r.Status) +// MarshalJSON implements the json.Marshaller interface for type AlertDefinition. +func (a AlertDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) +// MarshalJSON implements the json.Marshaller interface for type AlertDefinitionListResult. +func (a AlertDefinitionListResult) 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 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AlertDefinitionProperties. +func (a AlertDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) - delete(rawMsg, key) - case "targetRoleEligibilityScheduleId": - err = unpopulate(val, "TargetRoleEligibilityScheduleID", &r.TargetRoleEligibilityScheduleID) + err = unpopulate(val, "Scope", &a.Scope) delete(rawMsg, key) - case "targetRoleEligibilityScheduleInstanceId": - err = unpopulate(val, "TargetRoleEligibilityScheduleInstanceID", &r.TargetRoleEligibilityScheduleInstanceID) + case "securityImpact": + err = unpopulate(val, "SecurityImpact", &a.SecurityImpact) 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "expiration", r.Expiration) - populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) +// MarshalJSON implements the json.Marshaller interface for type AlertIncident. +func (a AlertIncident) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "duration", r.Duration) - populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) - populate(objectMap, "type", r.Type) +// MarshalJSON implements the json.Marshaller interface for type AlertIncidentListResult. +func (a AlertIncidentListResult) 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 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ticketNumber", r.TicketNumber) - populate(objectMap, "ticketSystem", r.TicketSystem) +// MarshalJSON implements the json.Marshaller interface for type AlertIncidentProperties. +func (a AlertIncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) +// MarshalJSON implements the json.Marshaller interface for type AlertListResult. +func (a AlertListResult) 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 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule - populate(objectMap, "setting", r.Setting) - populate(objectMap, "target", r.Target) +// MarshalJSON implements the json.Marshaller interface for type AlertOperationResult. +func (a AlertOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 "lastActionDateTime": + err = unpopulateTimeRFC3339(val, "LastActionDateTime", &a.LastActionDateTime) delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &r.RuleType) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &a.ResourceLocation) delete(rawMsg, key) - case "setting": - err = unpopulate(val, "Setting", &r.Setting) + case "status": + err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &r.Target) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "properties", r.Properties) - populate(objectMap, "type", r.Type) +// MarshalJSON implements the json.Marshaller interface for type AlertProperties. +func (a AlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) +// MarshalJSON implements the json.Marshaller interface for type AzureRolesAssignedOutsidePimAlertConfigurationProperties. +func (a AzureRolesAssignedOutsidePimAlertConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type AzureRolesAssignedOutsidePimAlertIncidentProperties. +func (a AzureRolesAssignedOutsidePimAlertIncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 "policyAssignmentProperties": - err = unpopulate(val, "PolicyAssignmentProperties", &r.PolicyAssignmentProperties) + case "assigneeDisplayName": + err = unpopulate(val, "AssigneeDisplayName", &a.AssigneeDisplayName) delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &r.PolicyID) + case "assigneeId": + err = unpopulate(val, "AssigneeID", &a.AssigneeID) + delete(rawMsg, key) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "claimValue", r.ClaimValue) - populate(objectMap, "id", r.ID) - populate(objectMap, "isEnabled", r.IsEnabled) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule - populate(objectMap, "target", r.Target) +// MarshalJSON implements the json.Marshaller interface for type DuplicateRoleCreatedAlertConfigurationProperties. +func (d DuplicateRoleCreatedAlertConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "enabledRules", r.EnabledRules) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule - populate(objectMap, "target", r.Target) +// MarshalJSON implements the json.Marshaller interface for type DuplicateRoleCreatedAlertIncidentProperties. +func (d DuplicateRoleCreatedAlertIncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - populate(objectMap, "isExpirationRequired", r.IsExpirationRequired) - populate(objectMap, "maximumDuration", r.MaximumDuration) - objectMap["ruleType"] = RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule - populate(objectMap, "target", r.Target) +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinitionProperties. +func (e ErrorDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) - 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) + case "display": + err = unpopulate(val, "Display", &o.Display) 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) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) - case "isOrganizationDefault": - err = unpopulate(val, "IsOrganizationDefault", &r.IsOrganizationDefault) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) - case "lastModifiedDateTime": - err = unpopulateTimeRFC3339(val, "LastModifiedDateTime", &r.LastModifiedDateTime) - 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", r.ID) - objectMap["ruleType"] = r.RuleType - populate(objectMap, "target", r.Target) +// MarshalJSON implements the json.Marshaller interface for type RecordAllDecisionsProperties. +func (r RecordAllDecisionsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) @@ -3430,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 { @@ -3447,155 +2330,179 @@ func (r *RoleManagementPolicyRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyRuleTarget. -func (r RoleManagementPolicyRuleTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) +// MarshalJSON implements the json.Marshaller interface for type TooManyOwnersAssignedToResourceAlertConfigurationProperties. +func (t TooManyOwnersAssignedToResourceAlertConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", u.Description) - populate(objectMap, "id", u.ID) - populate(objectMap, "isBackup", u.IsBackup) - populate(objectMap, "userType", u.UserType) +// MarshalJSON implements the json.Marshaller interface for type TooManyOwnersAssignedToResourceAlertIncidentProperties. +func (t TooManyOwnersAssignedToResourceAlertIncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "errorInfo", v.ErrorInfo) - populate(objectMap, "isValid", v.IsValid) +// MarshalJSON implements the json.Marshaller interface for type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties. +func (t TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", v.Code) - populate(objectMap, "message", v.Message) +// MarshalJSON implements the json.Marshaller interface for type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties. +func (t TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -3605,7 +2512,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { 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..bc0640b58e8d --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/operations_client.go @@ -0,0 +1,105 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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 2bde172b043d..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client.go +++ /dev/null @@ -1,197 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - subscriptionID string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &PermissionsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// NewListForResourcePager - Gets all permissions the caller has for a resource. -// If the operation fails it returns an *azcore.ResponseError type. -// 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.ListForResource -// 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// 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.ListForResourceGroup -// 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.pl.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.host, 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 2a44d8b05e08..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go +++ /dev/null @@ -1,65 +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. - -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/tree/main/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() - client, err := armauthorization.NewPermissionsClient("subID", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourceGroupPager("rgname", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewPermissionsClient("subId", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourcePager("rgname", "rpnamespace", "parentResourcePath", "resourceType", "resourceName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go b/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go index f0d982480959..99f767cba8ee 100644 --- a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go +++ b/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go @@ -11,47 +11,88 @@ 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 } - var m map[string]interface{} + var m map[string]any 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 } - 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 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 + } + 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 fArray, nil + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAlertIncidentPropertiesClassification(rawMsg json.RawMessage) (AlertIncidentPropertiesClassification, error) { + if rawMsg == nil { + return nil, 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 5d8c1d1ad635..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client.go +++ /dev/null @@ -1,158 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ProviderOperationsMetadataClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// options - ProviderOperationsMetadataClientListOptions contains the optional parameters for the ProviderOperationsMetadataClient.List -// 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.pl.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.host, 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 58d63502f8e3..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go +++ /dev/null @@ -1,60 +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. - -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/tree/main/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() - client, err := armauthorization.NewProviderOperationsMetadataClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "resourceProviderNamespace", &armauthorization.ProviderOperationsMetadataClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewProviderOperationsMetadataClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armauthorization.ProviderOperationsMetadataClientListOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/response_types.go b/sdk/resourcemanager/authorization/armauthorization/response_types.go index 86054a1afb9b..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.List. -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.ListForResourceGroup. -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.ListForResource. -type DenyAssignmentsClientListForResourceResponse struct { - DenyAssignmentListResult +// AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse contains the response from method AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI. +type AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse struct { + AccessReviewHistoryInstance } -// DenyAssignmentsClientListForScopeResponse contains the response from method DenyAssignmentsClient.ListForScope. -type DenyAssignmentsClientListForScopeResponse struct { - DenyAssignmentListResult +// AccessReviewHistoryDefinitionInstancesClientListResponse contains the response from method AccessReviewHistoryDefinitionInstancesClient.NewListPager. +type AccessReviewHistoryDefinitionInstancesClientListResponse struct { + AccessReviewHistoryDefinitionInstanceListResult } -// DenyAssignmentsClientListResponse contains the response from method DenyAssignmentsClient.List. -type DenyAssignmentsClientListResponse struct { - DenyAssignmentListResult +// AccessReviewHistoryDefinitionsClientGetByIDResponse contains the response from method AccessReviewHistoryDefinitionsClient.GetByID. +type AccessReviewHistoryDefinitionsClientGetByIDResponse struct { + AccessReviewHistoryDefinition } -// EligibleChildResourcesClientGetResponse contains the response from method EligibleChildResourcesClient.Get. -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.ListForResourceGroup. -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.ListForResource. -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.List. -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.ListForScope. -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.ListForScope. -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.ListForScope. -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.ListForResourceGroup. -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.ListForResource. -type RoleAssignmentsClientListForResourceResponse struct { - RoleAssignmentListResult +// AlertOperationClientGetResponse contains the response from method AlertOperationClient.Get. +type AlertOperationClientGetResponse struct { + AlertOperationResult } -// RoleAssignmentsClientListForScopeResponse contains the response from method RoleAssignmentsClient.ListForScope. -type RoleAssignmentsClientListForScopeResponse struct { - RoleAssignmentListResult +// AlertsClientGetResponse contains the response from method AlertsClient.Get. +type AlertsClientGetResponse struct { + Alert } -// RoleAssignmentsClientListForSubscriptionResponse contains the response from method RoleAssignmentsClient.ListForSubscription. -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.List. -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.ListForScope. -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.ListForScope. -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.ListForScope. -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.ListForScope. -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.ListForScope. -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 db553da2df14..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client.go +++ /dev/null @@ -1,649 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - subscriptionID string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// 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.ListForResource -// 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// 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.ListForResourceGroup -// 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.pl.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.host, 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. -// 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}' -// options - RoleAssignmentsClientListForScopeOptions contains the optional parameters for the RoleAssignmentsClient.ListForScope -// 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// options - RoleAssignmentsClientListForSubscriptionOptions contains the optional parameters for the RoleAssignmentsClient.ListForSubscription -// 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.pl.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.host, 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 6f9e6bd553b6..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go +++ /dev/null @@ -1,299 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForSubscriptionPager(&armauthorization.RoleAssignmentsClientListForSubscriptionOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourceGroupPager("testrg", &armauthorization.RoleAssignmentsClientListForResourceGroupOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForResourcePager("testrg", "Microsoft.DocumentDb", "databaseAccounts", "test-db-account", &armauthorization.RoleAssignmentsClientListForResourceOptions{Filter: nil, - TenantID: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResource.json -func ExampleRoleAssignmentsClient_Create_roleAssignments_CreateForResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResourceGroup.json -func ExampleRoleAssignmentsClient_Create_roleAssignments_CreateForResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForSubscription.json -func ExampleRoleAssignmentsClient_Create_roleAssignments_CreateForSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2", &armauthorization.RoleAssignmentsClientListForScopeOptions{Filter: nil, - TenantID: nil, - SkipToken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go deleted file mode 100644 index fe20774aa42e..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go +++ /dev/null @@ -1,164 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentScheduleInstancesClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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. -// 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. -// options - RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.ListForScope -// 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.pl.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.host, 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 8cd418654dfe..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go +++ /dev/null @@ -1,61 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleAssignmentScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentScheduleInstancesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go deleted file mode 100644 index 389750dd681a..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go +++ /dev/null @@ -1,312 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentScheduleRequestsClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// 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.ListForScope -// 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.pl.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.host, 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.pl.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.host, 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 ae5ed4e932ab..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.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. - -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/tree/main/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() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentScheduleRequestsClientListForScopeOptions{Filter: to.Ptr("assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleAssignmentScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go deleted file mode 100644 index fc1b71a44a83..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go +++ /dev/null @@ -1,164 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleAssignmentSchedulesClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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. -// 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. -// options - RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.ListForScope -// 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.pl.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.host, 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 afe2a2995be7..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go +++ /dev/null @@ -1,61 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleAssignmentSchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleAssignmentSchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleAssignmentSchedulesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go deleted file mode 100644 index 2d567783e662..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go +++ /dev/null @@ -1,308 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleDefinitionsClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// scope - The scope of the role definition. -// options - RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.List 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.pl.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.host, 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 9a1e6ed8269c..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go +++ /dev/null @@ -1,115 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, "scope", "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "scope", "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("scope", &armauthorization.RoleDefinitionsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleDefinitionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetByID(ctx, "roleDefinitionId", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go deleted file mode 100644 index b4b96e8380cd..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go +++ /dev/null @@ -1,164 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleEligibilityScheduleInstancesClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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. -// 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. -// options - RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.ListForScope -// 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.pl.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.host, 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 0828dedd328d..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go +++ /dev/null @@ -1,61 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleEligibilityScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilityScheduleInstancesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleEligibilityScheduleInstancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go deleted file mode 100644 index 1c5613028c3a..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go +++ /dev/null @@ -1,311 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleEligibilityScheduleRequestsClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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. -// 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 requests. -// options - RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.ListForScope -// 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.pl.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.host, 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.pl.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.host, 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 dbc75b6798c3..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go +++ /dev/null @@ -1,146 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilityScheduleRequestsClientListForScopeOptions{Filter: to.Ptr("assignedTo('A3BB8764-CB92-4276-9D2A-CA1E895E55EA')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleEligibilityScheduleRequestsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go deleted file mode 100644 index 814f6090a0ea..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go +++ /dev/null @@ -1,164 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleEligibilitySchedulesClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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. -// 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. -// options - RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.ListForScope -// 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.pl.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.host, 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 5be7e12a0e12..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go +++ /dev/null @@ -1,61 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleEligibilitySchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleEligibilitySchedulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f", &armauthorization.RoleEligibilitySchedulesClientListForScopeOptions{Filter: to.Ptr("assignedTo('a3bb8764-cb92-4276-9d2a-ca1e895e55ea')")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go deleted file mode 100644 index 4d29abb5bec0..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go +++ /dev/null @@ -1,253 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleManagementPoliciesClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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.pl.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.host, 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. -// 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. -// options - RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.ListForScope -// 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.pl.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.host, 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.pl.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.host, 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 3903e3f9f7f1..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go +++ /dev/null @@ -1,416 +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. - -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/tree/main/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() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleManagementPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go deleted file mode 100644 index fcf1b0369e2b..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go +++ /dev/null @@ -1,253 +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" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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 { - host string - pl runtime.Pipeline -} - -// 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) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &RoleManagementPolicyAssignmentsClient{ - host: ep, - pl: pl, - } - 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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. -// 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. -// options - RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.ListForScope -// 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.pl.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.host, 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 39b91d4c9a58..000000000000 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.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. - -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/tree/main/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() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.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/tree/main/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() - client, err := armauthorization.NewRoleManagementPolicyAssignmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListForScopePager("providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go new file mode 100644 index 000000000000..42ab666fa8e2 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go @@ -0,0 +1,152 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewDefaultSettingsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..758e3bf51001 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go @@ -0,0 +1,153 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..7a480397ca72 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionInstanceClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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..30dfe7447706 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go @@ -0,0 +1,119 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionInstancesClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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..fe5a7a09661a --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go @@ -0,0 +1,174 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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..d4a9478bb23c --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go @@ -0,0 +1,304 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..f6f8d12a2e2a --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,124 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceContactedReviewersClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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..508d7092f41d --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go @@ -0,0 +1,129 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceDecisionsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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..0b121d4902d6 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go @@ -0,0 +1,243 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstancesClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..0ffe326a4c77 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go @@ -0,0 +1,318 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewScheduleDefinitionsClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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.pl.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.host, 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..25d1fe562829 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,119 @@ +//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" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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 { + host string + pl runtime.Pipeline +} + +// 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) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &TenantLevelAccessReviewInstanceContactedReviewersClient{ + host: ep, + pl: pl, + } + 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.pl.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.host, 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 +} diff --git a/sdk/resourcemanager/authorization/armauthorization/time_rfc3339.go b/sdk/resourcemanager/authorization/armauthorization/time_rfc3339.go index 1577635ee029..d14cae128eac 100644 --- a/sdk/resourcemanager/authorization/armauthorization/time_rfc3339.go +++ b/sdk/resourcemanager/authorization/armauthorization/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) {