diff --git a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md index 4d4506fd30bf..105d6c8fcc20 100644 --- a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md +++ b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md @@ -1,5 +1,239 @@ # Release History +## 3.0.0-beta.1 (2023-07-28) +### Breaking Changes + +- Field `EffectiveRules` of struct `RoleManagementPolicyAssignmentProperties` has been removed + +### Features Added + +- New enum type `AccessRecommendationType` with values `AccessRecommendationTypeApprove`, `AccessRecommendationTypeDeny`, `AccessRecommendationTypeNoInfoAvailable` +- New enum type `AccessReviewActorIdentityType` with values `AccessReviewActorIdentityTypeServicePrincipal`, `AccessReviewActorIdentityTypeUser` +- New enum type `AccessReviewApplyResult` with values `AccessReviewApplyResultAppliedSuccessfully`, `AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound`, `AccessReviewApplyResultAppliedWithUnknownFailure`, `AccessReviewApplyResultApplyNotSupported`, `AccessReviewApplyResultApplying`, `AccessReviewApplyResultNew` +- New enum type `AccessReviewDecisionInsightType` with values `AccessReviewDecisionInsightTypeUserSignInInsight` +- New enum type `AccessReviewDecisionPrincipalResourceMembershipType` with values `AccessReviewDecisionPrincipalResourceMembershipTypeDirect`, `AccessReviewDecisionPrincipalResourceMembershipTypeIndirect` +- New enum type `AccessReviewHistoryDefinitionStatus` with values `AccessReviewHistoryDefinitionStatusDone`, `AccessReviewHistoryDefinitionStatusError`, `AccessReviewHistoryDefinitionStatusInProgress`, `AccessReviewHistoryDefinitionStatusRequested` +- New enum type `AccessReviewInstanceReviewersType` with values `AccessReviewInstanceReviewersTypeAssigned`, `AccessReviewInstanceReviewersTypeManagers`, `AccessReviewInstanceReviewersTypeSelf` +- New enum type `AccessReviewInstanceStatus` with values `AccessReviewInstanceStatusApplied`, `AccessReviewInstanceStatusApplying`, `AccessReviewInstanceStatusAutoReviewed`, `AccessReviewInstanceStatusAutoReviewing`, `AccessReviewInstanceStatusCompleted`, `AccessReviewInstanceStatusCompleting`, `AccessReviewInstanceStatusInProgress`, `AccessReviewInstanceStatusInitializing`, `AccessReviewInstanceStatusNotStarted`, `AccessReviewInstanceStatusScheduled`, `AccessReviewInstanceStatusStarting` +- New enum type `AccessReviewRecurrencePatternType` with values `AccessReviewRecurrencePatternTypeAbsoluteMonthly`, `AccessReviewRecurrencePatternTypeWeekly` +- New enum type `AccessReviewRecurrenceRangeType` with values `AccessReviewRecurrenceRangeTypeEndDate`, `AccessReviewRecurrenceRangeTypeNoEnd`, `AccessReviewRecurrenceRangeTypeNumbered` +- New enum type `AccessReviewResult` with values `AccessReviewResultApprove`, `AccessReviewResultDeny`, `AccessReviewResultDontKnow`, `AccessReviewResultNotNotified`, `AccessReviewResultNotReviewed` +- New enum type `AccessReviewReviewerType` with values `AccessReviewReviewerTypeServicePrincipal`, `AccessReviewReviewerTypeUser` +- New enum type `AccessReviewScheduleDefinitionReviewersType` with values `AccessReviewScheduleDefinitionReviewersTypeAssigned`, `AccessReviewScheduleDefinitionReviewersTypeManagers`, `AccessReviewScheduleDefinitionReviewersTypeSelf` +- New enum type `AccessReviewScheduleDefinitionStatus` with values `AccessReviewScheduleDefinitionStatusApplied`, `AccessReviewScheduleDefinitionStatusApplying`, `AccessReviewScheduleDefinitionStatusAutoReviewed`, `AccessReviewScheduleDefinitionStatusAutoReviewing`, `AccessReviewScheduleDefinitionStatusCompleted`, `AccessReviewScheduleDefinitionStatusCompleting`, `AccessReviewScheduleDefinitionStatusInProgress`, `AccessReviewScheduleDefinitionStatusInitializing`, `AccessReviewScheduleDefinitionStatusNotStarted`, `AccessReviewScheduleDefinitionStatusScheduled`, `AccessReviewScheduleDefinitionStatusStarting` +- New enum type `AccessReviewScopeAssignmentState` with values `AccessReviewScopeAssignmentStateActive`, `AccessReviewScopeAssignmentStateEligible` +- New enum type `AccessReviewScopePrincipalType` with values `AccessReviewScopePrincipalTypeGuestUser`, `AccessReviewScopePrincipalTypeRedeemedGuestUser`, `AccessReviewScopePrincipalTypeServicePrincipal`, `AccessReviewScopePrincipalTypeUser`, `AccessReviewScopePrincipalTypeUserGroup` +- New enum type `DecisionResourceType` with values `DecisionResourceTypeAzureRole` +- New enum type `DecisionTargetType` with values `DecisionTargetTypeServicePrincipal`, `DecisionTargetTypeUser` +- New enum type `DefaultDecisionType` with values `DefaultDecisionTypeApprove`, `DefaultDecisionTypeDeny`, `DefaultDecisionTypeRecommendation` +- New enum type `RecordAllDecisionsResult` with values `RecordAllDecisionsResultApprove`, `RecordAllDecisionsResultDeny` +- New enum type `SeverityLevel` with values `SeverityLevelHigh`, `SeverityLevelLow`, `SeverityLevelMedium` +- New function `*AccessReviewDecisionIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionInsightProperties.GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties` +- New function `*AccessReviewDecisionServicePrincipalIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionUserIdentity.GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity` +- New function `*AccessReviewDecisionUserSignInInsightProperties.GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties` +- New function `NewAccessReviewDefaultSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewDefaultSettingsClient, error)` +- New function `*AccessReviewDefaultSettingsClient.Get(context.Context, *AccessReviewDefaultSettingsClientGetOptions) (AccessReviewDefaultSettingsClientGetResponse, error)` +- New function `*AccessReviewDefaultSettingsClient.Put(context.Context, AccessReviewScheduleSettings, *AccessReviewDefaultSettingsClientPutOptions) (AccessReviewDefaultSettingsClientPutResponse, error)` +- New function `NewAccessReviewHistoryDefinitionClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionClient, error)` +- New function `*AccessReviewHistoryDefinitionClient.Create(context.Context, string, AccessReviewHistoryDefinitionProperties, *AccessReviewHistoryDefinitionClientCreateOptions) (AccessReviewHistoryDefinitionClientCreateResponse, error)` +- New function `*AccessReviewHistoryDefinitionClient.DeleteByID(context.Context, string, *AccessReviewHistoryDefinitionClientDeleteByIDOptions) (AccessReviewHistoryDefinitionClientDeleteByIDResponse, error)` +- New function `NewAccessReviewHistoryDefinitionInstanceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstanceClient, error)` +- New function `*AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI(context.Context, string, string, *AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error)` +- New function `NewAccessReviewHistoryDefinitionInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstancesClient, error)` +- New function `*AccessReviewHistoryDefinitionInstancesClient.NewListPager(string, *AccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionInstancesClientListResponse]` +- New function `NewAccessReviewHistoryDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewHistoryDefinitionsClient, error)` +- New function `*AccessReviewHistoryDefinitionsClient.GetByID(context.Context, string, *AccessReviewHistoryDefinitionsClientGetByIDOptions) (AccessReviewHistoryDefinitionsClientGetByIDResponse, error)` +- New function `*AccessReviewHistoryDefinitionsClient.NewListPager(*AccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionsClientListResponse]` +- New function `NewAccessReviewInstanceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceClient, error)` +- New function `*AccessReviewInstanceClient.AcceptRecommendations(context.Context, string, string, *AccessReviewInstanceClientAcceptRecommendationsOptions) (AccessReviewInstanceClientAcceptRecommendationsResponse, error)` +- New function `*AccessReviewInstanceClient.ApplyDecisions(context.Context, string, string, *AccessReviewInstanceClientApplyDecisionsOptions) (AccessReviewInstanceClientApplyDecisionsResponse, error)` +- New function `*AccessReviewInstanceClient.ResetDecisions(context.Context, string, string, *AccessReviewInstanceClientResetDecisionsOptions) (AccessReviewInstanceClientResetDecisionsResponse, error)` +- New function `*AccessReviewInstanceClient.SendReminders(context.Context, string, string, *AccessReviewInstanceClientSendRemindersOptions) (AccessReviewInstanceClientSendRemindersResponse, error)` +- New function `*AccessReviewInstanceClient.Stop(context.Context, string, string, *AccessReviewInstanceClientStopOptions) (AccessReviewInstanceClientStopResponse, error)` +- New function `NewAccessReviewInstanceContactedReviewersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceContactedReviewersClient, error)` +- New function `*AccessReviewInstanceContactedReviewersClient.NewListPager(string, string, *AccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[AccessReviewInstanceContactedReviewersClientListResponse]` +- New function `NewAccessReviewInstanceDecisionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceDecisionsClient, error)` +- New function `*AccessReviewInstanceDecisionsClient.NewListPager(string, string, *AccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceDecisionsClientListResponse]` +- New function `NewAccessReviewInstanceMyDecisionsClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstanceMyDecisionsClient, error)` +- New function `*AccessReviewInstanceMyDecisionsClient.GetByID(context.Context, string, string, string, *AccessReviewInstanceMyDecisionsClientGetByIDOptions) (AccessReviewInstanceMyDecisionsClientGetByIDResponse, error)` +- New function `*AccessReviewInstanceMyDecisionsClient.NewListPager(string, string, *AccessReviewInstanceMyDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceMyDecisionsClientListResponse]` +- New function `*AccessReviewInstanceMyDecisionsClient.Patch(context.Context, string, string, string, AccessReviewDecisionProperties, *AccessReviewInstanceMyDecisionsClientPatchOptions) (AccessReviewInstanceMyDecisionsClientPatchResponse, error)` +- New function `NewAccessReviewInstancesAssignedForMyApprovalClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstancesAssignedForMyApprovalClient, error)` +- New function `*AccessReviewInstancesAssignedForMyApprovalClient.GetByID(context.Context, string, string, *AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions) (AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse, error)` +- New function `*AccessReviewInstancesAssignedForMyApprovalClient.NewListPager(string, *AccessReviewInstancesAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewInstancesAssignedForMyApprovalClientListResponse]` +- New function `NewAccessReviewInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewInstancesClient, error)` +- New function `*AccessReviewInstancesClient.Create(context.Context, string, string, AccessReviewInstanceProperties, *AccessReviewInstancesClientCreateOptions) (AccessReviewInstancesClientCreateResponse, error)` +- New function `*AccessReviewInstancesClient.GetByID(context.Context, string, string, *AccessReviewInstancesClientGetByIDOptions) (AccessReviewInstancesClientGetByIDResponse, error)` +- New function `*AccessReviewInstancesClient.NewListPager(string, *AccessReviewInstancesClientListOptions) *runtime.Pager[AccessReviewInstancesClientListResponse]` +- New function `NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient, error)` +- New function `*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager(*AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse]` +- New function `NewAccessReviewScheduleDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccessReviewScheduleDefinitionsClient, error)` +- New function `*AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID(context.Context, string, AccessReviewScheduleDefinitionProperties, *AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.DeleteByID(context.Context, string, *AccessReviewScheduleDefinitionsClientDeleteByIDOptions) (AccessReviewScheduleDefinitionsClientDeleteByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.GetByID(context.Context, string, *AccessReviewScheduleDefinitionsClientGetByIDOptions) (AccessReviewScheduleDefinitionsClientGetByIDResponse, error)` +- New function `*AccessReviewScheduleDefinitionsClient.NewListPager(*AccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsClientListResponse]` +- New function `*AccessReviewScheduleDefinitionsClient.Stop(context.Context, string, *AccessReviewScheduleDefinitionsClientStopOptions) (AccessReviewScheduleDefinitionsClientStopResponse, error)` +- New function `*AlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `NewAlertConfigurationsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertConfigurationsClient, error)` +- New function `*AlertConfigurationsClient.Get(context.Context, string, string, *AlertConfigurationsClientGetOptions) (AlertConfigurationsClientGetResponse, error)` +- New function `*AlertConfigurationsClient.NewListForScopePager(string, *AlertConfigurationsClientListForScopeOptions) *runtime.Pager[AlertConfigurationsClientListForScopeResponse]` +- New function `*AlertConfigurationsClient.Update(context.Context, string, string, AlertConfiguration, *AlertConfigurationsClientUpdateOptions) (AlertConfigurationsClientUpdateResponse, error)` +- New function `NewAlertDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertDefinitionsClient, error)` +- New function `*AlertDefinitionsClient.Get(context.Context, string, string, *AlertDefinitionsClientGetOptions) (AlertDefinitionsClientGetResponse, error)` +- New function `*AlertDefinitionsClient.NewListForScopePager(string, *AlertDefinitionsClientListForScopeOptions) *runtime.Pager[AlertDefinitionsClientListForScopeResponse]` +- New function `*AlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `NewAlertIncidentsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertIncidentsClient, error)` +- New function `*AlertIncidentsClient.Get(context.Context, string, string, string, *AlertIncidentsClientGetOptions) (AlertIncidentsClientGetResponse, error)` +- New function `*AlertIncidentsClient.NewListForScopePager(string, string, *AlertIncidentsClientListForScopeOptions) *runtime.Pager[AlertIncidentsClientListForScopeResponse]` +- New function `*AlertIncidentsClient.Remediate(context.Context, string, string, string, *AlertIncidentsClientRemediateOptions) (AlertIncidentsClientRemediateResponse, error)` +- New function `NewAlertOperationClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertOperationClient, error)` +- New function `*AlertOperationClient.Get(context.Context, string, string, *AlertOperationClientGetOptions) (AlertOperationClientGetResponse, error)` +- New function `NewAlertsClient(azcore.TokenCredential, *arm.ClientOptions) (*AlertsClient, error)` +- New function `*AlertsClient.Get(context.Context, string, string, *AlertsClientGetOptions) (AlertsClientGetResponse, error)` +- New function `*AlertsClient.NewListForScopePager(string, *AlertsClientListForScopeOptions) *runtime.Pager[AlertsClientListForScopeResponse]` +- New function `*AlertsClient.BeginRefresh(context.Context, string, string, *AlertsClientBeginRefreshOptions) (*runtime.Poller[AlertsClientRefreshResponse], error)` +- New function `*AlertsClient.BeginRefreshAll(context.Context, string, *AlertsClientBeginRefreshAllOptions) (*runtime.Poller[AlertsClientRefreshAllResponse], error)` +- New function `*AlertsClient.Update(context.Context, string, string, Alert, *AlertsClientUpdateOptions) (AlertsClientUpdateResponse, error)` +- New function `*AzureRolesAssignedOutsidePimAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*AzureRolesAssignedOutsidePimAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `*ClientFactory.NewAccessReviewDefaultSettingsClient() *AccessReviewDefaultSettingsClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionClient() *AccessReviewHistoryDefinitionClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionInstanceClient() *AccessReviewHistoryDefinitionInstanceClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionInstancesClient() *AccessReviewHistoryDefinitionInstancesClient` +- New function `*ClientFactory.NewAccessReviewHistoryDefinitionsClient() *AccessReviewHistoryDefinitionsClient` +- New function `*ClientFactory.NewAccessReviewInstanceClient() *AccessReviewInstanceClient` +- New function `*ClientFactory.NewAccessReviewInstanceContactedReviewersClient() *AccessReviewInstanceContactedReviewersClient` +- New function `*ClientFactory.NewAccessReviewInstanceDecisionsClient() *AccessReviewInstanceDecisionsClient` +- New function `*ClientFactory.NewAccessReviewInstanceMyDecisionsClient() *AccessReviewInstanceMyDecisionsClient` +- New function `*ClientFactory.NewAccessReviewInstancesAssignedForMyApprovalClient() *AccessReviewInstancesAssignedForMyApprovalClient` +- New function `*ClientFactory.NewAccessReviewInstancesClient() *AccessReviewInstancesClient` +- New function `*ClientFactory.NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient() *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient` +- New function `*ClientFactory.NewAccessReviewScheduleDefinitionsClient() *AccessReviewScheduleDefinitionsClient` +- New function `*ClientFactory.NewAlertConfigurationsClient() *AlertConfigurationsClient` +- New function `*ClientFactory.NewAlertDefinitionsClient() *AlertDefinitionsClient` +- New function `*ClientFactory.NewAlertIncidentsClient() *AlertIncidentsClient` +- New function `*ClientFactory.NewAlertOperationClient() *AlertOperationClient` +- New function `*ClientFactory.NewAlertsClient() *AlertsClient` +- New function `*ClientFactory.NewOperationsClient() *OperationsClient` +- New function `*ClientFactory.NewScopeAccessReviewDefaultSettingsClient() *ScopeAccessReviewDefaultSettingsClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionClient() *ScopeAccessReviewHistoryDefinitionClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstanceClient() *ScopeAccessReviewHistoryDefinitionInstanceClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionInstancesClient() *ScopeAccessReviewHistoryDefinitionInstancesClient` +- New function `*ClientFactory.NewScopeAccessReviewHistoryDefinitionsClient() *ScopeAccessReviewHistoryDefinitionsClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceClient() *ScopeAccessReviewInstanceClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceContactedReviewersClient() *ScopeAccessReviewInstanceContactedReviewersClient` +- New function `*ClientFactory.NewScopeAccessReviewInstanceDecisionsClient() *ScopeAccessReviewInstanceDecisionsClient` +- New function `*ClientFactory.NewScopeAccessReviewInstancesClient() *ScopeAccessReviewInstancesClient` +- New function `*ClientFactory.NewScopeAccessReviewScheduleDefinitionsClient() *ScopeAccessReviewScheduleDefinitionsClient` +- New function `*ClientFactory.NewTenantLevelAccessReviewInstanceContactedReviewersClient() *TenantLevelAccessReviewInstanceContactedReviewersClient` +- New function `*DuplicateRoleCreatedAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*DuplicateRoleCreatedAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `NewOperationsClient(azcore.TokenCredential, *arm.ClientOptions) (*OperationsClient, error)` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New function `NewScopeAccessReviewDefaultSettingsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewDefaultSettingsClient, error)` +- New function `*ScopeAccessReviewDefaultSettingsClient.Get(context.Context, string, *ScopeAccessReviewDefaultSettingsClientGetOptions) (ScopeAccessReviewDefaultSettingsClientGetResponse, error)` +- New function `*ScopeAccessReviewDefaultSettingsClient.Put(context.Context, string, AccessReviewScheduleSettings, *ScopeAccessReviewDefaultSettingsClientPutOptions) (ScopeAccessReviewDefaultSettingsClientPutResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionClient.Create(context.Context, string, string, AccessReviewHistoryDefinitionProperties, *ScopeAccessReviewHistoryDefinitionClientCreateOptions) (ScopeAccessReviewHistoryDefinitionClientCreateResponse, error)` +- New function `*ScopeAccessReviewHistoryDefinitionClient.DeleteByID(context.Context, string, string, *ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions) (ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionInstanceClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstanceClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI(context.Context, string, string, string, *ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error)` +- New function `NewScopeAccessReviewHistoryDefinitionInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstancesClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager(string, string, *ScopeAccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionInstancesClientListResponse]` +- New function `NewScopeAccessReviewHistoryDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionsClient, error)` +- New function `*ScopeAccessReviewHistoryDefinitionsClient.GetByID(context.Context, string, string, *ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions) (ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewHistoryDefinitionsClient.NewListPager(string, *ScopeAccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionsClientListResponse]` +- New function `NewScopeAccessReviewInstanceClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceClient, error)` +- New function `*ScopeAccessReviewInstanceClient.ApplyDecisions(context.Context, string, string, string, *ScopeAccessReviewInstanceClientApplyDecisionsOptions) (ScopeAccessReviewInstanceClientApplyDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.RecordAllDecisions(context.Context, string, string, string, RecordAllDecisionsProperties, *ScopeAccessReviewInstanceClientRecordAllDecisionsOptions) (ScopeAccessReviewInstanceClientRecordAllDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.ResetDecisions(context.Context, string, string, string, *ScopeAccessReviewInstanceClientResetDecisionsOptions) (ScopeAccessReviewInstanceClientResetDecisionsResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.SendReminders(context.Context, string, string, string, *ScopeAccessReviewInstanceClientSendRemindersOptions) (ScopeAccessReviewInstanceClientSendRemindersResponse, error)` +- New function `*ScopeAccessReviewInstanceClient.Stop(context.Context, string, string, string, *ScopeAccessReviewInstanceClientStopOptions) (ScopeAccessReviewInstanceClientStopResponse, error)` +- New function `NewScopeAccessReviewInstanceContactedReviewersClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceContactedReviewersClient, error)` +- New function `*ScopeAccessReviewInstanceContactedReviewersClient.NewListPager(string, string, string, *ScopeAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceContactedReviewersClientListResponse]` +- New function `NewScopeAccessReviewInstanceDecisionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstanceDecisionsClient, error)` +- New function `*ScopeAccessReviewInstanceDecisionsClient.NewListPager(string, string, string, *ScopeAccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceDecisionsClientListResponse]` +- New function `NewScopeAccessReviewInstancesClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewInstancesClient, error)` +- New function `*ScopeAccessReviewInstancesClient.Create(context.Context, string, string, string, AccessReviewInstanceProperties, *ScopeAccessReviewInstancesClientCreateOptions) (ScopeAccessReviewInstancesClientCreateResponse, error)` +- New function `*ScopeAccessReviewInstancesClient.GetByID(context.Context, string, string, string, *ScopeAccessReviewInstancesClientGetByIDOptions) (ScopeAccessReviewInstancesClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewInstancesClient.NewListPager(string, string, *ScopeAccessReviewInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewInstancesClientListResponse]` +- New function `NewScopeAccessReviewScheduleDefinitionsClient(azcore.TokenCredential, *arm.ClientOptions) (*ScopeAccessReviewScheduleDefinitionsClient, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID(context.Context, string, string, AccessReviewScheduleDefinitionProperties, *ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.DeleteByID(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.GetByID(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse, error)` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.NewListPager(string, *ScopeAccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewScheduleDefinitionsClientListResponse]` +- New function `*ScopeAccessReviewScheduleDefinitionsClient.Stop(context.Context, string, string, *ScopeAccessReviewScheduleDefinitionsClientStopOptions) (ScopeAccessReviewScheduleDefinitionsClientStopResponse, error)` +- New function `NewTenantLevelAccessReviewInstanceContactedReviewersClient(azcore.TokenCredential, *arm.ClientOptions) (*TenantLevelAccessReviewInstanceContactedReviewersClient, error)` +- New function `*TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager(string, string, *TenantLevelAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[TenantLevelAccessReviewInstanceContactedReviewersClientListResponse]` +- New function `*TooManyOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*TooManyOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New function `*TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties.GetAlertConfigurationProperties() *AlertConfigurationProperties` +- New function `*TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties.GetAlertIncidentProperties() *AlertIncidentProperties` +- New struct `AccessReviewActorIdentity` +- New struct `AccessReviewContactedReviewer` +- New struct `AccessReviewContactedReviewerListResult` +- New struct `AccessReviewContactedReviewerProperties` +- New struct `AccessReviewDecision` +- New struct `AccessReviewDecisionInsight` +- New struct `AccessReviewDecisionListResult` +- New struct `AccessReviewDecisionPrincipalResourceMembership` +- New struct `AccessReviewDecisionProperties` +- New struct `AccessReviewDecisionResource` +- New struct `AccessReviewDecisionServicePrincipalIdentity` +- New struct `AccessReviewDecisionUserIdentity` +- New struct `AccessReviewDecisionUserSignInInsightProperties` +- New struct `AccessReviewDefaultSettings` +- New struct `AccessReviewHistoryDefinition` +- New struct `AccessReviewHistoryDefinitionInstanceListResult` +- New struct `AccessReviewHistoryDefinitionListResult` +- New struct `AccessReviewHistoryDefinitionProperties` +- New struct `AccessReviewHistoryInstance` +- New struct `AccessReviewHistoryInstanceProperties` +- New struct `AccessReviewHistoryScheduleSettings` +- New struct `AccessReviewInstance` +- New struct `AccessReviewInstanceListResult` +- New struct `AccessReviewInstanceProperties` +- New struct `AccessReviewRecurrencePattern` +- New struct `AccessReviewRecurrenceRange` +- New struct `AccessReviewRecurrenceSettings` +- New struct `AccessReviewReviewer` +- New struct `AccessReviewScheduleDefinition` +- New struct `AccessReviewScheduleDefinitionListResult` +- New struct `AccessReviewScheduleDefinitionProperties` +- New struct `AccessReviewScheduleSettings` +- New struct `AccessReviewScope` +- New struct `Alert` +- New struct `AlertConfiguration` +- New struct `AlertConfigurationListResult` +- New struct `AlertDefinition` +- New struct `AlertDefinitionListResult` +- New struct `AlertDefinitionProperties` +- New struct `AlertIncident` +- New struct `AlertIncidentListResult` +- New struct `AlertListResult` +- New struct `AlertOperationResult` +- New struct `AlertProperties` +- New struct `AzureRolesAssignedOutsidePimAlertConfigurationProperties` +- New struct `AzureRolesAssignedOutsidePimAlertIncidentProperties` +- New struct `DuplicateRoleCreatedAlertConfigurationProperties` +- New struct `DuplicateRoleCreatedAlertIncidentProperties` +- New struct `ErrorDefinition` +- New struct `ErrorDefinitionProperties` +- New struct `Operation` +- New struct `OperationDisplay` +- New struct `OperationListResult` +- New struct `RecordAllDecisionsProperties` +- New struct `TooManyOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyOwnersAssignedToResourceAlertIncidentProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties` +- New struct `TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties` +- New field `Condition`, `ConditionVersion`, `CreatedBy`, `CreatedOn`, `UpdatedBy`, `UpdatedOn` in struct `DenyAssignmentProperties` +- New field `Condition`, `ConditionVersion` in struct `Permission` +- New field `CreatedBy`, `CreatedOn`, `UpdatedBy`, `UpdatedOn` in struct `RoleDefinitionProperties` + + ## 2.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go new file mode 100644 index 000000000000..8ed7b97e973f --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewdefaultsettings_client.go @@ -0,0 +1,142 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewDefaultSettingsClient contains the methods for the AccessReviewDefaultSettings group. +// Don't use this type directly, use NewAccessReviewDefaultSettingsClient() instead. +type AccessReviewDefaultSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewDefaultSettingsClient creates a new instance of AccessReviewDefaultSettingsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewDefaultSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewDefaultSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewDefaultSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewDefaultSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Get +// method. +func (client *AccessReviewDefaultSettingsClient) Get(ctx context.Context, options *AccessReviewDefaultSettingsClientGetOptions) (AccessReviewDefaultSettingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, options) + if err != nil { + return AccessReviewDefaultSettingsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewDefaultSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewDefaultSettingsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AccessReviewDefaultSettingsClient) getCreateRequest(ctx context.Context, options *AccessReviewDefaultSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccessReviewDefaultSettingsClient) getHandleResponse(resp *http.Response) (AccessReviewDefaultSettingsClientGetResponse, error) { + result := AccessReviewDefaultSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return AccessReviewDefaultSettingsClientGetResponse{}, err + } + return result, nil +} + +// Put - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - properties - Access review schedule settings. +// - options - AccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Put +// method. +func (client *AccessReviewDefaultSettingsClient) Put(ctx context.Context, properties AccessReviewScheduleSettings, options *AccessReviewDefaultSettingsClientPutOptions) (AccessReviewDefaultSettingsClientPutResponse, error) { + req, err := client.putCreateRequest(ctx, properties, options) + if err != nil { + return AccessReviewDefaultSettingsClientPutResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewDefaultSettingsClientPutResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewDefaultSettingsClientPutResponse{}, runtime.NewResponseError(resp) + } + return client.putHandleResponse(resp) +} + +// putCreateRequest creates the Put request. +func (client *AccessReviewDefaultSettingsClient) putCreateRequest(ctx context.Context, properties AccessReviewScheduleSettings, options *AccessReviewDefaultSettingsClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// putHandleResponse handles the Put response. +func (client *AccessReviewDefaultSettingsClient) putHandleResponse(resp *http.Response) (AccessReviewDefaultSettingsClientPutResponse, error) { + result := AccessReviewDefaultSettingsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return AccessReviewDefaultSettingsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go new file mode 100644 index 000000000000..418ef799f8c1 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinition_client.go @@ -0,0 +1,143 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionClient contains the methods for the AccessReviewHistoryDefinition group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionClient() instead. +type AccessReviewHistoryDefinitionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionClient creates a new instance of AccessReviewHistoryDefinitionClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create a scheduled or one-time Access Review History Definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - properties - Access review history definition properties. +// - options - AccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.Create +// method. +func (client *AccessReviewHistoryDefinitionClient) Create(ctx context.Context, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *AccessReviewHistoryDefinitionClientCreateOptions) (AccessReviewHistoryDefinitionClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, historyDefinitionID, properties, options) + if err != nil { + return AccessReviewHistoryDefinitionClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *AccessReviewHistoryDefinitionClient) createCreateRequest(ctx context.Context, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *AccessReviewHistoryDefinitionClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *AccessReviewHistoryDefinitionClient) createHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionClientCreateResponse, error) { + result := AccessReviewHistoryDefinitionClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return AccessReviewHistoryDefinitionClientCreateResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete an access review history definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - options - AccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.DeleteByID +// method. +func (client *AccessReviewHistoryDefinitionClient) DeleteByID(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionClientDeleteByIDOptions) (AccessReviewHistoryDefinitionClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, historyDefinitionID, options) + if err != nil { + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewHistoryDefinitionClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *AccessReviewHistoryDefinitionClient) deleteByIDCreateRequest(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_client.go new file mode 100644 index 000000000000..2c1b12dbbe34 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstance_client.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionInstanceClient contains the methods for the AccessReviewHistoryDefinitionInstance group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionInstanceClient() instead. +type AccessReviewHistoryDefinitionInstanceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionInstanceClient creates a new instance of AccessReviewHistoryDefinitionInstanceClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionInstanceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GenerateDownloadURI - Generates a uri which can be used to retrieve review history data. This URI has a TTL of 1 day and +// can be retrieved by fetching the accessReviewHistoryDefinition object. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - instanceID - The id of the access review history definition instance to generate a URI for. +// - options - AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for the +// AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI method. +func (client *AccessReviewHistoryDefinitionInstanceClient) GenerateDownloadURI(ctx context.Context, historyDefinitionID string, instanceID string, options *AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + req, err := client.generateDownloadURICreateRequest(ctx, historyDefinitionID, instanceID, options) + if err != nil { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, runtime.NewResponseError(resp) + } + return client.generateDownloadURIHandleResponse(resp) +} + +// generateDownloadURICreateRequest creates the GenerateDownloadURI request. +func (client *AccessReviewHistoryDefinitionInstanceClient) generateDownloadURICreateRequest(ctx context.Context, historyDefinitionID string, instanceID string, options *AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generateDownloadURIHandleResponse handles the GenerateDownloadURI response. +func (client *AccessReviewHistoryDefinitionInstanceClient) generateDownloadURIHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + result := AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryInstance); err != nil { + return AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go new file mode 100644 index 000000000000..078277be385d --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitioninstances_client.go @@ -0,0 +1,110 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionInstancesClient contains the methods for the AccessReviewHistoryDefinitionInstances group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionInstancesClient() instead. +type AccessReviewHistoryDefinitionInstancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionInstancesClient creates a new instance of AccessReviewHistoryDefinitionInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review history definition instances by definition Id +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - options - AccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the AccessReviewHistoryDefinitionInstancesClient.NewListPager +// method. +func (client *AccessReviewHistoryDefinitionInstancesClient) NewListPager(historyDefinitionID string, options *AccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewHistoryDefinitionInstancesClientListResponse]{ + More: func(page AccessReviewHistoryDefinitionInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewHistoryDefinitionInstancesClientListResponse) (AccessReviewHistoryDefinitionInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, historyDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewHistoryDefinitionInstancesClient) listCreateRequest(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewHistoryDefinitionInstancesClient) listHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionInstancesClientListResponse, error) { + result := AccessReviewHistoryDefinitionInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionInstanceListResult); err != nil { + return AccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go new file mode 100644 index 000000000000..38bad9bbb2e8 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewhistorydefinitions_client.go @@ -0,0 +1,164 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewHistoryDefinitionsClient contains the methods for the AccessReviewHistoryDefinitions group. +// Don't use this type directly, use NewAccessReviewHistoryDefinitionsClient() instead. +type AccessReviewHistoryDefinitionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewHistoryDefinitionsClient creates a new instance of AccessReviewHistoryDefinitionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewHistoryDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewHistoryDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewHistoryDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewHistoryDefinitionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetByID - Get access review history definition by definition Id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - historyDefinitionID - The id of the access review history definition. +// - options - AccessReviewHistoryDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionsClient.GetByID +// method. +func (client *AccessReviewHistoryDefinitionsClient) GetByID(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionsClientGetByIDOptions) (AccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, historyDefinitionID, options) + if err != nil { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewHistoryDefinitionsClient) getByIDCreateRequest(ctx context.Context, historyDefinitionID string, options *AccessReviewHistoryDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewHistoryDefinitionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + result := AccessReviewHistoryDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return AccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the accessReviewHistoryDefinitions available from this provider, definition instances are only available +// for 30 days after creation. +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewHistoryDefinitionsClientListOptions contains the optional parameters for the AccessReviewHistoryDefinitionsClient.NewListPager +// method. +func (client *AccessReviewHistoryDefinitionsClient) NewListPager(options *AccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[AccessReviewHistoryDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewHistoryDefinitionsClientListResponse]{ + More: func(page AccessReviewHistoryDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewHistoryDefinitionsClientListResponse) (AccessReviewHistoryDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewHistoryDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewHistoryDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewHistoryDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewHistoryDefinitionsClient) listCreateRequest(ctx context.Context, options *AccessReviewHistoryDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewHistoryDefinitionsClient) listHandleResponse(resp *http.Response) (AccessReviewHistoryDefinitionsClientListResponse, error) { + result := AccessReviewHistoryDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionListResult); err != nil { + return AccessReviewHistoryDefinitionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go new file mode 100644 index 000000000000..d5e3125ed5a4 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client.go @@ -0,0 +1,286 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceClient contains the methods for the AccessReviewInstance group. +// Don't use this type directly, use NewAccessReviewInstanceClient() instead. +type AccessReviewInstanceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstanceClient creates a new instance of AccessReviewInstanceClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// AcceptRecommendations - An action to accept recommendations for decision in an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientAcceptRecommendationsOptions contains the optional parameters for the AccessReviewInstanceClient.AcceptRecommendations +// method. +func (client *AccessReviewInstanceClient) AcceptRecommendations(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientAcceptRecommendationsOptions) (AccessReviewInstanceClientAcceptRecommendationsResponse, error) { + req, err := client.acceptRecommendationsCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientAcceptRecommendationsResponse{}, nil +} + +// acceptRecommendationsCreateRequest creates the AcceptRecommendations request. +func (client *AccessReviewInstanceClient) acceptRecommendationsCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientAcceptRecommendationsOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ApplyDecisions - An action to apply all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ApplyDecisions +// method. +func (client *AccessReviewInstanceClient) ApplyDecisions(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientApplyDecisionsOptions) (AccessReviewInstanceClientApplyDecisionsResponse, error) { + req, err := client.applyDecisionsCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientApplyDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientApplyDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientApplyDecisionsResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientApplyDecisionsResponse{}, nil +} + +// applyDecisionsCreateRequest creates the ApplyDecisions request. +func (client *AccessReviewInstanceClient) applyDecisionsCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientApplyDecisionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ResetDecisions - An action to reset all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ResetDecisions +// method. +func (client *AccessReviewInstanceClient) ResetDecisions(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientResetDecisionsOptions) (AccessReviewInstanceClientResetDecisionsResponse, error) { + req, err := client.resetDecisionsCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientResetDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientResetDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientResetDecisionsResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientResetDecisionsResponse{}, nil +} + +// resetDecisionsCreateRequest creates the ResetDecisions request. +func (client *AccessReviewInstanceClient) resetDecisionsCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientResetDecisionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// SendReminders - An action to send reminders for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the AccessReviewInstanceClient.SendReminders +// method. +func (client *AccessReviewInstanceClient) SendReminders(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientSendRemindersOptions) (AccessReviewInstanceClientSendRemindersResponse, error) { + req, err := client.sendRemindersCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientSendRemindersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientSendRemindersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientSendRemindersResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientSendRemindersResponse{}, nil +} + +// sendRemindersCreateRequest creates the SendReminders request. +func (client *AccessReviewInstanceClient) sendRemindersCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientSendRemindersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Stop - An action to stop an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceClientStopOptions contains the optional parameters for the AccessReviewInstanceClient.Stop +// method. +func (client *AccessReviewInstanceClient) Stop(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientStopOptions) (AccessReviewInstanceClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstanceClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewInstanceClientStopResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewInstanceClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *AccessReviewInstanceClient) stopCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceClientStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client_example_test.go new file mode 100644 index 000000000000..4c422c7d573b --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstance_client_example_test.go @@ -0,0 +1,35 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/AccessReviewInstanceAcceptRecommendations.json +func ExampleAccessReviewInstanceClient_AcceptRecommendations() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAccessReviewInstanceClient().AcceptRecommendations(ctx, "488a6d0e-0a63-4946-86e3-1f5bbc934661", "d9b9e056-7004-470b-bf21-1635e98487da", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go new file mode 100644 index 000000000000..4b7f3aaadb44 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceContactedReviewersClient contains the methods for the AccessReviewInstanceContactedReviewers group. +// Don't use this type directly, use NewAccessReviewInstanceContactedReviewersClient() instead. +type AccessReviewInstanceContactedReviewersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstanceContactedReviewersClient creates a new instance of AccessReviewInstanceContactedReviewersClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceContactedReviewersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceContactedReviewersClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceContactedReviewersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceContactedReviewersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance contacted reviewers +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the AccessReviewInstanceContactedReviewersClient.NewListPager +// method. +func (client *AccessReviewInstanceContactedReviewersClient) NewListPager(scheduleDefinitionID string, id string, options *AccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[AccessReviewInstanceContactedReviewersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstanceContactedReviewersClientListResponse]{ + More: func(page AccessReviewInstanceContactedReviewersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstanceContactedReviewersClientListResponse) (AccessReviewInstanceContactedReviewersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstanceContactedReviewersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceContactedReviewersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceContactedReviewersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstanceContactedReviewersClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceContactedReviewersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstanceContactedReviewersClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceContactedReviewersClientListResponse, error) { + result := AccessReviewInstanceContactedReviewersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewContactedReviewerListResult); err != nil { + return AccessReviewInstanceContactedReviewersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go new file mode 100644 index 000000000000..0048c75f1aa5 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancedecisions_client.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceDecisionsClient contains the methods for the AccessReviewInstanceDecisions group. +// Don't use this type directly, use NewAccessReviewInstanceDecisionsClient() instead. +type AccessReviewInstanceDecisionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstanceDecisionsClient creates a new instance of AccessReviewInstanceDecisionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceDecisionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceDecisionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceDecisionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceDecisionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance decisions +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceDecisionsClientListOptions contains the optional parameters for the AccessReviewInstanceDecisionsClient.NewListPager +// method. +func (client *AccessReviewInstanceDecisionsClient) NewListPager(scheduleDefinitionID string, id string, options *AccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceDecisionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstanceDecisionsClientListResponse]{ + More: func(page AccessReviewInstanceDecisionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstanceDecisionsClientListResponse) (AccessReviewInstanceDecisionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstanceDecisionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceDecisionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceDecisionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstanceDecisionsClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceDecisionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstanceDecisionsClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceDecisionsClientListResponse, error) { + result := AccessReviewInstanceDecisionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { + return AccessReviewInstanceDecisionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go new file mode 100644 index 000000000000..0676e7a8ef43 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client.go @@ -0,0 +1,232 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstanceMyDecisionsClient contains the methods for the AccessReviewInstanceMyDecisions group. +// Don't use this type directly, use NewAccessReviewInstanceMyDecisionsClient() instead. +type AccessReviewInstanceMyDecisionsClient struct { + internal *arm.Client +} + +// NewAccessReviewInstanceMyDecisionsClient creates a new instance of AccessReviewInstanceMyDecisionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstanceMyDecisionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstanceMyDecisionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstanceMyDecisionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstanceMyDecisionsClient{ + internal: cl, + } + return client, nil +} + +// GetByID - Get my single access review instance decision. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - decisionID - The id of the decision record. +// - options - AccessReviewInstanceMyDecisionsClientGetByIDOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.GetByID +// method. +func (client *AccessReviewInstanceMyDecisionsClient) GetByID(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, options *AccessReviewInstanceMyDecisionsClientGetByIDOptions) (AccessReviewInstanceMyDecisionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, id, decisionID, options) + if err != nil { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewInstanceMyDecisionsClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, options *AccessReviewInstanceMyDecisionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + if decisionID == "" { + return nil, errors.New("parameter decisionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{decisionId}", url.PathEscape(decisionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewInstanceMyDecisionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsClientGetByIDResponse, error) { + result := AccessReviewInstanceMyDecisionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecision); err != nil { + return AccessReviewInstanceMyDecisionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get my access review instance decisions. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstanceMyDecisionsClientListOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.NewListPager +// method. +func (client *AccessReviewInstanceMyDecisionsClient) NewListPager(scheduleDefinitionID string, id string, options *AccessReviewInstanceMyDecisionsClientListOptions) *runtime.Pager[AccessReviewInstanceMyDecisionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstanceMyDecisionsClientListResponse]{ + More: func(page AccessReviewInstanceMyDecisionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstanceMyDecisionsClientListResponse) (AccessReviewInstanceMyDecisionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstanceMyDecisionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceMyDecisionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceMyDecisionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstanceMyDecisionsClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstanceMyDecisionsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstanceMyDecisionsClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsClientListResponse, error) { + result := AccessReviewInstanceMyDecisionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { + return AccessReviewInstanceMyDecisionsClientListResponse{}, err + } + return result, nil +} + +// Patch - Record a decision. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - decisionID - The id of the decision record. +// - properties - Access review decision properties to patch. +// - options - AccessReviewInstanceMyDecisionsClientPatchOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.Patch +// method. +func (client *AccessReviewInstanceMyDecisionsClient) Patch(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, properties AccessReviewDecisionProperties, options *AccessReviewInstanceMyDecisionsClientPatchOptions) (AccessReviewInstanceMyDecisionsClientPatchResponse, error) { + req, err := client.patchCreateRequest(ctx, scheduleDefinitionID, id, decisionID, properties, options) + if err != nil { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, runtime.NewResponseError(resp) + } + return client.patchHandleResponse(resp) +} + +// patchCreateRequest creates the Patch request. +func (client *AccessReviewInstanceMyDecisionsClient) patchCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, decisionID string, properties AccessReviewDecisionProperties, options *AccessReviewInstanceMyDecisionsClientPatchOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + if decisionID == "" { + return nil, errors.New("parameter decisionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{decisionId}", url.PathEscape(decisionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// patchHandleResponse handles the Patch response. +func (client *AccessReviewInstanceMyDecisionsClient) patchHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsClientPatchResponse, error) { + result := AccessReviewInstanceMyDecisionsClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecision); err != nil { + return AccessReviewInstanceMyDecisionsClientPatchResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client_example_test.go new file mode 100644 index 000000000000..761321033301 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancemydecisions_client_example_test.go @@ -0,0 +1,204 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstanceMyDecisions.json +func ExampleAccessReviewInstanceMyDecisionsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAccessReviewInstanceMyDecisionsClient().NewListPager("488a6d0e-0a63-4946-86e3-1f5bbc934661", "4135f961-be78-4005-8101-c72a5af307a2", &armauthorization.AccessReviewInstanceMyDecisionsClientListOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewDecisionListResult = armauthorization.AccessReviewDecisionListResult{ + // Value: []*armauthorization.AccessReviewDecision{ + // { + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances/decisions"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/488a6d0e-0a63-4946-86e3-1f5bbc934661/instances/4135f961-be78-4005-8101-c72a5af307a2/decisions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewDecisionProperties{ + // AppliedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("36777fc8-4ec2-49ea-a56c-cec0bd47d83a"), + // PrincipalName: to.Ptr("Amit Ghosh"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("amitgho@microsoft.com"), + // }, + // AppliedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-03T21:02:30.667Z"); return t}()), + // ApplyResult: to.Ptr(armauthorization.AccessReviewApplyResult("Success")), + // Decision: to.Ptr(armauthorization.AccessReviewResultDeny), + // Justification: to.Ptr("This person has left this team"), + // Principal: &armauthorization.AccessReviewDecisionUserIdentity{ + // Type: to.Ptr(armauthorization.DecisionTargetTypeUser), + // DisplayName: to.Ptr("Shubham Gupta"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // PrincipalResourceMembership: &armauthorization.AccessReviewDecisionPrincipalResourceMembership{ + // MembershipTypes: []*armauthorization.AccessReviewDecisionPrincipalResourceMembershipType{ + // to.Ptr(armauthorization.AccessReviewDecisionPrincipalResourceMembershipTypeDirect), + // to.Ptr(armauthorization.AccessReviewDecisionPrincipalResourceMembershipTypeIndirect)}, + // }, + // Recommendation: to.Ptr(armauthorization.AccessRecommendationTypeDeny), + // Resource: &armauthorization.AccessReviewDecisionResource{ + // Type: to.Ptr(armauthorization.DecisionResourceTypeAzureRole), + // DisplayName: to.Ptr("Owner"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // }, + // ReviewedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // ReviewedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstanceMyDecisionById.json +func ExampleAccessReviewInstanceMyDecisionsClient_GetByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccessReviewInstanceMyDecisionsClient().GetByID(ctx, "488a6d0e-0a63-4946-86e3-1f5bbc934661", "4135f961-be78-4005-8101-c72a5af307a2", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewDecision = armauthorization.AccessReviewDecision{ + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances/decisions"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/488a6d0e-0a63-4946-86e3-1f5bbc934661/instances/4135f961-be78-4005-8101-c72a5af307a2/decisions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewDecisionProperties{ + // AppliedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("36777fc8-4ec2-49ea-a56c-cec0bd47d83a"), + // PrincipalName: to.Ptr("Amit Ghosh"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("amitgho@microsoft.com"), + // }, + // AppliedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-03T21:02:30.667Z"); return t}()), + // ApplyResult: to.Ptr(armauthorization.AccessReviewApplyResult("Success")), + // Decision: to.Ptr(armauthorization.AccessReviewResultDeny), + // Justification: to.Ptr("This person has left this team"), + // Principal: &armauthorization.AccessReviewDecisionUserIdentity{ + // Type: to.Ptr(armauthorization.DecisionTargetTypeUser), + // DisplayName: to.Ptr("Shubham Gupta"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // PrincipalResourceMembership: &armauthorization.AccessReviewDecisionPrincipalResourceMembership{ + // MembershipTypes: []*armauthorization.AccessReviewDecisionPrincipalResourceMembershipType{ + // to.Ptr(armauthorization.AccessReviewDecisionPrincipalResourceMembershipTypeDirect), + // to.Ptr(armauthorization.AccessReviewDecisionPrincipalResourceMembershipTypeIndirect)}, + // }, + // Recommendation: to.Ptr(armauthorization.AccessRecommendationTypeDeny), + // Resource: &armauthorization.AccessReviewDecisionResource{ + // Type: to.Ptr(armauthorization.DecisionResourceTypeAzureRole), + // DisplayName: to.Ptr("Owner"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // }, + // ReviewedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // ReviewedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/PatchAccessReviewInstanceMyDecisionById.json +func ExampleAccessReviewInstanceMyDecisionsClient_Patch() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccessReviewInstanceMyDecisionsClient().Patch(ctx, "488a6d0e-0a63-4946-86e3-1f5bbc934661", "4135f961-be78-4005-8101-c72a5af307a2", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", armauthorization.AccessReviewDecisionProperties{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewDecision = armauthorization.AccessReviewDecision{ + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances/decisions"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/488a6d0e-0a63-4946-86e3-1f5bbc934661/instances/4135f961-be78-4005-8101-c72a5af307a2/decisions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewDecisionProperties{ + // AppliedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("36777fc8-4ec2-49ea-a56c-cec0bd47d83a"), + // PrincipalName: to.Ptr("Amit Ghosh"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("amitgho@microsoft.com"), + // }, + // AppliedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-03T21:02:30.667Z"); return t}()), + // ApplyResult: to.Ptr(armauthorization.AccessReviewApplyResult("Success")), + // Decision: to.Ptr(armauthorization.AccessReviewResultDeny), + // Justification: to.Ptr("This person has left this team"), + // Principal: &armauthorization.AccessReviewDecisionUserIdentity{ + // Type: to.Ptr(armauthorization.DecisionTargetTypeUser), + // DisplayName: to.Ptr("Shubham Gupta"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // Recommendation: to.Ptr(armauthorization.AccessRecommendationTypeDeny), + // Resource: &armauthorization.AccessReviewDecisionResource{ + // Type: to.Ptr(armauthorization.DecisionResourceTypeAzureRole), + // DisplayName: to.Ptr("Owner"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // }, + // ReviewedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // ReviewedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go new file mode 100644 index 000000000000..5c86c8717bd0 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstances_client.go @@ -0,0 +1,232 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstancesClient contains the methods for the AccessReviewInstances group. +// Don't use this type directly, use NewAccessReviewInstancesClient() instead. +type AccessReviewInstancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewInstancesClient creates a new instance of AccessReviewInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Update access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - properties - Access review instance properties. +// - options - AccessReviewInstancesClientCreateOptions contains the optional parameters for the AccessReviewInstancesClient.Create +// method. +func (client *AccessReviewInstancesClient) Create(ctx context.Context, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *AccessReviewInstancesClientCreateOptions) (AccessReviewInstancesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, scheduleDefinitionID, id, properties, options) + if err != nil { + return AccessReviewInstancesClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *AccessReviewInstancesClient) createCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *AccessReviewInstancesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *AccessReviewInstancesClient) createHandleResponse(resp *http.Response) (AccessReviewInstancesClientCreateResponse, error) { + result := AccessReviewInstancesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return AccessReviewInstancesClientCreateResponse{}, err + } + return result, nil +} + +// GetByID - Get access review instances +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstancesClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesClient.GetByID +// method. +func (client *AccessReviewInstancesClient) GetByID(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesClientGetByIDOptions) (AccessReviewInstancesClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstancesClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewInstancesClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewInstancesClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstancesClientGetByIDResponse, error) { + result := AccessReviewInstancesClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return AccessReviewInstancesClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review instances +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewInstancesClientListOptions contains the optional parameters for the AccessReviewInstancesClient.NewListPager +// method. +func (client *AccessReviewInstancesClient) NewListPager(scheduleDefinitionID string, options *AccessReviewInstancesClientListOptions) *runtime.Pager[AccessReviewInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstancesClientListResponse]{ + More: func(page AccessReviewInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstancesClientListResponse) (AccessReviewInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstancesClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstancesClient) listHandleResponse(resp *http.Response) (AccessReviewInstancesClientListResponse, error) { + result := AccessReviewInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { + return AccessReviewInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go new file mode 100644 index 000000000000..f911882f8f67 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client.go @@ -0,0 +1,162 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewInstancesAssignedForMyApprovalClient contains the methods for the AccessReviewInstancesAssignedForMyApproval group. +// Don't use this type directly, use NewAccessReviewInstancesAssignedForMyApprovalClient() instead. +type AccessReviewInstancesAssignedForMyApprovalClient struct { + internal *arm.Client +} + +// NewAccessReviewInstancesAssignedForMyApprovalClient creates a new instance of AccessReviewInstancesAssignedForMyApprovalClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewInstancesAssignedForMyApprovalClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewInstancesAssignedForMyApprovalClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewInstancesAssignedForMyApprovalClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewInstancesAssignedForMyApprovalClient{ + internal: cl, + } + return client, nil +} + +// GetByID - Get single access review instance assigned for my approval. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesAssignedForMyApprovalClient.GetByID +// method. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) GetByID(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions) (AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, id, options) + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse, error) { + result := AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review instances assigned for my approval. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewInstancesAssignedForMyApprovalClientListOptions contains the optional parameters for the AccessReviewInstancesAssignedForMyApprovalClient.NewListPager +// method. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) NewListPager(scheduleDefinitionID string, options *AccessReviewInstancesAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewInstancesAssignedForMyApprovalClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewInstancesAssignedForMyApprovalClientListResponse]{ + More: func(page AccessReviewInstancesAssignedForMyApprovalClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewInstancesAssignedForMyApprovalClientListResponse) (AccessReviewInstancesAssignedForMyApprovalClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewInstancesAssignedForMyApprovalClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewInstancesAssignedForMyApprovalClient) listHandleResponse(resp *http.Response) (AccessReviewInstancesAssignedForMyApprovalClientListResponse, error) { + result := AccessReviewInstancesAssignedForMyApprovalClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { + return AccessReviewInstancesAssignedForMyApprovalClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client_example_test.go new file mode 100644 index 000000000000..9e2ee87f0ea7 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewinstancesassignedformyapproval_client_example_test.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_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/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstancesAssignedForMyApproval.json +func ExampleAccessReviewInstancesAssignedForMyApprovalClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAccessReviewInstancesAssignedForMyApprovalClient().NewListPager("488a6d0e-0a63-4946-86e3-1f5bbc934661", &armauthorization.AccessReviewInstancesAssignedForMyApprovalClientListOptions{Filter: to.Ptr("assignedToMeToReview()")}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewInstanceListResult = armauthorization.AccessReviewInstanceListResult{ + // Value: []*armauthorization.AccessReviewInstance{ + // { + // Name: to.Ptr("4135f961-be78-4005-8101-c72a5af307a2"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/488a6d0e-0a63-4946-86e3-1f5bbc934661/instances/4135f961-be78-4005-8101-c72a5af307a2"), + // Properties: &armauthorization.AccessReviewInstanceProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewInstanceStatusApplied), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstanceAssignedForMyApproval.json +func ExampleAccessReviewInstancesAssignedForMyApprovalClient_GetByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccessReviewInstancesAssignedForMyApprovalClient().GetByID(ctx, "488a6d0e-0a63-4946-86e3-1f5bbc934661", "4135f961-be78-4005-8101-c72a5af307a2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewInstance = armauthorization.AccessReviewInstance{ + // Name: to.Ptr("4135f961-be78-4005-8101-c72a5af307a2"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/488a6d0e-0a63-4946-86e3-1f5bbc934661/instances/4135f961-be78-4005-8101-c72a5af307a2"), + // Properties: &armauthorization.AccessReviewInstanceProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewInstanceStatusApplied), + // }, + // } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go new file mode 100644 index 000000000000..75ac537ae145 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitions_client.go @@ -0,0 +1,305 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccessReviewScheduleDefinitionsClient contains the methods for the AccessReviewScheduleDefinitions group. +// Don't use this type directly, use NewAccessReviewScheduleDefinitionsClient() instead. +type AccessReviewScheduleDefinitionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccessReviewScheduleDefinitionsClient creates a new instance of AccessReviewScheduleDefinitionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewScheduleDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewScheduleDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewScheduleDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewScheduleDefinitionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdateByID - Create or Update access review schedule definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - properties - Access review schedule definition properties. +// - options - AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID +// method. +func (client *AccessReviewScheduleDefinitionsClient) CreateOrUpdateByID(ctx context.Context, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + req, err := client.createOrUpdateByIDCreateRequest(ctx, scheduleDefinitionID, properties, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateByIDHandleResponse(resp) +} + +// createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. +func (client *AccessReviewScheduleDefinitionsClient) createOrUpdateByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createOrUpdateByIDHandleResponse handles the CreateOrUpdateByID response. +func (client *AccessReviewScheduleDefinitionsClient) createOrUpdateByIDHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + result := AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete access review schedule definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.DeleteByID +// method. +func (client *AccessReviewScheduleDefinitionsClient) DeleteByID(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientDeleteByIDOptions) (AccessReviewScheduleDefinitionsClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, scheduleDefinitionID, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *AccessReviewScheduleDefinitionsClient) deleteByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetByID - Get single access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.GetByID +// method. +func (client *AccessReviewScheduleDefinitionsClient) GetByID(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientGetByIDOptions) (AccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scheduleDefinitionID, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *AccessReviewScheduleDefinitionsClient) getByIDCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *AccessReviewScheduleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + result := AccessReviewScheduleDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return AccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review schedule definitions +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.NewListPager +// method. +func (client *AccessReviewScheduleDefinitionsClient) NewListPager(options *AccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewScheduleDefinitionsClientListResponse]{ + More: func(page AccessReviewScheduleDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewScheduleDefinitionsClientListResponse) (AccessReviewScheduleDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewScheduleDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewScheduleDefinitionsClient) listCreateRequest(ctx context.Context, options *AccessReviewScheduleDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewScheduleDefinitionsClient) listHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsClientListResponse, error) { + result := AccessReviewScheduleDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { + return AccessReviewScheduleDefinitionsClientListResponse{}, err + } + return result, nil +} + +// Stop - Stop access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - AccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.Stop +// method. +func (client *AccessReviewScheduleDefinitionsClient) Stop(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientStopOptions) (AccessReviewScheduleDefinitionsClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scheduleDefinitionID, options) + if err != nil { + return AccessReviewScheduleDefinitionsClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AccessReviewScheduleDefinitionsClientStopResponse{}, runtime.NewResponseError(resp) + } + return AccessReviewScheduleDefinitionsClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *AccessReviewScheduleDefinitionsClient) stopCreateRequest(ctx context.Context, scheduleDefinitionID string, options *AccessReviewScheduleDefinitionsClientStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go new file mode 100644 index 000000000000..5dea7a3d2627 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client.go @@ -0,0 +1,101 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClient contains the methods for the AccessReviewScheduleDefinitionsAssignedForMyApproval group. +// Don't use this type directly, use NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient() instead. +type AccessReviewScheduleDefinitionsAssignedForMyApprovalClient struct { + internal *arm.Client +} + +// NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient creates a new instance of AccessReviewScheduleDefinitionsAssignedForMyApprovalClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AccessReviewScheduleDefinitionsAssignedForMyApprovalClient, error) { + cl, err := arm.NewClient(moduleName+".AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccessReviewScheduleDefinitionsAssignedForMyApprovalClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instances assigned for my approval. +// +// Generated from API version 2021-12-01-preview +// - options - AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions contains the optional parameters for the +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.NewListPager method. +func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) NewListPager(options *AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions) *runtime.Pager[AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse]{ + More: func(page AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse) (AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) listCreateRequest(ctx context.Context, options *AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) listHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse, error) { + result := AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client_example_test.go new file mode 100644 index 000000000000..5edc4ac7e668 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/accessreviewscheduledefinitionsassignedformyapproval_client_example_test.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewScheduleDefinitionsAssignedForMyApproval.json +func ExampleAccessReviewScheduleDefinitionsAssignedForMyApprovalClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient().NewListPager(&armauthorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClientListOptions{Filter: to.Ptr("assignedToMeToReview()")}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewScheduleDefinitionListResult = armauthorization.AccessReviewScheduleDefinitionListResult{ + // Value: []*armauthorization.AccessReviewScheduleDefinition{ + // { + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewScheduleDefinitionProperties{ + // CreatedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // DescriptionForAdmins: to.Ptr("asdfasdf"), + // DescriptionForReviewers: to.Ptr("asdfasdf"), + // DisplayName: to.Ptr("Hello world"), + // Instances: []*armauthorization.AccessReviewInstance{ + // { + // Name: to.Ptr("4135f961-be78-4005-8101-c72a5af307a2"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/488a6d0e-0a63-4946-86e3-1f5bbc934661/instances/4135f961-be78-4005-8101-c72a5af307a2"), + // Properties: &armauthorization.AccessReviewInstanceProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewInstanceStatusApplied), + // }, + // }}, + // Reviewers: []*armauthorization.AccessReviewReviewer{ + // { + // PrincipalID: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d "), + // PrincipalType: to.Ptr(armauthorization.AccessReviewReviewerTypeUser), + // }}, + // ReviewersType: to.Ptr(armauthorization.AccessReviewScheduleDefinitionReviewersTypeAssigned), + // Scope: &armauthorization.AccessReviewScope{ + // ResourceID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // RoleDefinitionID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/roleDefinitions/b225c7ff-4338-4cdc-a790-6b34d987f7cd"), + // }, + // Settings: &armauthorization.AccessReviewScheduleSettings{ + // AutoApplyDecisionsEnabled: to.Ptr(true), + // DefaultDecision: to.Ptr(armauthorization.DefaultDecisionTypeApprove), + // DefaultDecisionEnabled: to.Ptr(true), + // InstanceDurationInDays: to.Ptr[int32](30), + // JustificationRequiredOnApproval: to.Ptr(true), + // MailNotificationsEnabled: to.Ptr(true), + // RecommendationsEnabled: to.Ptr(true), + // Recurrence: &armauthorization.AccessReviewRecurrenceSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }, + // ReminderNotificationsEnabled: to.Ptr(true), + // }, + // Status: to.Ptr(armauthorization.AccessReviewScheduleDefinitionStatusInProgress), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go b/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go new file mode 100644 index 000000000000..c83634418c9b --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client.go @@ -0,0 +1,190 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertConfigurationsClient contains the methods for the AlertConfigurations group. +// Don't use this type directly, use NewAlertConfigurationsClient() instead. +type AlertConfigurationsClient struct { + internal *arm.Client +} + +// NewAlertConfigurationsClient creates a new instance of AlertConfigurationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertConfigurationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertConfigurationsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertConfigurationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertConfigurationsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert configuration. The scope can be any REST resource instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' +// for a subscription, +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource +// group, and +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// - alertID - The name of the alert configuration to get. +// - options - AlertConfigurationsClientGetOptions contains the optional parameters for the AlertConfigurationsClient.Get method. +func (client *AlertConfigurationsClient) Get(ctx context.Context, scope string, alertID string, options *AlertConfigurationsClientGetOptions) (AlertConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertID, options) + if err != nil { + return AlertConfigurationsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertConfigurationsClient) getCreateRequest(ctx context.Context, scope string, alertID string, options *AlertConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertConfigurationsClient) getHandleResponse(resp *http.Response) (AlertConfigurationsClientGetResponse, error) { + result := AlertConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertConfiguration); err != nil { + return AlertConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alert configurations for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert configuration. +// - options - AlertConfigurationsClientListForScopeOptions contains the optional parameters for the AlertConfigurationsClient.NewListForScopePager +// method. +func (client *AlertConfigurationsClient) NewListForScopePager(scope string, options *AlertConfigurationsClientListForScopeOptions) *runtime.Pager[AlertConfigurationsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertConfigurationsClientListForScopeResponse]{ + More: func(page AlertConfigurationsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertConfigurationsClientListForScopeResponse) (AlertConfigurationsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertConfigurationsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertConfigurationsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertConfigurationsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertConfigurationsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *AlertConfigurationsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertConfigurationsClient) listForScopeHandleResponse(resp *http.Response) (AlertConfigurationsClientListForScopeResponse, error) { + result := AlertConfigurationsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertConfigurationListResult); err != nil { + return AlertConfigurationsClientListForScopeResponse{}, err + } + return result, nil +} + +// Update - Update an alert configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert configuration. +// - alertID - The name of the alert configuration to update. +// - parameters - Parameters for the alert configuration. +// - options - AlertConfigurationsClientUpdateOptions contains the optional parameters for the AlertConfigurationsClient.Update +// method. +func (client *AlertConfigurationsClient) Update(ctx context.Context, scope string, alertID string, parameters AlertConfiguration, options *AlertConfigurationsClientUpdateOptions) (AlertConfigurationsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, scope, alertID, parameters, options) + if err != nil { + return AlertConfigurationsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertConfigurationsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertConfigurationsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return AlertConfigurationsClientUpdateResponse{}, nil +} + +// updateCreateRequest creates the Update request. +func (client *AlertConfigurationsClient) updateCreateRequest(ctx context.Context, scope string, alertID string, parameters AlertConfiguration, options *AlertConfigurationsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertConfigurations/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client_example_test.go new file mode 100644 index 000000000000..6d518486aadc --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertconfigurations_client_example_test.go @@ -0,0 +1,151 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertConfigurationById.json +func ExampleAlertConfigurationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertConfigurationsClient().Get(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "TooManyOwnersAssignedToResource", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AlertConfiguration = armauthorization.AlertConfiguration{ + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("TooManyOwnersAssignedToResourceAlertConfiguration"), + // AlertDefinitionID: to.Ptr("TooManyOwnersAssignedToResource"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // ThresholdNumberOfOwners: to.Ptr[int32](3), + // ThresholdPercentageOfOwnersOutOfAllRoleMembers: to.Ptr[int32](40), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/UpdateAlertConfiguration.json +func ExampleAlertConfigurationsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAlertConfigurationsClient().Update(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "TooManyOwnersAssignedToResource", armauthorization.AlertConfiguration{ + Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertConfigurationProperties{ + AlertConfigurationType: to.Ptr("TooManyOwnersAssignedToResourceAlertConfiguration"), + IsEnabled: to.Ptr(true), + ThresholdNumberOfOwners: to.Ptr[int32](2), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertConfigurations.json +func ExampleAlertConfigurationsClient_NewListForScopePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAlertConfigurationsClient().NewListForScopePager("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AlertConfigurationListResult = armauthorization.AlertConfigurationListResult{ + // Value: []*armauthorization.AlertConfiguration{ + // { + // Name: to.Ptr("DuplicateRoleCreated"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/DuplicateRoleCreated"), + // Properties: &armauthorization.DuplicateRoleCreatedAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("DuplicateRoleCreatedAlertConfiguration"), + // AlertDefinitionID: to.Ptr("DuplicateRoleCreated"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // }, + // }, + // { + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("TooManyOwnersAssignedToResourceAlertConfiguration"), + // AlertDefinitionID: to.Ptr("TooManyOwnersAssignedToResource"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // ThresholdNumberOfOwners: to.Ptr[int32](2), + // ThresholdPercentageOfOwnersOutOfAllRoleMembers: to.Ptr[int32](3), + // }, + // }, + // { + // Name: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/TooManyPermanentOwnersAssignedToResource"), + // Properties: &armauthorization.TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("TooManyPermanentOwnersAssignedToResourceAlertConfiguration"), + // AlertDefinitionID: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // ThresholdNumberOfPermanentOwners: to.Ptr[int32](10), + // ThresholdPercentageOfPermanentOwnersOutOfAllOwners: to.Ptr[int32](10), + // }, + // }, + // { + // Name: to.Ptr("AzureRolesAssignedOutsidePimAlert"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/AzureRolesAssignedOutsidePimAlert"), + // Properties: &armauthorization.AzureRolesAssignedOutsidePimAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("AzureRolesAssignedOutsidePimAlertConfiguration"), + // AlertDefinitionID: to.Ptr("AzureRolesAssignedOutsidePimAlert"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go new file mode 100644 index 000000000000..6c849a9667e9 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client.go @@ -0,0 +1,150 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertDefinitionsClient contains the methods for the AlertDefinitions group. +// Don't use this type directly, use NewAlertDefinitionsClient() instead. +type AlertDefinitionsClient struct { + internal *arm.Client +} + +// NewAlertDefinitionsClient creates a new instance of AlertDefinitionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertDefinitionsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert definition. The scope can be any REST resource instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' +// for a subscription, +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource +// group, and +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// - alertDefinitionID - The name of the alert definition to get. +// - options - AlertDefinitionsClientGetOptions contains the optional parameters for the AlertDefinitionsClient.Get method. +func (client *AlertDefinitionsClient) Get(ctx context.Context, scope string, alertDefinitionID string, options *AlertDefinitionsClientGetOptions) (AlertDefinitionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertDefinitionID, options) + if err != nil { + return AlertDefinitionsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertDefinitionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertDefinitionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertDefinitionsClient) getCreateRequest(ctx context.Context, scope string, alertDefinitionID string, options *AlertDefinitionsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions/{alertDefinitionId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertDefinitionId}", alertDefinitionID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertDefinitionsClient) getHandleResponse(resp *http.Response) (AlertDefinitionsClientGetResponse, error) { + result := AlertDefinitionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertDefinition); err != nil { + return AlertDefinitionsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alert definitions for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert definition. +// - options - AlertDefinitionsClientListForScopeOptions contains the optional parameters for the AlertDefinitionsClient.NewListForScopePager +// method. +func (client *AlertDefinitionsClient) NewListForScopePager(scope string, options *AlertDefinitionsClientListForScopeOptions) *runtime.Pager[AlertDefinitionsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertDefinitionsClientListForScopeResponse]{ + More: func(page AlertDefinitionsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertDefinitionsClientListForScopeResponse) (AlertDefinitionsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertDefinitionsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertDefinitionsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertDefinitionsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertDefinitionsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *AlertDefinitionsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertDefinitions" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertDefinitionsClient) listForScopeHandleResponse(resp *http.Response) (AlertDefinitionsClientListForScopeResponse, error) { + result := AlertDefinitionsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertDefinitionListResult); err != nil { + return AlertDefinitionsClientListForScopeResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client_example_test.go new file mode 100644 index 000000000000..6b002d36c1c3 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertdefinitions_client_example_test.go @@ -0,0 +1,146 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertDefinitionById.json +func ExampleAlertDefinitionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertDefinitionsClient().Get(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "TooManyPermanentOwnersAssignedToResource", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AlertDefinition = armauthorization.AlertDefinition{ + // Name: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/TooManyPermanentOwnersAssignedToResource"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("The number of users set to never expire is too high. To enhance the security of your resources, we recommend requiring activation for role use. Take a moment to review the list of users, and suggested changes here."), + // DisplayName: to.Ptr("Too many permanent owners assigned to a resource"), + // HowToPrevent: to.Ptr("Enable “Activation Required” in the role settings menu. This will ensure newly added users must activate their role."), + // IsConfigurable: to.Ptr(true), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("To mitigate this issue, require the user to activate the role before use."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("Providing users permanent access in a role may leave resources vulnerable to accidental or malicious activity."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelMedium), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertDefinitions.json +func ExampleAlertDefinitionsClient_NewListForScopePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAlertDefinitionsClient().NewListForScopePager("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AlertDefinitionListResult = armauthorization.AlertDefinitionListResult{ + // Value: []*armauthorization.AlertDefinition{ + // { + // Name: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/TooManyPermanentOwnersAssignedToResource"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("The number of users set to never expire is too high. To enhance the security of your resources, we recommend requiring activation for role use. Take a moment to review the list of users, and suggested changes here."), + // DisplayName: to.Ptr("Too many permanent owners assigned to a resource"), + // HowToPrevent: to.Ptr("Enable “Activation Required” in the role settings menu. This will ensure newly added users must activate their role."), + // IsConfigurable: to.Ptr(true), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("To mitigate this issue, require the user to activate the role before use."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("Providing users permanent access in a role may leave resources vulnerable to accidental or malicious activity."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelMedium), + // }, + // }, + // { + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("The number of users with the Owner role is too high. We recommend assigning these individuals to less privileged roles or roles more suitable to their daily needs. Take a moment to review the current assignments, and suggested changes here."), + // DisplayName: to.Ptr("Too many owners assigned to a resource"), + // HowToPrevent: to.Ptr("Choose a role that provides the fewest privileges necessary for a user or group to complete their tasks."), + // IsConfigurable: to.Ptr(true), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("To mitigate this issue, reduce the number of users in the Owner role. Review the list of users in the list, and reassign them to a less privileged role such as Contributor."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("As the number of users with the owner role increases, so does the potential for malicious or mistaken actions affecting your resource."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelMedium), + // }, + // }, + // { + // Name: to.Ptr("DuplicateRoleCreated"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/DuplicateRoleCreated"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("One or more custom roles have the same display name and/or permissions as a built-in or preexisting custom role. Please review the newly created role membership assignments and determine the appropriate action."), + // DisplayName: to.Ptr("Duplicate role created"), + // HowToPrevent: to.Ptr("Prior to creating a custom role, determine if a built-in or preexisting custom role aligns to your security requirements."), + // IsConfigurable: to.Ptr(false), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("To mitigate this issue, review the newly created role, and determine if a built-in role is suitable."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("Duplicate roles add confusion and increases the complexity of administration."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelMedium), + // }, + // }, + // { + // Name: to.Ptr("AzureRolesAssignedOutsidePimAlert"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/AzureRolesAssignedOutsidePimAlert"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("2 privileged assignment(s) were made outisde of Azure AD PIM"), + // DisplayName: to.Ptr("Roles are being assigned outside of Privileged Identity Management"), + // HowToPrevent: to.Ptr("Investigate where users are being assigned privileged roles outside of Privileged Identity Management and prohibit future assignments from there."), + // IsConfigurable: to.Ptr(false), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("Review the users in the list and remove them from privileged roles assigned outside of Privileged Identity Management."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("Privileged role assignments made outside of Privileged Identity Management are not properly monitored and may indicate an active attack."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelHigh), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go b/sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go new file mode 100644 index 000000000000..10021ec8ad77 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertincidents_client.go @@ -0,0 +1,195 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertIncidentsClient contains the methods for the AlertIncidents group. +// Don't use this type directly, use NewAlertIncidentsClient() instead. +type AlertIncidentsClient struct { + internal *arm.Client +} + +// NewAlertIncidentsClient creates a new instance of AlertIncidentsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertIncidentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertIncidentsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertIncidentsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertIncidentsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert incident. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert incident. The scope can be any REST resource instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' +// for a subscription, +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource +// group, and +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// - alertID - The name of the alert. +// - alertIncidentID - The name of the alert incident to get. +// - options - AlertIncidentsClientGetOptions contains the optional parameters for the AlertIncidentsClient.Get method. +func (client *AlertIncidentsClient) Get(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientGetOptions) (AlertIncidentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertID, alertIncidentID, options) + if err != nil { + return AlertIncidentsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertIncidentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertIncidentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertIncidentsClient) getCreateRequest(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + urlPath = strings.ReplaceAll(urlPath, "{alertIncidentId}", alertIncidentID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertIncidentsClient) getHandleResponse(resp *http.Response) (AlertIncidentsClientGetResponse, error) { + result := AlertIncidentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertIncident); err != nil { + return AlertIncidentsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alert incidents for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert incident. +// - alertID - The name of the alert. +// - options - AlertIncidentsClientListForScopeOptions contains the optional parameters for the AlertIncidentsClient.NewListForScopePager +// method. +func (client *AlertIncidentsClient) NewListForScopePager(scope string, alertID string, options *AlertIncidentsClientListForScopeOptions) *runtime.Pager[AlertIncidentsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertIncidentsClientListForScopeResponse]{ + More: func(page AlertIncidentsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertIncidentsClientListForScopeResponse) (AlertIncidentsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, alertID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertIncidentsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertIncidentsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertIncidentsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertIncidentsClient) listForScopeCreateRequest(ctx context.Context, scope string, alertID string, options *AlertIncidentsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertIncidentsClient) listForScopeHandleResponse(resp *http.Response) (AlertIncidentsClientListForScopeResponse, error) { + result := AlertIncidentsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertIncidentListResult); err != nil { + return AlertIncidentsClientListForScopeResponse{}, err + } + return result, nil +} + +// Remediate - Remediate an alert incident. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert incident. +// - alertID - The name of the alert. +// - alertIncidentID - The name of the alert incident to remediate. +// - options - AlertIncidentsClientRemediateOptions contains the optional parameters for the AlertIncidentsClient.Remediate +// method. +func (client *AlertIncidentsClient) Remediate(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientRemediateOptions) (AlertIncidentsClientRemediateResponse, error) { + req, err := client.remediateCreateRequest(ctx, scope, alertID, alertIncidentID, options) + if err != nil { + return AlertIncidentsClientRemediateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertIncidentsClientRemediateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertIncidentsClientRemediateResponse{}, runtime.NewResponseError(resp) + } + return AlertIncidentsClientRemediateResponse{}, nil +} + +// remediateCreateRequest creates the Remediate request. +func (client *AlertIncidentsClient) remediateCreateRequest(ctx context.Context, scope string, alertID string, alertIncidentID string, options *AlertIncidentsClientRemediateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/alertIncidents/{alertIncidentId}/remediate" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + urlPath = strings.ReplaceAll(urlPath, "{alertIncidentId}", alertIncidentID) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertincidents_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/alertincidents_client_example_test.go new file mode 100644 index 000000000000..8bd425d70fd9 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertincidents_client_example_test.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertIncidentById.json +func ExampleAlertIncidentsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertIncidentsClient().Get(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "TooManyOwnersAssignedToResource", "5cf9ee65-d22e-4784-8b17-3de1c3b7bdcc", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AlertIncident = armauthorization.AlertIncident{ + // Name: to.Ptr("5cf9ee65-d22e-4784-8b17-3de1c3b7bdcc"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts/alertIncidents"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyOwnersAssignedToResource/alertIncidents/5cf9ee65-d22e-4784-8b17-3de1c3b7bdcc"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertIncidentProperties{ + // AlertIncidentType: to.Ptr("TooManyOwnersAssignedToResourceAlertIncident"), + // AssigneeName: to.Ptr("test-user"), + // AssigneeType: to.Ptr("User"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertIncidents.json +func ExampleAlertIncidentsClient_NewListForScopePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAlertIncidentsClient().NewListForScopePager("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "TooManyOwnersAssignedToResource", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AlertIncidentListResult = armauthorization.AlertIncidentListResult{ + // Value: []*armauthorization.AlertIncident{ + // { + // Name: to.Ptr("5cf9ee65-d22e-4784-8b17-3de1c3b7bdcc"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts/alertIncidents"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyOwnersAssignedToResource/alertIncidents/5cf9ee65-d22e-4784-8b17-3de1c3b7bdcc"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertIncidentProperties{ + // AlertIncidentType: to.Ptr("TooManyOwnersAssignedToResourceAlertIncident"), + // AssigneeName: to.Ptr("test-user"), + // AssigneeType: to.Ptr("User"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/RemediateAlertIncident.json +func ExampleAlertIncidentsClient_Remediate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAlertIncidentsClient().Remediate(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "DuplicateRoleCreated", "0645231d-16ba-4ebf-851a-0875df4052bd", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go b/sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go new file mode 100644 index 000000000000..48057e6e7f0c --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertoperation_client.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertOperationClient contains the methods for the AlertOperation group. +// Don't use this type directly, use NewAlertOperationClient() instead. +type AlertOperationClient struct { + internal *arm.Client +} + +// NewAlertOperationClient creates a new instance of AlertOperationClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertOperationClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertOperationClient, error) { + cl, err := arm.NewClient(moduleName+".AlertOperationClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertOperationClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert operation. +// - operationID - The id of the alert operation. +// - options - AlertOperationClientGetOptions contains the optional parameters for the AlertOperationClient.Get method. +func (client *AlertOperationClient) Get(ctx context.Context, scope string, operationID string, options *AlertOperationClientGetOptions) (AlertOperationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, operationID, options) + if err != nil { + return AlertOperationClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertOperationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertOperationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertOperationClient) getCreateRequest(ctx context.Context, scope string, operationID string, options *AlertOperationClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlertOperations/{operationId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{operationId}", operationID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertOperationClient) getHandleResponse(resp *http.Response) (AlertOperationClientGetResponse, error) { + result := AlertOperationClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertOperationResult); err != nil { + return AlertOperationClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alertoperation_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/alertoperation_client_example_test.go new file mode 100644 index 000000000000..4649473fb690 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alertoperation_client_example_test.go @@ -0,0 +1,46 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertOperationById.json +func ExampleAlertOperationClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertOperationClient().Get(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "{operationId}", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AlertOperationResult = armauthorization.AlertOperationResult{ + // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-05T03:04:06.467+00:00"); return t}()), + // ID: to.Ptr("{operationId}"), + // LastActionDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-05T03:04:06.467+00:00"); return t}()), + // ResourceLocation: to.Ptr("https://management.azure.com/providers/Microsoft.Subscription/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/DuplicateRoleCreated?api-version=2022-08-01-preview"), + // Status: to.Ptr("Running"), + // StatusDetail: to.Ptr("{\"result\":[{\"name\":\"DuplicateRoleCreated\",\"statusDetail\":\"Alert scan is not yet started.\"}]}"), + // } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alerts_client.go b/sdk/resourcemanager/authorization/armauthorization/alerts_client.go new file mode 100644 index 000000000000..1ab64cb6d7dd --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alerts_client.go @@ -0,0 +1,298 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// AlertsClient contains the methods for the Alerts group. +// Don't use this type directly, use NewAlertsClient() instead. +type AlertsClient struct { + internal *arm.Client +} + +// NewAlertsClient creates a new instance of AlertsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { + cl, err := arm.NewClient(moduleName+".AlertsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get the specified alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. The scope can be any REST resource instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' +// for a subscription, +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource +// group, and +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// - alertID - The name of the alert to get. +// - options - AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +func (client *AlertsClient) Get(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (AlertsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, alertID, options) + if err != nil { + return AlertsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AlertsClient) getCreateRequest(ctx context.Context, scope string, alertID string, options *AlertsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertsClient) getHandleResponse(resp *http.Response) (AlertsClientGetResponse, error) { + result := AlertsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { + return AlertsClientGetResponse{}, err + } + return result, nil +} + +// NewListForScopePager - Gets alerts for a resource scope. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - options - AlertsClientListForScopeOptions contains the optional parameters for the AlertsClient.NewListForScopePager method. +func (client *AlertsClient) NewListForScopePager(scope string, options *AlertsClientListForScopeOptions) *runtime.Pager[AlertsClientListForScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertsClientListForScopeResponse]{ + More: func(page AlertsClientListForScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertsClientListForScopeResponse) (AlertsClientListForScopeResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listForScopeCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AlertsClientListForScopeResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertsClientListForScopeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AlertsClientListForScopeResponse{}, runtime.NewResponseError(resp) + } + return client.listForScopeHandleResponse(resp) + }, + }) +} + +// listForScopeCreateRequest creates the ListForScope request. +func (client *AlertsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *AlertsClientListForScopeOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listForScopeHandleResponse handles the ListForScope response. +func (client *AlertsClient) listForScopeHandleResponse(resp *http.Response) (AlertsClientListForScopeResponse, error) { + result := AlertsClientListForScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertListResult); err != nil { + return AlertsClientListForScopeResponse{}, err + } + return result, nil +} + +// BeginRefresh - Refresh an alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - alertID - The name of the alert to refresh. +// - options - AlertsClientBeginRefreshOptions contains the optional parameters for the AlertsClient.BeginRefresh method. +func (client *AlertsClient) BeginRefresh(ctx context.Context, scope string, alertID string, options *AlertsClientBeginRefreshOptions) (*runtime.Poller[AlertsClientRefreshResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refresh(ctx, scope, alertID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AlertsClientRefreshResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AlertsClientRefreshResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Refresh - Refresh an alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +func (client *AlertsClient) refresh(ctx context.Context, scope string, alertID string, options *AlertsClientBeginRefreshOptions) (*http.Response, error) { + req, err := client.refreshCreateRequest(ctx, scope, alertID, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// refreshCreateRequest creates the Refresh request. +func (client *AlertsClient) refreshCreateRequest(ctx context.Context, scope string, alertID string, options *AlertsClientBeginRefreshOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}/refresh" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRefreshAll - Refresh all alerts for a resource scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - options - AlertsClientBeginRefreshAllOptions contains the optional parameters for the AlertsClient.BeginRefreshAll method. +func (client *AlertsClient) BeginRefreshAll(ctx context.Context, scope string, options *AlertsClientBeginRefreshAllOptions) (*runtime.Poller[AlertsClientRefreshAllResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.refreshAll(ctx, scope, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AlertsClientRefreshAllResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[AlertsClientRefreshAllResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// RefreshAll - Refresh all alerts for a resource scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +func (client *AlertsClient) refreshAll(ctx context.Context, scope string, options *AlertsClientBeginRefreshAllOptions) (*http.Response, error) { + req, err := client.refreshAllCreateRequest(ctx, scope, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// refreshAllCreateRequest creates the RefreshAll request. +func (client *AlertsClient) refreshAllCreateRequest(ctx context.Context, scope string, options *AlertsClientBeginRefreshAllOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/refresh" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update an alert. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - scope - The scope of the alert. +// - alertID - The name of the alert to dismiss. +// - parameters - Parameters for the alert. +// - options - AlertsClientUpdateOptions contains the optional parameters for the AlertsClient.Update method. +func (client *AlertsClient) Update(ctx context.Context, scope string, alertID string, parameters Alert, options *AlertsClientUpdateOptions) (AlertsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, scope, alertID, parameters, options) + if err != nil { + return AlertsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return AlertsClientUpdateResponse{}, nil +} + +// updateCreateRequest creates the Update request. +func (client *AlertsClient) updateCreateRequest(ctx context.Context, scope string, alertID string, parameters Alert, options *AlertsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementAlerts/{alertId}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + urlPath = strings.ReplaceAll(urlPath, "{alertId}", alertID) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/authorization/armauthorization/alerts_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/alerts_client_example_test.go new file mode 100644 index 000000000000..cbfb591d9c04 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/alerts_client_example_test.go @@ -0,0 +1,286 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_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/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlertById.json +func ExampleAlertsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertsClient().Get(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "TooManyOwnersAssignedToResource", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Alert = armauthorization.Alert{ + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.AlertProperties{ + // AlertConfiguration: &armauthorization.AlertConfiguration{ + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("TooManyOwnersAssignedToResourceAlertConfiguration"), + // AlertDefinitionID: to.Ptr("TooManyOwnersAssignedToResource"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // ThresholdNumberOfOwners: to.Ptr[int32](2), + // ThresholdPercentageOfOwnersOutOfAllRoleMembers: to.Ptr[int32](3), + // }, + // }, + // AlertDefinition: &armauthorization.AlertDefinition{ + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("The number of users with the Owner role is too high. We recommend assigning these individuals to less privileged roles or roles more suitable to their daily needs. Take a moment to review the current assignments, and suggested changes here."), + // DisplayName: to.Ptr("Too many owners assigned to a resource"), + // HowToPrevent: to.Ptr("Choose a role that provides the fewest privileges necessary for a user or group to complete their tasks."), + // IsConfigurable: to.Ptr(true), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("To mitigate this issue, reduce the number of users in the Owner role. Review the list of users in the list, and reassign them to a less privileged role such as Contributor."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("As the number of users with the owner role increases, so does the potential for malicious or mistaken actions affecting your resource."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelMedium), + // }, + // }, + // AlertIncidents: []*armauthorization.AlertIncident{ + // { + // Name: to.Ptr("a9f38501-74ec-43ea-8663-6c538602150d"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts/alertIncidents"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyOwnersAssignedToResource/alertIncidents/a9f38501-74ec-43ea-8663-6c538602150d"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertIncidentProperties{ + // AlertIncidentType: to.Ptr("TooManyOwnersAssignedToResourceAlertIncident"), + // AssigneeName: to.Ptr("testUser"), + // AssigneeType: to.Ptr("User"), + // }, + // }}, + // IncidentCount: to.Ptr[int32](1), + // IsActive: to.Ptr(true), + // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-05T03:04:06.467+00:00"); return t}()), + // LastScannedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-06T18:25:00.38+00:00"); return t}()), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/UpdateAlert.json +func ExampleAlertsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewAlertsClient().Update(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "TooManyPermanentOwnersAssignedToResource", armauthorization.Alert{ + Properties: &armauthorization.AlertProperties{ + IsActive: to.Ptr(false), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/GetAlerts.json +func ExampleAlertsClient_NewListForScopePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAlertsClient().NewListForScopePager("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AlertListResult = armauthorization.AlertListResult{ + // Value: []*armauthorization.Alert{ + // { + // Name: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyPermanentOwnersAssignedToResource"), + // Properties: &armauthorization.AlertProperties{ + // AlertConfiguration: &armauthorization.AlertConfiguration{ + // Name: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/TooManyPermanentOwnersAssignedToResource"), + // Properties: &armauthorization.TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("TooManyPermanentOwnersAssignedToResourceAlertConfiguration"), + // AlertDefinitionID: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // ThresholdNumberOfPermanentOwners: to.Ptr[int32](10), + // ThresholdPercentageOfPermanentOwnersOutOfAllOwners: to.Ptr[int32](10), + // }, + // }, + // AlertDefinition: &armauthorization.AlertDefinition{ + // Name: to.Ptr("TooManyPermanentOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/TooManyPermanentOwnersAssignedToResource"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("The number of users set to never expire is too high. To enhance the security of your resources, we recommend requiring activation for role use. Take a moment to review the list of users, and suggested changes here."), + // DisplayName: to.Ptr("Too many permanent owners assigned to a resource"), + // HowToPrevent: to.Ptr("Enable “Activation Required” in the role settings menu. This will ensure newly added users must activate their role."), + // IsConfigurable: to.Ptr(true), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("To mitigate this issue, require the user to activate the role before use."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("Providing users permanent access in a role may leave resources vulnerable to accidental or malicious activity."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelMedium), + // }, + // }, + // AlertIncidents: []*armauthorization.AlertIncident{ + // { + // Name: to.Ptr("a9f38501-74ec-43ea-8663-6c538602150d"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts/alertIncidents"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyPermanentOwnersAssignedToResource/alertIncidents/a9f38501-74ec-43ea-8663-6c538602150d"), + // Properties: &armauthorization.TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties{ + // AlertIncidentType: to.Ptr("TooManyPermanentOwnersAssignedToResourceAlertIncident"), + // AssigneeName: to.Ptr("testUser"), + // AssigneeType: to.Ptr("User"), + // }, + // }}, + // IncidentCount: to.Ptr[int32](1), + // IsActive: to.Ptr(true), + // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-05T03:04:06.467+00:00"); return t}()), + // LastScannedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-06T18:25:00.38+00:00"); return t}()), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // }, + // }, + // { + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.AlertProperties{ + // AlertConfiguration: &armauthorization.AlertConfiguration{ + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertConfigurations"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertConfigurations/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertConfigurationProperties{ + // AlertConfigurationType: to.Ptr("TooManyOwnersAssignedToResourceAlertConfiguration"), + // AlertDefinitionID: to.Ptr("TooManyOwnersAssignedToResource"), + // IsEnabled: to.Ptr(true), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // ThresholdNumberOfOwners: to.Ptr[int32](2), + // ThresholdPercentageOfOwnersOutOfAllRoleMembers: to.Ptr[int32](3), + // }, + // }, + // AlertDefinition: &armauthorization.AlertDefinition{ + // Name: to.Ptr("TooManyOwnersAssignedToResource"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlertDefinitions"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlertDefinitions/TooManyOwnersAssignedToResource"), + // Properties: &armauthorization.AlertDefinitionProperties{ + // Description: to.Ptr("The number of users with the Owner role is too high. We recommend assigning these individuals to less privileged roles or roles more suitable to their daily needs. Take a moment to review the current assignments, and suggested changes here."), + // DisplayName: to.Ptr("Too many owners assigned to a resource"), + // HowToPrevent: to.Ptr("Choose a role that provides the fewest privileges necessary for a user or group to complete their tasks."), + // IsConfigurable: to.Ptr(true), + // IsRemediatable: to.Ptr(true), + // MitigationSteps: to.Ptr("To mitigate this issue, reduce the number of users in the Owner role. Review the list of users in the list, and reassign them to a less privileged role such as Contributor."), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // SecurityImpact: to.Ptr("As the number of users with the owner role increases, so does the potential for malicious or mistaken actions affecting your resource."), + // SeverityLevel: to.Ptr(armauthorization.SeverityLevelMedium), + // }, + // }, + // AlertIncidents: []*armauthorization.AlertIncident{ + // { + // Name: to.Ptr("a9f38501-74ec-43ea-8663-6c538602150d"), + // Type: to.Ptr("Microsoft.Authorization/roleManagementAlerts/alertIncidents"), + // ID: to.Ptr("/subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleManagementAlerts/TooManyOwnersAssignedToResource/alertIncidents/a9f38501-74ec-43ea-8663-6c538602150d"), + // Properties: &armauthorization.TooManyOwnersAssignedToResourceAlertIncidentProperties{ + // AlertIncidentType: to.Ptr("TooManyOwnersAssignedToResourceAlertIncident"), + // AssigneeName: to.Ptr("testUser"), + // AssigneeType: to.Ptr("User"), + // }, + // }}, + // IncidentCount: to.Ptr[int32](1), + // IsActive: to.Ptr(true), + // LastModifiedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-05T03:04:06.467+00:00"); return t}()), + // LastScannedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-06T18:25:00.38+00:00"); return t}()), + // Scope: to.Ptr("subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/RefreshAlert.json +func ExampleAlertsClient_BeginRefresh() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAlertsClient().BeginRefresh(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", "AzureRolesAssignedOutsidePimAlert", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-08-01-preview/examples/RefreshAllAlerts.json +func ExampleAlertsClient_BeginRefreshAll() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAlertsClient().BeginRefreshAll(ctx, "subscriptions/afa2a084-766f-4003-8ae1-c4aeb893a99f", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/autorest.md b/sdk/resourcemanager/authorization/armauthorization/autorest.md index 114d6e2b73ff..3066d777776d 100644 --- a/sdk/resourcemanager/authorization/armauthorization/autorest.md +++ b/sdk/resourcemanager/authorization/armauthorization/autorest.md @@ -5,9 +5,9 @@ ``` 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 +- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.1.1 -tag: package-2022-04-01 +module-version: 3.0.0-beta.1 +tag: package-2022-05-01-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go index c88e382e222c..d0fabea128d8 100644 --- a/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/classicadministrators_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetClassicAdministrators.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/GetClassicAdministrators.json func ExampleClassicAdministratorsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/authorization/armauthorization/client_factory.go b/sdk/resourcemanager/authorization/armauthorization/client_factory.go index 07b3cf896c4b..4d04e69925ab 100644 --- a/sdk/resourcemanager/authorization/armauthorization/client_factory.go +++ b/sdk/resourcemanager/authorization/armauthorization/client_factory.go @@ -73,6 +73,131 @@ func (c *ClientFactory) NewRoleDefinitionsClient() *RoleDefinitionsClient { return subClient } +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewHistoryDefinitionsClient() *AccessReviewHistoryDefinitionsClient { + subClient, _ := NewAccessReviewHistoryDefinitionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewHistoryDefinitionClient() *AccessReviewHistoryDefinitionClient { + subClient, _ := NewAccessReviewHistoryDefinitionClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewHistoryDefinitionInstanceClient() *AccessReviewHistoryDefinitionInstanceClient { + subClient, _ := NewAccessReviewHistoryDefinitionInstanceClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewHistoryDefinitionInstancesClient() *AccessReviewHistoryDefinitionInstancesClient { + subClient, _ := NewAccessReviewHistoryDefinitionInstancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewScheduleDefinitionsClient() *AccessReviewScheduleDefinitionsClient { + subClient, _ := NewAccessReviewScheduleDefinitionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstancesClient() *AccessReviewInstancesClient { + subClient, _ := NewAccessReviewInstancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstanceClient() *AccessReviewInstanceClient { + subClient, _ := NewAccessReviewInstanceClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstanceDecisionsClient() *AccessReviewInstanceDecisionsClient { + subClient, _ := NewAccessReviewInstanceDecisionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstanceContactedReviewersClient() *AccessReviewInstanceContactedReviewersClient { + subClient, _ := NewAccessReviewInstanceContactedReviewersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewDefaultSettingsClient() *AccessReviewDefaultSettingsClient { + subClient, _ := NewAccessReviewDefaultSettingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionsClient() *ScopeAccessReviewHistoryDefinitionsClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionClient() *ScopeAccessReviewHistoryDefinitionClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionInstanceClient() *ScopeAccessReviewHistoryDefinitionInstanceClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionInstanceClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewHistoryDefinitionInstancesClient() *ScopeAccessReviewHistoryDefinitionInstancesClient { + subClient, _ := NewScopeAccessReviewHistoryDefinitionInstancesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewScheduleDefinitionsClient() *ScopeAccessReviewScheduleDefinitionsClient { + subClient, _ := NewScopeAccessReviewScheduleDefinitionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstancesClient() *ScopeAccessReviewInstancesClient { + subClient, _ := NewScopeAccessReviewInstancesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstanceClient() *ScopeAccessReviewInstanceClient { + subClient, _ := NewScopeAccessReviewInstanceClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstanceDecisionsClient() *ScopeAccessReviewInstanceDecisionsClient { + subClient, _ := NewScopeAccessReviewInstanceDecisionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewInstanceContactedReviewersClient() *ScopeAccessReviewInstanceContactedReviewersClient { + subClient, _ := NewScopeAccessReviewInstanceContactedReviewersClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewScopeAccessReviewDefaultSettingsClient() *ScopeAccessReviewDefaultSettingsClient { + subClient, _ := NewScopeAccessReviewDefaultSettingsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient() *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient { + subClient, _ := NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstancesAssignedForMyApprovalClient() *AccessReviewInstancesAssignedForMyApprovalClient { + subClient, _ := NewAccessReviewInstancesAssignedForMyApprovalClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAccessReviewInstanceMyDecisionsClient() *AccessReviewInstanceMyDecisionsClient { + subClient, _ := NewAccessReviewInstanceMyDecisionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTenantLevelAccessReviewInstanceContactedReviewersClient() *TenantLevelAccessReviewInstanceContactedReviewersClient { + subClient, _ := NewTenantLevelAccessReviewInstanceContactedReviewersClient(c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewEligibleChildResourcesClient() *EligibleChildResourcesClient { subClient, _ := NewEligibleChildResourcesClient(c.credential, c.options) return subClient @@ -117,3 +242,28 @@ func (c *ClientFactory) NewRoleManagementPolicyAssignmentsClient() *RoleManageme subClient, _ := NewRoleManagementPolicyAssignmentsClient(c.credential, c.options) return subClient } + +func (c *ClientFactory) NewAlertsClient() *AlertsClient { + subClient, _ := NewAlertsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertConfigurationsClient() *AlertConfigurationsClient { + subClient, _ := NewAlertConfigurationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertDefinitionsClient() *AlertDefinitionsClient { + subClient, _ := NewAlertDefinitionsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertIncidentsClient() *AlertIncidentsClient { + subClient, _ := NewAlertIncidentsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAlertOperationClient() *AlertOperationClient { + subClient, _ := NewAlertOperationClient(c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/authorization/armauthorization/constants.go b/sdk/resourcemanager/authorization/armauthorization/constants.go index 41729e2b0ba1..e76e279dd8c6 100644 --- a/sdk/resourcemanager/authorization/armauthorization/constants.go +++ b/sdk/resourcemanager/authorization/armauthorization/constants.go @@ -11,9 +11,335 @@ package armauthorization const ( moduleName = "armauthorization" - moduleVersion = "v2.1.1" + moduleVersion = "v3.0.0-beta.1" ) +// AccessRecommendationType - The feature- generated recommendation shown to the reviewer. +type AccessRecommendationType string + +const ( + AccessRecommendationTypeApprove AccessRecommendationType = "Approve" + AccessRecommendationTypeDeny AccessRecommendationType = "Deny" + AccessRecommendationTypeNoInfoAvailable AccessRecommendationType = "NoInfoAvailable" +) + +// PossibleAccessRecommendationTypeValues returns the possible values for the AccessRecommendationType const type. +func PossibleAccessRecommendationTypeValues() []AccessRecommendationType { + return []AccessRecommendationType{ + AccessRecommendationTypeApprove, + AccessRecommendationTypeDeny, + AccessRecommendationTypeNoInfoAvailable, + } +} + +// AccessReviewActorIdentityType - The identity type : user/servicePrincipal +type AccessReviewActorIdentityType string + +const ( + AccessReviewActorIdentityTypeServicePrincipal AccessReviewActorIdentityType = "servicePrincipal" + AccessReviewActorIdentityTypeUser AccessReviewActorIdentityType = "user" +) + +// PossibleAccessReviewActorIdentityTypeValues returns the possible values for the AccessReviewActorIdentityType const type. +func PossibleAccessReviewActorIdentityTypeValues() []AccessReviewActorIdentityType { + return []AccessReviewActorIdentityType{ + AccessReviewActorIdentityTypeServicePrincipal, + AccessReviewActorIdentityTypeUser, + } +} + +// AccessReviewApplyResult - The outcome of applying the decision. +type AccessReviewApplyResult string + +const ( + AccessReviewApplyResultAppliedSuccessfully AccessReviewApplyResult = "AppliedSuccessfully" + AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound AccessReviewApplyResult = "AppliedSuccessfullyButObjectNotFound" + AccessReviewApplyResultAppliedWithUnknownFailure AccessReviewApplyResult = "AppliedWithUnknownFailure" + AccessReviewApplyResultApplyNotSupported AccessReviewApplyResult = "ApplyNotSupported" + AccessReviewApplyResultApplying AccessReviewApplyResult = "Applying" + AccessReviewApplyResultNew AccessReviewApplyResult = "New" +) + +// PossibleAccessReviewApplyResultValues returns the possible values for the AccessReviewApplyResult const type. +func PossibleAccessReviewApplyResultValues() []AccessReviewApplyResult { + return []AccessReviewApplyResult{ + AccessReviewApplyResultAppliedSuccessfully, + AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound, + AccessReviewApplyResultAppliedWithUnknownFailure, + AccessReviewApplyResultApplyNotSupported, + AccessReviewApplyResultApplying, + AccessReviewApplyResultNew, + } +} + +// AccessReviewDecisionInsightType - The type of insight +type AccessReviewDecisionInsightType string + +const ( + AccessReviewDecisionInsightTypeUserSignInInsight AccessReviewDecisionInsightType = "userSignInInsight" +) + +// PossibleAccessReviewDecisionInsightTypeValues returns the possible values for the AccessReviewDecisionInsightType const type. +func PossibleAccessReviewDecisionInsightTypeValues() []AccessReviewDecisionInsightType { + return []AccessReviewDecisionInsightType{ + AccessReviewDecisionInsightTypeUserSignInInsight, + } +} + +type AccessReviewDecisionPrincipalResourceMembershipType string + +const ( + AccessReviewDecisionPrincipalResourceMembershipTypeDirect AccessReviewDecisionPrincipalResourceMembershipType = "direct" + AccessReviewDecisionPrincipalResourceMembershipTypeIndirect AccessReviewDecisionPrincipalResourceMembershipType = "indirect" +) + +// PossibleAccessReviewDecisionPrincipalResourceMembershipTypeValues returns the possible values for the AccessReviewDecisionPrincipalResourceMembershipType const type. +func PossibleAccessReviewDecisionPrincipalResourceMembershipTypeValues() []AccessReviewDecisionPrincipalResourceMembershipType { + return []AccessReviewDecisionPrincipalResourceMembershipType{ + AccessReviewDecisionPrincipalResourceMembershipTypeDirect, + AccessReviewDecisionPrincipalResourceMembershipTypeIndirect, + } +} + +// 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 ( + AccessReviewHistoryDefinitionStatusDone AccessReviewHistoryDefinitionStatus = "Done" + AccessReviewHistoryDefinitionStatusError AccessReviewHistoryDefinitionStatus = "Error" + AccessReviewHistoryDefinitionStatusInProgress AccessReviewHistoryDefinitionStatus = "InProgress" + AccessReviewHistoryDefinitionStatusRequested AccessReviewHistoryDefinitionStatus = "Requested" +) + +// PossibleAccessReviewHistoryDefinitionStatusValues returns the possible values for the AccessReviewHistoryDefinitionStatus const type. +func PossibleAccessReviewHistoryDefinitionStatusValues() []AccessReviewHistoryDefinitionStatus { + return []AccessReviewHistoryDefinitionStatus{ + AccessReviewHistoryDefinitionStatusDone, + AccessReviewHistoryDefinitionStatusError, + AccessReviewHistoryDefinitionStatusInProgress, + AccessReviewHistoryDefinitionStatusRequested, + } +} + +// 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 ( + AccessReviewInstanceReviewersTypeAssigned AccessReviewInstanceReviewersType = "Assigned" + AccessReviewInstanceReviewersTypeManagers AccessReviewInstanceReviewersType = "Managers" + AccessReviewInstanceReviewersTypeSelf AccessReviewInstanceReviewersType = "Self" +) + +// PossibleAccessReviewInstanceReviewersTypeValues returns the possible values for the AccessReviewInstanceReviewersType const type. +func PossibleAccessReviewInstanceReviewersTypeValues() []AccessReviewInstanceReviewersType { + return []AccessReviewInstanceReviewersType{ + AccessReviewInstanceReviewersTypeAssigned, + AccessReviewInstanceReviewersTypeManagers, + AccessReviewInstanceReviewersTypeSelf, + } +} + +// AccessReviewInstanceStatus - This read-only field specifies the status of an access review instance. +type AccessReviewInstanceStatus string + +const ( + 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" +) + +// 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, + } +} + +// AccessReviewRecurrencePatternType - The recurrence type : weekly, monthly, etc. +type AccessReviewRecurrencePatternType string + +const ( + AccessReviewRecurrencePatternTypeAbsoluteMonthly AccessReviewRecurrencePatternType = "absoluteMonthly" + AccessReviewRecurrencePatternTypeWeekly AccessReviewRecurrencePatternType = "weekly" +) + +// PossibleAccessReviewRecurrencePatternTypeValues returns the possible values for the AccessReviewRecurrencePatternType const type. +func PossibleAccessReviewRecurrencePatternTypeValues() []AccessReviewRecurrencePatternType { + return []AccessReviewRecurrencePatternType{ + AccessReviewRecurrencePatternTypeAbsoluteMonthly, + AccessReviewRecurrencePatternTypeWeekly, + } +} + +// AccessReviewRecurrenceRangeType - The recurrence range type. The possible values are: endDate, noEnd, numbered. +type AccessReviewRecurrenceRangeType string + +const ( + AccessReviewRecurrenceRangeTypeEndDate AccessReviewRecurrenceRangeType = "endDate" + AccessReviewRecurrenceRangeTypeNoEnd AccessReviewRecurrenceRangeType = "noEnd" + AccessReviewRecurrenceRangeTypeNumbered AccessReviewRecurrenceRangeType = "numbered" +) + +// PossibleAccessReviewRecurrenceRangeTypeValues returns the possible values for the AccessReviewRecurrenceRangeType const type. +func PossibleAccessReviewRecurrenceRangeTypeValues() []AccessReviewRecurrenceRangeType { + return []AccessReviewRecurrenceRangeType{ + AccessReviewRecurrenceRangeTypeEndDate, + AccessReviewRecurrenceRangeTypeNoEnd, + AccessReviewRecurrenceRangeTypeNumbered, + } +} + +// AccessReviewResult - Represents a reviewer's decision for a given review +type AccessReviewResult string + +const ( + AccessReviewResultApprove AccessReviewResult = "Approve" + AccessReviewResultDeny AccessReviewResult = "Deny" + AccessReviewResultDontKnow AccessReviewResult = "DontKnow" + AccessReviewResultNotNotified AccessReviewResult = "NotNotified" + AccessReviewResultNotReviewed AccessReviewResult = "NotReviewed" +) + +// PossibleAccessReviewResultValues returns the possible values for the AccessReviewResult const type. +func PossibleAccessReviewResultValues() []AccessReviewResult { + return []AccessReviewResult{ + AccessReviewResultApprove, + AccessReviewResultDeny, + AccessReviewResultDontKnow, + AccessReviewResultNotNotified, + AccessReviewResultNotReviewed, + } +} + +// AccessReviewReviewerType - The identity type : user/servicePrincipal +type AccessReviewReviewerType string + +const ( + AccessReviewReviewerTypeServicePrincipal AccessReviewReviewerType = "servicePrincipal" + AccessReviewReviewerTypeUser AccessReviewReviewerType = "user" +) + +// PossibleAccessReviewReviewerTypeValues returns the possible values for the AccessReviewReviewerType const type. +func PossibleAccessReviewReviewerTypeValues() []AccessReviewReviewerType { + return []AccessReviewReviewerType{ + AccessReviewReviewerTypeServicePrincipal, + AccessReviewReviewerTypeUser, + } +} + +// 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 ( + AccessReviewScheduleDefinitionReviewersTypeAssigned AccessReviewScheduleDefinitionReviewersType = "Assigned" + AccessReviewScheduleDefinitionReviewersTypeManagers AccessReviewScheduleDefinitionReviewersType = "Managers" + AccessReviewScheduleDefinitionReviewersTypeSelf AccessReviewScheduleDefinitionReviewersType = "Self" +) + +// 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, + } +} + // ApprovalMode - The type of rule type ApprovalMode string @@ -50,6 +376,54 @@ func PossibleAssignmentTypeValues() []AssignmentType { } } +// 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, + } +} + // EnablementRules - The type of enablement rule type EnablementRules string @@ -158,6 +532,22 @@ func PossibleRecipientTypeValues() []RecipientType { } } +// 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, + } +} + // RequestType - The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc type RequestType string @@ -210,6 +600,24 @@ func PossibleRoleManagementPolicyRuleTypeValues() []RoleManagementPolicyRuleType } } +// 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, + } +} + // Status - The status of the role assignment schedule. type Status string diff --git a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go index 0e71ca0c31cd..26350365c15f 100644 --- a/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/denyassignments_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResource.json func ExampleDenyAssignmentsClient_NewListForResourcePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -78,7 +78,7 @@ func ExampleDenyAssignmentsClient_NewListForResourcePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentsForResourceGroup.json func ExampleDenyAssignmentsClient_NewListForResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -139,7 +139,7 @@ func ExampleDenyAssignmentsClient_NewListForResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllDenyAssignments.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllDenyAssignments.json func ExampleDenyAssignmentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -200,7 +200,7 @@ func ExampleDenyAssignmentsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByNameId.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByNameId.json func ExampleDenyAssignmentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -253,7 +253,7 @@ func ExampleDenyAssignmentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentById.json func ExampleDenyAssignmentsClient_GetByID() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -306,7 +306,7 @@ func ExampleDenyAssignmentsClient_GetByID() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetDenyAssignmentByScope.json func ExampleDenyAssignmentsClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go index 92ebd41853d0..625b848f6c01 100644 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client.go @@ -41,7 +41,7 @@ func NewEligibleChildResourcesClient(credential azcore.TokenCredential, options // NewGetPager - Get the child resources of a resource on which user has eligible access // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - scope - The scope of the role management policy. // - options - EligibleChildResourcesClientGetOptions contains the optional parameters for the EligibleChildResourcesClient.NewGetPager // method. @@ -85,7 +85,7 @@ func (client *EligibleChildResourcesClient) getCreateRequest(ctx context.Context if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-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/eligiblechildresources_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go index 19809f07fcc3..8725eda3b354 100644 --- a/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/eligiblechildresources_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetEligibleChildResourcesByScope.json func ExampleEligibleChildResourcesClient_NewGetPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -45,12 +45,12 @@ func ExampleEligibleChildResourcesClient_NewGetPager() { // { // Name: to.Ptr("RG-1"), // Type: to.Ptr("resourcegroup"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-1"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-1"), // }, // { // Name: to.Ptr("RG-2"), // Type: to.Ptr("resourcegroup"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-2"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/resourceGroups/RG-2"), // }}, // } } diff --git a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go index 503426fcc294..23994ba1d14e 100644 --- a/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/globaladministrator_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2015-07-01/examples/ElevateAccess.json func ExampleGlobalAdministratorClient_ElevateAccess() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/authorization/armauthorization/go.mod b/sdk/resourcemanager/authorization/armauthorization/go.mod index 51b8d8ec812b..f2ef8940d0c8 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.mod +++ b/sdk/resourcemanager/authorization/armauthorization/go.mod @@ -1,21 +1,21 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3 go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect ) diff --git a/sdk/resourcemanager/authorization/armauthorization/go.sum b/sdk/resourcemanager/authorization/armauthorization/go.sum index 8ba445a8c4da..21718b486698 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.sum +++ b/sdk/resourcemanager/authorization/armauthorization/go.sum @@ -1,13 +1,13 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= +github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= +github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -18,14 +18,14 @@ github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/authorization/armauthorization/models.go b/sdk/resourcemanager/authorization/armauthorization/models.go index bf76234d6875..662120496885 100644 --- a/sdk/resourcemanager/authorization/armauthorization/models.go +++ b/sdk/resourcemanager/authorization/armauthorization/models.go @@ -11,6 +11,1134 @@ package armauthorization import "time" +// AccessReviewActorIdentity - Details of the actor identity +type AccessReviewActorIdentity struct { + // READ-ONLY; The identity id + PrincipalID *string + + // READ-ONLY; The identity display name + PrincipalName *string + + // READ-ONLY; The identity type : user/servicePrincipal + PrincipalType *AccessReviewActorIdentityType + + // READ-ONLY; The user principal name(if valid) + UserPrincipalName *string +} + +// AccessReviewContactedReviewer - Access Review Contacted Reviewer. +type AccessReviewContactedReviewer struct { + // Access Review Contacted Reviewer properties. + Properties *AccessReviewContactedReviewerProperties + + // READ-ONLY; The access review reviewer id. + ID *string + + // READ-ONLY; The access review reviewer id. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// AccessReviewContactedReviewerListResult - List of access review contacted reviewers. +type AccessReviewContactedReviewerListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Access Review Contacted Reviewer. + Value []*AccessReviewContactedReviewer +} + +// AccessReviewContactedReviewerProperties - Properties of access review contacted reviewer. +type AccessReviewContactedReviewerProperties struct { + // READ-ONLY; Date Time when the reviewer was contacted. + CreatedDateTime *time.Time + + // READ-ONLY; The display name of the reviewer + UserDisplayName *string + + // READ-ONLY; The user principal name of the reviewer + UserPrincipalName *string +} + +// AccessReviewDecision - Access Review. +type AccessReviewDecision struct { + // Access Review Decision properties. + Properties *AccessReviewDecisionProperties + + // READ-ONLY; The access review decision id. + ID *string + + // READ-ONLY; The access review decision name. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// 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 +} + +// AccessReviewDecisionIdentity - Target of the decision. +type AccessReviewDecisionIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType + + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string + + // READ-ONLY; The id of principal whose access was reviewed. + ID *string +} + +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionIdentity. +func (a *AccessReviewDecisionIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return a +} + +// AccessReviewDecisionInsight - Access Review Decision Insight. +type AccessReviewDecisionInsight struct { + // Access Review Decision Insight properties. + Properties AccessReviewDecisionInsightPropertiesClassification + + // READ-ONLY; The access review insight id. + ID *string + + // READ-ONLY; The access review insight name. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// AccessReviewDecisionInsightPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetAccessReviewDecisionInsightProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AccessReviewDecisionInsightProperties, *AccessReviewDecisionUserSignInInsightProperties +type AccessReviewDecisionInsightPropertiesClassification interface { + // GetAccessReviewDecisionInsightProperties returns the AccessReviewDecisionInsightProperties content of the underlying type. + GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties +} + +// AccessReviewDecisionInsightProperties - Details of the Insight. +type AccessReviewDecisionInsightProperties struct { + // REQUIRED; The type of insight + Type *AccessReviewDecisionInsightType + + // READ-ONLY; Date Time when the insight was created. + InsightCreatedDateTime any +} + +// 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 + + // Access Review Decision list. + Value []*AccessReviewDecision +} + +// 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 +} + +// 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 + + // This is the collection of insights for this decision item. + Insights []*AccessReviewDecisionInsight + + // Justification provided by approvers for their action + Justification *string + + // READ-ONLY; Details of the approver. + AppliedBy *AccessReviewActorIdentity + + // READ-ONLY; The date and time when the review decision was applied. + AppliedDateTime *time.Time + + // READ-ONLY; The outcome of applying the decision. + ApplyResult *AccessReviewApplyResult + + // READ-ONLY; Principal associated with the decision record. Can be AccessReviewDecisionUserIdentity or AccessReviewDecisionServicePrincipalIdentity + Principal AccessReviewDecisionIdentityClassification + + // READ-ONLY; Details of the membership type. + PrincipalResourceMembership *AccessReviewDecisionPrincipalResourceMembership + + // READ-ONLY; The feature- generated recommendation shown to the reviewer. + Recommendation *AccessRecommendationType + + // READ-ONLY; Resource associated with this decision record. + Resource *AccessReviewDecisionResource + + // READ-ONLY; Details of the approver. + ReviewedBy *AccessReviewActorIdentity + + // READ-ONLY; Date Time when a decision was taken. + ReviewedDateTime *time.Time +} + +// AccessReviewDecisionResource - Target of the decision. +type AccessReviewDecisionResource struct { + // REQUIRED; The type of resource + Type *DecisionResourceType + + // READ-ONLY; The display name of resource associated with a decision record. + DisplayName *string + + // READ-ONLY; The id of resource associated with a decision record. + ID *string +} + +// AccessReviewDecisionServicePrincipalIdentity - Service Principal Decision Target +type AccessReviewDecisionServicePrincipalIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType + + // READ-ONLY; The appId for the service principal entity being reviewed + AppID *string + + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string + + // READ-ONLY; The id of principal whose access was reviewed. + ID *string +} + +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionServicePrincipalIdentity. +func (a *AccessReviewDecisionServicePrincipalIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return &AccessReviewDecisionIdentity{ + Type: a.Type, + ID: a.ID, + DisplayName: a.DisplayName, + } +} + +// AccessReviewDecisionUserIdentity - User Decision Target +type AccessReviewDecisionUserIdentity struct { + // REQUIRED; The type of decision target : User/ServicePrincipal + Type *DecisionTargetType + + // READ-ONLY; The display name of the user whose access was reviewed. + DisplayName *string + + // READ-ONLY; The id of principal whose access was reviewed. + ID *string + + // READ-ONLY; The user principal name of the user whose access was reviewed. + UserPrincipalName *string +} + +// GetAccessReviewDecisionIdentity implements the AccessReviewDecisionIdentityClassification interface for type AccessReviewDecisionUserIdentity. +func (a *AccessReviewDecisionUserIdentity) GetAccessReviewDecisionIdentity() *AccessReviewDecisionIdentity { + return &AccessReviewDecisionIdentity{ + Type: a.Type, + ID: a.ID, + DisplayName: a.DisplayName, + } +} + +// AccessReviewDecisionUserSignInInsightProperties - User Decision Target +type AccessReviewDecisionUserSignInInsightProperties struct { + // REQUIRED; The type of insight + Type *AccessReviewDecisionInsightType + + // READ-ONLY; Date Time when the insight was created. + InsightCreatedDateTime any + + // READ-ONLY; Date Time when the user signed into the tenant. + LastSignInDateTime any +} + +// GetAccessReviewDecisionInsightProperties implements the AccessReviewDecisionInsightPropertiesClassification interface for +// type AccessReviewDecisionUserSignInInsightProperties. +func (a *AccessReviewDecisionUserSignInInsightProperties) GetAccessReviewDecisionInsightProperties() *AccessReviewDecisionInsightProperties { + return &AccessReviewDecisionInsightProperties{ + Type: a.Type, + InsightCreatedDateTime: a.InsightCreatedDateTime, + } +} + +// AccessReviewDefaultSettings - Access Review Default Settings. +type AccessReviewDefaultSettings struct { + // Access Review properties. + Properties *AccessReviewScheduleSettings + + // READ-ONLY; The access review default settings id. This is only going to be default + ID *string + + // READ-ONLY; The access review default settings name. This is always going to be Access Review Default Settings + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// AccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Get +// method. +type AccessReviewDefaultSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the AccessReviewDefaultSettingsClient.Put +// method. +type AccessReviewDefaultSettingsClientPutOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewHistoryDefinition - Access Review History Definition. +type AccessReviewHistoryDefinition struct { + // Access Review History Definition properties. + Properties *AccessReviewHistoryDefinitionProperties + + // READ-ONLY; The access review history definition id. + ID *string + + // READ-ONLY; The access review history definition unique id. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// AccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.Create +// method. +type AccessReviewHistoryDefinitionClientCreateOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionClient.DeleteByID +// method. +type AccessReviewHistoryDefinitionClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for the AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI +// method. +type AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewHistoryDefinitionInstanceListResult - List of Access Review History Instances. +type AccessReviewHistoryDefinitionInstanceListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Access Review History Definition's Instance list. + Value []*AccessReviewHistoryInstance +} + +// AccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the AccessReviewHistoryDefinitionInstancesClient.NewListPager +// method. +type AccessReviewHistoryDefinitionInstancesClientListOptions 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 + + // Access Review History Definition list. + Value []*AccessReviewHistoryDefinition +} + +// 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 + + // The display name for the history definition. + DisplayName *string + + // Set of access review history instances for this history definition. + Instances []*AccessReviewHistoryInstance + + // A collection of scopes used when selecting review history data + Scopes []*AccessReviewScope + + // Recurrence settings for recurring history reports, skip for one-time reports. + Settings *AccessReviewHistoryScheduleSettings + + // READ-ONLY; The user or other identity who created this history definition. + CreatedBy *AccessReviewActorIdentity + + // READ-ONLY; Date time when history definition was created + CreatedDateTime *time.Time + + // 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 + + // 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 + + // 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 +} + +// AccessReviewHistoryDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewHistoryDefinitionsClient.GetByID +// method. +type AccessReviewHistoryDefinitionsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// AccessReviewHistoryInstance - Access Review History Definition Instance. +type AccessReviewHistoryInstance struct { + // Access Review History Definition Instance properties. + Properties *AccessReviewHistoryInstanceProperties + + // READ-ONLY; The access review history definition instance id. + ID *string + + // READ-ONLY; The access review history definition instance unique id. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// AccessReviewHistoryInstanceProperties - Access Review History Definition Instance properties. +type AccessReviewHistoryInstanceProperties struct { + // The display name for the parent history definition. + DisplayName *string + + // Date time when history data report expires and the associated data is deleted. + Expiration *time.Time + + // Date time when the history data report is scheduled to be generated. + FulfilledDateTime *time.Time + + // 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 + + // 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 + + // Date time when the history data report is scheduled to be generated. + RunDateTime *time.Time + + // 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 + + // 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 +} + +// AccessReviewHistoryScheduleSettings - Recurrence settings of an Access Review History Definition. +type AccessReviewHistoryScheduleSettings struct { + // Access Review History Definition recurrence settings. + Pattern *AccessReviewRecurrencePattern + + // Access Review History Definition recurrence settings. + Range *AccessReviewRecurrenceRange +} + +// AccessReviewInstance - Access Review Instance. +type AccessReviewInstance struct { + // Access Review properties. + Properties *AccessReviewInstanceProperties + + // READ-ONLY; The access review instance id. + ID *string + + // READ-ONLY; The access review instance name. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// AccessReviewInstanceClientAcceptRecommendationsOptions contains the optional parameters for the AccessReviewInstanceClient.AcceptRecommendations +// method. +type AccessReviewInstanceClientAcceptRecommendationsOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ApplyDecisions +// method. +type AccessReviewInstanceClientApplyDecisionsOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the AccessReviewInstanceClient.ResetDecisions +// method. +type AccessReviewInstanceClientResetDecisionsOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the AccessReviewInstanceClient.SendReminders +// method. +type AccessReviewInstanceClientSendRemindersOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstanceClientStopOptions contains the optional parameters for the AccessReviewInstanceClient.Stop method. +type AccessReviewInstanceClientStopOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the AccessReviewInstanceContactedReviewersClient.NewListPager +// method. +type AccessReviewInstanceContactedReviewersClientListOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// AccessReviewInstanceListResult - List of Access Review Instances. +type AccessReviewInstanceListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Access Review Instance list. + Value []*AccessReviewInstance +} + +// AccessReviewInstanceMyDecisionsClientGetByIDOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.GetByID +// method. +type AccessReviewInstanceMyDecisionsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// AccessReviewInstanceMyDecisionsClientPatchOptions contains the optional parameters for the AccessReviewInstanceMyDecisionsClient.Patch +// method. +type AccessReviewInstanceMyDecisionsClientPatchOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstanceProperties - Access Review Instance properties. +type AccessReviewInstanceProperties struct { + // This is the collection of backup reviewers. + BackupReviewers []*AccessReviewReviewer + + // The DateTime when the review instance is scheduled to end. + EndDateTime *time.Time + + // This is the collection of reviewers. + Reviewers []*AccessReviewReviewer + + // The DateTime when the review instance is scheduled to be start. + StartDateTime *time.Time + + // 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 + + // READ-ONLY; This read-only field specifies the status of an access review instance. + Status *AccessReviewInstanceStatus +} + +// AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesAssignedForMyApprovalClient.GetByID +// method. +type AccessReviewInstancesAssignedForMyApprovalClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// AccessReviewInstancesClientCreateOptions contains the optional parameters for the AccessReviewInstancesClient.Create method. +type AccessReviewInstancesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstancesClientGetByIDOptions contains the optional parameters for the AccessReviewInstancesClient.GetByID +// method. +type AccessReviewInstancesClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewInstancesClientListOptions contains the optional parameters for the AccessReviewInstancesClient.NewListPager +// method. +type AccessReviewInstancesClientListOptions struct { + // The filter to apply on the operation. Other than standard filters, one custom filter option is supported : 'assignedToMeToReview()'. + // When one specified $filter=assignedToMeToReview(), only items that + // are assigned to the calling user to review are returned + Filter *string +} + +// 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 + + // The recurrence type : weekly, monthly, etc. + Type *AccessReviewRecurrencePatternType +} + +// 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 + + // The number of times to repeat the access review. Required and must be positive if type is numbered. + NumberOfOccurrences *int32 + + // The DateTime when the review is scheduled to be start. This could be a date in the future. Required on create. + StartDate *time.Time + + // The recurrence range type. The possible values are: endDate, noEnd, numbered. + Type *AccessReviewRecurrenceRangeType +} + +// AccessReviewRecurrenceSettings - Recurrence Settings of an Access Review Schedule Definition. +type AccessReviewRecurrenceSettings struct { + // Access Review schedule definition recurrence pattern. + Pattern *AccessReviewRecurrencePattern + + // Access Review schedule definition recurrence range. + Range *AccessReviewRecurrenceRange +} + +// AccessReviewReviewer - Descriptor for what needs to be reviewed +type AccessReviewReviewer struct { + // The id of the reviewer(user/servicePrincipal) + PrincipalID *string + + // READ-ONLY; The identity type : user/servicePrincipal + PrincipalType *AccessReviewReviewerType +} + +// AccessReviewScheduleDefinition - Access Review Schedule Definition. +type AccessReviewScheduleDefinition struct { + // Access Review properties. + Properties *AccessReviewScheduleDefinitionProperties + + // READ-ONLY; The access review schedule definition id. + ID *string + + // READ-ONLY; The access review schedule definition unique id. + Name *string + + // READ-ONLY; The resource type. + Type *string +} + +// AccessReviewScheduleDefinitionListResult - List of Access Review Schedule Definitions. +type AccessReviewScheduleDefinitionListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Access Review Schedule Definition list. + Value []*AccessReviewScheduleDefinition +} + +// AccessReviewScheduleDefinitionProperties - Access Review. +type AccessReviewScheduleDefinitionProperties struct { + // This is the collection of backup reviewers. + BackupReviewers []*AccessReviewReviewer + + // The description provided by the access review creator and visible to admins. + DescriptionForAdmins *string + + // The description provided by the access review creator to be shown to reviewers. + DescriptionForReviewers *string + + // The display name for the schedule definition. + DisplayName *string + + // This is the collection of instances returned when one does an expand on it. + Instances []*AccessReviewInstance + + // This is the collection of reviewers. + Reviewers []*AccessReviewReviewer + + // Access Review Settings. + Settings *AccessReviewScheduleSettings + + // READ-ONLY; The user or other identity who created this review. + CreatedBy *AccessReviewActorIdentity + + // 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 + + // 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 + + // READ-ONLY; This read-only field specifies the status of an accessReview. + Status *AccessReviewScheduleDefinitionStatus +} + +// 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 +} + +// AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID +// method. +type AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.DeleteByID +// method. +type AccessReviewScheduleDefinitionsClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.GetByID +// method. +type AccessReviewScheduleDefinitionsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// AccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.NewListPager +// method. +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 +} + +// AccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the AccessReviewScheduleDefinitionsClient.Stop +// method. +type AccessReviewScheduleDefinitionsClientStopOptions struct { + // placeholder for future optional parameters +} + +// 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 + + // This specifies the behavior for the autoReview feature when an access review completes. + DefaultDecision *DefaultDecisionType + + // Flag to indicate whether reviewers are required to provide a justification when reviewing access. + DefaultDecisionEnabled *bool + + // The duration in days for an instance. + InstanceDurationInDays *int32 + + // Flag to indicate whether the reviewer is required to pass justification when recording a decision. + JustificationRequiredOnApproval *bool + + // Flag to indicate whether sending mails to reviewers and the review creator is enabled. + MailNotificationsEnabled *bool + + // 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 + + // Flag to indicate whether showing recommendations to reviewers is enabled. + RecommendationsEnabled *bool + + // Access Review Settings. + Recurrence *AccessReviewRecurrenceSettings + + // Flag to indicate whether sending reminder emails to reviewers are enabled. + ReminderNotificationsEnabled *bool +} + +// AccessReviewScope - Descriptor for what needs to be reviewed +type AccessReviewScope struct { + // This is used to indicate the resource id(s) to exclude + ExcludeResourceID *string + + // This is used to indicate the role definition id(s) to exclude + ExcludeRoleDefinitionID *string + + // Flag to indicate whether to expand nested memberships or not. + ExpandNestedMemberships *bool + + // Duration users are inactive for. The value should be in ISO 8601 format (http://en.wikipedia.org/wiki/ISO_8601#Durations).This + // code can be used to convert TimeSpan to a valid interval string: + // XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + InactiveDuration *string + + // Flag to indicate whether to expand nested memberships or not. + IncludeAccessBelowResource *bool + + // Flag to indicate whether to expand nested memberships or not. + IncludeInheritedAccess *bool + + // READ-ONLY; The role assignment state eligible/active to review + AssignmentState *AccessReviewScopeAssignmentState + + // READ-ONLY; The identity type user/servicePrincipal to review + PrincipalType *AccessReviewScopePrincipalType + + // READ-ONLY; ResourceId in which this review is getting created + ResourceID *string + + // READ-ONLY; This is used to indicate the role being reviewed + RoleDefinitionID *string +} + +// Alert - The alert. +type Alert struct { + // Alert properties. + Properties *AlertProperties + + // READ-ONLY; The alert ID. + ID *string + + // READ-ONLY; The alert name. + Name *string + + // READ-ONLY; The alert type. + Type *string +} + +// AlertConfiguration - Alert configuration. +type AlertConfiguration struct { + // Alert configuration properties. + Properties AlertConfigurationPropertiesClassification + + // READ-ONLY; The alert configuration ID. + ID *string + + // READ-ONLY; The alert configuration name. + Name *string + + // READ-ONLY; The alert configuration type. + Type *string +} + +// AlertConfigurationListResult - Alert configuration list operation result. +type AlertConfigurationListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Alert configuration list + Value []*AlertConfiguration +} + +// 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 +} + +// AlertConfigurationProperties - Alert configuration properties. +type AlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string + + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool + + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition + + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string + + // READ-ONLY; The alert scope. + Scope *string +} + +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type AlertConfigurationProperties. +func (a *AlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return a +} + +// AlertConfigurationsClientGetOptions contains the optional parameters for the AlertConfigurationsClient.Get method. +type AlertConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertConfigurationsClientListForScopeOptions contains the optional parameters for the AlertConfigurationsClient.NewListForScopePager +// method. +type AlertConfigurationsClientListForScopeOptions struct { + // placeholder for future optional parameters +} + +// AlertConfigurationsClientUpdateOptions contains the optional parameters for the AlertConfigurationsClient.Update method. +type AlertConfigurationsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// AlertDefinition - Alert definition +type AlertDefinition struct { + // Alert definition properties. + Properties *AlertDefinitionProperties + + // READ-ONLY; The alert definition ID. + ID *string + + // READ-ONLY; The alert definition name. + Name *string + + // READ-ONLY; The alert definition type. + Type *string +} + +// AlertDefinitionListResult - Alert definition list operation result. +type AlertDefinitionListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Alert definition list + Value []*AlertDefinition +} + +// AlertDefinitionProperties - Alert definition properties. +type AlertDefinitionProperties struct { + // READ-ONLY; The alert description. + Description *string + + // READ-ONLY; The alert display name. + DisplayName *string + + // READ-ONLY; The ways to prevent the alert. + HowToPrevent *string + + // READ-ONLY; True if the alert configuration can be configured; false, otherwise. + IsConfigurable *bool + + // READ-ONLY; True if the alert can be remediated; false, otherwise. + IsRemediatable *bool + + // READ-ONLY; The methods to mitigate the alert. + MitigationSteps *string + + // READ-ONLY; The alert scope. + Scope *string + + // READ-ONLY; Security impact of the alert. + SecurityImpact *string + + // READ-ONLY; Severity level of the alert. + SeverityLevel *SeverityLevel +} + +// AlertDefinitionsClientGetOptions contains the optional parameters for the AlertDefinitionsClient.Get method. +type AlertDefinitionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertDefinitionsClientListForScopeOptions contains the optional parameters for the AlertDefinitionsClient.NewListForScopePager +// method. +type AlertDefinitionsClientListForScopeOptions struct { + // placeholder for future optional parameters +} + +// AlertIncident - Alert incident +type AlertIncident struct { + // Alert incident properties. + Properties AlertIncidentPropertiesClassification + + // READ-ONLY; The alert incident ID. + ID *string + + // READ-ONLY; The alert incident name. + Name *string + + // READ-ONLY; The alert incident type. + Type *string +} + +// AlertIncidentListResult - Alert incident list operation result. +type AlertIncidentListResult struct { + // The URL to use for getting the next set of results. + NextLink *string + + // Alert incident list + Value []*AlertIncident +} + +// 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 +} + +// AlertIncidentProperties - Alert incident properties +type AlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string +} + +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type AlertIncidentProperties. +func (a *AlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { return a } + +// AlertIncidentsClientGetOptions contains the optional parameters for the AlertIncidentsClient.Get method. +type AlertIncidentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertIncidentsClientListForScopeOptions contains the optional parameters for the AlertIncidentsClient.NewListForScopePager +// method. +type AlertIncidentsClientListForScopeOptions struct { + // placeholder for future optional parameters +} + +// AlertIncidentsClientRemediateOptions contains the optional parameters for the AlertIncidentsClient.Remediate method. +type AlertIncidentsClientRemediateOptions 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 + + // Alert list + Value []*Alert +} + +// AlertOperationClientGetOptions contains the optional parameters for the AlertOperationClient.Get method. +type AlertOperationClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertOperationResult - Alert operation result +type AlertOperationResult struct { + // READ-ONLY; The created date of the alert operation. + CreatedDateTime *time.Time + + // READ-ONLY; The id of the alert operation. + ID *string + + // READ-ONLY; The last action date of the alert operation. + LastActionDateTime *time.Time + + // READ-ONLY; The location of the alert associated with the operation. + ResourceLocation *string + + // READ-ONLY; The status of the alert operation. + Status *string + + // READ-ONLY; The status detail of the alert operation. + StatusDetail *string +} + +// AlertProperties - Alert properties. +type AlertProperties struct { + // False by default; true if the alert is active. + IsActive *bool + + // READ-ONLY; The alert configuration. + AlertConfiguration *AlertConfiguration + + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition + + // READ-ONLY; The alert incidents. + AlertIncidents []*AlertIncident + + // READ-ONLY; The number of generated incidents of the alert. + IncidentCount *int32 + + // READ-ONLY; The date time when the alert configuration was updated or new incidents were generated. + LastModifiedDateTime *time.Time + + // READ-ONLY; The date time when the alert was last scanned. + LastScannedDateTime *time.Time + + // READ-ONLY; The alert scope. + Scope *string +} + +// AlertsClientBeginRefreshAllOptions contains the optional parameters for the AlertsClient.BeginRefreshAll method. +type AlertsClientBeginRefreshAllOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AlertsClientBeginRefreshOptions contains the optional parameters for the AlertsClient.BeginRefresh method. +type AlertsClientBeginRefreshOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +type AlertsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertsClientListForScopeOptions contains the optional parameters for the AlertsClient.NewListForScopePager method. +type AlertsClientListForScopeOptions struct { + // placeholder for future optional parameters +} + +// AlertsClientUpdateOptions contains the optional parameters for the AlertsClient.Update method. +type AlertsClientUpdateOptions struct { + // placeholder for future optional parameters +} + // ApprovalSettings - The approval settings. type ApprovalSettings struct { // The type of rule @@ -22,32 +1150,104 @@ type ApprovalSettings struct { // Determines whether approval is required or not. IsApprovalRequired *bool - // Determines whether approval is required for assignment extension. - IsApprovalRequiredForExtension *bool + // Determines whether approval is required for assignment extension. + IsApprovalRequiredForExtension *bool + + // Determine whether requestor justification is required. + IsRequestorJustificationRequired *bool +} + +// ApprovalStage - The approval stage. +type ApprovalStage struct { + // The time in days when approval request would be timed out + ApprovalStageTimeOutInDays *int32 + + // The escalation approver of the request. + EscalationApprovers []*UserSet + + // The time in minutes when the approval request would be escalated if the primary approver does not approve + EscalationTimeInMinutes *int32 + + // Determines whether approver need to provide justification for his decision. + IsApproverJustificationRequired *bool + + // The value determine whether escalation feature is enabled. + IsEscalationEnabled *bool + + // The primary approver of the request. + PrimaryApprovers []*UserSet +} + +// AzureRolesAssignedOutsidePimAlertConfigurationProperties - The Azure roles assigned outside PIM alert configuration properties. +type AzureRolesAssignedOutsidePimAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string + + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool + + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition + + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string + + // READ-ONLY; The alert scope. + Scope *string +} + +// 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, + } +} + +// AzureRolesAssignedOutsidePimAlertIncidentProperties - Azure roles assigned outside PIM alert incident properties. +type AzureRolesAssignedOutsidePimAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string + + // READ-ONLY; The assignee display name. + AssigneeDisplayName *string + + // READ-ONLY; The assignee ID. + AssigneeID *string + + // READ-ONLY; The assignee user principal name. + AssigneeUserPrincipalName *string - // Determine whether requestor justification is required. - IsRequestorJustificationRequired *bool -} + // READ-ONLY; The date the assignment was activated. + AssignmentActivatedDate *time.Time -// ApprovalStage - The approval stage. -type ApprovalStage struct { - // The time in days when approval request would be timed out - ApprovalStageTimeOutInDays *int32 + // READ-ONLY; The requestor display name. + RequestorDisplayName *string - // The escalation approver of the request. - EscalationApprovers []*UserSet + // READ-ONLY; The requestor ID. + RequestorID *string - // The time in minutes when the approval request would be escalated if the primary approver does not approve - EscalationTimeInMinutes *int32 + // READ-ONLY; The requestor user principal name. + RequestorUserPrincipalName *string - // Determines whether approver need to provide justification for his decision. - IsApproverJustificationRequired *bool + // READ-ONLY; The role definition ID. + RoleDefinitionID *string - // The value determine whether escalation feature is enabled. - IsEscalationEnabled *bool + // READ-ONLY; The role display name. + RoleDisplayName *string - // The primary approver of the request. - PrimaryApprovers []*UserSet + // READ-ONLY; The role template ID. + RoleTemplateID *string +} + +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type AzureRolesAssignedOutsidePimAlertIncidentProperties. +func (a *AzureRolesAssignedOutsidePimAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: a.AlertIncidentType, + } } // ClassicAdministrator - Classic Administrators @@ -149,6 +1349,14 @@ type DenyAssignmentPermission struct { // DenyAssignmentProperties - Deny assignment properties. type DenyAssignmentProperties struct { + // The conditions on the deny assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // Version of the condition. + ConditionVersion *string + // The display name of the deny assignment. DenyAssignmentName *string @@ -172,6 +1380,18 @@ type DenyAssignmentProperties struct { // The deny assignment scope. Scope *string + + // READ-ONLY; Id of the user who created the assignment + CreatedBy *string + + // READ-ONLY; Time it was created + CreatedOn *time.Time + + // READ-ONLY; Id of the user who updated the assignment + UpdatedBy *string + + // READ-ONLY; Time it was updated + UpdatedOn *time.Time } // DenyAssignmentsClientGetByIDOptions contains the optional parameters for the DenyAssignmentsClient.GetByID method. @@ -243,6 +1463,57 @@ type DenyAssignmentsClientListOptions struct { Filter *string } +// DuplicateRoleCreatedAlertConfigurationProperties - The duplicate role created alert configuration. +type DuplicateRoleCreatedAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string + + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool + + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition + + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string + + // READ-ONLY; The alert scope. + Scope *string +} + +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type DuplicateRoleCreatedAlertConfigurationProperties. +func (d *DuplicateRoleCreatedAlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return &AlertConfigurationProperties{ + AlertDefinitionID: d.AlertDefinitionID, + Scope: d.Scope, + IsEnabled: d.IsEnabled, + AlertConfigurationType: d.AlertConfigurationType, + AlertDefinition: d.AlertDefinition, + } +} + +// DuplicateRoleCreatedAlertIncidentProperties - Duplicate role created alert incident properties. +type DuplicateRoleCreatedAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string + + // READ-ONLY; The duplicate roles. + DuplicateRoles *string + + // READ-ONLY; The reason for the incident. + Reason *string + + // READ-ONLY; The role name. + RoleName *string +} + +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type DuplicateRoleCreatedAlertIncidentProperties. +func (d *DuplicateRoleCreatedAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: d.AlertIncidentType, + } +} + // EligibleChildResource - Eligible child resource type EligibleChildResource struct { // READ-ONLY; The resource scope Id. @@ -283,6 +1554,21 @@ type ErrorAdditionalInfo struct { Type *string } +// ErrorDefinition - Error description and code explaining why an operation failed. +type ErrorDefinition struct { + // Error of the list gateway status. + Error *ErrorDefinitionProperties +} + +// ErrorDefinitionProperties - Error description and code explaining why an operation failed. +type ErrorDefinitionProperties struct { + // Error code of list gateway. + Code *string + + // READ-ONLY; Description of the error. + Message *string +} + // ErrorDetail - The error detail. type ErrorDetail struct { // READ-ONLY; The error additional info. @@ -364,6 +1650,50 @@ type GlobalAdministratorClientElevateAccessOptions struct { // placeholder for future optional parameters } +// Operation - The definition of a Microsoft.Authorization operation. +type Operation struct { + // Display of the operation + Display *OperationDisplay + + // Indicates whether the operation is a data action + IsDataAction *bool + + // Name of the operation + Name *string + + // Origin of the operation + Origin *string +} + +// OperationDisplay - The display information for a Microsoft.Authorization operation. +type OperationDisplay struct { + // READ-ONLY; The description for the operation. + Description *string + + // READ-ONLY; The operation that users can perform. + Operation *string + + // READ-ONLY; The resource provider name: Microsoft.Authorization. + Provider *string + + // READ-ONLY; The resource on which the operation is performed. + Resource *string +} + +// 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 + + // The collection value. + Value []*Operation +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + // Permission - Role definition permissions. type Permission struct { // Allowed actions. @@ -377,6 +1707,14 @@ type Permission struct { // Denied Data actions. NotDataActions []*string + + // READ-ONLY; The conditions on the role definition. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + // StringEqualsIgnoreCase + // 'foostoragecontainer' + Condition *string + + // READ-ONLY; Version of the condition. Currently the only accepted value is '2.0' + ConditionVersion *string } // PermissionGetResult - Permissions information. @@ -400,7 +1738,6 @@ type PermissionsClientListForResourceOptions struct { // placeholder for future optional parameters } -// PolicyAssignmentProperties - Expanded info of resource scope, role definition and policy type PolicyAssignmentProperties struct { // Details of the policy Policy *PolicyAssignmentPropertiesPolicy @@ -448,7 +1785,6 @@ type PolicyAssignmentPropertiesScope struct { Type *string } -// PolicyProperties - Expanded info of resource scope type PolicyProperties struct { // READ-ONLY; Details of the resource scope Scope *PolicyPropertiesScope @@ -546,6 +1882,21 @@ type ProviderOperationsMetadataListResult struct { Value []*ProviderOperationsMetadata } +// RecordAllDecisionsProperties - Record All Decisions payload. +type RecordAllDecisionsProperties struct { + // The decision to make. Approvers can take action of Approve/Deny + Decision *RecordAllDecisionsResult + + // Justification provided by approvers for their action + Justification *string + + // READ-ONLY; The id of principal which needs to be approved/denied. + PrincipalID *string + + // READ-ONLY; The id of resource which needs to be approved/denied. + ResourceID *string +} + // ResourceType - Resource Type type ResourceType struct { // The resource type display name. @@ -1147,6 +2498,18 @@ type RoleDefinitionProperties struct { // The role type. RoleType *string + + // READ-ONLY; Id of the user who created the assignment + CreatedBy *string + + // READ-ONLY; Time it was created + CreatedOn *time.Time + + // READ-ONLY; Id of the user who updated the assignment + UpdatedBy *string + + // READ-ONLY; Time it was updated + UpdatedOn *time.Time } // RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate @@ -1634,9 +2997,6 @@ type RoleManagementPolicyAssignmentProperties struct { // The role management policy scope. Scope *string - // READ-ONLY; The readonly computed rule applied to the policy. - EffectiveRules []RoleManagementPolicyRuleClassification - // READ-ONLY; Additional properties of scope, role definition and policy PolicyAssignmentProperties *PolicyAssignmentProperties } @@ -1864,6 +3224,271 @@ type RoleManagementPolicyRuleTarget struct { TargetObjects []*string } +// ScopeAccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Get +// method. +type ScopeAccessReviewDefaultSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Put +// method. +type ScopeAccessReviewDefaultSettingsClientPutOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.Create +// method. +type ScopeAccessReviewHistoryDefinitionClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.DeleteByID +// method. +type ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI +// method. +type ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// ScopeAccessReviewHistoryDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionsClient.NewListPager +// method. +type ScopeAccessReviewHistoryDefinitionsClientListOptions struct { + // The filter to apply on the operation. Only standard filters on definition name and created date are supported + Filter *string +} + +// ScopeAccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ApplyDecisions +// method. +type ScopeAccessReviewInstanceClientApplyDecisionsOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewInstanceClientRecordAllDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.RecordAllDecisions +// method. +type ScopeAccessReviewInstanceClientRecordAllDecisionsOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ResetDecisions +// method. +type ScopeAccessReviewInstanceClientResetDecisionsOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.SendReminders +// method. +type ScopeAccessReviewInstanceClientSendRemindersOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewInstanceClientStopOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.Stop +// method. +type ScopeAccessReviewInstanceClientStopOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the ScopeAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +type ScopeAccessReviewInstanceContactedReviewersClientListOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// ScopeAccessReviewInstancesClientCreateOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.Create +// method. +type ScopeAccessReviewInstancesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewInstancesClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.GetByID +// method. +type ScopeAccessReviewInstancesClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// 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 +} + +// ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID +// method. +type ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.DeleteByID +// method. +type ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.GetByID +// method. +type ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions struct { + // placeholder for future optional parameters +} + +// ScopeAccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.NewListPager +// method. +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 +} + +// ScopeAccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.Stop +// method. +type ScopeAccessReviewScheduleDefinitionsClientStopOptions struct { + // placeholder for future optional parameters +} + +// TenantLevelAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +type TenantLevelAccessReviewInstanceContactedReviewersClientListOptions struct { + // placeholder for future optional parameters +} + +// TooManyOwnersAssignedToResourceAlertConfigurationProperties - Too many owners assigned to resource alert configuration +// properties. +type TooManyOwnersAssignedToResourceAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string + + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool + + // The threshold number of owners. + ThresholdNumberOfOwners *int32 + + // The threshold percentage of owners out of all role members. + ThresholdPercentageOfOwnersOutOfAllRoleMembers *int32 + + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition + + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string + + // READ-ONLY; The alert scope. + Scope *string +} + +// 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, + } +} + +// TooManyOwnersAssignedToResourceAlertIncidentProperties - Too many owners assigned to resource alert incident properties. +type TooManyOwnersAssignedToResourceAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string + + // READ-ONLY; The assignee name. + AssigneeName *string + + // READ-ONLY; The assignee type. + AssigneeType *string +} + +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type TooManyOwnersAssignedToResourceAlertIncidentProperties. +func (t *TooManyOwnersAssignedToResourceAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: t.AlertIncidentType, + } +} + +// TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties - Too many permanent owners assigned to resource alert +// configuration properties. +type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties struct { + // REQUIRED; The alert configuration type. + AlertConfigurationType *string + + // True if the alert is enabled, false will disable the scanning for the specific alert. + IsEnabled *bool + + // The threshold number of permanent owners. + ThresholdNumberOfPermanentOwners *int32 + + // The threshold percentage of permanent owners out of all owners. + ThresholdPercentageOfPermanentOwnersOutOfAllOwners *int32 + + // READ-ONLY; The alert definition. + AlertDefinition *AlertDefinition + + // READ-ONLY; The alert definition ID. + AlertDefinitionID *string + + // READ-ONLY; The alert scope. + Scope *string +} + +// GetAlertConfigurationProperties implements the AlertConfigurationPropertiesClassification interface for type TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties. +func (t *TooManyPermanentOwnersAssignedToResourceAlertConfigurationProperties) GetAlertConfigurationProperties() *AlertConfigurationProperties { + return &AlertConfigurationProperties{ + AlertDefinitionID: t.AlertDefinitionID, + Scope: t.Scope, + IsEnabled: t.IsEnabled, + AlertConfigurationType: t.AlertConfigurationType, + AlertDefinition: t.AlertDefinition, + } +} + +// TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties - Too many permanent owners assigned to resource alert +// incident properties. +type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties struct { + // REQUIRED; The alert incident type. + AlertIncidentType *string + + // READ-ONLY; The assignee name. + AssigneeName *string + + // READ-ONLY; The assignee type. + AssigneeType *string +} + +// GetAlertIncidentProperties implements the AlertIncidentPropertiesClassification interface for type TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties. +func (t *TooManyPermanentOwnersAssignedToResourceAlertIncidentProperties) GetAlertIncidentProperties() *AlertIncidentProperties { + return &AlertIncidentProperties{ + AlertIncidentType: t.AlertIncidentType, + } +} + // UserSet - The detail of a user. type UserSet struct { // The description of the user. diff --git a/sdk/resourcemanager/authorization/armauthorization/models_serde.go b/sdk/resourcemanager/authorization/armauthorization/models_serde.go index 8d74c31974b4..fd4dbf7fae1e 100644 --- a/sdk/resourcemanager/authorization/armauthorization/models_serde.go +++ b/sdk/resourcemanager/authorization/armauthorization/models_serde.go @@ -16,6 +16,1922 @@ import ( "reflect" ) +// 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 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + case "principalName": + err = unpopulate(val, "PrincipalName", &a.PrincipalName) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &a.PrincipalType) + delete(rawMsg, key) + case "userPrincipalName": + err = unpopulate(val, "UserPrincipalName", &a.UserPrincipalName) + 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 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 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 "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", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessReviewContactedReviewerListResult. +func (a AccessReviewContactedReviewerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessReviewContactedReviewerListResult. +func (a *AccessReviewContactedReviewerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdDateTime": + err = unpopulateTimeRFC3339(val, "CreatedDateTime", &a.CreatedDateTime) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + a.Properties, err = unmarshalAccessReviewDecisionInsightPropertiesClassification(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", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccessReviewDecisionInsightProperties. +func (a AccessReviewDecisionInsightProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "insightCreatedDateTime", a.InsightCreatedDateTime) + objectMap["type"] = a.Type + return json.Marshal(objectMap) +} + +// 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "insightCreatedDateTime": + err = unpopulate(val, "InsightCreatedDateTime", &a.InsightCreatedDateTime) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "membershipTypes": + err = unpopulate(val, "MembershipTypes", &a.MembershipTypes) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appliedBy": + err = unpopulate(val, "AppliedBy", &a.AppliedBy) + delete(rawMsg, key) + 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 "insights": + err = unpopulate(val, "Insights", &a.Insights) + delete(rawMsg, key) + case "justification": + err = unpopulate(val, "Justification", &a.Justification) + delete(rawMsg, key) + case "principal": + a.Principal, err = unmarshalAccessReviewDecisionIdentityClassification(val) + delete(rawMsg, key) + case "principalResourceMembership": + err = unpopulate(val, "PrincipalResourceMembership", &a.PrincipalResourceMembership) + delete(rawMsg, key) + case "recommendation": + err = unpopulate(val, "Recommendation", &a.Recommendation) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &a.Resource) + delete(rawMsg, key) + case "reviewedBy": + err = unpopulate(val, "ReviewedBy", &a.ReviewedBy) + delete(rawMsg, key) + case "reviewedDateTime": + err = unpopulateTimeRFC3339(val, "ReviewedDateTime", &a.ReviewedDateTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appId": + err = unpopulate(val, "AppID", &a.AppID) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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) + case "userPrincipalName": + err = unpopulate(val, "UserPrincipalName", &a.UserPrincipalName) + 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 AccessReviewDecisionUserSignInInsightProperties. +func (a AccessReviewDecisionUserSignInInsightProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "insightCreatedDateTime", a.InsightCreatedDateTime) + populateAny(objectMap, "lastSignInDateTime", a.LastSignInDateTime) + objectMap["type"] = AccessReviewDecisionInsightTypeUserSignInInsight + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "insightCreatedDateTime": + err = unpopulate(val, "InsightCreatedDateTime", &a.InsightCreatedDateTime) + delete(rawMsg, key) + case "lastSignInDateTime": + err = unpopulate(val, "LastSignInDateTime", &a.LastSignInDateTime) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", 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", &a.DisplayName) + delete(rawMsg, key) + case "instances": + err = unpopulate(val, "Instances", &a.Instances) + 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 "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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) + delete(rawMsg, key) + case "range": + err = unpopulate(val, "Range", &a.Range) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupReviewers": + err = unpopulate(val, "BackupReviewers", &a.BackupReviewers) + delete(rawMsg, key) + case "endDateTime": + err = unpopulateTimeRFC3339(val, "EndDateTime", &a.EndDateTime) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endDate": + err = unpopulateTimeRFC3339(val, "EndDate", &a.EndDate) + delete(rawMsg, key) + 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", &a.Type) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "pattern": + err = unpopulate(val, "Pattern", &a.Pattern) + delete(rawMsg, key) + case "range": + err = unpopulate(val, "Range", &a.Range) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &a.PrincipalType) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupReviewers": + err = unpopulate(val, "BackupReviewers", &a.BackupReviewers) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &a.CreatedBy) + delete(rawMsg, key) + case "descriptionForAdmins": + err = unpopulate(val, "DescriptionForAdmins", &a.DescriptionForAdmins) + delete(rawMsg, key) + case "descriptionForReviewers": + err = unpopulate(val, "DescriptionForReviewers", &a.DescriptionForReviewers) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "instances": + err = unpopulate(val, "Instances", &a.Instances) + delete(rawMsg, key) + case "reviewers": + err = unpopulate(val, "Reviewers", &a.Reviewers) + delete(rawMsg, key) + case "reviewersType": + err = unpopulate(val, "ReviewersType", &a.ReviewersType) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoApplyDecisionsEnabled": + err = unpopulate(val, "AutoApplyDecisionsEnabled", &a.AutoApplyDecisionsEnabled) + delete(rawMsg, key) + case "defaultDecision": + err = unpopulate(val, "DefaultDecision", &a.DefaultDecision) + delete(rawMsg, key) + case "defaultDecisionEnabled": + err = unpopulate(val, "DefaultDecisionEnabled", &a.DefaultDecisionEnabled) + delete(rawMsg, key) + case "instanceDurationInDays": + err = unpopulate(val, "InstanceDurationInDays", &a.InstanceDurationInDays) + delete(rawMsg, key) + case "justificationRequiredOnApproval": + err = unpopulate(val, "JustificationRequiredOnApproval", &a.JustificationRequiredOnApproval) + delete(rawMsg, key) + case "mailNotificationsEnabled": + err = unpopulate(val, "MailNotificationsEnabled", &a.MailNotificationsEnabled) + delete(rawMsg, key) + case "recommendationLookBackDuration": + err = unpopulate(val, "RecommendationLookBackDuration", &a.RecommendationLookBackDuration) + delete(rawMsg, key) + case "recommendationsEnabled": + err = unpopulate(val, "RecommendationsEnabled", &a.RecommendationsEnabled) + delete(rawMsg, key) + case "recurrence": + err = unpopulate(val, "Recurrence", &a.Recurrence) + delete(rawMsg, key) + case "reminderNotificationsEnabled": + err = unpopulate(val, "ReminderNotificationsEnabled", &a.ReminderNotificationsEnabled) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assignmentState": + err = unpopulate(val, "AssignmentState", &a.AssignmentState) + delete(rawMsg, key) + case "excludeResourceId": + err = unpopulate(val, "ExcludeResourceID", &a.ExcludeResourceID) + delete(rawMsg, key) + case "excludeRoleDefinitionId": + err = unpopulate(val, "ExcludeRoleDefinitionID", &a.ExcludeRoleDefinitionID) + delete(rawMsg, key) + case "expandNestedMemberships": + err = unpopulate(val, "ExpandNestedMemberships", &a.ExpandNestedMemberships) + delete(rawMsg, key) + case "inactiveDuration": + err = unpopulate(val, "InactiveDuration", &a.InactiveDuration) + delete(rawMsg, key) + case "includeAccessBelowResource": + err = unpopulate(val, "IncludeAccessBelowResource", &a.IncludeAccessBelowResource) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + a.Properties, err = unmarshalAlertConfigurationPropertiesClassification(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", 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 "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &a.AlertConfigurationType) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "howToPrevent": + err = unpopulate(val, "HowToPrevent", &a.HowToPrevent) + delete(rawMsg, key) + case "isConfigurable": + err = unpopulate(val, "IsConfigurable", &a.IsConfigurable) + delete(rawMsg, key) + case "isRemediatable": + err = unpopulate(val, "IsRemediatable", &a.IsRemediatable) + delete(rawMsg, key) + case "mitigationSteps": + err = unpopulate(val, "MitigationSteps", &a.MitigationSteps) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + delete(rawMsg, key) + case "securityImpact": + err = unpopulate(val, "SecurityImpact", &a.SecurityImpact) + delete(rawMsg, key) + case "severityLevel": + err = unpopulate(val, "SeverityLevel", &a.SeverityLevel) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &a.AlertIncidentType) + 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 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 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 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", 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", &a.ID) + delete(rawMsg, key) + case "lastActionDateTime": + err = unpopulateTimeRFC3339(val, "LastActionDateTime", &a.LastActionDateTime) + delete(rawMsg, key) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &a.ResourceLocation) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "statusDetail": + err = unpopulate(val, "StatusDetail", &a.StatusDetail) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertConfiguration": + err = unpopulate(val, "AlertConfiguration", &a.AlertConfiguration) + delete(rawMsg, key) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &a.AlertDefinition) + delete(rawMsg, key) + case "alertIncidents": + err = unpopulate(val, "AlertIncidents", &a.AlertIncidents) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ApprovalSettings. func (a ApprovalSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -106,6 +2022,116 @@ func (a *ApprovalStage) UnmarshalJSON(data []byte) error { return nil } +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &a.AlertConfigurationType) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + +// 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 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &a.AlertIncidentType) + delete(rawMsg, key) + case "assigneeDisplayName": + err = unpopulate(val, "AssigneeDisplayName", &a.AssigneeDisplayName) + delete(rawMsg, key) + 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", &a.RoleDefinitionID) + delete(rawMsg, key) + 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", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ClassicAdministrator. func (c ClassicAdministrator) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -362,6 +2388,10 @@ func (d *DenyAssignmentPermission) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DenyAssignmentProperties. func (d DenyAssignmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "condition", d.Condition) + populate(objectMap, "conditionVersion", d.ConditionVersion) + populate(objectMap, "createdBy", d.CreatedBy) + populateTimeRFC3339(objectMap, "createdOn", d.CreatedOn) populate(objectMap, "denyAssignmentName", d.DenyAssignmentName) populate(objectMap, "description", d.Description) populate(objectMap, "doNotApplyToChildScopes", d.DoNotApplyToChildScopes) @@ -370,6 +2400,8 @@ func (d DenyAssignmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "permissions", d.Permissions) populate(objectMap, "principals", d.Principals) populate(objectMap, "scope", d.Scope) + populate(objectMap, "updatedBy", d.UpdatedBy) + populateTimeRFC3339(objectMap, "updatedOn", d.UpdatedOn) return json.Marshal(objectMap) } @@ -382,6 +2414,18 @@ func (d *DenyAssignmentProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "condition": + err = unpopulate(val, "Condition", &d.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &d.ConditionVersion) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &d.CreatedBy) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, "CreatedOn", &d.CreatedOn) + delete(rawMsg, key) case "denyAssignmentName": err = unpopulate(val, "DenyAssignmentName", &d.DenyAssignmentName) delete(rawMsg, key) @@ -406,6 +2450,94 @@ func (d *DenyAssignmentProperties) UnmarshalJSON(data []byte) error { case "scope": err = unpopulate(val, "Scope", &d.Scope) delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &d.UpdatedBy) + delete(rawMsg, key) + case "updatedOn": + err = unpopulateTimeRFC3339(val, "UpdatedOn", &d.UpdatedOn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// 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 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertConfigurationType": + err = unpopulate(val, "AlertConfigurationType", &d.AlertConfigurationType) + delete(rawMsg, key) + case "alertDefinition": + err = unpopulate(val, "AlertDefinition", &d.AlertDefinition) + delete(rawMsg, key) + case "alertDefinitionId": + err = unpopulate(val, "AlertDefinitionID", &d.AlertDefinitionID) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &d.IsEnabled) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &d.Scope) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// 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 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &d.AlertIncidentType) + delete(rawMsg, key) + case "duplicateRoles": + err = unpopulate(val, "DuplicateRoles", &d.DuplicateRoles) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &d.Reason) + delete(rawMsg, key) + case "roleName": + err = unpopulate(val, "RoleName", &d.RoleName) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -417,14 +2549,79 @@ func (d *DenyAssignmentProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EligibleChildResource. func (e EligibleChildResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResource. +func (e *EligibleChildResource) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EligibleChildResourcesListResult. +func (e EligibleChildResourcesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EligibleChildResourcesListResult. +func (e *EligibleChildResourcesListResult) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) populate(objectMap, "type", e.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 ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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) @@ -432,11 +2629,8 @@ func (e *EligibleChildResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) @@ -449,16 +2643,15 @@ func (e *EligibleChildResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EligibleChildResourcesListResult. -func (e EligibleChildResourcesListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. +func (e ErrorDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "error", e.Error) 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 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", e, err) @@ -466,11 +2659,8 @@ func (e *EligibleChildResourcesListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { @@ -480,16 +2670,16 @@ func (e *EligibleChildResourcesListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorDefinitionProperties. +func (e ErrorDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) 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 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", e, err) @@ -497,11 +2687,11 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { @@ -725,10 +2915,121 @@ func (e *ExpandedPropertiesScope) UnmarshalJSON(data []byte) error { return nil } +// 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 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// 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 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + 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 "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Permission. func (p Permission) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actions", p.Actions) + populate(objectMap, "condition", p.Condition) + populate(objectMap, "conditionVersion", p.ConditionVersion) populate(objectMap, "dataActions", p.DataActions) populate(objectMap, "notActions", p.NotActions) populate(objectMap, "notDataActions", p.NotDataActions) @@ -747,6 +3048,12 @@ func (p *Permission) UnmarshalJSON(data []byte) error { case "actions": err = unpopulate(val, "Actions", &p.Actions) delete(rawMsg, key) + case "condition": + err = unpopulate(val, "Condition", &p.Condition) + delete(rawMsg, key) + case "conditionVersion": + err = unpopulate(val, "ConditionVersion", &p.ConditionVersion) + delete(rawMsg, key) case "dataActions": err = unpopulate(val, "DataActions", &p.DataActions) delete(rawMsg, key) @@ -1161,6 +3468,45 @@ func (p *ProviderOperationsMetadataListResult) UnmarshalJSON(data []byte) error return nil } +// 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 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "decision": + err = unpopulate(val, "Decision", &r.Decision) + delete(rawMsg, key) + case "justification": + err = unpopulate(val, "Justification", &r.Justification) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &r.PrincipalID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &r.ResourceID) + 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 ResourceType. func (r ResourceType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2189,10 +4535,14 @@ func (r *RoleDefinitionListResult) UnmarshalJSON(data []byte) error { func (r RoleDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assignableScopes", r.AssignableScopes) + populate(objectMap, "createdBy", r.CreatedBy) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) populate(objectMap, "description", r.Description) populate(objectMap, "permissions", r.Permissions) populate(objectMap, "roleName", r.RoleName) populate(objectMap, "type", r.RoleType) + populate(objectMap, "updatedBy", r.UpdatedBy) + populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) return json.Marshal(objectMap) } @@ -2208,6 +4558,12 @@ func (r *RoleDefinitionProperties) UnmarshalJSON(data []byte) error { case "assignableScopes": err = unpopulate(val, "AssignableScopes", &r.AssignableScopes) delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &r.CreatedBy) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTimeRFC3339(val, "CreatedOn", &r.CreatedOn) + delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &r.Description) delete(rawMsg, key) @@ -2220,6 +4576,12 @@ func (r *RoleDefinitionProperties) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "RoleType", &r.RoleType) delete(rawMsg, key) + case "updatedBy": + err = unpopulate(val, "UpdatedBy", &r.UpdatedBy) + 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) @@ -3044,7 +5406,6 @@ func (r *RoleManagementPolicyAssignmentListResult) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type RoleManagementPolicyAssignmentProperties. func (r RoleManagementPolicyAssignmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "effectiveRules", r.EffectiveRules) populate(objectMap, "policyAssignmentProperties", r.PolicyAssignmentProperties) populate(objectMap, "policyId", r.PolicyID) populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) @@ -3061,9 +5422,6 @@ func (r *RoleManagementPolicyAssignmentProperties) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "effectiveRules": - r.EffectiveRules, err = unmarshalRoleManagementPolicyRuleClassificationArray(val) - delete(rawMsg, key) case "policyAssignmentProperties": err = unpopulate(val, "PolicyAssignmentProperties", &r.PolicyAssignmentProperties) delete(rawMsg, key) @@ -3436,6 +5794,178 @@ func (r *RoleManagementPolicyRuleTarget) UnmarshalJSON(data []byte) error { return nil } +// 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 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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 "isEnabled": + err = unpopulate(val, "IsEnabled", &t.IsEnabled) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &t.Scope) + delete(rawMsg, key) + case "thresholdNumberOfOwners": + err = unpopulate(val, "ThresholdNumberOfOwners", &t.ThresholdNumberOfOwners) + delete(rawMsg, key) + case "thresholdPercentageOfOwnersOutOfAllRoleMembers": + err = unpopulate(val, "ThresholdPercentageOfOwnersOutOfAllRoleMembers", &t.ThresholdPercentageOfOwnersOutOfAllRoleMembers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// 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 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &t.AlertIncidentType) + delete(rawMsg, key) + 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", t, err) + } + } + return nil +} + +// 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 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + 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 "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", t, err) + } + } + return nil +} + +// 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 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertIncidentType": + err = unpopulate(val, "AlertIncidentType", &t.AlertIncidentType) + delete(rawMsg, key) + 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", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UserSet. func (u UserSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/authorization/armauthorization/operations_client.go b/sdk/resourcemanager/authorization/armauthorization/operations_client.go new file mode 100644 index 000000000000..16714e533be3 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/operations_client.go @@ -0,0 +1,94 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Lists the operations available from this provider. +// +// Generated from API version 2021-12-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/permissions_client.go b/sdk/resourcemanager/authorization/armauthorization/permissions_client.go index 017e852c8368..6ae4a6958fde 100644 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/permissions_client.go @@ -46,7 +46,7 @@ func NewPermissionsClient(subscriptionID string, credential azcore.TokenCredenti // NewListForResourcePager - Gets all permissions the caller has for a resource. // -// Generated from API version 2022-04-01 +// Generated from API version 2022-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceProviderNamespace - The namespace of the resource provider. // - parentResourcePath - The parent resource identity. @@ -105,7 +105,7 @@ func (client *PermissionsClient) listForResourceCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -122,7 +122,7 @@ func (client *PermissionsClient) listForResourceHandleResponse(resp *http.Respon // NewListForResourceGroupPager - Gets all permissions the caller has for a resource group. // -// Generated from API version 2022-04-01 +// Generated from API version 2022-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PermissionsClientListForResourceGroupOptions contains the optional parameters for the PermissionsClient.NewListForResourceGroupPager // method. @@ -170,7 +170,7 @@ func (client *PermissionsClient) listForResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-05-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/permissions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go index 2a95750de5e4..15da9c56fa7f 100644 --- a/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/permissions_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetPermissions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-05-01-preview/examples/GetPermissions.json func ExamplePermissionsClient_NewListForResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,7 +55,7 @@ func ExamplePermissionsClient_NewListForResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetResourcePermissions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-05-01-preview/examples/GetResourcePermissions.json func ExamplePermissionsClient_NewListForResourcePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go b/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go index 9785c4d86b04..355d6f81fb2a 100644 --- a/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go +++ b/sdk/resourcemanager/authorization/armauthorization/polymorphic_helpers.go @@ -11,6 +11,92 @@ package armauthorization import "encoding/json" +func unmarshalAccessReviewDecisionIdentityClassification(rawMsg json.RawMessage) (AccessReviewDecisionIdentityClassification, 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 AccessReviewDecisionIdentityClassification + switch m["type"] { + case string(DecisionTargetTypeServicePrincipal): + b = &AccessReviewDecisionServicePrincipalIdentity{} + case string(DecisionTargetTypeUser): + b = &AccessReviewDecisionUserIdentity{} + default: + b = &AccessReviewDecisionIdentity{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAccessReviewDecisionInsightPropertiesClassification(rawMsg json.RawMessage) (AccessReviewDecisionInsightPropertiesClassification, 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 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 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) +} + func unmarshalRoleManagementPolicyRuleClassification(rawMsg json.RawMessage) (RoleManagementPolicyRuleClassification, error) { if rawMsg == nil { return nil, nil diff --git a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go index e9566f71cf55..64860e56a9e9 100644 --- a/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/provideroperationsmetadata_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetProviderOperationsRP.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetProviderOperationsRP.json func ExampleProviderOperationsMetadataClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,7 +52,7 @@ func ExampleProviderOperationsMetadataClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllProviderOperations.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetAllProviderOperations.json func ExampleProviderOperationsMetadataClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/authorization/armauthorization/response_types.go b/sdk/resourcemanager/authorization/armauthorization/response_types.go index 6085555aa696..cf9a24be05d7 100644 --- a/sdk/resourcemanager/authorization/armauthorization/response_types.go +++ b/sdk/resourcemanager/authorization/armauthorization/response_types.go @@ -9,6 +9,221 @@ package armauthorization +// AccessReviewDefaultSettingsClientGetResponse contains the response from method AccessReviewDefaultSettingsClient.Get. +type AccessReviewDefaultSettingsClientGetResponse struct { + AccessReviewDefaultSettings +} + +// AccessReviewDefaultSettingsClientPutResponse contains the response from method AccessReviewDefaultSettingsClient.Put. +type AccessReviewDefaultSettingsClientPutResponse struct { + AccessReviewDefaultSettings +} + +// AccessReviewHistoryDefinitionClientCreateResponse contains the response from method AccessReviewHistoryDefinitionClient.Create. +type AccessReviewHistoryDefinitionClientCreateResponse struct { + AccessReviewHistoryDefinition +} + +// AccessReviewHistoryDefinitionClientDeleteByIDResponse contains the response from method AccessReviewHistoryDefinitionClient.DeleteByID. +type AccessReviewHistoryDefinitionClientDeleteByIDResponse struct { + // placeholder for future response values +} + +// AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse contains the response from method AccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI. +type AccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse struct { + AccessReviewHistoryInstance +} + +// AccessReviewHistoryDefinitionInstancesClientListResponse contains the response from method AccessReviewHistoryDefinitionInstancesClient.NewListPager. +type AccessReviewHistoryDefinitionInstancesClientListResponse struct { + AccessReviewHistoryDefinitionInstanceListResult +} + +// AccessReviewHistoryDefinitionsClientGetByIDResponse contains the response from method AccessReviewHistoryDefinitionsClient.GetByID. +type AccessReviewHistoryDefinitionsClientGetByIDResponse struct { + AccessReviewHistoryDefinition +} + +// AccessReviewHistoryDefinitionsClientListResponse contains the response from method AccessReviewHistoryDefinitionsClient.NewListPager. +type AccessReviewHistoryDefinitionsClientListResponse struct { + AccessReviewHistoryDefinitionListResult +} + +// AccessReviewInstanceClientAcceptRecommendationsResponse contains the response from method AccessReviewInstanceClient.AcceptRecommendations. +type AccessReviewInstanceClientAcceptRecommendationsResponse struct { + // placeholder for future response values +} + +// AccessReviewInstanceClientApplyDecisionsResponse contains the response from method AccessReviewInstanceClient.ApplyDecisions. +type AccessReviewInstanceClientApplyDecisionsResponse struct { + // placeholder for future response values +} + +// AccessReviewInstanceClientResetDecisionsResponse contains the response from method AccessReviewInstanceClient.ResetDecisions. +type AccessReviewInstanceClientResetDecisionsResponse struct { + // placeholder for future response values +} + +// AccessReviewInstanceClientSendRemindersResponse contains the response from method AccessReviewInstanceClient.SendReminders. +type AccessReviewInstanceClientSendRemindersResponse struct { + // placeholder for future response values +} + +// AccessReviewInstanceClientStopResponse contains the response from method AccessReviewInstanceClient.Stop. +type AccessReviewInstanceClientStopResponse struct { + // placeholder for future response values +} + +// AccessReviewInstanceContactedReviewersClientListResponse contains the response from method AccessReviewInstanceContactedReviewersClient.NewListPager. +type AccessReviewInstanceContactedReviewersClientListResponse struct { + AccessReviewContactedReviewerListResult +} + +// AccessReviewInstanceDecisionsClientListResponse contains the response from method AccessReviewInstanceDecisionsClient.NewListPager. +type AccessReviewInstanceDecisionsClientListResponse struct { + AccessReviewDecisionListResult +} + +// 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 +} + +// AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse contains the response from method AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID. +type AccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse struct { + AccessReviewScheduleDefinition +} + +// AccessReviewScheduleDefinitionsClientDeleteByIDResponse contains the response from method AccessReviewScheduleDefinitionsClient.DeleteByID. +type AccessReviewScheduleDefinitionsClientDeleteByIDResponse struct { + // placeholder for future response values +} + +// AccessReviewScheduleDefinitionsClientGetByIDResponse contains the response from method AccessReviewScheduleDefinitionsClient.GetByID. +type AccessReviewScheduleDefinitionsClientGetByIDResponse struct { + AccessReviewScheduleDefinition +} + +// AccessReviewScheduleDefinitionsClientListResponse contains the response from method AccessReviewScheduleDefinitionsClient.NewListPager. +type AccessReviewScheduleDefinitionsClientListResponse struct { + AccessReviewScheduleDefinitionListResult +} + +// AccessReviewScheduleDefinitionsClientStopResponse contains the response from method AccessReviewScheduleDefinitionsClient.Stop. +type AccessReviewScheduleDefinitionsClientStopResponse struct { + // placeholder for future response values +} + +// AlertConfigurationsClientGetResponse contains the response from method AlertConfigurationsClient.Get. +type AlertConfigurationsClientGetResponse struct { + AlertConfiguration +} + +// AlertConfigurationsClientListForScopeResponse contains the response from method AlertConfigurationsClient.NewListForScopePager. +type AlertConfigurationsClientListForScopeResponse struct { + AlertConfigurationListResult +} + +// AlertConfigurationsClientUpdateResponse contains the response from method AlertConfigurationsClient.Update. +type AlertConfigurationsClientUpdateResponse struct { + // placeholder for future response values +} + +// AlertDefinitionsClientGetResponse contains the response from method AlertDefinitionsClient.Get. +type AlertDefinitionsClientGetResponse struct { + AlertDefinition +} + +// AlertDefinitionsClientListForScopeResponse contains the response from method AlertDefinitionsClient.NewListForScopePager. +type AlertDefinitionsClientListForScopeResponse struct { + AlertDefinitionListResult +} + +// AlertIncidentsClientGetResponse contains the response from method AlertIncidentsClient.Get. +type AlertIncidentsClientGetResponse struct { + AlertIncident +} + +// AlertIncidentsClientListForScopeResponse contains the response from method AlertIncidentsClient.NewListForScopePager. +type AlertIncidentsClientListForScopeResponse struct { + AlertIncidentListResult +} + +// AlertIncidentsClientRemediateResponse contains the response from method AlertIncidentsClient.Remediate. +type AlertIncidentsClientRemediateResponse struct { + // placeholder for future response values +} + +// AlertOperationClientGetResponse contains the response from method AlertOperationClient.Get. +type AlertOperationClientGetResponse struct { + AlertOperationResult +} + +// AlertsClientGetResponse contains the response from method AlertsClient.Get. +type AlertsClientGetResponse struct { + Alert +} + +// AlertsClientListForScopeResponse contains the response from method AlertsClient.NewListForScopePager. +type AlertsClientListForScopeResponse struct { + AlertListResult +} + +// AlertsClientRefreshAllResponse contains the response from method AlertsClient.BeginRefreshAll. +type AlertsClientRefreshAllResponse struct { + AlertOperationResult +} + +// AlertsClientRefreshResponse contains the response from method AlertsClient.BeginRefresh. +type AlertsClientRefreshResponse struct { + AlertOperationResult +} + +// AlertsClientUpdateResponse contains the response from method AlertsClient.Update. +type AlertsClientUpdateResponse struct { + // placeholder for future response values +} + // ClassicAdministratorsClientListResponse contains the response from method ClassicAdministratorsClient.NewListPager. type ClassicAdministratorsClientListResponse struct { ClassicAdministratorListResult @@ -54,6 +269,11 @@ type GlobalAdministratorClientElevateAccessResponse struct { // placeholder for future response values } +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + OperationListResult +} + // PermissionsClientListForResourceGroupResponse contains the response from method PermissionsClient.NewListForResourceGroupPager. type PermissionsClientListForResourceGroupResponse struct { PermissionGetResult @@ -278,3 +498,123 @@ type RoleManagementPolicyAssignmentsClientGetResponse struct { type RoleManagementPolicyAssignmentsClientListForScopeResponse struct { RoleManagementPolicyAssignmentListResult } + +// ScopeAccessReviewDefaultSettingsClientGetResponse contains the response from method ScopeAccessReviewDefaultSettingsClient.Get. +type ScopeAccessReviewDefaultSettingsClientGetResponse struct { + AccessReviewDefaultSettings +} + +// ScopeAccessReviewDefaultSettingsClientPutResponse contains the response from method ScopeAccessReviewDefaultSettingsClient.Put. +type ScopeAccessReviewDefaultSettingsClientPutResponse struct { + AccessReviewDefaultSettings +} + +// ScopeAccessReviewHistoryDefinitionClientCreateResponse contains the response from method ScopeAccessReviewHistoryDefinitionClient.Create. +type ScopeAccessReviewHistoryDefinitionClientCreateResponse struct { + AccessReviewHistoryDefinition +} + +// ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse contains the response from method ScopeAccessReviewHistoryDefinitionClient.DeleteByID. +type ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse struct { + // placeholder for future response values +} + +// ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse contains the response from method ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI. +type ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse struct { + AccessReviewHistoryInstance +} + +// ScopeAccessReviewHistoryDefinitionInstancesClientListResponse contains the response from method ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager. +type ScopeAccessReviewHistoryDefinitionInstancesClientListResponse struct { + AccessReviewHistoryDefinitionInstanceListResult +} + +// ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse contains the response from method ScopeAccessReviewHistoryDefinitionsClient.GetByID. +type ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse struct { + AccessReviewHistoryDefinition +} + +// 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 +} + +// ScopeAccessReviewInstanceClientResetDecisionsResponse contains the response from method ScopeAccessReviewInstanceClient.ResetDecisions. +type ScopeAccessReviewInstanceClientResetDecisionsResponse struct { + // placeholder for future response values +} + +// ScopeAccessReviewInstanceClientSendRemindersResponse contains the response from method ScopeAccessReviewInstanceClient.SendReminders. +type ScopeAccessReviewInstanceClientSendRemindersResponse struct { + // placeholder for future response values +} + +// ScopeAccessReviewInstanceClientStopResponse contains the response from method ScopeAccessReviewInstanceClient.Stop. +type ScopeAccessReviewInstanceClientStopResponse struct { + // placeholder for future response values +} + +// 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 +} + +// ScopeAccessReviewInstancesClientGetByIDResponse contains the response from method ScopeAccessReviewInstancesClient.GetByID. +type ScopeAccessReviewInstancesClientGetByIDResponse struct { + AccessReviewInstance +} + +// ScopeAccessReviewInstancesClientListResponse contains the response from method ScopeAccessReviewInstancesClient.NewListPager. +type ScopeAccessReviewInstancesClientListResponse struct { + AccessReviewInstanceListResult +} + +// ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse contains the response from method ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID. +type ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse struct { + AccessReviewScheduleDefinition +} + +// ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse contains the response from method ScopeAccessReviewScheduleDefinitionsClient.DeleteByID. +type ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse struct { + // placeholder for future response values +} + +// 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 +} + +// TenantLevelAccessReviewInstanceContactedReviewersClientListResponse contains the response from method TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager. +type TenantLevelAccessReviewInstanceContactedReviewersClientListResponse struct { + AccessReviewContactedReviewerListResult +} diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go index 81bceceffe6c..3216011855c2 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignments_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -59,7 +59,7 @@ func ExampleRoleAssignmentsClient_NewListForSubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -111,7 +111,7 @@ func ExampleRoleAssignmentsClient_NewListForResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -174,7 +174,7 @@ func ExampleRoleAssignmentsClient_NewListForResourcePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -205,7 +205,7 @@ func ExampleRoleAssignmentsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResource.json func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -242,7 +242,7 @@ func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForResource() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForResourceGroup.json func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -279,7 +279,7 @@ func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForResourceGroup() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForSubscription.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateForSubscription.json func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForSubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -316,7 +316,7 @@ func ExampleRoleAssignmentsClient_Create_createRoleAssignmentForSubscription() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -347,7 +347,7 @@ func ExampleRoleAssignmentsClient_Delete() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_ListForScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -389,7 +389,7 @@ func ExampleRoleAssignmentsClient_NewListForScopePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_GetById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -420,7 +420,7 @@ func ExampleRoleAssignmentsClient_GetByID() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_CreateById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { @@ -457,7 +457,7 @@ func ExampleRoleAssignmentsClient_CreateByID() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/RoleAssignments_DeleteById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/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 { diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go index a075a48037f6..6f07ad5cb644 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client.go @@ -44,7 +44,7 @@ func NewRoleAssignmentScheduleInstancesClient(credential azcore.TokenCredential, // 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 +// Generated from API version 2020-10-01-preview // - 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 @@ -77,7 +77,7 @@ func (client *RoleAssignmentScheduleInstancesClient) getCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -94,7 +94,7 @@ func (client *RoleAssignmentScheduleInstancesClient) getHandleResponse(resp *htt // NewListForScopePager - Gets role assignment schedule instances of a role assignment schedule. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - scope - The scope of the role assignment schedule. // - options - RoleAssignmentScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleInstancesClient.NewListForScopePager // method. @@ -138,7 +138,7 @@ func (client *RoleAssignmentScheduleInstancesClient) listForScopeCreateRequest(c if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-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/roleassignmentscheduleinstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go index a42559a020dc..74124f4a5a00 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignmentscheduleinstances_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleInstancesByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleAssignmentScheduleInstancesByScope.json func ExampleRoleAssignmentScheduleInstancesClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -45,7 +45,7 @@ func ExampleRoleAssignmentScheduleInstancesClient_NewListForScopePager() { // { // Name: to.Ptr("ed9b8180-cef7-4c77-a63c-b8566ecfc412"), // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleInstances/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleInstances/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), // Properties: &armauthorization.RoleAssignmentScheduleInstanceProperties{ // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), @@ -76,9 +76,9 @@ func ExampleRoleAssignmentScheduleInstancesClient_NewListForScopePager() { // OriginRoleAssignmentID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleAssignments/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), + // RoleAssignmentScheduleID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), // Status: to.Ptr(armauthorization.StatusAccepted), // }, @@ -87,7 +87,7 @@ func ExampleRoleAssignmentScheduleInstancesClient_NewListForScopePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleInstanceByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleAssignmentScheduleInstanceByName.json func ExampleRoleAssignmentScheduleInstancesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -108,7 +108,7 @@ func ExampleRoleAssignmentScheduleInstancesClient_Get() { // res.RoleAssignmentScheduleInstance = armauthorization.RoleAssignmentScheduleInstance{ // Name: to.Ptr("ed9b8180-cef7-4c77-a63c-b8566ecfc412"), // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleInstances/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleInstances/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), // Properties: &armauthorization.RoleAssignmentScheduleInstanceProperties{ // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), @@ -136,12 +136,12 @@ func ExampleRoleAssignmentScheduleInstancesClient_Get() { // LinkedRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // LinkedRoleEligibilityScheduleInstanceID: to.Ptr("21e4b59a-0499-4fe0-a3c3-43a3055b773a"), // MemberType: to.Ptr(armauthorization.MemberTypeDirect), - // OriginRoleAssignmentID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleAssignments/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), + // OriginRoleAssignmentID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleAssignments/ed9b8180-cef7-4c77-a63c-b8566ecfc412"), // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), + // RoleAssignmentScheduleID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), // Status: to.Ptr(armauthorization.StatusAccepted), // }, diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go index 08733fdd3847..1a11e4124b13 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client.go @@ -44,7 +44,7 @@ func NewRoleAssignmentScheduleRequestsClient(credential azcore.TokenCredential, // 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 +// Generated from API version 2022-04-01-preview // - 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 @@ -77,7 +77,7 @@ func (client *RoleAssignmentScheduleRequestsClient) cancelCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -86,11 +86,12 @@ func (client *RoleAssignmentScheduleRequestsClient) cancelCreateRequest(ctx cont // Create - Creates a role assignment schedule request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-01 +// Generated from API version 2022-04-01-preview // - 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}' +// 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. // - roleAssignmentScheduleRequestName - A GUID for the role assignment to create. The name must be unique and different for // each role assignment. @@ -125,7 +126,7 @@ func (client *RoleAssignmentScheduleRequestsClient) createCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -143,7 +144,7 @@ func (client *RoleAssignmentScheduleRequestsClient) createHandleResponse(resp *h // 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 +// Generated from API version 2022-04-01-preview // - 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 @@ -176,7 +177,7 @@ func (client *RoleAssignmentScheduleRequestsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -193,7 +194,7 @@ func (client *RoleAssignmentScheduleRequestsClient) getHandleResponse(resp *http // NewListForScopePager - Gets role assignment schedule requests for a scope. // -// Generated from API version 2020-10-01 +// Generated from API version 2022-04-01-preview // - scope - The scope of the role assignments schedule requests. // - options - RoleAssignmentScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleAssignmentScheduleRequestsClient.NewListForScopePager // method. @@ -237,7 +238,7 @@ func (client *RoleAssignmentScheduleRequestsClient) listForScopeCreateRequest(ct if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +256,7 @@ func (client *RoleAssignmentScheduleRequestsClient) listForScopeHandleResponse(r // 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 +// Generated from API version 2022-04-01-preview // - 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. @@ -289,7 +290,7 @@ func (client *RoleAssignmentScheduleRequestsClient) validateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-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/roleassignmentschedulerequests_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go index e80073b299cc..a14f8eaa3d20 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedulerequests_client_example_test.go @@ -17,10 +17,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleAssignmentScheduleRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/PutRoleAssignmentScheduleRequest.json func ExampleRoleAssignmentScheduleRequestsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -53,7 +53,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_Create() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleRequestByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/GetRoleAssignmentScheduleRequestByName.json func ExampleRoleAssignmentScheduleRequestsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -74,7 +74,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_Get() { // res.RoleAssignmentScheduleRequest = armauthorization.RoleAssignmentScheduleRequest{ // Name: to.Ptr("fea7a502-9a96-4806-a26f-eee560e52045"), // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), // Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -109,7 +109,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_Get() { // }, // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // Status: to.Ptr(armauthorization.StatusProvisioned), // TargetRoleAssignmentScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // TicketInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesTicketInfo{ @@ -118,7 +118,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleRequestByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/GetRoleAssignmentScheduleRequestByScope.json func ExampleRoleAssignmentScheduleRequestsClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -145,7 +145,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_NewListForScopePager() { // { // Name: to.Ptr("fea7a502-9a96-4806-a26f-eee560e52045"), // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), // Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -180,7 +180,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_NewListForScopePager() { // }, // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // Status: to.Ptr(armauthorization.StatusProvisioned), // TargetRoleAssignmentScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // TicketInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesTicketInfo{ @@ -191,7 +191,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_NewListForScopePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/CancelRoleAssignmentScheduleRequestByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/CancelRoleAssignmentScheduleRequestByName.json func ExampleRoleAssignmentScheduleRequestsClient_Cancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -208,7 +208,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_Cancel() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/ValidateRoleAssignmentScheduleRequestByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/ValidateRoleAssignmentScheduleRequestByName.json func ExampleRoleAssignmentScheduleRequestsClient_Validate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -245,7 +245,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_Validate() { // res.RoleAssignmentScheduleRequest = armauthorization.RoleAssignmentScheduleRequest{ // Name: to.Ptr("fea7a502-9a96-4806-a26f-eee560e52045"), // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), // Properties: &armauthorization.RoleAssignmentScheduleRequestProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -280,7 +280,7 @@ func ExampleRoleAssignmentScheduleRequestsClient_Validate() { // }, // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // Status: to.Ptr(armauthorization.StatusProvisioned), // TargetRoleAssignmentScheduleID: to.Ptr("c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), // TicketInfo: &armauthorization.RoleAssignmentScheduleRequestPropertiesTicketInfo{ diff --git a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go index 0951657afeed..277d04416d1d 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client.go @@ -44,7 +44,7 @@ func NewRoleAssignmentSchedulesClient(credential azcore.TokenCredential, options // 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 +// Generated from API version 2020-10-01-preview // - 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 @@ -77,7 +77,7 @@ func (client *RoleAssignmentSchedulesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -94,7 +94,7 @@ func (client *RoleAssignmentSchedulesClient) getHandleResponse(resp *http.Respon // NewListForScopePager - Gets role assignment schedules for a resource scope. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - scope - The scope of the role assignments schedules. // - options - RoleAssignmentSchedulesClientListForScopeOptions contains the optional parameters for the RoleAssignmentSchedulesClient.NewListForScopePager // method. @@ -138,7 +138,7 @@ func (client *RoleAssignmentSchedulesClient) listForScopeCreateRequest(ctx conte if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-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/roleassignmentschedules_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go index 4e0005d52e66..e1c08a5a6735 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleassignmentschedules_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentScheduleByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleAssignmentScheduleByName.json func ExampleRoleAssignmentSchedulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleRoleAssignmentSchedulesClient_Get() { // res.RoleAssignmentSchedule = armauthorization.RoleAssignmentSchedule{ // Name: to.Ptr("c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentSchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), // Properties: &armauthorization.RoleAssignmentScheduleProperties{ // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), @@ -68,9 +68,9 @@ func ExampleRoleAssignmentSchedulesClient_Get() { // MemberType: to.Ptr(armauthorization.MemberTypeDirect), // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), + // RoleAssignmentScheduleRequestID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), // Status: to.Ptr(armauthorization.StatusProvisioned), // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), @@ -78,7 +78,7 @@ func ExampleRoleAssignmentSchedulesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleAssignmentSchedulesByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleAssignmentSchedulesByScope.json func ExampleRoleAssignmentSchedulesClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -105,7 +105,7 @@ func ExampleRoleAssignmentSchedulesClient_NewListForScopePager() { // { // Name: to.Ptr("c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), // Type: to.Ptr("Microsoft.Authorization/RoleAssignmentSchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentSchedules/c9e264ff-3133-4776-a81a-ebc7c33c8ec6"), // Properties: &armauthorization.RoleAssignmentScheduleProperties{ // AssignmentType: to.Ptr(armauthorization.AssignmentTypeAssigned), // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), @@ -134,9 +134,9 @@ func ExampleRoleAssignmentSchedulesClient_NewListForScopePager() { // MemberType: to.Ptr(armauthorization.MemberTypeDirect), // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), - // RoleAssignmentScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), + // RoleAssignmentScheduleRequestID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleAssignmentScheduleRequests/fea7a502-9a96-4806-a26f-eee560e52045"), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/c8d4ff99-41c3-41a8-9f60-21dfdad59608"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), // Status: to.Ptr(armauthorization.StatusProvisioned), // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:35:27.91Z"); return t}()), diff --git a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go index b63a06cd91f5..dd0f37f5966e 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client.go @@ -44,8 +44,11 @@ func NewRoleDefinitionsClient(credential azcore.TokenCredential, options *arm.Cl // 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. +// Generated from API version 2022-05-01-preview +// - 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}' // - roleDefinitionID - The ID of the role definition. // - roleDefinition - The values for the role definition. // - options - RoleDefinitionsClientCreateOrUpdateOptions contains the optional parameters for the RoleDefinitionsClient.CreateOrUpdate @@ -78,7 +81,7 @@ func (client *RoleDefinitionsClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, roleDefinition) @@ -96,8 +99,11 @@ func (client *RoleDefinitionsClient) createOrUpdateHandleResponse(resp *http.Res // 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. +// Generated from API version 2022-05-01-preview +// - 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}' // - 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) { @@ -128,7 +134,7 @@ func (client *RoleDefinitionsClient) deleteCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -143,11 +149,14 @@ func (client *RoleDefinitionsClient) deleteHandleResponse(resp *http.Response) ( return result, nil } -// Get - Get role definition by name (GUID). +// Get - Get role definition by ID (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. +// Generated from API version 2022-05-01-preview +// - 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}' // - 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) { @@ -178,7 +187,7 @@ func (client *RoleDefinitionsClient) getCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -196,7 +205,7 @@ func (client *RoleDefinitionsClient) getHandleResponse(resp *http.Response) (Rol // GetByID - Gets a role definition by ID. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-04-01 +// Generated from API version 2022-05-01-preview // - 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. @@ -225,7 +234,7 @@ func (client *RoleDefinitionsClient) getByIDCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,8 +251,11 @@ func (client *RoleDefinitionsClient) getByIDHandleResponse(resp *http.Response) // NewListPager - Get all role definitions that are applicable at scope and above. // -// Generated from API version 2022-04-01 -// - scope - The scope of the role definition. +// Generated from API version 2022-05-01-preview +// - 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 - RoleDefinitionsClientListOptions contains the optional parameters for the RoleDefinitionsClient.NewListPager // method. func (client *RoleDefinitionsClient) NewListPager(scope string, options *RoleDefinitionsClientListOptions) *runtime.Pager[RoleDefinitionsClientListResponse] { @@ -286,7 +298,7 @@ func (client *RoleDefinitionsClient) listCreateRequest(ctx context.Context, scop if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-05-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/roledefinitions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go index 7a333c84336b..beb6b2e43817 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roledefinitions_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/DeleteRoleDefinition.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-05-01-preview/examples/DeleteRoleDefinition.json func ExampleRoleDefinitionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +60,7 @@ func ExampleRoleDefinitionsClient_Delete() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-05-01-preview/examples/GetRoleDefinitionById.json func ExampleRoleDefinitionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -103,7 +103,7 @@ func ExampleRoleDefinitionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/PutRoleDefinition.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-05-01-preview/examples/PutRoleDefinition.json func ExampleRoleDefinitionsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -120,7 +120,7 @@ func ExampleRoleDefinitionsClient_CreateOrUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionAtScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-05-01-preview/examples/GetRoleDefinitionAtScope.json func ExampleRoleDefinitionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -171,7 +171,7 @@ func ExampleRoleDefinitionsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionById.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-05-01-preview/examples/GetRoleDefinitionByRoleId.json func ExampleRoleDefinitionsClient_GetByID() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go index 67cda0be90f9..c5fef63b1b80 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client.go @@ -44,7 +44,7 @@ func NewRoleEligibilityScheduleInstancesClient(credential azcore.TokenCredential // 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 +// Generated from API version 2020-10-01-preview // - 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 @@ -77,7 +77,7 @@ func (client *RoleEligibilityScheduleInstancesClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -94,7 +94,7 @@ func (client *RoleEligibilityScheduleInstancesClient) getHandleResponse(resp *ht // NewListForScopePager - Gets role eligibility schedule instances of a role eligibility schedule. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - scope - The scope of the role eligibility schedule. // - options - RoleEligibilityScheduleInstancesClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleInstancesClient.NewListForScopePager // method. @@ -138,7 +138,7 @@ func (client *RoleEligibilityScheduleInstancesClient) listForScopeCreateRequest( if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-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/roleeligibilityscheduleinstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go index 7715f6a28c74..5af25bb21c47 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityscheduleinstances_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleInstancesByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleEligibilityScheduleInstancesByScope.json func ExampleRoleEligibilityScheduleInstancesClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -45,7 +45,7 @@ func ExampleRoleEligibilityScheduleInstancesClient_NewListForScopePager() { // { // Name: to.Ptr("21e4b59a-0499-4fe0-a3c3-43a3055b773a"), // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleInstances/21e4b59a-0499-4fe0-a3c3-43a3055b773a"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleInstances/21e4b59a-0499-4fe0-a3c3-43a3055b773a"), // Properties: &armauthorization.RoleEligibilityScheduleInstanceProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -73,8 +73,8 @@ func ExampleRoleEligibilityScheduleInstancesClient_NewListForScopePager() { // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // RoleEligibilityScheduleID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T00:32:36.86Z"); return t}()), // Status: to.Ptr(armauthorization.StatusProvisioned), // }, @@ -83,7 +83,7 @@ func ExampleRoleEligibilityScheduleInstancesClient_NewListForScopePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleInstanceByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleEligibilityScheduleInstanceByName.json func ExampleRoleEligibilityScheduleInstancesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -104,7 +104,7 @@ func ExampleRoleEligibilityScheduleInstancesClient_Get() { // res.RoleEligibilityScheduleInstance = armauthorization.RoleEligibilityScheduleInstance{ // Name: to.Ptr("21e4b59a-0499-4fe0-a3c3-43a3055b773a"), // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityScheduleInstances"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleInstances/21e4b59a-0499-4fe0-a3c3-43a3055b773a"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleInstances/21e4b59a-0499-4fe0-a3c3-43a3055b773a"), // Properties: &armauthorization.RoleEligibilityScheduleInstanceProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -132,8 +132,8 @@ func ExampleRoleEligibilityScheduleInstancesClient_Get() { // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // RoleEligibilityScheduleID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-10T00:32:36.86Z"); return t}()), // Status: to.Ptr(armauthorization.StatusProvisioned), // }, diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go index 6e9f899172aa..be1747d6a035 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client.go @@ -44,7 +44,7 @@ func NewRoleEligibilityScheduleRequestsClient(credential azcore.TokenCredential, // 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 +// Generated from API version 2022-04-01-preview // - 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 @@ -77,7 +77,7 @@ func (client *RoleEligibilityScheduleRequestsClient) cancelCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -86,11 +86,12 @@ func (client *RoleEligibilityScheduleRequestsClient) cancelCreateRequest(ctx con // Create - Creates a role eligibility schedule request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-01 +// Generated from API version 2022-04-01-preview // - 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}' +// 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. // - roleEligibilityScheduleRequestName - The name of the role eligibility to create. It can be any valid GUID. // - parameters - Parameters for the role eligibility schedule request. @@ -124,7 +125,7 @@ func (client *RoleEligibilityScheduleRequestsClient) createCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -142,7 +143,7 @@ func (client *RoleEligibilityScheduleRequestsClient) createHandleResponse(resp * // 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 +// Generated from API version 2022-04-01-preview // - 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 @@ -175,7 +176,7 @@ func (client *RoleEligibilityScheduleRequestsClient) getCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +193,7 @@ func (client *RoleEligibilityScheduleRequestsClient) getHandleResponse(resp *htt // NewListForScopePager - Gets role eligibility schedule requests for a scope. // -// Generated from API version 2020-10-01 +// Generated from API version 2022-04-01-preview // - scope - The scope of the role eligibility schedule requests. // - options - RoleEligibilityScheduleRequestsClientListForScopeOptions contains the optional parameters for the RoleEligibilityScheduleRequestsClient.NewListForScopePager // method. @@ -236,7 +237,7 @@ func (client *RoleEligibilityScheduleRequestsClient) listForScopeCreateRequest(c if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +255,7 @@ func (client *RoleEligibilityScheduleRequestsClient) listForScopeHandleResponse( // 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 +// Generated from API version 2022-04-01-preview // - 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. @@ -288,7 +289,7 @@ func (client *RoleEligibilityScheduleRequestsClient) validateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2022-04-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/roleeligibilityschedulerequests_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go index 0a2717a109e1..ee39142224aa 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedulerequests_client_example_test.go @@ -17,10 +17,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleEligibilityScheduleRequest.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/PutRoleEligibilityScheduleRequest.json func ExampleRoleEligibilityScheduleRequestsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -52,7 +52,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_Create() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleRequestByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/GetRoleEligibilityScheduleRequestByName.json func ExampleRoleEligibilityScheduleRequestsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -73,7 +73,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_Get() { // res.RoleEligibilityScheduleRequest = armauthorization.RoleEligibilityScheduleRequest{ // Name: to.Ptr("64caffb6-55c0-4deb-a585-68e948ea1ad6"), // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), // Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -108,7 +108,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_Get() { // }, // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t}()), // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // Status: to.Ptr(armauthorization.StatusProvisioned), // TargetRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // TicketInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesTicketInfo{ @@ -117,7 +117,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleRequestByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/GetRoleEligibilityScheduleRequestByScope.json func ExampleRoleEligibilityScheduleRequestsClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -144,7 +144,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_NewListForScopePager() { // { // Name: to.Ptr("64caffb6-55c0-4deb-a585-68e948ea1ad6"), // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), // Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -179,7 +179,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_NewListForScopePager() { // }, // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t}()), // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // Status: to.Ptr(armauthorization.StatusProvisioned), // TargetRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // TicketInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesTicketInfo{ @@ -190,7 +190,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_NewListForScopePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/CancelRoleEligibilityScheduleRequestByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/CancelRoleEligibilityScheduleRequestByName.json func ExampleRoleEligibilityScheduleRequestsClient_Cancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -207,7 +207,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_Cancel() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/ValidateRoleEligibilityScheduleRequestByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2022-04-01-preview/examples/ValidateRoleEligibilityScheduleRequestByName.json func ExampleRoleEligibilityScheduleRequestsClient_Validate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -243,7 +243,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_Validate() { // res.RoleEligibilityScheduleRequest = armauthorization.RoleEligibilityScheduleRequest{ // Name: to.Ptr("64caffb6-55c0-4deb-a585-68e948ea1ad6"), // Type: to.Ptr("Microsoft.Authorization/RoleEligibilityScheduleRequests"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), // Properties: &armauthorization.RoleEligibilityScheduleRequestProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -278,7 +278,7 @@ func ExampleRoleEligibilityScheduleRequestsClient_Validate() { // }, // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:31:27.91Z"); return t}()), // }, - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // Status: to.Ptr(armauthorization.StatusProvisioned), // TargetRoleEligibilityScheduleID: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // TicketInfo: &armauthorization.RoleEligibilityScheduleRequestPropertiesTicketInfo{ diff --git a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go index 2477e7657164..9b29184e2807 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client.go @@ -44,7 +44,7 @@ func NewRoleEligibilitySchedulesClient(credential azcore.TokenCredential, option // 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 +// Generated from API version 2020-10-01-preview // - 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 @@ -77,7 +77,7 @@ func (client *RoleEligibilitySchedulesClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -94,7 +94,7 @@ func (client *RoleEligibilitySchedulesClient) getHandleResponse(resp *http.Respo // NewListForScopePager - Gets role eligibility schedules for a resource scope. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - scope - The scope of the role eligibility schedules. // - options - RoleEligibilitySchedulesClientListForScopeOptions contains the optional parameters for the RoleEligibilitySchedulesClient.NewListForScopePager // method. @@ -138,7 +138,7 @@ func (client *RoleEligibilitySchedulesClient) listForScopeCreateRequest(ctx cont if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-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/roleeligibilityschedules_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go index 9496908540ef..9b6acd0226ff 100644 --- a/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/roleeligibilityschedules_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilityScheduleByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleEligibilityScheduleByName.json func ExampleRoleEligibilitySchedulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleRoleEligibilitySchedulesClient_Get() { // res.RoleEligibilitySchedule = armauthorization.RoleEligibilitySchedule{ // Name: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // Type: to.Ptr("Microsoft.Authorization/RoleEligibilitySchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), // Properties: &armauthorization.RoleEligibilityScheduleProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -67,8 +67,8 @@ func ExampleRoleEligibilitySchedulesClient_Get() { // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // RoleEligibilityScheduleRequestID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:33:14.557Z"); return t}()), // Status: to.Ptr(armauthorization.StatusProvisioned), // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T22:27:00.513Z"); return t}()), @@ -76,7 +76,7 @@ func ExampleRoleEligibilitySchedulesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleEligibilitySchedulesByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleEligibilitySchedulesByScope.json func ExampleRoleEligibilitySchedulesClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -103,7 +103,7 @@ func ExampleRoleEligibilitySchedulesClient_NewListForScopePager() { // { // Name: to.Ptr("b1477448-2cc6-4ceb-93b4-54a202a89413"), // Type: to.Ptr("Microsoft.Authorization/RoleEligibilitySchedules"), - // ID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilitySchedules/b1477448-2cc6-4ceb-93b4-54a202a89413"), // Properties: &armauthorization.RoleEligibilityScheduleProperties{ // Condition: to.Ptr("@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'"), // ConditionVersion: to.Ptr("1.0"), @@ -131,8 +131,8 @@ func ExampleRoleEligibilitySchedulesClient_NewListForScopePager() { // PrincipalID: to.Ptr("a3bb8764-cb92-4276-9d2a-ca1e895e55ea"), // PrincipalType: to.Ptr(armauthorization.PrincipalTypeUser), // RoleDefinitionID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"), - // RoleEligibilityScheduleRequestID: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), - // Scope: to.Ptr("/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), + // RoleEligibilityScheduleRequestID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f/providers/Microsoft.Authorization/RoleEligibilityScheduleRequests/64caffb6-55c0-4deb-a585-68e948ea1ad6"), + // Scope: to.Ptr("/providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"), // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T21:33:14.557Z"); return t}()), // Status: to.Ptr(armauthorization.StatusProvisioned), // UpdatedOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-09T22:27:00.513Z"); return t}()), diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go index f4be0e309829..d8655d99e384 100644 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client.go @@ -44,7 +44,7 @@ func NewRoleManagementPoliciesClient(credential azcore.TokenCredential, options // Delete - Delete a role management policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - 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 @@ -77,7 +77,7 @@ func (client *RoleManagementPoliciesClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -86,7 +86,7 @@ func (client *RoleManagementPoliciesClient) deleteCreateRequest(ctx context.Cont // 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 +// Generated from API version 2020-10-01-preview // - 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 @@ -119,7 +119,7 @@ func (client *RoleManagementPoliciesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -136,7 +136,7 @@ func (client *RoleManagementPoliciesClient) getHandleResponse(resp *http.Respons // NewListForScopePager - Gets role management policies for a resource scope. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - scope - The scope of the role management policy. // - options - RoleManagementPoliciesClientListForScopeOptions contains the optional parameters for the RoleManagementPoliciesClient.NewListForScopePager // method. @@ -177,7 +177,7 @@ func (client *RoleManagementPoliciesClient) listForScopeCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -195,7 +195,7 @@ func (client *RoleManagementPoliciesClient) listForScopeHandleResponse(resp *htt // Update - Update a role management policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - 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. @@ -229,7 +229,7 @@ func (client *RoleManagementPoliciesClient) updateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-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/rolemanagementpolicies_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go index c4bbd901092c..beb3194af205 100644 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicies_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleManagementPolicyByName.json func ExampleRoleManagementPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,7 +39,7 @@ func ExampleRoleManagementPoliciesClient_Get() { // res.RoleManagementPolicy = armauthorization.RoleManagementPolicy{ // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Properties: &armauthorization.RoleManagementPolicyProperties{ // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ // &armauthorization.RoleManagementPolicyEnablementRule{ @@ -590,7 +590,7 @@ func ExampleRoleManagementPoliciesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PatchPartialRoleManagementPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/PatchPartialRoleManagementPolicy.json func ExampleRoleManagementPoliciesClient_Update_patchPartialRoleManagementPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -643,7 +643,7 @@ func ExampleRoleManagementPoliciesClient_Update_patchPartialRoleManagementPolicy // res.RoleManagementPolicy = armauthorization.RoleManagementPolicy{ // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Properties: &armauthorization.RoleManagementPolicyProperties{ // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ // &armauthorization.RoleManagementPolicyExpirationRule{ @@ -1194,7 +1194,7 @@ func ExampleRoleManagementPoliciesClient_Update_patchPartialRoleManagementPolicy // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PatchRoleManagementPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/PatchRoleManagementPolicy.json func ExampleRoleManagementPoliciesClient_Update_patchRoleManagementPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1483,7 +1483,7 @@ func ExampleRoleManagementPoliciesClient_Update_patchRoleManagementPolicy() { // res.RoleManagementPolicy = armauthorization.RoleManagementPolicy{ // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Properties: &armauthorization.RoleManagementPolicyProperties{ // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ // &armauthorization.RoleManagementPolicyExpirationRule{ @@ -2034,7 +2034,7 @@ func ExampleRoleManagementPoliciesClient_Update_patchRoleManagementPolicy() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/DeleteRoleManagementPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/DeleteRoleManagementPolicy.json func ExampleRoleManagementPoliciesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2051,7 +2051,7 @@ func ExampleRoleManagementPoliciesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleManagementPolicyByScope.json func ExampleRoleManagementPoliciesClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2078,7 +2078,7 @@ func ExampleRoleManagementPoliciesClient_NewListForScopePager() { // { // Name: to.Ptr("570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicies"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/570c3619-7688-4b34-b290-2b8bb3ccab2a"), // Properties: &armauthorization.RoleManagementPolicyProperties{ // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ // &armauthorization.RoleManagementPolicyEnablementRule{ diff --git a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go index 43f0a3b629f8..bec4ad5c08b6 100644 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client.go @@ -44,7 +44,7 @@ func NewRoleManagementPolicyAssignmentsClient(credential azcore.TokenCredential, // Create - Create a role management policy assignment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - 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. @@ -78,7 +78,7 @@ func (client *RoleManagementPolicyAssignmentsClient) createCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -96,7 +96,7 @@ func (client *RoleManagementPolicyAssignmentsClient) createHandleResponse(resp * // Delete - Delete a role management policy assignment // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - 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 @@ -129,7 +129,7 @@ func (client *RoleManagementPolicyAssignmentsClient) deleteCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -138,7 +138,7 @@ func (client *RoleManagementPolicyAssignmentsClient) deleteCreateRequest(ctx con // 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 +// Generated from API version 2020-10-01-preview // - 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 @@ -171,7 +171,7 @@ func (client *RoleManagementPolicyAssignmentsClient) getCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +188,7 @@ func (client *RoleManagementPolicyAssignmentsClient) getHandleResponse(resp *htt // NewListForScopePager - Gets role management assignment policies for a resource scope. // -// Generated from API version 2020-10-01 +// Generated from API version 2020-10-01-preview // - scope - The scope of the role management policy. // - options - RoleManagementPolicyAssignmentsClientListForScopeOptions contains the optional parameters for the RoleManagementPolicyAssignmentsClient.NewListForScopePager // method. @@ -229,7 +229,7 @@ func (client *RoleManagementPolicyAssignmentsClient) listForScopeCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") + reqQP.Set("api-version", "2020-10-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/rolemanagementpolicyassignments_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go index e89561c80bf3..9395eed7017a 100644 --- a/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go +++ b/sdk/resourcemanager/authorization/armauthorization/rolemanagementpolicyassignments_client_example_test.go @@ -15,10 +15,10 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyAssignmentByName.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleManagementPolicyAssignmentByName.json func ExampleRoleManagementPolicyAssignmentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -39,300 +39,34 @@ func ExampleRoleManagementPolicyAssignmentsClient_Get() { // res.RoleManagementPolicyAssignment = armauthorization.RoleManagementPolicyAssignment{ // Name: to.Ptr("b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicyAssignment"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicyAssignment/b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicyAssignment/b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), // Properties: &armauthorization.RoleManagementPolicyAssignmentProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, + // PolicyAssignmentProperties: &armauthorization.PolicyAssignmentProperties{ + // Policy: &armauthorization.PolicyAssignmentPropertiesPolicy{ + // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), + // LastModifiedBy: &armauthorization.Principal{ + // DisplayName: to.Ptr("Admin"), // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // PolicyAssignmentProperties: &armauthorization.PolicyAssignmentProperties{ - // Policy: &armauthorization.PolicyAssignmentPropertiesPolicy{ - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // }, - // RoleDefinition: &armauthorization.PolicyAssignmentPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("FHIR Data Converter"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // }, - // Scope: &armauthorization.PolicyAssignmentPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // PolicyID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // } + // }, + // RoleDefinition: &armauthorization.PolicyAssignmentPropertiesRoleDefinition{ + // Type: to.Ptr("BuiltInRole"), + // DisplayName: to.Ptr("FHIR Data Converter"), + // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), + // }, + // Scope: &armauthorization.PolicyAssignmentPropertiesScope{ + // Type: to.Ptr("subscription"), + // DisplayName: to.Ptr("Pay-As-You-Go"), + // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), + // }, + // }, + // PolicyID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), + // RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), + // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/PutRoleManagementPolicyAssignment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/PutRoleManagementPolicyAssignment.json func ExampleRoleManagementPolicyAssignmentsClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -345,7 +79,7 @@ func ExampleRoleManagementPolicyAssignmentsClient_Create() { } _, err = clientFactory.NewRoleManagementPolicyAssignmentsClient().Create(ctx, "providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368", "b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24", armauthorization.RoleManagementPolicyAssignment{ Properties: &armauthorization.RoleManagementPolicyAssignmentProperties{ - PolicyID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), + PolicyID: to.Ptr("/providers/Microsoft.Subscription/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"), }, @@ -355,7 +89,7 @@ func ExampleRoleManagementPolicyAssignmentsClient_Create() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/DeleteRoleManagementPolicyAssignment.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/DeleteRoleManagementPolicyAssignment.json func ExampleRoleManagementPolicyAssignmentsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -372,7 +106,7 @@ func ExampleRoleManagementPolicyAssignmentsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/53b1affe357b3bfbb53721d0a2002382a046d3b0/specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetRoleManagementPolicyAssignmentByScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2020-10-01-preview/examples/GetRoleManagementPolicyAssignmentByScope.json func ExampleRoleManagementPolicyAssignmentsClient_NewListForScopePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -399,297 +133,31 @@ func ExampleRoleManagementPolicyAssignmentsClient_NewListForScopePager() { // { // Name: to.Ptr("b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), // Type: to.Ptr("Microsoft.Authorization/RoleManagementPolicyAssignment"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicyAssignment/b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), + // ID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicyAssignment/b959d571-f0b5-4042-88a7-01be6cb22db9_a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), // Properties: &armauthorization.RoleManagementPolicyAssignmentProperties{ - // EffectiveRules: []armauthorization.RoleManagementPolicyRuleClassification{ - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // }, + // PolicyAssignmentProperties: &armauthorization.PolicyAssignmentProperties{ + // Policy: &armauthorization.PolicyAssignmentPropertiesPolicy{ + // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), + // LastModifiedBy: &armauthorization.Principal{ + // DisplayName: to.Ptr("Admin"), // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Eligibility"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Eligibility"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_eligible@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(false), - // MaximumDuration: to.Ptr("P90D"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_Admin_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("Admin"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("approver_admin_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }, - // &armauthorization.RoleManagementPolicyApprovalRule{ - // ID: to.Ptr("Approval_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // Setting: &armauthorization.ApprovalSettings{ - // ApprovalMode: to.Ptr(armauthorization.ApprovalModeSingleStage), - // ApprovalStages: []*armauthorization.ApprovalStage{ - // { - // ApprovalStageTimeOutInDays: to.Ptr[int32](1), - // EscalationTimeInMinutes: to.Ptr[int32](0), - // IsApproverJustificationRequired: to.Ptr(true), - // IsEscalationEnabled: to.Ptr(false), - // PrimaryApprovers: []*armauthorization.UserSet{ - // { - // Description: to.Ptr("amansw_new_group"), - // ID: to.Ptr("2385b0f3-5fa9-43cf-8ca4-b01dc97298cd"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }, - // { - // Description: to.Ptr("amansw_group"), - // ID: to.Ptr("2f4913c9-d15b-406a-9946-1d66a28f2690"), - // IsBackup: to.Ptr(false), - // UserType: to.Ptr(armauthorization.UserTypeGroup), - // }}, - // }}, - // IsApprovalRequired: to.Ptr(true), - // IsApprovalRequiredForExtension: to.Ptr(false), - // IsRequestorJustificationRequired: to.Ptr(true), - // }, - // }, - // &armauthorization.RoleManagementPolicyAuthenticationContextRule{ - // ID: to.Ptr("AuthenticationContext_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // ClaimValue: to.Ptr(""), - // IsEnabled: to.Ptr(false), - // }, - // &armauthorization.RoleManagementPolicyEnablementRule{ - // ID: to.Ptr("Enablement_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // EnabledRules: []*armauthorization.EnablementRules{ - // to.Ptr(armauthorization.EnablementRulesMultiFactorAuthentication), - // to.Ptr(armauthorization.EnablementRulesJustification), - // to.Ptr(armauthorization.EnablementRulesTicketing)}, - // }, - // &armauthorization.RoleManagementPolicyExpirationRule{ - // ID: to.Ptr("Expiration_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsExpirationRequired: to.Ptr(true), - // MaximumDuration: to.Ptr("PT7H"), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Admin_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("admin_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeAdmin), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Requestor_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(false), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationRecipients: []*string{ - // to.Ptr("requestor_enduser_member@test.com")}, - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeRequestor), - // }, - // &armauthorization.RoleManagementPolicyNotificationRule{ - // ID: to.Ptr("Notification_Approver_EndUser_Assignment"), - // RuleType: to.Ptr(armauthorization.RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule), - // Target: &armauthorization.RoleManagementPolicyRuleTarget{ - // Caller: to.Ptr("EndUser"), - // Level: to.Ptr("Assignment"), - // Operations: []*string{ - // to.Ptr("All")}, - // }, - // IsDefaultRecipientsEnabled: to.Ptr(true), - // NotificationLevel: to.Ptr(armauthorization.NotificationLevelCritical), - // NotificationType: to.Ptr(armauthorization.NotificationDeliveryMechanismEmail), - // RecipientType: to.Ptr(armauthorization.RecipientTypeApprover), - // }}, - // PolicyAssignmentProperties: &armauthorization.PolicyAssignmentProperties{ - // Policy: &armauthorization.PolicyAssignmentPropertiesPolicy{ - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // LastModifiedBy: &armauthorization.Principal{ - // DisplayName: to.Ptr("Admin"), - // }, - // }, - // RoleDefinition: &armauthorization.PolicyAssignmentPropertiesRoleDefinition{ - // Type: to.Ptr("BuiltInRole"), - // DisplayName: to.Ptr("FHIR Data Converter"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // }, - // Scope: &armauthorization.PolicyAssignmentPropertiesScope{ - // Type: to.Ptr("subscription"), - // DisplayName: to.Ptr("Pay-As-You-Go"), - // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }, - // PolicyID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), - // RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), - // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), - // }, - // }}, - // } + // }, + // RoleDefinition: &armauthorization.PolicyAssignmentPropertiesRoleDefinition{ + // Type: to.Ptr("BuiltInRole"), + // DisplayName: to.Ptr("FHIR Data Converter"), + // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), + // }, + // Scope: &armauthorization.PolicyAssignmentPropertiesScope{ + // Type: to.Ptr("subscription"), + // DisplayName: to.Ptr("Pay-As-You-Go"), + // ID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), + // }, + // }, + // PolicyID: to.Ptr("/providers/Microsoft.Subscription/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleManagementPolicies/b959d571-f0b5-4042-88a7-01be6cb22db9"), + // RoleDefinitionID: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368/providers/Microsoft.Authorization/roleDefinitions/a1705bd2-3a8f-45a5-8683-466fcfd5cc24"), + // Scope: to.Ptr("/subscriptions/129ff972-28f8-46b8-a726-e497be039368"), + // }, + // }}, + // } } } diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go new file mode 100644 index 000000000000..a5c0ca19e225 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client.go @@ -0,0 +1,141 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewDefaultSettingsClient contains the methods for the ScopeAccessReviewDefaultSettings group. +// Don't use this type directly, use NewScopeAccessReviewDefaultSettingsClient() instead. +type ScopeAccessReviewDefaultSettingsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewDefaultSettingsClient creates a new instance of ScopeAccessReviewDefaultSettingsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewDefaultSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewDefaultSettingsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewDefaultSettingsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewDefaultSettingsClient{ + internal: cl, + } + return client, nil +} + +// Get - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - options - ScopeAccessReviewDefaultSettingsClientGetOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Get +// method. +func (client *ScopeAccessReviewDefaultSettingsClient) Get(ctx context.Context, scope string, options *ScopeAccessReviewDefaultSettingsClientGetOptions) (ScopeAccessReviewDefaultSettingsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, options) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ScopeAccessReviewDefaultSettingsClient) getCreateRequest(ctx context.Context, scope string, options *ScopeAccessReviewDefaultSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ScopeAccessReviewDefaultSettingsClient) getHandleResponse(resp *http.Response) (ScopeAccessReviewDefaultSettingsClientGetResponse, error) { + result := ScopeAccessReviewDefaultSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return ScopeAccessReviewDefaultSettingsClientGetResponse{}, err + } + return result, nil +} + +// Put - Get access review default settings for the subscription +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - properties - Access review schedule settings. +// - options - ScopeAccessReviewDefaultSettingsClientPutOptions contains the optional parameters for the ScopeAccessReviewDefaultSettingsClient.Put +// method. +func (client *ScopeAccessReviewDefaultSettingsClient) Put(ctx context.Context, scope string, properties AccessReviewScheduleSettings, options *ScopeAccessReviewDefaultSettingsClientPutOptions) (ScopeAccessReviewDefaultSettingsClientPutResponse, error) { + req, err := client.putCreateRequest(ctx, scope, properties, options) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, runtime.NewResponseError(resp) + } + return client.putHandleResponse(resp) +} + +// putCreateRequest creates the Put request. +func (client *ScopeAccessReviewDefaultSettingsClient) putCreateRequest(ctx context.Context, scope string, properties AccessReviewScheduleSettings, options *ScopeAccessReviewDefaultSettingsClientPutOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// putHandleResponse handles the Put response. +func (client *ScopeAccessReviewDefaultSettingsClient) putHandleResponse(resp *http.Response) (ScopeAccessReviewDefaultSettingsClientPutResponse, error) { + result := ScopeAccessReviewDefaultSettingsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { + return ScopeAccessReviewDefaultSettingsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client_example_test.go new file mode 100644 index 000000000000..45f9209436e9 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewdefaultsettings_client_example_test.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewDefaultSettings.json +func ExampleScopeAccessReviewDefaultSettingsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewDefaultSettingsClient().Get(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewDefaultSettings = armauthorization.AccessReviewDefaultSettings{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewSettings"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewSettings/default"), + // Properties: &armauthorization.AccessReviewScheduleSettings{ + // AutoApplyDecisionsEnabled: to.Ptr(true), + // DefaultDecision: to.Ptr(armauthorization.DefaultDecisionTypeApprove), + // DefaultDecisionEnabled: to.Ptr(true), + // InstanceDurationInDays: to.Ptr[int32](30), + // JustificationRequiredOnApproval: to.Ptr(true), + // MailNotificationsEnabled: to.Ptr(true), + // RecommendationsEnabled: to.Ptr(true), + // Recurrence: &armauthorization.AccessReviewRecurrenceSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }, + // ReminderNotificationsEnabled: to.Ptr(true), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/PutAccessReviewDefaultSettings.json +func ExampleScopeAccessReviewDefaultSettingsClient_Put() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewDefaultSettingsClient().Put(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", armauthorization.AccessReviewScheduleSettings{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewDefaultSettings = armauthorization.AccessReviewDefaultSettings{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewSettings"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewSettings/default"), + // Properties: &armauthorization.AccessReviewScheduleSettings{ + // AutoApplyDecisionsEnabled: to.Ptr(true), + // DefaultDecision: to.Ptr(armauthorization.DefaultDecisionTypeApprove), + // DefaultDecisionEnabled: to.Ptr(true), + // InstanceDurationInDays: to.Ptr[int32](30), + // JustificationRequiredOnApproval: to.Ptr(true), + // MailNotificationsEnabled: to.Ptr(true), + // RecommendationsEnabled: to.Ptr(true), + // Recurrence: &armauthorization.AccessReviewRecurrenceSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }, + // ReminderNotificationsEnabled: to.Ptr(true), + // }, + // } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go new file mode 100644 index 000000000000..79512fa437c2 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client.go @@ -0,0 +1,142 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionClient contains the methods for the ScopeAccessReviewHistoryDefinition group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionClient() instead. +type ScopeAccessReviewHistoryDefinitionClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionClient creates a new instance of ScopeAccessReviewHistoryDefinitionClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionClient{ + internal: cl, + } + return client, nil +} + +// Create - Create a scheduled or one-time Access Review History Definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - properties - Access review history definition properties. +// - options - ScopeAccessReviewHistoryDefinitionClientCreateOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.Create +// method. +func (client *ScopeAccessReviewHistoryDefinitionClient) Create(ctx context.Context, scope string, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *ScopeAccessReviewHistoryDefinitionClientCreateOptions) (ScopeAccessReviewHistoryDefinitionClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, scope, historyDefinitionID, properties, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *ScopeAccessReviewHistoryDefinitionClient) createCreateRequest(ctx context.Context, scope string, historyDefinitionID string, properties AccessReviewHistoryDefinitionProperties, options *ScopeAccessReviewHistoryDefinitionClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *ScopeAccessReviewHistoryDefinitionClient) createHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionClientCreateResponse, error) { + result := ScopeAccessReviewHistoryDefinitionClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return ScopeAccessReviewHistoryDefinitionClientCreateResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete an access review history definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - options - ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionClient.DeleteByID +// method. +func (client *ScopeAccessReviewHistoryDefinitionClient) DeleteByID(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions) (ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, scope, historyDefinitionID, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewHistoryDefinitionClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *ScopeAccessReviewHistoryDefinitionClient) deleteByIDCreateRequest(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client_example_test.go new file mode 100644 index 000000000000..0858b62d3d9f --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinition_client_example_test.go @@ -0,0 +1,99 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/PutAccessReviewHistoryDefinition.json +func ExampleScopeAccessReviewHistoryDefinitionClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewHistoryDefinitionClient().Create(ctx, "subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a", "44724910-d7a5-4c29-b28f-db73e717165a", armauthorization.AccessReviewHistoryDefinitionProperties{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewHistoryDefinition = armauthorization.AccessReviewHistoryDefinition{ + // Name: to.Ptr("44724910-d7a5-4c29-b28f-db73e717165a"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewHistoryDefinition"), + // ID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/44724910-d7a5-4c29-b28f-db73e717165a"), + // Properties: &armauthorization.AccessReviewHistoryDefinitionProperties{ + // CreatedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("673ad0d8-7b0e-4201-aaeb-74cdcbf22af9"), + // PrincipalName: to.Ptr("levi"), + // UserPrincipalName: to.Ptr("levi"), + // }, + // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-23T00:27:33.6905189+00:00"); return t}()), + // Decisions: []*armauthorization.AccessReviewResult{ + // to.Ptr(armauthorization.AccessReviewResultApprove), + // to.Ptr(armauthorization.AccessReviewResultDeny), + // to.Ptr(armauthorization.AccessReviewResultNotReviewed), + // to.Ptr(armauthorization.AccessReviewResultDontKnow), + // to.Ptr(armauthorization.AccessReviewResultNotNotified)}, + // DisplayName: to.Ptr("Hello world name"), + // ReviewHistoryPeriodEndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // ReviewHistoryPeriodStartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00-07:00"); return t}()), + // Scopes: []*armauthorization.AccessReviewScope{ + // { + // ExpandNestedMemberships: to.Ptr(true), + // PrincipalType: to.Ptr(armauthorization.AccessReviewScopePrincipalTypeUser), + // ResourceID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a"), + // RoleDefinitionID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/roleDefinitions"), + // }, + // { + // ExpandNestedMemberships: to.Ptr(false), + // PrincipalType: to.Ptr(armauthorization.AccessReviewScopePrincipalTypeUser), + // ResourceID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a"), + // RoleDefinitionID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/roleDefinitions/1562cf42-00b9-457c-86ef-5702d4132904"), + // }}, + // Settings: &armauthorization.AccessReviewHistoryScheduleSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-01T00:00:00-08:00"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // }, + // }, + // Status: to.Ptr(armauthorization.AccessReviewHistoryDefinitionStatusRequested), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/DeleteAccessReviewHistoryDefinition.json +func ExampleScopeAccessReviewHistoryDefinitionClient_DeleteByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewHistoryDefinitionClient().DeleteByID(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client.go new file mode 100644 index 000000000000..d8d2047786e1 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client.go @@ -0,0 +1,102 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionInstanceClient contains the methods for the ScopeAccessReviewHistoryDefinitionInstance group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionInstanceClient() instead. +type ScopeAccessReviewHistoryDefinitionInstanceClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionInstanceClient creates a new instance of ScopeAccessReviewHistoryDefinitionInstanceClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionInstanceClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionInstanceClient{ + internal: cl, + } + return client, nil +} + +// GenerateDownloadURI - Generates a uri which can be used to retrieve review history data. This URI has a TTL of 1 day and +// can be retrieved by fetching the accessReviewHistoryDefinition object. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - instanceID - The id of the access review history definition instance to generate a URI for. +// - options - ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions contains the optional parameters for +// the ScopeAccessReviewHistoryDefinitionInstanceClient.GenerateDownloadURI method. +func (client *ScopeAccessReviewHistoryDefinitionInstanceClient) GenerateDownloadURI(ctx context.Context, scope string, historyDefinitionID string, instanceID string, options *ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + req, err := client.generateDownloadURICreateRequest(ctx, scope, historyDefinitionID, instanceID, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, runtime.NewResponseError(resp) + } + return client.generateDownloadURIHandleResponse(resp) +} + +// generateDownloadURICreateRequest creates the GenerateDownloadURI request. +func (client *ScopeAccessReviewHistoryDefinitionInstanceClient) generateDownloadURICreateRequest(ctx context.Context, scope string, historyDefinitionID string, instanceID string, options *ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + if instanceID == "" { + return nil, errors.New("parameter instanceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{instanceId}", url.PathEscape(instanceID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generateDownloadURIHandleResponse handles the GenerateDownloadURI response. +func (client *ScopeAccessReviewHistoryDefinitionInstanceClient) generateDownloadURIHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse, error) { + result := ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryInstance); err != nil { + return ScopeAccessReviewHistoryDefinitionInstanceClientGenerateDownloadURIResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client_example_test.go new file mode 100644 index 000000000000..37e4577f0f31 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstance_client_example_test.go @@ -0,0 +1,53 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/PostAccessReviewHistoryDefinitionInstance.json +func ExampleScopeAccessReviewHistoryDefinitionInstanceClient_GenerateDownloadURI() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewHistoryDefinitionInstanceClient().GenerateDownloadURI(ctx, "subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a", "44724910-d7a5-4c29-b28f-db73e717165a", "9038f4f3-3d8d-43c3-8ede-669ea082c43b", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewHistoryInstance = armauthorization.AccessReviewHistoryInstance{ + // Name: to.Ptr("9038f4f3-3d8d-43c3-8ede-669ea082c43b"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewHistoryInstance"), + // ID: to.Ptr("9038f4f3-3d8d-43c3-8ede-669ea082c43b"), + // Properties: &armauthorization.AccessReviewHistoryInstanceProperties{ + // DisplayName: to.Ptr("Hello world name"), + // DownloadURI: to.Ptr("https://dfermconsolreportusc.blob.core.windows.net/df-erm-reports/Hello world name-22be232e-a93d-42a3-8ac5-313cfd29a0eb.csv?sv=2015-04-05&ss=b&srt=o&sp=rl&st=2021-03-22T19:39:38.0000000Z&se=2021-03-23T19:41:38.0000000Z&spr=https&sig=84rlGCIgU4ToMn%2FFLncBXq95O8a8RsFlwQY1Knl%2Fo%2FI%3D"), + // Expiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-22T00:28:33.6905189+00:00"); return t}()), + // FulfilledDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-23T00:28:33.6905189+00:00"); return t}()), + // ReviewHistoryPeriodEndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // ReviewHistoryPeriodStartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00-07:00"); return t}()), + // RunDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-23T00:27:33.6905189+00:00"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewHistoryDefinitionStatusRequested), + // }, + // } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go new file mode 100644 index 000000000000..52c94ed14d51 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionInstancesClient contains the methods for the ScopeAccessReviewHistoryDefinitionInstances group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionInstancesClient() instead. +type ScopeAccessReviewHistoryDefinitionInstancesClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionInstancesClient creates a new instance of ScopeAccessReviewHistoryDefinitionInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionInstancesClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review history definition instances by definition Id +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - options - ScopeAccessReviewHistoryDefinitionInstancesClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionInstancesClient.NewListPager +// method. +func (client *ScopeAccessReviewHistoryDefinitionInstancesClient) NewListPager(scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewHistoryDefinitionInstancesClientListResponse]{ + More: func(page ScopeAccessReviewHistoryDefinitionInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewHistoryDefinitionInstancesClientListResponse) (ScopeAccessReviewHistoryDefinitionInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, historyDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewHistoryDefinitionInstancesClient) listCreateRequest(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewHistoryDefinitionInstancesClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionInstancesClientListResponse, error) { + result := ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionInstanceListResult); err != nil { + return ScopeAccessReviewHistoryDefinitionInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client_example_test.go new file mode 100644 index 000000000000..101e68299e24 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitioninstances_client_example_test.go @@ -0,0 +1,60 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewHistoryDefinitionInstances.json +func ExampleScopeAccessReviewHistoryDefinitionInstancesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewScopeAccessReviewHistoryDefinitionInstancesClient().NewListPager("subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a", "44724910-d7a5-4c29-b28f-db73e717165a", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewHistoryDefinitionInstanceListResult = armauthorization.AccessReviewHistoryDefinitionInstanceListResult{ + // Value: []*armauthorization.AccessReviewHistoryInstance{ + // { + // Name: to.Ptr("44724910-d7a5-4c29-b28f-db73e717165a"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewHistoryInstance"), + // ID: to.Ptr("44724910-d7a5-4c29-b28f-db73e717165a"), + // Properties: &armauthorization.AccessReviewHistoryInstanceProperties{ + // DisplayName: to.Ptr("Hello world name"), + // Expiration: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-22T00:28:33.6905189+00:00"); return t}()), + // FulfilledDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-23T00:28:33.6905189+00:00"); return t}()), + // ReviewHistoryPeriodEndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // ReviewHistoryPeriodStartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00-07:00"); return t}()), + // RunDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-23T00:27:33.6905189+00:00"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewHistoryDefinitionStatusRequested), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go new file mode 100644 index 000000000000..b8bf9f260cd7 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client.go @@ -0,0 +1,163 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewHistoryDefinitionsClient contains the methods for the ScopeAccessReviewHistoryDefinitions group. +// Don't use this type directly, use NewScopeAccessReviewHistoryDefinitionsClient() instead. +type ScopeAccessReviewHistoryDefinitionsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewHistoryDefinitionsClient creates a new instance of ScopeAccessReviewHistoryDefinitionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewHistoryDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewHistoryDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewHistoryDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewHistoryDefinitionsClient{ + internal: cl, + } + return client, nil +} + +// GetByID - Get access review history definition by definition Id +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - historyDefinitionID - The id of the access review history definition. +// - options - ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionsClient.GetByID +// method. +func (client *ScopeAccessReviewHistoryDefinitionsClient) GetByID(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions) (ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scope, historyDefinitionID, options) + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ScopeAccessReviewHistoryDefinitionsClient) getByIDCreateRequest(ctx context.Context, scope string, historyDefinitionID string, options *ScopeAccessReviewHistoryDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if historyDefinitionID == "" { + return nil, errors.New("parameter historyDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{historyDefinitionId}", url.PathEscape(historyDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ScopeAccessReviewHistoryDefinitionsClient) getByIDHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse, error) { + result := ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinition); err != nil { + return ScopeAccessReviewHistoryDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the accessReviewHistoryDefinitions available from this provider, definition instances are only available +// for 30 days after creation. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - options - ScopeAccessReviewHistoryDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewHistoryDefinitionsClient.NewListPager +// method. +func (client *ScopeAccessReviewHistoryDefinitionsClient) NewListPager(scope string, options *ScopeAccessReviewHistoryDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewHistoryDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewHistoryDefinitionsClientListResponse]{ + More: func(page ScopeAccessReviewHistoryDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewHistoryDefinitionsClientListResponse) (ScopeAccessReviewHistoryDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewHistoryDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *ScopeAccessReviewHistoryDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewHistoryDefinitionsClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewHistoryDefinitionsClientListResponse, error) { + result := ScopeAccessReviewHistoryDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewHistoryDefinitionListResult); err != nil { + return ScopeAccessReviewHistoryDefinitionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client_example_test.go new file mode 100644 index 000000000000..aefbc8f01acb --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewhistorydefinitions_client_example_test.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_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewHistoryDefinitions.json +func ExampleScopeAccessReviewHistoryDefinitionsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewScopeAccessReviewHistoryDefinitionsClient().NewListPager("subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a", &armauthorization.ScopeAccessReviewHistoryDefinitionsClientListOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewHistoryDefinitionListResult = armauthorization.AccessReviewHistoryDefinitionListResult{ + // Value: []*armauthorization.AccessReviewHistoryDefinition{ + // { + // Name: to.Ptr("44724910-d7a5-4c29-b28f-db73e717165a"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewHistoryDefinition"), + // ID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/44724910-d7a5-4c29-b28f-db73e717165a"), + // Properties: &armauthorization.AccessReviewHistoryDefinitionProperties{ + // CreatedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("673ad0d8-7b0e-4201-aaeb-74cdcbf22af9"), + // PrincipalName: to.Ptr("levi"), + // UserPrincipalName: to.Ptr("levi"), + // }, + // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-23T00:27:33.6905189+00:00"); return t}()), + // Decisions: []*armauthorization.AccessReviewResult{ + // to.Ptr(armauthorization.AccessReviewResultApprove), + // to.Ptr(armauthorization.AccessReviewResultDeny), + // to.Ptr(armauthorization.AccessReviewResultNotReviewed), + // to.Ptr(armauthorization.AccessReviewResultDontKnow), + // to.Ptr(armauthorization.AccessReviewResultNotNotified)}, + // DisplayName: to.Ptr("Hello world name"), + // ReviewHistoryPeriodEndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // ReviewHistoryPeriodStartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00-07:00"); return t}()), + // Scopes: []*armauthorization.AccessReviewScope{ + // { + // ExpandNestedMemberships: to.Ptr(true), + // PrincipalType: to.Ptr(armauthorization.AccessReviewScopePrincipalTypeUser), + // ResourceID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a"), + // RoleDefinitionID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/roleDefinitions"), + // }, + // { + // ExpandNestedMemberships: to.Ptr(false), + // PrincipalType: to.Ptr(armauthorization.AccessReviewScopePrincipalTypeUser), + // ResourceID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a"), + // RoleDefinitionID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/roleDefinitions/1562cf42-00b9-457c-86ef-5702d4132904"), + // }}, + // Settings: &armauthorization.AccessReviewHistoryScheduleSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-01T00:00:00-08:00"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // }, + // }, + // Status: to.Ptr(armauthorization.AccessReviewHistoryDefinitionStatusDone), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewHistoryDefinition.json +func ExampleScopeAccessReviewHistoryDefinitionsClient_GetByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewHistoryDefinitionsClient().GetByID(ctx, "subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a", "44724910-d7a5-4c29-b28f-db73e717165a", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewHistoryDefinition = armauthorization.AccessReviewHistoryDefinition{ + // Name: to.Ptr("44724910-d7a5-4c29-b28f-db73e717165a"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewHistoryDefinition"), + // ID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/44724910-d7a5-4c29-b28f-db73e717165a"), + // Properties: &armauthorization.AccessReviewHistoryDefinitionProperties{ + // CreatedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("673ad0d8-7b0e-4201-aaeb-74cdcbf22af9"), + // PrincipalName: to.Ptr("levi"), + // UserPrincipalName: to.Ptr("levi"), + // }, + // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-23T00:27:33.6905189+00:00"); return t}()), + // Decisions: []*armauthorization.AccessReviewResult{ + // to.Ptr(armauthorization.AccessReviewResultApprove), + // to.Ptr(armauthorization.AccessReviewResultDeny), + // to.Ptr(armauthorization.AccessReviewResultNotReviewed), + // to.Ptr(armauthorization.AccessReviewResultDontKnow), + // to.Ptr(armauthorization.AccessReviewResultNotNotified)}, + // DisplayName: to.Ptr("Hello world name"), + // ReviewHistoryPeriodEndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // ReviewHistoryPeriodStartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-01T00:00:00-07:00"); return t}()), + // Scopes: []*armauthorization.AccessReviewScope{ + // { + // ExpandNestedMemberships: to.Ptr(true), + // PrincipalType: to.Ptr(armauthorization.AccessReviewScopePrincipalTypeUser), + // ResourceID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a"), + // RoleDefinitionID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/roleDefinitions"), + // }, + // { + // ExpandNestedMemberships: to.Ptr(false), + // PrincipalType: to.Ptr(armauthorization.AccessReviewScopePrincipalTypeUser), + // ResourceID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a"), + // RoleDefinitionID: to.Ptr("/subscriptions/129a304b-4aea-4b86-a9f7-ba7e2b23737a/providers/Microsoft.Authorization/roleDefinitions/1562cf42-00b9-457c-86ef-5702d4132904"), + // }}, + // Settings: &armauthorization.AccessReviewHistoryScheduleSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-01T00:00:00-08:00"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-12-01T00:00:00-08:00"); return t}()), + // }, + // }, + // Status: to.Ptr(armauthorization.AccessReviewHistoryDefinitionStatusDone), + // }, + // } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go new file mode 100644 index 000000000000..7c16cf46147b --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client.go @@ -0,0 +1,293 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstanceClient contains the methods for the ScopeAccessReviewInstance group. +// Don't use this type directly, use NewScopeAccessReviewInstanceClient() instead. +type ScopeAccessReviewInstanceClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstanceClient creates a new instance of ScopeAccessReviewInstanceClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstanceClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstanceClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstanceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceClient{ + internal: cl, + } + return client, nil +} + +// ApplyDecisions - An action to apply all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientApplyDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ApplyDecisions +// method. +func (client *ScopeAccessReviewInstanceClient) ApplyDecisions(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientApplyDecisionsOptions) (ScopeAccessReviewInstanceClientApplyDecisionsResponse, error) { + req, err := client.applyDecisionsCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientApplyDecisionsResponse{}, nil +} + +// applyDecisionsCreateRequest creates the ApplyDecisions request. +func (client *ScopeAccessReviewInstanceClient) applyDecisionsCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientApplyDecisionsOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// RecordAllDecisions - An action to approve/deny all decisions for a review with certain filters. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - properties - Record all decisions payload. +// - options - ScopeAccessReviewInstanceClientRecordAllDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.RecordAllDecisions +// method. +func (client *ScopeAccessReviewInstanceClient) RecordAllDecisions(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties RecordAllDecisionsProperties, options *ScopeAccessReviewInstanceClientRecordAllDecisionsOptions) (ScopeAccessReviewInstanceClientRecordAllDecisionsResponse, error) { + req, err := client.recordAllDecisionsCreateRequest(ctx, scope, scheduleDefinitionID, id, properties, options) + if err != nil { + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientRecordAllDecisionsResponse{}, nil +} + +// recordAllDecisionsCreateRequest creates the RecordAllDecisions request. +func (client *ScopeAccessReviewInstanceClient) recordAllDecisionsCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties RecordAllDecisionsProperties, options *ScopeAccessReviewInstanceClientRecordAllDecisionsOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/recordAllDecisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// ResetDecisions - An action to reset all decisions for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientResetDecisionsOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.ResetDecisions +// method. +func (client *ScopeAccessReviewInstanceClient) ResetDecisions(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientResetDecisionsOptions) (ScopeAccessReviewInstanceClientResetDecisionsResponse, error) { + req, err := client.resetDecisionsCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientResetDecisionsResponse{}, nil +} + +// resetDecisionsCreateRequest creates the ResetDecisions request. +func (client *ScopeAccessReviewInstanceClient) resetDecisionsCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientResetDecisionsOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// SendReminders - An action to send reminders for an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientSendRemindersOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.SendReminders +// method. +func (client *ScopeAccessReviewInstanceClient) SendReminders(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientSendRemindersOptions) (ScopeAccessReviewInstanceClientSendRemindersResponse, error) { + req, err := client.sendRemindersCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientSendRemindersResponse{}, nil +} + +// sendRemindersCreateRequest creates the SendReminders request. +func (client *ScopeAccessReviewInstanceClient) sendRemindersCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientSendRemindersOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Stop - An action to stop an access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceClientStopOptions contains the optional parameters for the ScopeAccessReviewInstanceClient.Stop +// method. +func (client *ScopeAccessReviewInstanceClient) Stop(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientStopOptions) (ScopeAccessReviewInstanceClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstanceClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewInstanceClientStopResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewInstanceClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ScopeAccessReviewInstanceClient) stopCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceClientStopOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client_example_test.go new file mode 100644 index 000000000000..1f54ba9cd4f4 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstance_client_example_test.go @@ -0,0 +1,103 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/StopAccessReviewInstance.json +func ExampleScopeAccessReviewInstanceClient_Stop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewInstanceClient().Stop(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "d9b9e056-7004-470b-bf21-1635e98487da", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/AccessReviewInstanceRecordAllDecisions.json +func ExampleScopeAccessReviewInstanceClient_RecordAllDecisions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewInstanceClient().RecordAllDecisions(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "d9b9e056-7004-470b-bf21-1635e98487da", armauthorization.RecordAllDecisionsProperties{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/AccessReviewInstanceResetDecisions.json +func ExampleScopeAccessReviewInstanceClient_ResetDecisions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewInstanceClient().ResetDecisions(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "d9b9e056-7004-470b-bf21-1635e98487da", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/AccessReviewInstanceApplyDecisions.json +func ExampleScopeAccessReviewInstanceClient_ApplyDecisions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewInstanceClient().ApplyDecisions(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "d9b9e056-7004-470b-bf21-1635e98487da", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/AccessReviewInstanceSendReminders.json +func ExampleScopeAccessReviewInstanceClient_SendReminders() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewInstanceClient().SendReminders(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "d9b9e056-7004-470b-bf21-1635e98487da", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go new file mode 100644 index 000000000000..73f574406ea4 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstanceContactedReviewersClient contains the methods for the ScopeAccessReviewInstanceContactedReviewers group. +// Don't use this type directly, use NewScopeAccessReviewInstanceContactedReviewersClient() instead. +type ScopeAccessReviewInstanceContactedReviewersClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstanceContactedReviewersClient creates a new instance of ScopeAccessReviewInstanceContactedReviewersClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstanceContactedReviewersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstanceContactedReviewersClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstanceContactedReviewersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceContactedReviewersClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance contacted reviewers +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the ScopeAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +func (client *ScopeAccessReviewInstanceContactedReviewersClient) NewListPager(scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceContactedReviewersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewInstanceContactedReviewersClientListResponse]{ + More: func(page ScopeAccessReviewInstanceContactedReviewersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewInstanceContactedReviewersClientListResponse) (ScopeAccessReviewInstanceContactedReviewersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewInstanceContactedReviewersClient) listCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceContactedReviewersClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewInstanceContactedReviewersClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewInstanceContactedReviewersClientListResponse, error) { + result := ScopeAccessReviewInstanceContactedReviewersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewContactedReviewerListResult); err != nil { + return ScopeAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client_example_test.go new file mode 100644 index 000000000000..b1b9f64d72a4 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancecontactedreviewers_client_example_test.go @@ -0,0 +1,56 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstanceContactedReviewers.json +func ExampleScopeAccessReviewInstanceContactedReviewersClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewScopeAccessReviewInstanceContactedReviewersClient().NewListPager("subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "265785a7-a81f-4201-8a18-bb0db95982b7", "f25ed880-9c31-4101-bc57-825d8df3b58c", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewContactedReviewerListResult = armauthorization.AccessReviewContactedReviewerListResult{ + // Value: []*armauthorization.AccessReviewContactedReviewer{ + // { + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances/contactedReviewers"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/instances/f8882fec-7d56-4e97-ad6d-5e3f4557971d/contactedReviewers/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewContactedReviewerProperties{ + // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // UserDisplayName: to.Ptr("Bob"), + // UserPrincipalName: to.Ptr("bob@contoso.com"), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go new file mode 100644 index 000000000000..8011cdd080e8 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client.go @@ -0,0 +1,118 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstanceDecisionsClient contains the methods for the ScopeAccessReviewInstanceDecisions group. +// Don't use this type directly, use NewScopeAccessReviewInstanceDecisionsClient() instead. +type ScopeAccessReviewInstanceDecisionsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstanceDecisionsClient creates a new instance of ScopeAccessReviewInstanceDecisionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstanceDecisionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstanceDecisionsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstanceDecisionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstanceDecisionsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance decisions +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstanceDecisionsClientListOptions contains the optional parameters for the ScopeAccessReviewInstanceDecisionsClient.NewListPager +// method. +func (client *ScopeAccessReviewInstanceDecisionsClient) NewListPager(scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceDecisionsClientListOptions) *runtime.Pager[ScopeAccessReviewInstanceDecisionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewInstanceDecisionsClientListResponse]{ + More: func(page ScopeAccessReviewInstanceDecisionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewInstanceDecisionsClientListResponse) (ScopeAccessReviewInstanceDecisionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewInstanceDecisionsClient) listCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstanceDecisionsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewInstanceDecisionsClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewInstanceDecisionsClientListResponse, error) { + result := ScopeAccessReviewInstanceDecisionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { + return ScopeAccessReviewInstanceDecisionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client_example_test.go new file mode 100644 index 000000000000..a521bff60c33 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstancedecisions_client_example_test.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstanceDecisions.json +func ExampleScopeAccessReviewInstanceDecisionsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewScopeAccessReviewInstanceDecisionsClient().NewListPager("subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "265785a7-a81f-4201-8a18-bb0db95982b7", "f25ed880-9c31-4101-bc57-825d8df3b58c", &armauthorization.ScopeAccessReviewInstanceDecisionsClientListOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewDecisionListResult = armauthorization.AccessReviewDecisionListResult{ + // Value: []*armauthorization.AccessReviewDecision{ + // { + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances/decisions"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/instances/f8882fec-7d56-4e97-ad6d-5e3f4557971d/decisions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewDecisionProperties{ + // AppliedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("36777fc8-4ec2-49ea-a56c-cec0bd47d83a"), + // PrincipalName: to.Ptr("Amit Ghosh"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("amitgho@microsoft.com"), + // }, + // AppliedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-03T21:02:30.667Z"); return t}()), + // ApplyResult: to.Ptr(armauthorization.AccessReviewApplyResult("Success")), + // Decision: to.Ptr(armauthorization.AccessReviewResultDeny), + // Justification: to.Ptr("This person has left this team"), + // Principal: &armauthorization.AccessReviewDecisionUserIdentity{ + // Type: to.Ptr(armauthorization.DecisionTargetTypeUser), + // DisplayName: to.Ptr("Shubham Gupta"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // PrincipalResourceMembership: &armauthorization.AccessReviewDecisionPrincipalResourceMembership{ + // MembershipTypes: []*armauthorization.AccessReviewDecisionPrincipalResourceMembershipType{ + // to.Ptr(armauthorization.AccessReviewDecisionPrincipalResourceMembershipTypeDirect), + // to.Ptr(armauthorization.AccessReviewDecisionPrincipalResourceMembershipTypeIndirect)}, + // }, + // Recommendation: to.Ptr(armauthorization.AccessRecommendationTypeDeny), + // Resource: &armauthorization.AccessReviewDecisionResource{ + // Type: to.Ptr(armauthorization.DecisionResourceTypeAzureRole), + // DisplayName: to.Ptr("Owner"), + // ID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // }, + // ReviewedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // ReviewedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }}, + // } + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go new file mode 100644 index 000000000000..ce8c57e2a179 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client.go @@ -0,0 +1,232 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewInstancesClient contains the methods for the ScopeAccessReviewInstances group. +// Don't use this type directly, use NewScopeAccessReviewInstancesClient() instead. +type ScopeAccessReviewInstancesClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewInstancesClient creates a new instance of ScopeAccessReviewInstancesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewInstancesClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewInstancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewInstancesClient{ + internal: cl, + } + return client, nil +} + +// Create - Update access review instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - properties - Access review instance properties. +// - options - ScopeAccessReviewInstancesClientCreateOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.Create +// method. +func (client *ScopeAccessReviewInstancesClient) Create(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *ScopeAccessReviewInstancesClientCreateOptions) (ScopeAccessReviewInstancesClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, scope, scheduleDefinitionID, id, properties, options) + if err != nil { + return ScopeAccessReviewInstancesClientCreateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstancesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstancesClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *ScopeAccessReviewInstancesClient) createCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, properties AccessReviewInstanceProperties, options *ScopeAccessReviewInstancesClientCreateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createHandleResponse handles the Create response. +func (client *ScopeAccessReviewInstancesClient) createHandleResponse(resp *http.Response) (ScopeAccessReviewInstancesClientCreateResponse, error) { + result := ScopeAccessReviewInstancesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return ScopeAccessReviewInstancesClientCreateResponse{}, err + } + return result, nil +} + +// GetByID - Get access review instances +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - ScopeAccessReviewInstancesClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.GetByID +// method. +func (client *ScopeAccessReviewInstancesClient) GetByID(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstancesClientGetByIDOptions) (ScopeAccessReviewInstancesClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scope, scheduleDefinitionID, id, options) + if err != nil { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ScopeAccessReviewInstancesClient) getByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, id string, options *ScopeAccessReviewInstancesClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ScopeAccessReviewInstancesClient) getByIDHandleResponse(resp *http.Response) (ScopeAccessReviewInstancesClientGetByIDResponse, error) { + result := ScopeAccessReviewInstancesClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { + return ScopeAccessReviewInstancesClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review instances +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewInstancesClientListOptions contains the optional parameters for the ScopeAccessReviewInstancesClient.NewListPager +// method. +func (client *ScopeAccessReviewInstancesClient) NewListPager(scope string, scheduleDefinitionID string, options *ScopeAccessReviewInstancesClientListOptions) *runtime.Pager[ScopeAccessReviewInstancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewInstancesClientListResponse]{ + More: func(page ScopeAccessReviewInstancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewInstancesClientListResponse) (ScopeAccessReviewInstancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, scheduleDefinitionID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewInstancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewInstancesClient) listCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewInstancesClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewInstancesClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewInstancesClientListResponse, error) { + result := ScopeAccessReviewInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { + return ScopeAccessReviewInstancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client_example_test.go new file mode 100644 index 000000000000..41f042de741d --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewinstances_client_example_test.go @@ -0,0 +1,127 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstances.json +func ExampleScopeAccessReviewInstancesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewScopeAccessReviewInstancesClient().NewListPager("subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "265785a7-a81f-4201-8a18-bb0db95982b7", &armauthorization.ScopeAccessReviewInstancesClientListOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewInstanceListResult = armauthorization.AccessReviewInstanceListResult{ + // Value: []*armauthorization.AccessReviewInstance{ + // { + // Name: to.Ptr("4135f961-be78-4005-8101-c72a5af307a2"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/instances/4135f961-be78-4005-8101-c72a5af307a2"), + // Properties: &armauthorization.AccessReviewInstanceProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewInstanceStatusApplied), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewInstance.json +func ExampleScopeAccessReviewInstancesClient_GetByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewInstancesClient().GetByID(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "4135f961-be78-4005-8101-c72a5af307a2", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewInstance = armauthorization.AccessReviewInstance{ + // Name: to.Ptr("4135f961-be78-4005-8101-c72a5af307a2"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/instances/4135f961-be78-4005-8101-c72a5af307a2"), + // Properties: &armauthorization.AccessReviewInstanceProperties{ + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewInstanceStatusApplied), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/PutAccessReviewInstance.json +func ExampleScopeAccessReviewInstancesClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewInstancesClient().Create(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "4135f961-be78-4005-8101-c72a5af307a2", armauthorization.AccessReviewInstanceProperties{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewInstance = armauthorization.AccessReviewInstance{ + // Name: to.Ptr("4135f961-be78-4005-8101-c72a5af307a2"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/instances/4135f961-be78-4005-8101-c72a5af307a2"), + // Properties: &armauthorization.AccessReviewInstanceProperties{ + // BackupReviewers: []*armauthorization.AccessReviewReviewer{ + // { + // PrincipalID: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewReviewerTypeUser), + // }}, + // EndDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // Reviewers: []*armauthorization.AccessReviewReviewer{ + // { + // PrincipalID: to.Ptr("89ff94f6-029c-429c-9037-6cf4fe2f4a13"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewReviewerType("group")), + // }}, + // ReviewersType: to.Ptr(armauthorization.AccessReviewInstanceReviewersTypeAssigned), + // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // Status: to.Ptr(armauthorization.AccessReviewInstanceStatusInProgress), + // }, + // } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go new file mode 100644 index 000000000000..1e9a906f6f06 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client.go @@ -0,0 +1,307 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ScopeAccessReviewScheduleDefinitionsClient contains the methods for the ScopeAccessReviewScheduleDefinitions group. +// Don't use this type directly, use NewScopeAccessReviewScheduleDefinitionsClient() instead. +type ScopeAccessReviewScheduleDefinitionsClient struct { + internal *arm.Client +} + +// NewScopeAccessReviewScheduleDefinitionsClient creates a new instance of ScopeAccessReviewScheduleDefinitionsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewScopeAccessReviewScheduleDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ScopeAccessReviewScheduleDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".ScopeAccessReviewScheduleDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ScopeAccessReviewScheduleDefinitionsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdateByID - Create or Update access review schedule definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - properties - Access review schedule definition properties. +// - options - ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions contains the optional parameters for the +// ScopeAccessReviewScheduleDefinitionsClient.CreateOrUpdateByID method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) CreateOrUpdateByID(ctx context.Context, scope string, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + req, err := client.createOrUpdateByIDCreateRequest(ctx, scope, scheduleDefinitionID, properties, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateByIDHandleResponse(resp) +} + +// createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) createOrUpdateByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties, options *ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// createOrUpdateByIDHandleResponse handles the CreateOrUpdateByID response. +func (client *ScopeAccessReviewScheduleDefinitionsClient) createOrUpdateByIDHandleResponse(resp *http.Response) (ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse, error) { + result := ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return ScopeAccessReviewScheduleDefinitionsClientCreateOrUpdateByIDResponse{}, err + } + return result, nil +} + +// DeleteByID - Delete access review schedule definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.DeleteByID +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) DeleteByID(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse, error) { + req, err := client.deleteByIDCreateRequest(ctx, scope, scheduleDefinitionID, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewScheduleDefinitionsClientDeleteByIDResponse{}, nil +} + +// deleteByIDCreateRequest creates the DeleteByID request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) deleteByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientDeleteByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// GetByID - Get single access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.GetByID +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) GetByID(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions) (ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + req, err := client.getByIDCreateRequest(ctx, scope, scheduleDefinitionID, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, runtime.NewResponseError(resp) + } + return client.getByIDHandleResponse(resp) +} + +// getByIDCreateRequest creates the GetByID request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) getByIDCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientGetByIDOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getByIDHandleResponse handles the GetByID response. +func (client *ScopeAccessReviewScheduleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse, error) { + result := ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { + return ScopeAccessReviewScheduleDefinitionsClientGetByIDResponse{}, err + } + return result, nil +} + +// NewListPager - Get access review schedule definitions +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - options - ScopeAccessReviewScheduleDefinitionsClientListOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.NewListPager +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) NewListPager(scope string, options *ScopeAccessReviewScheduleDefinitionsClientListOptions) *runtime.Pager[ScopeAccessReviewScheduleDefinitionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ScopeAccessReviewScheduleDefinitionsClientListResponse]{ + More: func(page ScopeAccessReviewScheduleDefinitionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ScopeAccessReviewScheduleDefinitionsClientListResponse) (ScopeAccessReviewScheduleDefinitionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *ScopeAccessReviewScheduleDefinitionsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + unencodedParams := []string{req.Raw().URL.RawQuery} + if options != nil && options.Filter != nil { + unencodedParams = append(unencodedParams, "$filter="+*options.Filter) + } + req.Raw().URL.RawQuery = strings.Join(unencodedParams, "&") + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ScopeAccessReviewScheduleDefinitionsClient) listHandleResponse(resp *http.Response) (ScopeAccessReviewScheduleDefinitionsClientListResponse, error) { + result := ScopeAccessReviewScheduleDefinitionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { + return ScopeAccessReviewScheduleDefinitionsClientListResponse{}, err + } + return result, nil +} + +// Stop - Stop access review definition +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-12-01-preview +// - scope - The scope of the resource. +// - scheduleDefinitionID - The id of the access review schedule definition. +// - options - ScopeAccessReviewScheduleDefinitionsClientStopOptions contains the optional parameters for the ScopeAccessReviewScheduleDefinitionsClient.Stop +// method. +func (client *ScopeAccessReviewScheduleDefinitionsClient) Stop(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientStopOptions) (ScopeAccessReviewScheduleDefinitionsClientStopResponse, error) { + req, err := client.stopCreateRequest(ctx, scope, scheduleDefinitionID, options) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, runtime.NewResponseError(resp) + } + return ScopeAccessReviewScheduleDefinitionsClientStopResponse{}, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ScopeAccessReviewScheduleDefinitionsClient) stopCreateRequest(ctx context.Context, scope string, scheduleDefinitionID string, options *ScopeAccessReviewScheduleDefinitionsClientStopOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client_example_test.go new file mode 100644 index 000000000000..1e2938f2ffac --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/scopeaccessreviewscheduledefinitions_client_example_test.go @@ -0,0 +1,255 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewScheduleDefinitions.json +func ExampleScopeAccessReviewScheduleDefinitionsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewScopeAccessReviewScheduleDefinitionsClient().NewListPager("subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", &armauthorization.ScopeAccessReviewScheduleDefinitionsClientListOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewScheduleDefinitionListResult = armauthorization.AccessReviewScheduleDefinitionListResult{ + // Value: []*armauthorization.AccessReviewScheduleDefinition{ + // { + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewScheduleDefinitionProperties{ + // CreatedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // DescriptionForAdmins: to.Ptr("asdfasdf"), + // DescriptionForReviewers: to.Ptr("asdfasdf"), + // DisplayName: to.Ptr("Hello world"), + // Reviewers: []*armauthorization.AccessReviewReviewer{ + // { + // PrincipalID: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d "), + // PrincipalType: to.Ptr(armauthorization.AccessReviewReviewerTypeUser), + // }}, + // ReviewersType: to.Ptr(armauthorization.AccessReviewScheduleDefinitionReviewersTypeAssigned), + // Scope: &armauthorization.AccessReviewScope{ + // ResourceID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // RoleDefinitionID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/roleDefinitions/b225c7ff-4338-4cdc-a790-6b34d987f7cd"), + // }, + // Settings: &armauthorization.AccessReviewScheduleSettings{ + // AutoApplyDecisionsEnabled: to.Ptr(true), + // DefaultDecision: to.Ptr(armauthorization.DefaultDecisionTypeApprove), + // DefaultDecisionEnabled: to.Ptr(true), + // InstanceDurationInDays: to.Ptr[int32](30), + // JustificationRequiredOnApproval: to.Ptr(true), + // MailNotificationsEnabled: to.Ptr(true), + // RecommendationsEnabled: to.Ptr(true), + // Recurrence: &armauthorization.AccessReviewRecurrenceSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }, + // ReminderNotificationsEnabled: to.Ptr(true), + // }, + // Status: to.Ptr(armauthorization.AccessReviewScheduleDefinitionStatusInProgress), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/GetAccessReviewScheduleDefinition.json +func ExampleScopeAccessReviewScheduleDefinitionsClient_GetByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewScheduleDefinitionsClient().GetByID(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewScheduleDefinition = armauthorization.AccessReviewScheduleDefinition{ + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewScheduleDefinitionProperties{ + // CreatedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // DescriptionForAdmins: to.Ptr("asdfasdf"), + // DescriptionForReviewers: to.Ptr("asdfasdf"), + // DisplayName: to.Ptr("Hello world"), + // Reviewers: []*armauthorization.AccessReviewReviewer{ + // { + // PrincipalID: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d "), + // PrincipalType: to.Ptr(armauthorization.AccessReviewReviewerTypeUser), + // }}, + // ReviewersType: to.Ptr(armauthorization.AccessReviewScheduleDefinitionReviewersTypeAssigned), + // Scope: &armauthorization.AccessReviewScope{ + // ResourceID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // RoleDefinitionID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/roleDefinitions/b225c7ff-4338-4cdc-a790-6b34d987f7cd"), + // }, + // Settings: &armauthorization.AccessReviewScheduleSettings{ + // AutoApplyDecisionsEnabled: to.Ptr(true), + // DefaultDecision: to.Ptr(armauthorization.DefaultDecisionTypeApprove), + // DefaultDecisionEnabled: to.Ptr(true), + // InstanceDurationInDays: to.Ptr[int32](30), + // JustificationRequiredOnApproval: to.Ptr(true), + // MailNotificationsEnabled: to.Ptr(true), + // RecommendationsEnabled: to.Ptr(true), + // Recurrence: &armauthorization.AccessReviewRecurrenceSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }, + // ReminderNotificationsEnabled: to.Ptr(true), + // }, + // Status: to.Ptr(armauthorization.AccessReviewScheduleDefinitionStatusInProgress), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/DeleteAccessReviewScheduleDefinition.json +func ExampleScopeAccessReviewScheduleDefinitionsClient_DeleteByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewScheduleDefinitionsClient().DeleteByID(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/PutAccessReviewScheduleDefinition.json +func ExampleScopeAccessReviewScheduleDefinitionsClient_CreateOrUpdateByID() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScopeAccessReviewScheduleDefinitionsClient().CreateOrUpdateByID(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", armauthorization.AccessReviewScheduleDefinitionProperties{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccessReviewScheduleDefinition = armauthorization.AccessReviewScheduleDefinition{ + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions"), + // ID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewScheduleDefinitionProperties{ + // CreatedBy: &armauthorization.AccessReviewActorIdentity{ + // PrincipalID: to.Ptr("a6c7aecb-cbfd-4763-87ef-e91b4bd509d9"), + // PrincipalName: to.Ptr("Shubham Gupta"), + // PrincipalType: to.Ptr(armauthorization.AccessReviewActorIdentityTypeUser), + // UserPrincipalName: to.Ptr("shugup@microsoft.com"), + // }, + // DescriptionForAdmins: to.Ptr("asdfasdf"), + // DescriptionForReviewers: to.Ptr("asdfasdf"), + // DisplayName: to.Ptr("Hello world"), + // Reviewers: []*armauthorization.AccessReviewReviewer{ + // { + // PrincipalID: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d "), + // PrincipalType: to.Ptr(armauthorization.AccessReviewReviewerTypeUser), + // }}, + // ReviewersType: to.Ptr(armauthorization.AccessReviewScheduleDefinitionReviewersTypeAssigned), + // Scope: &armauthorization.AccessReviewScope{ + // ResourceID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // RoleDefinitionID: to.Ptr("/subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/providers/Microsoft.Authorization/roleDefinitions/b225c7ff-4338-4cdc-a790-6b34d987f7cd"), + // }, + // Settings: &armauthorization.AccessReviewScheduleSettings{ + // AutoApplyDecisionsEnabled: to.Ptr(true), + // DefaultDecision: to.Ptr(armauthorization.DefaultDecisionTypeApprove), + // DefaultDecisionEnabled: to.Ptr(true), + // InstanceDurationInDays: to.Ptr[int32](30), + // JustificationRequiredOnApproval: to.Ptr(true), + // MailNotificationsEnabled: to.Ptr(true), + // RecommendationsEnabled: to.Ptr(true), + // Recurrence: &armauthorization.AccessReviewRecurrenceSettings{ + // Range: &armauthorization.AccessReviewRecurrenceRange{ + // Type: to.Ptr(armauthorization.AccessReviewRecurrenceRangeTypeEndDate), + // EndDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:17:30.513Z"); return t}()), + // NumberOfOccurrences: to.Ptr[int32](1), + // StartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // }, + // }, + // ReminderNotificationsEnabled: to.Ptr(true), + // }, + // Status: to.Ptr(armauthorization.AccessReviewScheduleDefinitionStatusInProgress), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/StopAccessReviewScheduleDefinition.json +func ExampleScopeAccessReviewScheduleDefinitionsClient_Stop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewScopeAccessReviewScheduleDefinitionsClient().Stop(ctx, "subscriptions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d", "fa73e90b-5bf1-45fd-a182-35ce5fc0674d", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go b/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go new file mode 100644 index 000000000000..90b6d12c8235 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client.go @@ -0,0 +1,108 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TenantLevelAccessReviewInstanceContactedReviewersClient contains the methods for the TenantLevelAccessReviewInstanceContactedReviewers group. +// Don't use this type directly, use NewTenantLevelAccessReviewInstanceContactedReviewersClient() instead. +type TenantLevelAccessReviewInstanceContactedReviewersClient struct { + internal *arm.Client +} + +// NewTenantLevelAccessReviewInstanceContactedReviewersClient creates a new instance of TenantLevelAccessReviewInstanceContactedReviewersClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTenantLevelAccessReviewInstanceContactedReviewersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantLevelAccessReviewInstanceContactedReviewersClient, error) { + cl, err := arm.NewClient(moduleName+".TenantLevelAccessReviewInstanceContactedReviewersClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TenantLevelAccessReviewInstanceContactedReviewersClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Get access review instance contacted reviewers +// +// Generated from API version 2021-12-01-preview +// - scheduleDefinitionID - The id of the access review schedule definition. +// - id - The id of the access review instance. +// - options - TenantLevelAccessReviewInstanceContactedReviewersClientListOptions contains the optional parameters for the TenantLevelAccessReviewInstanceContactedReviewersClient.NewListPager +// method. +func (client *TenantLevelAccessReviewInstanceContactedReviewersClient) NewListPager(scheduleDefinitionID string, id string, options *TenantLevelAccessReviewInstanceContactedReviewersClientListOptions) *runtime.Pager[TenantLevelAccessReviewInstanceContactedReviewersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[TenantLevelAccessReviewInstanceContactedReviewersClientListResponse]{ + More: func(page TenantLevelAccessReviewInstanceContactedReviewersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TenantLevelAccessReviewInstanceContactedReviewersClientListResponse) (TenantLevelAccessReviewInstanceContactedReviewersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scheduleDefinitionID, id, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *TenantLevelAccessReviewInstanceContactedReviewersClient) listCreateRequest(ctx context.Context, scheduleDefinitionID string, id string, options *TenantLevelAccessReviewInstanceContactedReviewersClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers" + if scheduleDefinitionID == "" { + return nil, errors.New("parameter scheduleDefinitionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scheduleDefinitionId}", url.PathEscape(scheduleDefinitionID)) + if id == "" { + return nil, errors.New("parameter id cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{id}", url.PathEscape(id)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-12-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TenantLevelAccessReviewInstanceContactedReviewersClient) listHandleResponse(resp *http.Response) (TenantLevelAccessReviewInstanceContactedReviewersClientListResponse, error) { + result := TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewContactedReviewerListResult); err != nil { + return TenantLevelAccessReviewInstanceContactedReviewersClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client_example_test.go b/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client_example_test.go new file mode 100644 index 000000000000..8d8faf4dbc35 --- /dev/null +++ b/sdk/resourcemanager/authorization/armauthorization/tenantlevelaccessreviewinstancecontactedreviewers_client_example_test.go @@ -0,0 +1,56 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armauthorization_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/authorization/resource-manager/Microsoft.Authorization/preview/2021-12-01-preview/examples/TenantLevelGetAccessReviewInstanceContactedReviewers.json +func ExampleTenantLevelAccessReviewInstanceContactedReviewersClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armauthorization.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTenantLevelAccessReviewInstanceContactedReviewersClient().NewListPager("265785a7-a81f-4201-8a18-bb0db95982b7", "f25ed880-9c31-4101-bc57-825d8df3b58c", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.AccessReviewContactedReviewerListResult = armauthorization.AccessReviewContactedReviewerListResult{ + // Value: []*armauthorization.AccessReviewContactedReviewer{ + // { + // Name: to.Ptr("fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Type: to.Ptr("Microsoft.Authorization/accessReviewScheduleDefinitions/instances/contactedReviewers"), + // ID: to.Ptr("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/fa73e90b-5bf1-45fd-a182-35ce5fc0674d/instances/f8882fec-7d56-4e97-ad6d-5e3f4557971d/contactedReviewers/fa73e90b-5bf1-45fd-a182-35ce5fc0674d"), + // Properties: &armauthorization.AccessReviewContactedReviewerProperties{ + // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-03T21:02:30.667Z"); return t}()), + // UserDisplayName: to.Ptr("Bob"), + // UserPrincipalName: to.Ptr("bob@contoso.com"), + // }, + // }}, + // } + } +}