build-coordinator/src/main/java/org/jboss/pnc/coordinator/maintenance/TemporaryBuildsCleanerAsyncInvoker.java
public boolean deleteTemporaryBuild(Integer buildRecordId, String authToken, Consumer<Result> onComplete) throws ValidationException {
        BuildRecord buildRecord = buildRecordRepository.findByIdFetchAllProperties(buildRecordId);
        if (buildRecord == null) {
            return false;
        }

        if (!buildRecord.isTemporaryBuild()) {
            throw new ValidationException("Only deletion of the temporary builds is allowed");
        }

        executorService.submit(() -> {
            try {
                Result result = temporaryBuildsCleaner.deleteTemporaryBuild(buildRecordId, authToken);
                onComplete.accept(result);
            } catch (ValidationException e) {
                logger.error("Failed to delete temporary buildRecord.id: " + buildRecordId + ".", e);
                onComplete.accept(new Result(buildRecordId.toString(), Result.Status.FAILED, "Failed to delete temporary buildRecord."));
            }
        });

        return true;
    }
public boolean deleteTemporaryBuild(Integer buildRecordId, String authToken, Consumer<Result> onComplete) throws ValidationException {
        BuildRecord buildRecord = buildRecordRepository.findByIdFetchAllProperties(buildRecordId);
        if (buildRecord == null) {
            return false;
        }

        if (!buildRecord.isTemporaryBuild()) {
            throw new ValidationException("Only deletion of the temporary builds is allowed");
        }

        executorService.submit(() -> {
            try {
                Result result = temporaryBuildsCleaner.deleteTemporaryBuild(buildRecordId, authToken);
                onComplete.accept(result);
            } catch (ValidationException e) {
                logger.error("Failed to delete temporary buildRecord.id: " + buildRecordId + ".", e);
                onComplete.accept(new Result(buildRecordId.toString(), Result.Status.FAILED, "Failed to delete temporary buildRecord."));
            }
        });

        return true;
    }
Deletes a single temporary build.

@param buildRecordId ID of the build to be deleted
@param authToken Bearer token
@param onComplete Operation to be executed after deletion operation
@return True if the build exists and deletion started otherwise, false is build doesn't exist
@throws ValidationException Thrown when build cannot be deleted