Esempio n. 1
0
 @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;
 }
Esempio n. 2
0
 @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;
 }
Esempio n. 3
0
 @Override
 public UserIdGroupPairType apply(final NetworkPeer peer) {
   return new UserIdGroupPairType(
       peer.getUserQueryKey(), peer.getGroupName(), peer.getGroupId());
 }