use of com.sequenceiq.cloudbreak.converter.v4.blueprint.BlueprintToBlueprintV4ResponseConverter in project cloudbreak by hortonworks.
the class ClusterToClusterV4ResponseConverter method convert.
public ClusterV4Response convert(Cluster source) {
ClusterV4Response clusterResponse = new ClusterV4Response();
clusterResponse.setId(source.getId());
clusterResponse.setName(source.getName());
Stack stack = source.getStack();
clusterResponse.setStatus(stack.getStatus());
clusterResponse.setStatusReason(stack.getStatusReason());
setUptime(source, clusterResponse);
clusterResponse.setDescription(source.getDescription() == null ? "" : source.getDescription());
String managerAddress = stackUtil.extractClusterManagerAddress(stack);
Map<String, Collection<ClusterExposedServiceV4Response>> clusterExposedServicesForTopologies = serviceEndpointCollector.prepareClusterExposedServices(source, managerAddress);
clusterResponse.setExposedServices(clusterExposedServicesForTopologies);
convertCustomQueue(source, clusterResponse);
convertNullableProperties(source, clusterResponse);
convertContainerConfig(source, clusterResponse);
clusterResponse.setCreationFinished(source.getCreationFinished());
decorateResponseWithProxyConfig(source, clusterResponse);
clusterResponse.setCloudStorage(getCloudStorage(source));
clusterResponse.setCm(ClusterToClouderaManagerV4ResponseConverter.convert(source));
clusterResponse.setDatabases(source.getRdsConfigs().stream().filter(rds -> ResourceStatus.USER_MANAGED.equals(rds.getStatus())).map(rds -> rdsConfigToDatabaseV4ResponseConverter.convert(rds)).collect(Collectors.toList()));
clusterResponse.setWorkspace(workspaceToWorkspaceResourceV4ResponseConverter.convert(source.getWorkspace()));
clusterResponse.setBlueprint(getIfNotNull(source.getBlueprint(), blueprintToBlueprintV4ResponseConverter::convert));
clusterResponse.setExtendedBlueprintText(getExtendedBlueprintText(source));
convertDpSecrets(source, clusterResponse);
clusterResponse.setServerIp(stackUtil.extractClusterManagerIp(stack));
clusterResponse.setServerFqdn(source.getFqdn());
clusterResponse.setServerUrl(serviceEndpointCollector.getManagerServerUrl(source, managerAddress));
clusterResponse.setCustomConfigurationsName(getIfNotNull(source.getCustomConfigurations(), configurations -> configurations.getName()));
clusterResponse.setCustomConfigurationsCrn(getIfNotNull(source.getCustomConfigurations(), configurations -> configurations.getCrn()));
clusterResponse.setDatabaseServerCrn(source.getDatabaseServerCrn());
clusterResponse.setRangerRazEnabled(source.isRangerRazEnabled());
clusterResponse.setCertExpirationState(source.getCertExpirationState());
return clusterResponse;
}
Aggregations