for (EC2SecurityGroup group : groups) {
CloudStackKeyValue pair = new CloudStackKeyValue();
pair.setKeyValue(group.getAccount(), group.getName());
secGroupList.add(pair);
}
CloudStackSecurityGroupIngress resp = null;
if (ipPerm.getProtocol().equalsIgnoreCase("icmp")) {
resp = getApi().authorizeSecurityGroupIngress(null, constructCIDRList(ipPerm.getIpRangeSet()), null, null,
ipPerm.getToPort().toString(), ipPerm.getFromPort().toString(), ipPerm.getProtocol(), null,
request.getName(), null, secGroupList);
} else {
resp = getApi().authorizeSecurityGroupIngress(null, constructCIDRList(ipPerm.getIpRangeSet()), null,
ipPerm.getToPort().longValue(), null, null, ipPerm.getProtocol(), null, request.getName(),
ipPerm.getFromPort().longValue(), secGroupList);
}
if (resp != null && resp.getRuleId() != null) {
return true;
}
return false;
}
} catch(Exception e) {