Search in sources :

Example 1 with AmbariRepoDetailsJson

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

the class AmbariRepoDetailsToAmbariRepoDetailsRequestConverter method convert.

@Override
public AmbariRepoDetailsJson convert(AmbariRepo source) {
    AmbariRepoDetailsJson ambariRepoDetailsJson = new AmbariRepoDetailsJson();
    ambariRepoDetailsJson.setBaseUrl(source.getBaseUrl());
    ambariRepoDetailsJson.setGpgKeyUrl(source.getGpgKeyUrl());
    ambariRepoDetailsJson.setVersion(source.getVersion());
    return ambariRepoDetailsJson;
}
Also used : AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)

Example 2 with AmbariRepoDetailsJson

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

the class ClusterCreationSetupService method determineAmbariRepoConfig.

private ClusterComponent determineAmbariRepoConfig(Optional<Component> stackAmbariRepoConfig, AmbariRepoDetailsJson ambariRepoDetailsJson, Optional<Component> stackImageComponent, Cluster cluster) throws IOException {
    Json json;
    if (!stackAmbariRepoConfig.isPresent()) {
        AmbariRepo ambariRepo = ambariRepoDetailsJson != null ? conversionService.convert(ambariRepoDetailsJson, AmbariRepo.class) : defaultAmbariRepoService.getDefault(getOsType(stackImageComponent));
        if (ambariRepo == null) {
            throw new BadRequestException(String.format("Couldn't determine Ambari repo for the stack: %s", cluster.getStack().getName()));
        }
        json = new Json(ambariRepo);
    } else {
        json = stackAmbariRepoConfig.get().getAttributes();
    }
    return new ClusterComponent(ComponentType.AMBARI_REPO_DETAILS, json, cluster);
}
Also used : ClusterComponent(com.sequenceiq.cloudbreak.domain.ClusterComponent) AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson) AmbariStackDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson) Json(com.sequenceiq.cloudbreak.domain.json.Json) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo)

Example 3 with AmbariRepoDetailsJson

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

the class AmbariRepoToAmbariRepoDetailsJsonConverter method convert.

@Override
public AmbariRepoDetailsJson convert(AmbariRepo source) {
    AmbariRepoDetailsJson ambariRepoDetailsJson = new AmbariRepoDetailsJson();
    ambariRepoDetailsJson.setVersion(source.getVersion());
    ambariRepoDetailsJson.setBaseUrl(source.getBaseUrl());
    ambariRepoDetailsJson.setGpgKeyUrl(source.getGpgKeyUrl());
    return ambariRepoDetailsJson;
}
Also used : AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)

Example 4 with AmbariRepoDetailsJson

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

the class ClusterToClusterResponseConverter method convertComponentConfig.

private void convertComponentConfig(ClusterResponse response, Cluster source) {
    try {
        AmbariRepo ambariRepo = componentConfigProvider.getAmbariRepo(source.getComponents());
        if (ambariRepo != null) {
            AmbariRepoDetailsJson ambariRepoDetailsJson = getConversionService().convert(ambariRepo, AmbariRepoDetailsJson.class);
            response.setAmbariRepoDetailsJson(ambariRepoDetailsJson);
        }
        StackRepoDetails stackRepoDetails = componentConfigProvider.getStackRepo(source.getComponents());
        if (stackRepoDetails != null) {
            AmbariStackDetailsResponse ambariRepoDetailsJson = getConversionService().convert(stackRepoDetails, AmbariStackDetailsResponse.class);
            response.setAmbariStackDetails(ambariRepoDetailsJson);
        }
    } catch (RuntimeException e) {
        LOGGER.error("Failed to convert dynamic component.", e);
    }
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) AmbariStackDetailsResponse(com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsResponse) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo) AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)

Aggregations

AmbariRepoDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)4 AmbariRepo (com.sequenceiq.cloudbreak.cloud.model.AmbariRepo)2 AmbariStackDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson)1 AmbariStackDetailsResponse (com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsResponse)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)1 ClusterComponent (com.sequenceiq.cloudbreak.domain.ClusterComponent)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1