class JobDefinitionResolver {

    Optional<JobClusterConfig> getJobClusterConfigForVersion(final IJobClusterMetadata jobClusterMetadata, final String version) {
        Preconditions.checkNotNull(jobClusterMetadata, "JobClusterMetadata cannot be null");
        Preconditions.checkNotNull(version, "Version cannot be null");
        final String versionToFind = version;
        List<JobClusterConfig> configList = jobClusterMetadata.getJobClusterDefinition()
                .getJobClusterConfigs()
                .stream()
                .filter((cfg) -> cfg.getVersion().equals(versionToFind))
                .collect(Collectors.toList());
        if(!configList.isEmpty()) {
            return of(configList.get(0));

        } else {
            // unknown version
            String msg = String.format("No config with version %s found for Job Cluster %s. Job Submit fails", versionToFind, jobClusterMetadata.getJobClusterDefinition().getName());
            logger.warn(msg);
            return empty();
        }
    }

}