MDCBuilder.buildMdcContext(stack);
AmbariClient ambariClient = createAmbariClient(ambariIp);
try {
String clusterJson = ambariClient.getClusterAsJson();
if (clusterJson == null) {
throw new InternalServerException(String.format("Cluster response coming from Ambari server was null. [Ambari Server IP: '%s']", ambariIp));
}
return clusterJson;
} catch (HttpResponseException e) {
if ("Not Found".equals(e.getMessage())) {
throw new NotFoundException("Ambari blueprint not found.", e);
} else {
throw new InternalServerException("Something went wrong", e);
}
}
}