Search in sources :

Example 1 with Template

use of com.sequenceiq.cloudbreak.domain.Template in project cloudbreak by hortonworks.

the class TestUtil method awsTemplate.

public static Template awsTemplate(Long id) {
    Template awsTemplate = new Template();
    awsTemplate.setInstanceType("c3.2xlarge");
    awsTemplate.setId(id);
    awsTemplate.setCloudPlatform(AWS);
    awsTemplate.setVolumeCount(1);
    awsTemplate.setVolumeSize(100);
    awsTemplate.setVolumeType("standard");
    awsTemplate.setId(1L);
    awsTemplate.setName(DUMMY_NAME);
    awsTemplate.setDescription(DUMMY_DESCRIPTION);
    awsTemplate.setPublicInAccount(true);
    return awsTemplate;
}
Also used : Template(com.sequenceiq.cloudbreak.domain.Template)

Example 2 with Template

use of com.sequenceiq.cloudbreak.domain.Template in project cloudbreak by hortonworks.

the class TemplateService method get.

public Template get(Long id) {
    Template template = templateRepository.findOne(id);
    if (template == null) {
        throw new NotFoundException(String.format(TEMPLATE_NOT_FOUND_MSG, id));
    }
    authorizationService.hasReadPermission(template);
    return template;
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) Template(com.sequenceiq.cloudbreak.domain.Template)

Example 3 with Template

use of com.sequenceiq.cloudbreak.domain.Template in project cloudbreak by hortonworks.

the class TemplateService method delete.

public void delete(String templateName, IdentityUser user) {
    Template template = templateRepository.findByNameInAccount(templateName, user.getAccount(), user.getUserId());
    if (template == null) {
        throw new NotFoundException(String.format(TEMPLATE_NOT_FOUND_MSG, templateName));
    }
    delete(template);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) Template(com.sequenceiq.cloudbreak.domain.Template)

Example 4 with Template

use of com.sequenceiq.cloudbreak.domain.Template in project cloudbreak by hortonworks.

the class TemplateService method delete.

public void delete(Long templateId, IdentityUser user) {
    Template template = templateRepository.findByIdInAccount(templateId, user.getAccount());
    if (template == null) {
        throw new NotFoundException(String.format(TEMPLATE_NOT_FOUND_MSG, templateId));
    }
    delete(template);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) Template(com.sequenceiq.cloudbreak.domain.Template)

Example 5 with Template

use of com.sequenceiq.cloudbreak.domain.Template in project cloudbreak by hortonworks.

the class TemplateController method getPrivates.

@Override
public Set<TemplateResponse> getPrivates() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<Template> templates = templateService.retrievePrivateTemplates(user);
    return convert(templates);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Template(com.sequenceiq.cloudbreak.domain.Template)

Aggregations

Template (com.sequenceiq.cloudbreak.domain.Template)25 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)6 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)5 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)5 Credential (com.sequenceiq.cloudbreak.domain.Credential)4 CloudVmTypes (com.sequenceiq.cloudbreak.cloud.model.CloudVmTypes)3 Json (com.sequenceiq.cloudbreak.domain.json.Json)3 Test (org.junit.Test)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 Maps.newHashMap (com.google.common.collect.Maps.newHashMap)2 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)2 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)2 InstanceStatus (com.sequenceiq.cloudbreak.cloud.model.InstanceStatus)2 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)2 Platform (com.sequenceiq.cloudbreak.cloud.model.Platform)2 PlatformDisks (com.sequenceiq.cloudbreak.cloud.model.PlatformDisks)2 VmTypeMeta (com.sequenceiq.cloudbreak.cloud.model.VmTypeMeta)2 VolumeParameterConfig (com.sequenceiq.cloudbreak.cloud.model.VolumeParameterConfig)2 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 SecurityGroup (com.sequenceiq.cloudbreak.domain.SecurityGroup)2