use of com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse in project cloudbreak by hortonworks.
the class ClusterSecurityService method tryResolve.
public AmbariStack tryResolve(Ambari ambari) {
try {
String host = ambari.getHost();
String user = ambari.getUser();
String pass = ambari.getPass();
AmbariAddressJson ambariAddressJson = new AmbariAddressJson();
ambariAddressJson.setAmbariAddress(host);
StackResponse stack = cloudbreakClient.stackV1Endpoint().getStackForAmbari(ambariAddressJson);
Long id = stack.getId();
SecurityConfig securityConfig = tlsSecurityService.prepareSecurityConfig(id);
if (user == null || pass == null) {
AutoscaleClusterResponse clusterResponse = cloudbreakClient.clusterEndpoint().getForAutoscale(id);
return new AmbariStack(new Ambari(host, ambari.getPort(), clusterResponse.getUserName(), clusterResponse.getPassword()), id, securityConfig);
} else {
return new AmbariStack(ambari, id, securityConfig);
}
} catch (RuntimeException ignored) {
return new AmbariStack(ambari);
}
}
use of com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse in project cloudbreak by hortonworks.
the class ClusterToAutoscaleClusterResponseJsonConverter method convert.
@Override
public AutoscaleClusterResponse convert(Cluster source) {
AutoscaleClusterResponse response = getConversionService().convert(source, AutoscaleClusterResponse.class);
response.setPassword(source.getPassword());
return response;
}
use of com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse in project cloudbreak by hortonworks.
the class ClusterV1Controller method getForAutoscale.
@Override
public AutoscaleClusterResponse getForAutoscale(Long stackId) {
Stack stack = stackService.getForAutoscale(stackId);
AutoscaleClusterResponse cluster = clusterService.retrieveClusterForCurrentUser(stackId, AutoscaleClusterResponse.class);
String clusterJson = clusterService.getClusterJson(stack.getAmbariIp(), stackId);
return clusterService.getClusterResponse(cluster, clusterJson);
}
Aggregations