Search in sources :

Example 1 with SecurityRuleDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.SecurityRuleDetails in project cloudbreak by hortonworks.

the class SecurityGroupToSecurityGroupDetailsConverter method convert.

@Override
public SecurityGroupDetails convert(SecurityGroup source) {
    SecurityGroupDetails securityGroupDetails = new SecurityGroupDetails();
    securityGroupDetails.setId(source.getId());
    securityGroupDetails.setName(source.getName());
    securityGroupDetails.setDescription(source.getDescription());
    securityGroupDetails.setSecurityGroupId(source.getSecurityGroupId());
    securityGroupDetails.setSecurityRules((List<SecurityRuleDetails>) conversionService.convert(source.getSecurityRules(), TypeDescriptor.forObject(source.getSecurityRules()), TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(SecurityRuleDetails.class))));
    return securityGroupDetails;
}
Also used : SecurityRuleDetails(com.sequenceiq.cloudbreak.structuredevent.event.SecurityRuleDetails) List(java.util.List) SecurityGroupDetails(com.sequenceiq.cloudbreak.structuredevent.event.SecurityGroupDetails)

Example 2 with SecurityRuleDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.SecurityRuleDetails in project cloudbreak by hortonworks.

the class SecurityRuleToSecurityRuleDetailsConverter method convert.

@Override
public SecurityRuleDetails convert(SecurityRule source) {
    SecurityRuleDetails securityRuleDetails = new SecurityRuleDetails();
    securityRuleDetails.setCidr(source.getCidr());
    securityRuleDetails.setProtocol(source.getProtocol());
    securityRuleDetails.setPorts(Arrays.stream(source.getPorts()).collect(Collectors.joining(",")));
    return securityRuleDetails;
}
Also used : SecurityRuleDetails(com.sequenceiq.cloudbreak.structuredevent.event.SecurityRuleDetails)

Aggregations

SecurityRuleDetails (com.sequenceiq.cloudbreak.structuredevent.event.SecurityRuleDetails)2 SecurityGroupDetails (com.sequenceiq.cloudbreak.structuredevent.event.SecurityGroupDetails)1 List (java.util.List)1