use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser 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.common.model.user.IdentityUser 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.common.model.user.IdentityUser in project cloudbreak by hortonworks.
the class StackV2Controller method postStackForBlueprint.
@Override
public GeneratedBlueprintResponse postStackForBlueprint(StackV2Request stackRequest) throws Exception {
IdentityUser user = authenticatedUserService.getCbUser();
stackRequest.setAccount(user.getAccount());
stackRequest.setOwner(user.getUserId());
BlueprintPreparationObject blueprintPreparationObject = conversionService.convert(stackRequest, BlueprintPreparationObject.class);
String blueprintText = centralBlueprintUpdater.getBlueprintText(blueprintPreparationObject);
return new GeneratedBlueprintResponse(blueprintText);
}
use of com.sequenceiq.cloudbreak.common.model.user.IdentityUser 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.common.model.user.IdentityUser 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);
}
}
Aggregations