use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.CompactViewV4Response in project cloudbreak by hortonworks.
the class EnvironmentServiceDecorator method prepareEnvironments.
public void prepareEnvironments(Set<ClusterTemplateViewV4Response> clusterTemplateViewV4Responses) {
LOGGER.debug("Decorating with environment name the following cluster definition(s): {}", clusterTemplateViewV4Responses.stream().map(CompactViewV4Response::getName).collect(toSet()));
Collection<SimpleEnvironmentResponse> responses = environmentClientService.list().getResponses();
for (ClusterTemplateViewV4Response clusterTemplateViewV4Response : clusterTemplateViewV4Responses) {
Optional<SimpleEnvironmentResponse> first = responses.stream().filter(x -> x.getCrn().equals(clusterTemplateViewV4Response.getEnvironmentCrn())).findFirst();
first.ifPresentOrElse(simpleEnvironmentResponse -> clusterTemplateViewV4Response.setEnvironmentName(simpleEnvironmentResponse.getName()), () -> LOGGER.info("Unable to find environment name for cluster definition \"{}\"", clusterTemplateViewV4Response.getName()));
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.CompactViewV4Response in project cloudbreak by hortonworks.
the class SdxService method fetchRecipesFromCore.
private Set<String> fetchRecipesFromCore() {
String initiatorUserCrn = ThreadBasedUserCrnProvider.getUserCrn();
RecipeViewV4Responses recipeResponses = ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> recipeV4Endpoint.listInternal(WORKSPACE_ID_DEFAULT, initiatorUserCrn));
Set<String> recipeNames = recipeResponses.getResponses().stream().map(CompactViewV4Response::getName).collect(Collectors.toSet());
return recipeNames;
}
Aggregations