Search in sources :

Example 1 with BlueprintToBlueprintV4ResponseConverter

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;
}
Also used : Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) AwsStorageParameters(com.sequenceiq.common.api.cloudstorage.AwsStorageParameters) NullUtil.getIfNotNull(com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull) ResourceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus) ClusterExposedServiceV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.gateway.topology.ClusterExposedServiceV4Response) AwsEfsParameters(com.sequenceiq.common.api.cloudstorage.AwsEfsParameters) ClusterToClouderaManagerV4ResponseConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.cluster.clouderamanager.ClusterToClouderaManagerV4ResponseConverter) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) ProxyConfigDtoService(com.sequenceiq.cloudbreak.service.proxy.ProxyConfigDtoService) StringUtils(org.apache.commons.lang3.StringUtils) StringToSecretResponseConverter(com.sequenceiq.cloudbreak.service.secret.model.StringToSecretResponseConverter) StringUtils.isNotEmpty(org.apache.commons.lang3.StringUtils.isNotEmpty) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) CUSTOM_QUEUE(com.sequenceiq.cloudbreak.domain.ClusterAttributes.CUSTOM_QUEUE) Map(java.util.Map) RDSConfigToDatabaseV4ResponseConverter(com.sequenceiq.cloudbreak.converter.v4.database.RDSConfigToDatabaseV4ResponseConverter) WorkspaceToWorkspaceResourceV4ResponseConverter(com.sequenceiq.cloudbreak.converter.v4.workspaces.WorkspaceToWorkspaceResourceV4ResponseConverter) AnonymizerUtil.anonymize(com.sequenceiq.cloudbreak.common.anonymizer.AnonymizerUtil.anonymize) GatewayV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.gateway.GatewayV4Response) CloudbreakApiException(com.sequenceiq.cloudbreak.exception.CloudbreakApiException) Logger(org.slf4j.Logger) Collection(java.util.Collection) CustomContainerV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.customcontainer.CustomContainerV4Response) CloudStorageResponse(com.sequenceiq.common.api.cloudstorage.CloudStorageResponse) IOException(java.io.IOException) BlueprintToBlueprintV4ResponseConverter(com.sequenceiq.cloudbreak.converter.v4.blueprint.BlueprintToBlueprintV4ResponseConverter) Collectors(java.util.stream.Collectors) Json(com.sequenceiq.cloudbreak.common.json.Json) Component(org.springframework.stereotype.Component) StackUtil(com.sequenceiq.cloudbreak.util.StackUtil) ServiceEndpointCollector(com.sequenceiq.cloudbreak.service.ServiceEndpointCollector) Entry(java.util.Map.Entry) ClusterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response) GatewayToGatewayV4ResponseConverter(com.sequenceiq.cloudbreak.converter.v4.stacks.cluster.gateway.GatewayToGatewayV4ResponseConverter) ClusterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response) Collection(java.util.Collection) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

ResourceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.ResourceStatus)1 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)1 CustomContainerV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.customcontainer.CustomContainerV4Response)1 GatewayV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.gateway.GatewayV4Response)1 ClusterExposedServiceV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.gateway.topology.ClusterExposedServiceV4Response)1 AnonymizerUtil.anonymize (com.sequenceiq.cloudbreak.common.anonymizer.AnonymizerUtil.anonymize)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 BlueprintToBlueprintV4ResponseConverter (com.sequenceiq.cloudbreak.converter.v4.blueprint.BlueprintToBlueprintV4ResponseConverter)1 RDSConfigToDatabaseV4ResponseConverter (com.sequenceiq.cloudbreak.converter.v4.database.RDSConfigToDatabaseV4ResponseConverter)1 ClusterToClouderaManagerV4ResponseConverter (com.sequenceiq.cloudbreak.converter.v4.stacks.cluster.clouderamanager.ClusterToClouderaManagerV4ResponseConverter)1 GatewayToGatewayV4ResponseConverter (com.sequenceiq.cloudbreak.converter.v4.stacks.cluster.gateway.GatewayToGatewayV4ResponseConverter)1 WorkspaceToWorkspaceResourceV4ResponseConverter (com.sequenceiq.cloudbreak.converter.v4.workspaces.WorkspaceToWorkspaceResourceV4ResponseConverter)1 CUSTOM_QUEUE (com.sequenceiq.cloudbreak.domain.ClusterAttributes.CUSTOM_QUEUE)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 CloudbreakApiException (com.sequenceiq.cloudbreak.exception.CloudbreakApiException)1 ServiceEndpointCollector (com.sequenceiq.cloudbreak.service.ServiceEndpointCollector)1 ProxyConfigDtoService (com.sequenceiq.cloudbreak.service.proxy.ProxyConfigDtoService)1 StringToSecretResponseConverter (com.sequenceiq.cloudbreak.service.secret.model.StringToSecretResponseConverter)1 NullUtil.getIfNotNull (com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull)1