@Override public boolean apply(NetworkSecurityRule input) { NetworkSecurityRuleProperties props = input.properties(); return Objects.equal(portRange, props.destinationPortRange()) && Objects.equal(Protocol.fromValue(protocol.name()), props.protocol()) && Objects.equal(Direction.Inbound, props.direction()) // && Objects.equal(Access.Allow, props.access()) && any(ipRanges, equalTo(props.sourceAddressPrefix().replace("*", "0.0.0.0/0"))); } });
@Override public boolean apply(NetworkSecurityRule input) { NetworkSecurityRuleProperties props = input.properties(); return Objects.equal(portRange, props.destinationPortRange()) && Objects.equal(Protocol.fromValue(protocol.name()), props.protocol()) && Objects.equal(Direction.Inbound, props.direction()) // && Objects.equal(Access.Allow, props.access()) && any(ipRanges, equalTo(props.sourceAddressPrefix().replace("*", "0.0.0.0/0"))); } });
@Override public IpPermission apply(final NetworkSecurityRule rule) { if (!InboundRule.apply(rule)) { logger.warn(">> ignoring non-inbound network security rule %s...", rule.name()); return null; } IpPermission permissions = IpPermissions.permit(IpProtocol.fromValue(rule.properties().protocol().name())); String portRange = rule.properties().destinationPortRange(); if (!"*".equals(portRange)) { String[] range = portRange.split("-"); // One single element if it is a single port permissions = PortSelection.class.cast(permissions).fromPort(Integer.parseInt(range[0])) .to(Integer.parseInt(range[range.length - 1])); } if (!"*".equals(rule.properties().sourceAddressPrefix())) { permissions = ToSourceSelection.class.cast(permissions).originatingFromCidrBlock( rule.properties().sourceAddressPrefix()); } return permissions; }
@Override public IpPermission apply(final NetworkSecurityRule rule) { if (!InboundRule.apply(rule)) { logger.warn(">> ignoring non-inbound network security rule %s...", rule.name()); return null; } IpPermission permissions = IpPermissions.permit(IpProtocol.fromValue(rule.properties().protocol().name())); String portRange = rule.properties().destinationPortRange(); if (!"*".equals(portRange)) { String[] range = portRange.split("-"); // One single element if it is a single port permissions = PortSelection.class.cast(permissions).fromPort(Integer.parseInt(range[0])) .to(Integer.parseInt(range[range.length - 1])); } if (!"*".equals(rule.properties().sourceAddressPrefix())) { permissions = ToSourceSelection.class.cast(permissions).originatingFromCidrBlock( rule.properties().sourceAddressPrefix()); } return permissions; }