use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class BlueprintService method getByName.
public Blueprint getByName(String name, IdentityUser user) {
Blueprint blueprint = blueprintRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", name));
}
authorizationService.hasReadPermission(blueprint);
return blueprint;
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class BlueprintService method get.
public Blueprint get(Long id) {
Blueprint blueprint = blueprintRepository.findOne(id);
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", id));
}
authorizationService.hasReadPermission(blueprint);
return blueprint;
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class BlueprintService method delete.
public void delete(String name, IdentityUser user) {
Blueprint blueprint = blueprintRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", name));
}
delete(blueprint);
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class AmbariClusterService method getAmbariClient.
private AmbariClient getAmbariClient(Stack stack) {
if (stack.getAmbariIp() == null) {
throw new NotFoundException(String.format("Ambari server is not available for the stack.[id: %s]", stack.getId()));
}
HttpClientConfig httpClientConfig = tlsSecurityService.buildTLSClientConfigForPrimaryGateway(stack.getId(), stack.getAmbariIp());
AmbariClient ambariClient = ambariClientProvider.getAmbariClient(httpClientConfig, stack.getGatewayPort(), stack.getCluster());
return ambariClient;
}
use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.
the class TlsSecurityService method getCertificates.
public CertificateResponse getCertificates(Long stackId) {
SecurityConfig securityConfig = securityConfigRepository.findOneByStackId(stackId);
if (securityConfig == null) {
throw new NotFoundException("Security config doesn't exist.");
}
String serverCert = instanceMetaDataRepository.getServerCertByStackId(stackId);
if (serverCert == null) {
throw new NotFoundException("Server certificate was not found.");
}
return new CertificateResponse(decodeBase64(serverCert), securityConfig.getClientKeyDecoded().getBytes(), securityConfig.getClientCertDecoded().getBytes());
}
Aggregations