Search in sources :

Example 1 with UserNamePasswordJson

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

the class ClusterCommonService method put.

public Response put(Long stackId, UpdateClusterJson updateJson) {
    Stack stack = stackService.get(stackId);
    MDCBuilder.buildMdcContext(stack);
    UserNamePasswordJson userNamePasswordJson = updateJson.getUserNamePasswordJson();
    if (userNamePasswordJson != null) {
        ambariUserNamePasswordChange(stackId, stack, userNamePasswordJson);
        return Response.status(Status.NO_CONTENT).build();
    }
    if (updateJson.getStatus() != null) {
        LOGGER.info("Cluster status update request received. Stack id:  {}, status: {} ", stackId, updateJson.getStatus());
        clusterService.updateStatus(stackId, updateJson.getStatus());
        return Response.status(Status.NO_CONTENT).build();
    }
    if (updateJson.getBlueprintId() != null && updateJson.getHostgroups() != null && stack.getCluster().isCreateFailed()) {
        LOGGER.info("Cluster rebuild request received. Stack id:  {}", stackId);
        recreateCluster(stackId, updateJson);
        return Response.status(Status.NO_CONTENT).build();
    }
    if (updateJson.getHostGroupAdjustment() != null) {
        clusterHostgroupAdjustmentChange(stackId, updateJson, stack);
        return Response.status(Status.NO_CONTENT).build();
    }
    LOGGER.error("Invalid cluster update request received. Stack id: {}", stackId);
    throw new BadRequestException("Invalid update cluster request!");
}
Also used : UserNamePasswordJson(com.sequenceiq.cloudbreak.api.model.UserNamePasswordJson) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Aggregations

UserNamePasswordJson (com.sequenceiq.cloudbreak.api.model.UserNamePasswordJson)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1