use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackV2Controller method putStop.
@Override
public Response putStop(String name) {
IdentityUser user = authenticatedUserService.getCbUser();
Stack stack = stackService.getPublicStack(name, user);
if (!cloudParameterCache.isStartStopSupported(stack.cloudPlatform())) {
throw new BadRequestException(String.format("Stop is not supported on %s cloudplatform", stack.cloudPlatform()));
}
UpdateStackJson updateStackJson = new UpdateStackJson();
updateStackJson.setStatus(StatusRequest.STOPPED);
updateStackJson.setWithClusterEvent(true);
return stackCommonService.put(stack.getId(), updateStackJson);
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackV2Controller method putPassword.
@Override
public Response putPassword(String name, UserNamePasswordJson userNamePasswordJson) {
IdentityUser user = authenticatedUserService.getCbUser();
Stack stack = stackService.getPublicStack(name, user);
UpdateClusterJson updateClusterJson = conversionService.convert(userNamePasswordJson, UpdateClusterJson.class);
return clusterCommonController.put(stack.getId(), updateClusterJson);
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackV2Controller method putRepair.
@Override
public Response putRepair(String name) {
IdentityUser user = authenticatedUserService.getCbUser();
Stack stack = stackService.getPublicStack(name, user);
UpdateStackJson updateStackJson = new UpdateStackJson();
updateStackJson.setStatus(StatusRequest.REPAIR_FAILED_NODES);
updateStackJson.setWithClusterEvent(true);
return stackCommonService.put(stack.getId(), updateStackJson);
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackV2Controller method putScaling.
@Override
public Response putScaling(String name, StackScaleRequestV2 updateRequest) {
IdentityUser user = authenticatedUserService.getCbUser();
Stack stack = stackService.getPublicStack(name, user);
if (!cloudParameterCache.isScalingSupported(stack.cloudPlatform())) {
throw new BadRequestException(String.format("Scaling is not supported on %s cloudplatform", stack.cloudPlatform()));
}
updateRequest.setStackId(stack.getId());
UpdateStackJson updateStackJson = conversionService.convert(updateRequest, UpdateStackJson.class);
if (updateStackJson.getInstanceGroupAdjustment().getScalingAdjustment() > 0) {
return stackCommonService.put(stack.getId(), updateStackJson);
} else {
UpdateClusterJson updateClusterJson = conversionService.convert(updateRequest, UpdateClusterJson.class);
return clusterCommonController.put(stack.getId(), updateClusterJson);
}
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackV2Controller method putReinstall.
@Override
public Response putReinstall(String name, ReinstallRequestV2 reinstallRequestV2) {
IdentityUser user = authenticatedUserService.getCbUser();
reinstallRequestV2.setAccount(user.getAccount());
Stack stack = stackService.getPublicStack(name, user);
UpdateClusterJson updateClusterJson = conversionService.convert(reinstallRequestV2, UpdateClusterJson.class);
return clusterCommonController.put(stack.getId(), updateClusterJson);
}
Aggregations