@Override public Set<String> apply(final NetworkGroup group) { final Set<String> result = Sets.newHashSet(); for (final NetworkRule rule : group.getNetworkRules()) { for (final NetworkPeer peer : rule.getNetworkPeers()) { if (peer.getGroupName() != null) result.add(peer.getGroupName()); } } return result; }
@Override public PacketFilterRule apply(final NetworkRule from) { final PacketFilterRule pfrule = new PacketFilterRule( NetworkGroup.this.getOwnerAccountNumber(), NetworkGroup.this.getDisplayName(), from.getProtocol(), from.getLowPort(), from.getHighPort()); pfrule.getSourceCidrs().addAll(from.getIpRanges()); for (final NetworkPeer peer : from.getNetworkPeers()) pfrule.addPeer(peer.getUserQueryKey(), peer.getGroupName()); return pfrule; }
@Override public UserIdGroupPairType apply(final NetworkPeer peer) { return new UserIdGroupPairType( peer.getUserQueryKey(), peer.getGroupName(), peer.getGroupId()); }