Search in sources :

Example 1 with FirewallRules

use of com.cloud.agent.resource.virtualnetwork.model.FirewallRules in project cloudstack by apache.

the class SetFirewallRulesConfigItem method generateConfig.

@Override
public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
    final SetFirewallRulesCommand command = (SetFirewallRulesCommand) cmd;
    final List<FirewallRule> rules = new ArrayList<FirewallRule>();
    for (final FirewallRuleTO rule : command.getRules()) {
        final FirewallRule fwRule = new FirewallRule(rule.getId(), rule.getSrcVlanTag(), rule.getSrcIp(), rule.getProtocol(), rule.getSrcPortRange(), rule.revoked(), rule.isAlreadyAdded(), rule.getSourceCidrList(), rule.getPurpose().toString(), rule.getIcmpType(), rule.getIcmpCode(), rule.getTrafficType().toString(), rule.getGuestCidr(), rule.isDefaultEgressPolicy());
        rules.add(fwRule);
    }
    final FirewallRules ruleSet = new FirewallRules(rules.toArray(new FirewallRule[rules.size()]));
    return generateConfigItems(ruleSet);
}
Also used : ArrayList(java.util.ArrayList) FirewallRuleTO(com.cloud.agent.api.to.FirewallRuleTO) SetFirewallRulesCommand(com.cloud.agent.api.routing.SetFirewallRulesCommand) FirewallRule(com.cloud.agent.resource.virtualnetwork.model.FirewallRule) FirewallRules(com.cloud.agent.resource.virtualnetwork.model.FirewallRules)

Aggregations

SetFirewallRulesCommand (com.cloud.agent.api.routing.SetFirewallRulesCommand)1 FirewallRuleTO (com.cloud.agent.api.to.FirewallRuleTO)1 FirewallRule (com.cloud.agent.resource.virtualnetwork.model.FirewallRule)1 FirewallRules (com.cloud.agent.resource.virtualnetwork.model.FirewallRules)1 ArrayList (java.util.ArrayList)1