use of com.sequenceiq.cloudbreak.domain.SecurityGroup in project cloudbreak by hortonworks.
the class SecurityGroupController method convert.
private SecurityGroup convert(SecurityGroupRequest securityGroupRequest, boolean publicInAccount) {
SecurityGroup securityGroup = conversionService.convert(securityGroupRequest, SecurityGroup.class);
securityGroup.setPublicInAccount(publicInAccount);
return securityGroup;
}
use of com.sequenceiq.cloudbreak.domain.SecurityGroup in project cloudbreak by hortonworks.
the class SecurityGroupController method createSecurityGroup.
private SecurityGroupResponse createSecurityGroup(IdentityUser user, SecurityGroupRequest securityGroupRequest, boolean publicInAccount) {
SecurityGroup securityGroup = convert(securityGroupRequest, publicInAccount);
securityGroup = securityGroupService.create(user, securityGroup);
notify(user, ResourceEvent.SECURITY_GROUP_CREATED);
return conversionService.convert(securityGroup, SecurityGroupResponse.class);
}
use of com.sequenceiq.cloudbreak.domain.SecurityGroup in project cloudbreak by hortonworks.
the class DefaultSecurityGroupCreator method createSecurityGroup.
private SecurityGroup createSecurityGroup(IdentityUser user, String platform, String name, String description) {
SecurityGroup securityGroup = new SecurityGroup();
securityGroup.setName(name);
securityGroup.setOwner(user.getUserId());
securityGroup.setAccount(user.getAccount());
securityGroup.setDescription(description);
securityGroup.setPublicInAccount(true);
securityGroup.setCloudPlatform(platform);
securityGroup.setStatus(ResourceStatus.DEFAULT);
return securityGroup;
}
use of com.sequenceiq.cloudbreak.domain.SecurityGroup in project cloudbreak by hortonworks.
the class DefaultSecurityGroupCreator method addSecurityGroup.
private void addSecurityGroup(IdentityUser user, String platform, String name, Iterable<Port> securityGroupPorts, String securityGroupDesc) {
SecurityGroup onlySshAndSsl = createSecurityGroup(user, platform, name, securityGroupDesc);
SecurityRule sshAndSslRule = createSecurityRule(concatenatePorts(securityGroupPorts), onlySshAndSsl);
onlySshAndSsl.setSecurityRules(new HashSet<>(Collections.singletonList(sshAndSslRule)));
securityGroupService.create(user, onlySshAndSsl);
}
use of com.sequenceiq.cloudbreak.domain.SecurityGroup in project cloudbreak by hortonworks.
the class SecurityGroupService method get.
public SecurityGroup get(Long id) {
SecurityGroup securityGroup = groupRepository.findById(id);
if (securityGroup == null) {
throw new NotFoundException(String.format("SecurityGroup '%s' not found", id));
}
authorizationService.hasReadPermission(securityGroup);
return securityGroup;
}
Aggregations