use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class BlueprintService method delete.
public void delete(Long id, IdentityUser user) {
Blueprint blueprint = blueprintRepository.findByIdInAccount(id, user.getAccount());
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", id));
}
delete(blueprint);
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class BlueprintService method get.
public Blueprint get(String name, String account) {
Blueprint blueprint = blueprintRepository.findOneByName(name, account);
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found in %s account.", name, account));
}
authorizationService.hasReadPermission(blueprint);
return blueprint;
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class AmbariClusterService method getClusterJson.
@Override
public String getClusterJson(String ambariIp, Long stackId) {
try {
AmbariClient ambariClient = getAmbariClient(stackId);
String clusterJson = ambariClient.getClusterAsJson();
if (clusterJson == null) {
throw new BadRequestException(String.format("Cluster response coming from Ambari server was null. [Ambari Server IP: '%s']", ambariIp));
}
return clusterJson;
} catch (HttpResponseException e) {
if ("Not Found".equals(e.getMessage())) {
throw new NotFoundException("Ambari validation not found.", e);
} else {
String errorMessage = AmbariClientExceptionUtil.getErrorMessage(e);
throw new CloudbreakServiceException("Could not get Cluster from Ambari as JSON: " + errorMessage, e);
}
}
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class OrchestratorRecipeExecutor method preTerminationRecipesOnNodes.
public void preTerminationRecipesOnNodes(Stack stack, Set<Node> nodes) throws CloudbreakException {
if (stack.getCluster() == null) {
throw new NotFoundException("Cluster does not found, pre-termination will not be run.");
}
HostOrchestrator hostOrchestrator = hostOrchestratorResolver.get(stack.getOrchestrator().getType());
GatewayConfig gatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
try {
hostOrchestrator.preTerminationRecipes(gatewayConfig, nodes, clusterDeletionBasedModel(stack.getId(), stack.getCluster().getId()));
} catch (CloudbreakOrchestratorFailedException e) {
throw new CloudbreakException(e);
}
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class ClusterTemplateService method getByName.
public ClusterTemplate getByName(String name, IdentityUser user) {
ClusterTemplate clusterTemplate = clusterTemplateRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
if (clusterTemplate == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", name));
}
authorizationService.hasReadPermission(clusterTemplate);
return clusterTemplate;
}
Aggregations