class BackupService {

    public BackupFile uploadBackup(Boolean ignoreWarnings, String filename, byte[] fileBytes)
            throws InvalidFilenameException, UnhandledWarningsException, InvalidBackupFileException {
        auditDataHelper.putBackupFilename(backupRepository.getFilePath(filename));
        if (!FormatUtils.isValidBackupFilename(filename)) {
            throw new InvalidFilenameException("uploading backup file failed because of invalid filename ("
                    + filename + ")");
        }

        if (!ignoreWarnings && backupRepository.fileExists(filename)) {
            throw new UnhandledWarningsException(new WarningDeviation(WARNING_FILE_ALREADY_EXISTS, filename));
        }

        if (!isValidTarFile(fileBytes)) {
            throw new InvalidBackupFileException("backup file is not a valid tar file (" + filename + ")");
        }
        OffsetDateTime createdAt = backupRepository.writeBackupFile(filename, fileBytes);
        BackupFile backupFile = new BackupFile(filename);
        backupFile.setCreatedAt(createdAt);
        return backupFile;
    }

    @Autowired public  BackupService(BackupRepository backupRepository, ServerConfService serverConfService,
            ExternalProcessRunner externalProcessRunner,
            @Value("${script.generate-backup.path}") String generateBackupScriptPath,
            AuditDataHelper auditDataHelper);

}