Search in sources :

Example 1 with SecurityGroupRule

use of com.cloud.baremetal.networkservice.schema.SecurityGroupRule in project cloudstack by apache.

the class SecurityGroupHttpClient method generateRules.

private List<SecurityGroupRule> generateRules(final List<IpPortAndProto> ipps) {
    List<SecurityGroupRule> rules = new ArrayList<SecurityGroupRule>(ipps.size());
    for (SecurityGroupRulesCmd.IpPortAndProto ipp : ipps) {
        SecurityGroupRule r = new SecurityGroupRule();
        r.setProtocol(ipp.getProto());
        r.setStartPort(ipp.getStartPort());
        r.setEndPort(ipp.getEndPort());
        for (String cidr : ipp.getAllowedCidrs()) {
            r.getIp().add(cidr);
        }
        rules.add(r);
    }
    return rules;
}
Also used : SecurityGroupRulesCmd(com.cloud.agent.api.SecurityGroupRulesCmd) IpPortAndProto(com.cloud.agent.api.SecurityGroupRulesCmd.IpPortAndProto) ArrayList(java.util.ArrayList) SecurityGroupRule(com.cloud.baremetal.networkservice.schema.SecurityGroupRule)

Aggregations

SecurityGroupRulesCmd (com.cloud.agent.api.SecurityGroupRulesCmd)1 IpPortAndProto (com.cloud.agent.api.SecurityGroupRulesCmd.IpPortAndProto)1 SecurityGroupRule (com.cloud.baremetal.networkservice.schema.SecurityGroupRule)1 ArrayList (java.util.ArrayList)1