class DatabaseObtainerService {

    AttemptResult<Object> obtainAttemptResult(Cluster cluster, DatabaseOperation databaseOperation, String databaseCrn, boolean cancellable)
            throws JsonProcessingException {

        Optional<AttemptResult<Object>> result = Optional.ofNullable(clusterPollingCheckerService.checkClusterCancelledState(cluster, cancellable));
        if (result.isEmpty()) {
            checkArgument(cluster != null, "Cluster must not be null");
            try {
                LOGGER.info("Creation polling redbeams for database status: '{}'", cluster.getName());
                DatabaseServerV4Response rdsStatus = redbeamsClient.getByCrn(databaseCrn);
                LOGGER.info("Response from redbeams: {}", JsonUtil.writeValueAsString(rdsStatus));
                result = Optional.of(databaseCriteriaResolver.resolveResultByCriteria(databaseOperation, rdsStatus, cluster));
            } catch (NotFoundException e) {
                result = Optional.of(AttemptResults.finishWith(null));
            }
        }
        return result.get();
    }

      DatabaseObtainerService(RedbeamsClientService redbeamsClient, ClusterPollingCheckerService clusterPollingCheckerService,
            DatabaseCriteriaResolver databaseCriteriaResolver);

}