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;
}
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;
}
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);
}
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);
}
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);
}
Aggregations