Search in sources :

Example 1 with NotFoundException

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;
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 2 with NotFoundException

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;
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 3 with NotFoundException

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);
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 4 with NotFoundException

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;
}
Also used : HttpClientConfig(com.sequenceiq.cloudbreak.client.HttpClientConfig) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) AmbariClient(com.sequenceiq.ambari.client.AmbariClient)

Example 5 with NotFoundException

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());
}
Also used : SecurityConfig(com.sequenceiq.cloudbreak.domain.SecurityConfig) CertificateResponse(com.sequenceiq.cloudbreak.api.model.CertificateResponse) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Aggregations

NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)50 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)9 Stack (com.sequenceiq.cloudbreak.domain.Stack)8 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)5 ProxyConfig (com.sequenceiq.cloudbreak.domain.ProxyConfig)5 ClusterTemplate (com.sequenceiq.cloudbreak.domain.ClusterTemplate)4 ConstraintTemplate (com.sequenceiq.cloudbreak.domain.ConstraintTemplate)4 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)4 Template (com.sequenceiq.cloudbreak.domain.Template)4 LdapConfig (com.sequenceiq.cloudbreak.domain.LdapConfig)3 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)2 AutoscaleStackResponse (com.sequenceiq.cloudbreak.api.model.AutoscaleStackResponse)2 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)2 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)2 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)2 SecurityGroup (com.sequenceiq.cloudbreak.domain.SecurityGroup)2 CertificateResponse (com.sequenceiq.cloudbreak.api.model.CertificateResponse)1 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)1 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1