Search in sources :

Example 1 with UserNamePasswordV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UserNamePasswordV4Request in project cloudbreak by hortonworks.

the class ClusterCommonService method put.

public FlowIdentifier put(String crn, UpdateClusterV4Request updateJson) {
    Stack stack = stackService.getByCrnWithLists(crn);
    Long stackId = stack.getId();
    MDCBuilder.buildMdcContext(stack);
    UserNamePasswordV4Request userNamePasswordJson = updateJson.getUserNamePassword();
    FlowIdentifier flowIdentifier;
    if (userNamePasswordJson != null) {
        flowIdentifier = clusterManagerUserNamePasswordChange(stack, userNamePasswordJson);
    } else if (updateJson.getStatus() != null) {
        LOGGER.debug("Cluster status update request received. Stack id:  {}, status: {} ", stackId, updateJson.getStatus());
        flowIdentifier = clusterOperationService.updateStatus(stackId, updateJson.getStatus());
    } else if (updateJson.getBlueprintName() != null && updateJson.getHostgroups() != null && stack.getCluster().isCreateFailed()) {
        LOGGER.debug("Cluster rebuild request received. Stack id:  {}", stackId);
        try {
            flowIdentifier = recreateCluster(stack, updateJson);
        } catch (TransactionExecutionException e) {
            throw new TransactionRuntimeExecutionException(e);
        }
    } else if (updateJson.getHostGroupAdjustment() != null) {
        environmentService.checkEnvironmentStatus(stack, EnvironmentStatus.upscalable());
        flowIdentifier = clusterHostgroupAdjustmentChange(stackId, updateJson, stack);
    } else {
        LOGGER.info("Invalid cluster update request received. Stack id: {}", stackId);
        throw new BadRequestException("Invalid update cluster request!");
    }
    return flowIdentifier;
}
Also used : TransactionExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException) UserNamePasswordV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UserNamePasswordV4Request) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) TransactionRuntimeExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)

Example 2 with UserNamePasswordV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UserNamePasswordV4Request in project cloudbreak by hortonworks.

the class StackOperations method putPassword.

public FlowIdentifier putPassword(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid UserNamePasswordV4Request userNamePasswordJson) {
    Stack stack = nameOrCrn.hasName() ? stackService.getByNameInWorkspace(nameOrCrn.getName(), workspaceId) : stackService.getNotTerminatedByCrnInWorkspace(nameOrCrn.getCrn(), workspaceId);
    UpdateClusterV4Request updateClusterJson = userNamePasswordV4RequestToUpdateClusterV4RequestConverter.convert(userNamePasswordJson);
    return clusterCommonService.put(stack.getResourceCrn(), updateClusterJson);
}
Also used : UpdateClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UpdateClusterV4Request) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 3 with UserNamePasswordV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UserNamePasswordV4Request in project cloudbreak by hortonworks.

the class UserNamePasswordV4RequestToUpdateClusterV4RequestConverter method convert.

public UpdateClusterV4Request convert(UserNamePasswordV4Request source) {
    UpdateClusterV4Request updateStackJson = new UpdateClusterV4Request();
    updateStackJson.setUserNamePassword(source);
    return updateStackJson;
}
Also used : UpdateClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UpdateClusterV4Request)

Aggregations

UpdateClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UpdateClusterV4Request)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 UserNamePasswordV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UserNamePasswordV4Request)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)1 TransactionRuntimeExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)1 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)1