Search in sources :

Example 1 with AdvertisedRuntime

use of com.sequenceiq.sdx.api.model.AdvertisedRuntime in project cloudbreak by hortonworks.

the class CDPConfigServiceTest method rt.

private AdvertisedRuntime rt(String version, boolean defaultVersion) {
    AdvertisedRuntime advertisedRuntime = new AdvertisedRuntime();
    advertisedRuntime.setRuntimeVersion(version);
    advertisedRuntime.setDefaultRuntimeVersion(defaultVersion);
    return advertisedRuntime;
}
Also used : AdvertisedRuntime(com.sequenceiq.sdx.api.model.AdvertisedRuntime)

Example 2 with AdvertisedRuntime

use of com.sequenceiq.sdx.api.model.AdvertisedRuntime in project cloudbreak by hortonworks.

the class CDPConfigService method getAdvertisedRuntimes.

public List<AdvertisedRuntime> getAdvertisedRuntimes(String cloudPlatform) {
    List<String> runtimeVersions = getDatalakeVersions(cloudPlatform).stream().filter(runtimeVersion -> advertisedRuntimes.isEmpty() || advertisedRuntimes.contains(runtimeVersion)).collect(Collectors.toList());
    Optional<String> calculatedDefault = Strings.isNullOrEmpty(this.defaultRuntime) ? runtimeVersions.stream().findFirst() : Optional.ofNullable(this.defaultRuntime);
    List<AdvertisedRuntime> advertisedRuntimes = new ArrayList<>();
    for (String runtimeVersion : runtimeVersions) {
        AdvertisedRuntime advertisedRuntime = new AdvertisedRuntime();
        advertisedRuntime.setRuntimeVersion(runtimeVersion);
        if (calculatedDefault.map(r -> r.equals(runtimeVersion)).orElse(false)) {
            advertisedRuntime.setDefaultRuntimeVersion(true);
        }
        advertisedRuntimes.add(advertisedRuntime);
    }
    LOGGER.debug("Advertised runtime versions for datalake: {}", advertisedRuntimes);
    return advertisedRuntimes;
}
Also used : Arrays(java.util.Arrays) EntitlementService(com.sequenceiq.cloudbreak.auth.altus.EntitlementService) SdxClusterShape(com.sequenceiq.sdx.api.model.SdxClusterShape) ImageCatalogService(com.sequenceiq.datalake.service.imagecatalog.ImageCatalogService) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) JsonUtil(com.sequenceiq.cloudbreak.common.json.JsonUtil) StringUtils(org.apache.commons.lang3.StringUtils) CloudPlatform(com.sequenceiq.cloudbreak.common.mappable.CloudPlatform) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) PathMatchingResourcePatternResolver(org.springframework.core.io.support.PathMatchingResourcePatternResolver) Strings(com.google.common.base.Strings) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) CDPConfigKey(com.sequenceiq.datalake.service.sdx.CDPConfigKey) Matcher(java.util.regex.Matcher) Service(org.springframework.stereotype.Service) Map(java.util.Map) AdvertisedRuntime(com.sequenceiq.sdx.api.model.AdvertisedRuntime) Entitlement(com.sequenceiq.cloudbreak.auth.altus.model.Entitlement) Resource(org.springframework.core.io.Resource) MapUtils(org.apache.commons.collections4.MapUtils) Logger(org.slf4j.Logger) Versioned(com.sequenceiq.cloudbreak.common.type.Versioned) Predicate(java.util.function.Predicate) Set(java.util.Set) IOException(java.io.IOException) VersionComparator(com.sequenceiq.cloudbreak.util.VersionComparator) Collectors(java.util.stream.Collectors) Maps(com.google.common.collect.Maps) StandardCharsets(java.nio.charset.StandardCharsets) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) PostConstruct(javax.annotation.PostConstruct) CloudbreakServiceException(com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ArrayList(java.util.ArrayList) AdvertisedRuntime(com.sequenceiq.sdx.api.model.AdvertisedRuntime)

Aggregations

AdvertisedRuntime (com.sequenceiq.sdx.api.model.AdvertisedRuntime)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Strings (com.google.common.base.Strings)1 Maps (com.google.common.collect.Maps)1 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)1 EntitlementService (com.sequenceiq.cloudbreak.auth.altus.EntitlementService)1 Entitlement (com.sequenceiq.cloudbreak.auth.altus.model.Entitlement)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)1 JsonUtil (com.sequenceiq.cloudbreak.common.json.JsonUtil)1 CloudPlatform (com.sequenceiq.cloudbreak.common.mappable.CloudPlatform)1 Versioned (com.sequenceiq.cloudbreak.common.type.Versioned)1 VersionComparator (com.sequenceiq.cloudbreak.util.VersionComparator)1 ImageCatalogService (com.sequenceiq.datalake.service.imagecatalog.ImageCatalogService)1 CDPConfigKey (com.sequenceiq.datalake.service.sdx.CDPConfigKey)1 SdxClusterShape (com.sequenceiq.sdx.api.model.SdxClusterShape)1 IOException (java.io.IOException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1