Search in sources :

Example 1 with InstanceGroupV4Base

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceGroupV4Base in project cloudbreak by hortonworks.

the class SdxService method getInstanceGroupNamesBySdxDetails.

public Set<String> getInstanceGroupNamesBySdxDetails(SdxClusterShape clusterShape, String runtimeVersion, String cloudPlatform) {
    if (clusterShape == null || StringUtils.isAnyBlank(runtimeVersion, cloudPlatform)) {
        throw new BadRequestException("The following query params needs to be filled for this request: clusterShape, runtimeVersion, cloudPlatform");
    }
    Set<String> result = new HashSet<>();
    StackV4Request stackV4Request = cdpConfigService.getConfigForKey(new CDPConfigKey(CloudPlatform.valueOf(cloudPlatform), clusterShape, runtimeVersion));
    if (stackV4Request != null && CollectionUtils.isNotEmpty(stackV4Request.getInstanceGroups())) {
        result = stackV4Request.getInstanceGroups().stream().map(InstanceGroupV4Base::getName).collect(Collectors.toSet());
    }
    return result;
}
Also used : StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) InstanceGroupV4Base(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceGroupV4Base) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) LinkedHashSet(java.util.LinkedHashSet) HashSet(java.util.HashSet)

Aggregations

InstanceGroupV4Base (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceGroupV4Base)1 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1