Search in sources :

Example 26 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class RecipeService method delete.

public void delete(String name, IdentityUser user) {
    Recipe recipe = recipeRepository.findByNameInAccount(name, user.getAccount());
    if (recipe == null) {
        throw new NotFoundException(String.format("Recipe '%s' not found.", name));
    }
    delete(recipe);
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 27 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class RecipeService method get.

public Recipe get(Long id) {
    Recipe recipe = recipeRepository.findOne(id);
    if (recipe == null) {
        throw new NotFoundException(String.format("Recipe '%s' not found", id));
    }
    authorizationService.hasReadPermission(recipe);
    return recipe;
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 28 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class ProxyConfigService method delete.

public void delete(Long id, IdentityUser user) {
    ProxyConfig proxyConfig = proxyConfigRepository.findByIdAndAccount(id, user.getAccount());
    if (proxyConfig == null) {
        throw new NotFoundException(String.format("Proxy configuration '%s' not found.", id));
    }
    authorizationService.hasWritePermission(proxyConfig);
    delete(proxyConfig);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig)

Example 29 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class ProxyConfigService method get.

public ProxyConfig get(Long id) {
    ProxyConfig proxyConfig = proxyConfigRepository.findOne(id);
    if (proxyConfig == null) {
        throw new NotFoundException(String.format("Proxy configuration '%s' not found.", id));
    }
    authorizationService.hasReadPermission(proxyConfig);
    return proxyConfig;
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig)

Example 30 with NotFoundException

use of com.sequenceiq.cloudbreak.controller.NotFoundException in project cloudbreak by hortonworks.

the class ProxyConfigService method delete.

public void delete(String name, IdentityUser user) {
    ProxyConfig proxyConfig = proxyConfigRepository.findByNameBasedOnAccount(name, user.getAccount(), user.getUserId());
    if (proxyConfig == null) {
        throw new NotFoundException(String.format("Proxy configuration '%s' not found.", name));
    }
    authorizationService.hasWritePermission(proxyConfig);
    delete(proxyConfig);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig)

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