Interface BackupRestoreManager
-
- All Known Implementing Classes:
ConfluenceBackupRestoreManager
@ExperimentalApi public interface BackupRestoreManager
Responsible for accepting backup/restore operations, checking permissions, managing the queue and cluster-wide locks. All operations are asynchronous.- Since:
- 7.17.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
assertUserHasSystemAdminPermissions()
Checks whether the current user can upload a backup file.int
cancelAllJobsFromQueue()
Cancels all queued jobs including jobs in QUEUED state and PROCESSING state.Optional<BackupRestoreJob>
cancelJob(Long jobId)
Cancels the job.Collection<BackupRestoreJob>
findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter)
Returns jobs based on the filter provided.Optional<BackupRestoreJob>
getJob(Long id)
Get job by id.BackupRestoreSettings
getSettingsById(long id)
Returns job settings.Optional<BackupRestoreJobResult>
getStatisticsById(long id)
BackupRestoreJob
startSiteBackup(BackupRestoreSettings siteBackupSettings)
Queues a new site backup job if possible.BackupRestoreJob
startSiteRestore(BackupRestoreSettings siteRestoreSettings)
Queues the new site restore job if possible.BackupRestoreJob
startSpaceBackup(BackupRestoreSettings spaceBackupSettings)
Adds the new space backup job to the queue.BackupRestoreJob
startSpaceRestore(BackupRestoreSettings spaceRestoreSettings)
Adds the new space restore job to the queue.
-
-
-
Method Detail
-
getJob
Optional<BackupRestoreJob> getJob(Long id) throws NotPermittedException
Get job by id.- Throws:
NotPermittedException
-
startSpaceBackup
BackupRestoreJob startSpaceBackup(BackupRestoreSettings spaceBackupSettings) throws NotPermittedException, TheSameSpaceBackupRestoreJobAlreadyInProgressException
Adds the new space backup job to the queue. Throws an exception if the operation is not permitted. Support either single-space backup ot multi-space backups (depends on how many space ids are provided).- Parameters:
spaceBackupSettings
- space backup settings- Throws:
NotPermittedException
TheSameSpaceBackupRestoreJobAlreadyInProgressException
-
startSiteBackup
BackupRestoreJob startSiteBackup(BackupRestoreSettings siteBackupSettings) throws NotPermittedException
Queues a new site backup job if possible. Throws an exception if the operation is not permitted. The user has to be a sysadmin to perform this operation.- Parameters:
siteBackupSettings
- site backup settings- Throws:
NotPermittedException
-
startSpaceRestore
BackupRestoreJob startSpaceRestore(BackupRestoreSettings spaceRestoreSettings) throws NotPermittedException
Adds the new space restore job to the queue. Throws an exception if the operation is not permitted. The user has to the a sysadmin to perform this operation.- Parameters:
spaceRestoreSettings
- space restore settings- Throws:
NotPermittedException
-
startSiteRestore
BackupRestoreJob startSiteRestore(BackupRestoreSettings siteRestoreSettings) throws NotPermittedException
Queues the new site restore job if possible. It cancels all other jobs and starts the restore just after. Throws an exception if the operation is not permitted.- Parameters:
siteRestoreSettings
- site restore settings- Throws:
NotPermittedException
-
cancelJob
Optional<BackupRestoreJob> cancelJob(Long jobId) throws NotPermittedException
Cancels the job. If the job is already cancelled or failed, the method will do nothing. Throws an exception if the operation is not permitted.- Parameters:
jobId
- jobId- Returns:
- the job
- Throws:
NotPermittedException
-
cancelAllJobsFromQueue
int cancelAllJobsFromQueue() throws NotPermittedException
Cancels all queued jobs including jobs in QUEUED state and PROCESSING state.- Returns:
- number of cancelled jobs.
- Throws:
NotPermittedException
-
findJobs
Collection<BackupRestoreJob> findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter)
Returns jobs based on the filter provided. Permissions are based on the user SysAdmins can return all, Users can return only jobs that they have space export permissions for- Parameters:
backupRestoreJobsSearchFilter
- properties to filter jobs by- Returns:
- List of BackupRestoreJobs
-
assertUserHasSystemAdminPermissions
void assertUserHasSystemAdminPermissions() throws NotPermittedException
Checks whether the current user can upload a backup file. Throws a PermissionException if the user does not have permission.- Throws:
PermissionException
- if user doesn't have permission to upload backup fileNotPermittedException
-
getSettingsById
BackupRestoreSettings getSettingsById(long id)
Returns job settings.- Parameters:
id
- job id- Returns:
- settings
-
getStatisticsById
Optional<BackupRestoreJobResult> getStatisticsById(long id)
- Parameters:
id
-- Returns:
- the job's statistics
-
-