Search in sources :

Example 1 with CustomContainerResponse

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

the class ClusterToClusterResponseConverter method convertContainerConfig.

private void convertContainerConfig(Cluster source, ClusterResponse clusterResponse) {
    Json customContainerDefinition = source.getCustomContainerDefinition();
    if (customContainerDefinition != null && StringUtils.isNoneEmpty(customContainerDefinition.getValue())) {
        try {
            Map<String, String> map = customContainerDefinition.get(Map.class);
            Map<String, String> result = new HashMap<>();
            for (Entry<String, String> stringStringEntry : map.entrySet()) {
                result.put(stringStringEntry.getKey(), stringStringEntry.getValue());
            }
            clusterResponse.setCustomContainers(new CustomContainerResponse(result));
        } catch (IOException e) {
            LOGGER.error("Failed to add customContainerDefinition to response", e);
            throw new CloudbreakApiException("Failed to add customContainerDefinition to response", e);
        }
    }
}
Also used : HashMap(java.util.HashMap) CustomContainerResponse(com.sequenceiq.cloudbreak.api.model.CustomContainerResponse) AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson) GatewayJson(com.sequenceiq.cloudbreak.api.model.GatewayJson) Json(com.sequenceiq.cloudbreak.domain.json.Json) BlueprintInputJson(com.sequenceiq.cloudbreak.api.model.BlueprintInputJson) IOException(java.io.IOException) CloudbreakApiException(com.sequenceiq.cloudbreak.controller.CloudbreakApiException)

Aggregations

AmbariRepoDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)1 BlueprintInputJson (com.sequenceiq.cloudbreak.api.model.BlueprintInputJson)1 CustomContainerResponse (com.sequenceiq.cloudbreak.api.model.CustomContainerResponse)1 GatewayJson (com.sequenceiq.cloudbreak.api.model.GatewayJson)1 CloudbreakApiException (com.sequenceiq.cloudbreak.controller.CloudbreakApiException)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1