ClusterActionEvent event = entry.getValue();
ClusterSpec clusterSpec = event.getClusterSpec();
Map<String, List<String>> firewallRules = clusterSpec.getFirewallRules();
for (String role: firewallRules.keySet()) {
Rule rule = Rule.create();
if (role == null) {
rule.destination(event.getCluster().getInstances());
} else {
rule.destination(RolePredicates.role(role));
}
List<String> ports = firewallRules.get(role);
rule.ports(Ints.toArray(Collections2.transform(ports, new Function<String,Integer>() {
@Override
public Integer apply(String input) {
return Integer.valueOf(input);
}
})));