Search in sources :

Example 1 with AutoscaleClusterResponse

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);
    }
}
Also used : AmbariStack(com.sequenceiq.periscope.model.AmbariStack) AutoscaleClusterResponse(com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse) AmbariAddressJson(com.sequenceiq.cloudbreak.api.model.AmbariAddressJson) SecurityConfig(com.sequenceiq.periscope.domain.SecurityConfig) Ambari(com.sequenceiq.periscope.domain.Ambari) StackResponse(com.sequenceiq.cloudbreak.api.model.StackResponse)

Example 2 with AutoscaleClusterResponse

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;
}
Also used : AutoscaleClusterResponse(com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse)

Example 3 with AutoscaleClusterResponse

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);
}
Also used : AutoscaleClusterResponse(com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Aggregations

AutoscaleClusterResponse (com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse)3 AmbariAddressJson (com.sequenceiq.cloudbreak.api.model.AmbariAddressJson)1 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 Ambari (com.sequenceiq.periscope.domain.Ambari)1 SecurityConfig (com.sequenceiq.periscope.domain.SecurityConfig)1 AmbariStack (com.sequenceiq.periscope.model.AmbariStack)1