use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackService method getPublicStack.
public Stack getPublicStack(String name, IdentityUser identityUser) {
Stack stack = stackRepository.findByNameInAccount(name, identityUser.getAccount());
if (stack == null) {
throw new NotFoundException(String.format(STACK_NOT_FOUND_EXCEPTION_FORMAT_TEXT, name));
}
authorizationService.hasReadPermission(stack);
return stack;
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackService method getPublicStackJsonByName.
public StackResponse getPublicStackJsonByName(String name, IdentityUser identityUser, Collection<String> entries) {
Stack stack = stackRepository.findByNameInAccountWithLists(name, identityUser.getAccount());
if (stack == null) {
throw new NotFoundException(String.format(STACK_NOT_FOUND_EXCEPTION_FORMAT_TEXT, name));
}
authorizationService.hasReadPermission(stack);
StackResponse stackResponse = conversionService.convert(stack, StackResponse.class);
stackResponse = stackResponseDecorator.decorate(stackResponse, stack, entries);
return stackResponse;
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackService method updateStatus.
@Transactional(TxType.NEVER)
public void updateStatus(Long stackId, StatusRequest status, boolean updateCluster) {
Stack stack = getByIdWithLists(stackId);
Cluster cluster = null;
if (stack.getCluster() != null) {
cluster = clusterRepository.findOneWithLists(stack.getCluster().getId());
}
switch(status) {
case SYNC:
sync(stack, false);
break;
case FULL_SYNC:
sync(stack, true);
break;
case REPAIR_FAILED_NODES:
repairFailedNodes(stack);
break;
case STOPPED:
stop(stack, cluster, updateCluster);
break;
case STARTED:
start(stack, cluster, updateCluster);
break;
default:
throw new BadRequestException("Cannot update the status of stack because status request not valid.");
}
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackService method delete.
public void delete(String name, IdentityUser user, Boolean forced, Boolean deleteDependencies) {
Stack stack = stackRepository.findByNameInAccountOrOwner(name, user.getAccount(), user.getUserId());
if (stack == null) {
throw new NotFoundException(String.format(STACK_NOT_FOUND_EXCEPTION_FORMAT_TEXT, name));
}
delete(stack, forced, deleteDependencies);
}
use of com.sequenceiq.cloudbreak.domain.Stack in project cloudbreak by hortonworks.
the class StackService method delete.
public void delete(Long id, IdentityUser user, Boolean forced, Boolean deleteDependencies) {
Stack stack = stackRepository.findByIdInAccount(id, user.getAccount());
if (stack == null) {
throw new NotFoundException(String.format(STACK_NOT_FOUND_EXCEPTION_FORMAT_TEXT, id));
}
delete(stack, forced, deleteDependencies);
}
Aggregations