class FileSystemSupportMatrixService {

    public Set<CloudStorageSupportedV4Response> getCloudStorageMatrix(String stackVersion) {
        VersionComparator versionComparator = new VersionComparator();
        Set<CloudStorageSupportedV4Response> response = new HashSet<>();
        cloudFileSystemSupportMatrix.getProviders().forEach(supportConfigEntries -> {
            Set<String> supportedFileSystems = supportConfigEntries.getConfigEntries().stream()
                    .filter(supportConfigEntry -> {
                        Versioned minVersion = supportConfigEntry::getMinVersion;
                        Versioned currentVersion = () -> stackVersion.length() > supportConfigEntry.getMinVersion().length()
                                ? stackVersion.substring(0, supportConfigEntry.getMinVersion().length()) : stackVersion;
                        int compared = versionComparator.compare(minVersion, currentVersion);
                        return compared <= 0;
                    })
                    .map(CloudFileSystemSupportConfigEntry::getSupportedFileSytem)
                    .collect(Collectors.toSet());
            if (!supportedFileSystems.isEmpty()) {
                CloudStorageSupportedV4Response cloudStorageSupportedV4Response = new CloudStorageSupportedV4Response();
                cloudStorageSupportedV4Response.setProvider(supportConfigEntries.getProvider());
                cloudStorageSupportedV4Response.setFileSystemType(supportedFileSystems);
                response.add(cloudStorageSupportedV4Response);
            }
        });
        return response;
    }

}