Package dev.le_app.mcss_api_java
Class Backup
java.lang.Object
dev.le_app.mcss_api_java.Backup
This class contains information about a server's backup
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDelete the backup - NOTE: This won't delete the backup files, just the backup information in MCSSGets the backup IDGets the backup nameGets the last completion date/time of the backupGets the compression type of the backupGets the destination of the backupGets the file blacklist of the backupGets the folder blacklist of the backupGets the last backup state of the backup This value is updated every time the method is run, hence why all the other exceptionsbooleanGets whether the backup deletes old backupsbooleanGets whether the backup is suspendedvoidManually run a backupvoidsetBackupName(String backupName) Sets the backup namevoidsetCompressionType(BackupCompressionType compressionType) Sets the compression type of the backupvoidsetDeleteOldBackups(boolean deleteOldBackups) Sets if old backups should be deleted (following MCSS config)voidsetDestination(String destination) Sets the destination of the backupvoidsetFileBlacklist(String... fileBlacklist) Sets the file blacklist for the backupvoidsetFileBlacklist(ArrayList<String> fileBlacklist) Sets the file blacklist for the backupvoidsetFolderBlacklist(String... folderBlacklist) Sets the folder blacklist for the backupvoidsetFolderBlacklist(ArrayList<String> folderBlacklist) Sets the folder blacklist for the backupvoidsetSuspendServer(boolean suspendServer) Sets if the backup should suspend the server (shutdown) before creating the backupvoidUpdates all details of the backup from the API
-
Constructor Details
-
Backup
protected Backup(MCSSApi api, String serverID, String backupID) throws APIUnauthorizedException, IOException, APINoServerAccessException, APINotFoundException Creates a new Backup object - ONLY MADE BY THE SERVER OBJECT- Parameters:
api- MCSS API instanceserverID- Server ID of the origin serverbackupID- Backup ID of the backup- Throws:
APIUnauthorizedException- If the API key is invalidIOException- If there is an error connecting to the APIAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
-
Method Details
-
getBackupID
Gets the backup ID- Returns:
- STRING Backup ID
- Throws:
IllegalStateException- If the backup has been deleted
-
getBackupName
Gets the backup name- Returns:
- STRING Backup name
- Throws:
IllegalStateException- If the backup has been deleted
-
getDestination
Gets the destination of the backup- Returns:
- STRING Destination of the backup
- Throws:
IllegalStateException- If the backup has been deleted
-
isSuspended
Gets whether the backup is suspended- Returns:
- BOOLEAN Whether the backup is suspended
- Throws:
IllegalStateException- If the backup has been deleted
-
isDeleteOldBackups
Gets whether the backup deletes old backups- Returns:
- BOOLEAN Whether the backup deletes old backups
- Throws:
IllegalStateException- If the backup has been deleted
-
getCompressionType
Gets the compression type of the backup- Returns:
- BackupCompressionType Compression type of the backup
- Throws:
IllegalStateException- If the backup has been deleted
-
getFileBlacklist
Gets the file blacklist of the backup- Returns:
- ARRAYLIST File blacklist of the backup
- Throws:
IllegalStateException- If the backup has been deleted
-
getFolderBlacklist
Gets the folder blacklist of the backup- Returns:
- ARRAYLIST Folder blacklist of the backup
- Throws:
IllegalStateException- If the backup has been deleted
-
getCompletedAt
Gets the last completion date/time of the backup- Returns:
- LOCALDATETIME Completed at date of the backup
- Throws:
IllegalStateException- If the backup has been deleted
-
getLastBackupState
public LastBackupState getLastBackupState() throws IllegalStateException, APIUnauthorizedException, IOException, APINoServerAccessException, APINotFoundExceptionGets the last backup state of the backup This value is updated every time the method is run, hence why all the other exceptions- Returns:
- LastBackupState Last backup state of the backup
- Throws:
IllegalStateException- If the backup has been deletedAPIUnauthorizedException- If the API key is invalidIOException- If there is an error connecting to the APIAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setBackupName
public void setBackupName(String backupName) throws IllegalStateException, APIUnauthorizedException, IOException, APINoServerAccessException, APINotFoundException Sets the backup name- Parameters:
backupName- Backup name- Throws:
IllegalStateException- If the backup has been deletedAPIUnauthorizedException- If the API key is invalidIOException- If there is an error connecting to the APIAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setDestination
public void setDestination(String destination) throws IllegalStateException, APIUnauthorizedException, IOException, APINoServerAccessException, APINotFoundException Sets the destination of the backup- Parameters:
destination- Absolute PATH - destination of the backup - Use double \\ for folders- Throws:
IllegalStateException- If the backup has been deletedAPIUnauthorizedException- If the API key is invalidIOException- If there is an error connecting to the APIAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setCompressionType
public void setCompressionType(BackupCompressionType compressionType) throws IllegalStateException, APIUnauthorizedException, IOException, APINoServerAccessException, APINotFoundException Sets the compression type of the backup- Parameters:
compressionType- Compression type of the backup- Throws:
IllegalStateException- If the backup has been deletedAPIUnauthorizedException- If the API key is invalidIOException- If there is an error connecting to the APIAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setSuspendServer
public void setSuspendServer(boolean suspendServer) throws IllegalStateException, APIUnauthorizedException, IOException, APINoServerAccessException, APINotFoundException Sets if the backup should suspend the server (shutdown) before creating the backup- Parameters:
suspendServer- If the server should be suspended- Throws:
IllegalStateException- If the backup has been deletedAPIUnauthorizedException- If the API key is invalidIOException- If there is an error connecting to the APIAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setDeleteOldBackups
public void setDeleteOldBackups(boolean deleteOldBackups) throws IllegalStateException, APIUnauthorizedException, IOException, APINoServerAccessException, APINotFoundException Sets if old backups should be deleted (following MCSS config)- Parameters:
deleteOldBackups- If old backups should be deleted- Throws:
IllegalStateException- If the backup has been deletedAPIUnauthorizedException- If the API key is invalidIOException- If there is an error connecting to the APIAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setFileBlacklist
public void setFileBlacklist(ArrayList<String> fileBlacklist) throws IOException, APIUnauthorizedException, APINoServerAccessException, APINotFoundException Sets the file blacklist for the backup- Parameters:
fileBlacklist- ArrayList of the new blacklist- Throws:
IOException- If there is an error connecting to the APIAPIUnauthorizedException- If the API key is invalidAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setFileBlacklist
public void setFileBlacklist(String... fileBlacklist) throws IOException, APIUnauthorizedException, APINoServerAccessException, APINotFoundException Sets the file blacklist for the backup- Parameters:
fileBlacklist- collection of strings of the new blacklist- Throws:
IOException- If there is an error connecting to the APIAPIUnauthorizedException- If the API key is invalidAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setFolderBlacklist
public void setFolderBlacklist(ArrayList<String> folderBlacklist) throws IOException, APIUnauthorizedException, APINoServerAccessException, APINotFoundException Sets the folder blacklist for the backup- Parameters:
folderBlacklist- ArrayList of the new folder blacklist- Throws:
IOException- If there is an error connecting to the APIAPIUnauthorizedException- If the API key is invalidAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
setFolderBlacklist
public void setFolderBlacklist(String... folderBlacklist) throws IOException, APIUnauthorizedException, APINoServerAccessException, APINotFoundException Sets the folder blacklist for the backup- Parameters:
folderBlacklist- Collection of strings of the new folder blacklist- Throws:
IOException- If there is an error connecting to the APIAPIUnauthorizedException- If the API key is invalidAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
updateDetails
public void updateDetails() throws IOException, APIUnauthorizedException, APINoServerAccessException, APINotFoundExceptionUpdates all details of the backup from the API- Throws:
IOException- If there is an error connecting to the APIAPIUnauthorizedException- If the API key is invalidAPINoServerAccessException- If the API key does not have access to the serverAPINotFoundException- If the server or backup does not exist
-
deleteBackup
public void deleteBackup() throws APIUnauthorizedException, APINotFoundException, APINoServerAccessException, IOExceptionDelete the backup - NOTE: This won't delete the backup files, just the backup information in MCSS- Throws:
APIUnauthorizedException- If the API key is invalidAPINotFoundException- If the server or backup does not existAPINoServerAccessException- If the API key does not have access to the serverIOException- If there is an error connecting to the API
-
runBackup
public void runBackup() throws APIUnauthorizedException, APINotFoundException, APINoServerAccessException, IOExceptionManually run a backup- Throws:
APIUnauthorizedException- If the API key is invalidAPINotFoundException- If the server or backup does not existAPINoServerAccessException- If the API key does not have access to the serverIOException- If there is an error connecting to the API
-