> retry(operationDonePredicate, operationCompleteCheckTimeout,
> operationCompleteCheckInterval,
> MILLISECONDS).apply(operation);
> - checkState(!operation.get().getHttpError().isPresent(),"Could not
> create firewall, operation failed" + operation);
> + checkState(!operation.get().getHttpError().isPresent(), "Could not
> patch firewall, operation failed " + operation);
> + }
> + }
> +
> + private Set<Rule> createFirewallRulesFromInboundPorts(int[] inboundPorts)
> {
> + Set<Rule> rules = Sets.newLinkedHashSet();
> + for (int port : inboundPorts) {
> + rules.add(Rule.permitTcpRule(port));
This shouldn't add one rule per port. Rules can specify arrays of ranges. We
need some logic to find the minimal number of rules for the given inbound
ports. We should specify one rule for Tcp and one rule for Udp and each of
those rules should enumerate all the ports.
using the ports form this pastebin as an example: http://pastebin.com/3WxHWj2X
[22, 4369, 6000-7999, 8087, 8093, 8098-8099, 8985] covers all the ports
```
"allowed": [
{
"IPProtocol": "tcp",
"ports":["22", "4369", "6000-7999", "8087", "8093", "8098-8099", "8985"],
},
{
"IPProtocol": "udp",
"ports": ["22", "4369", "6000-7999", "8087", "8093", "8098-8099", "8985"] ,
}
]
```
https://cloud.google.com/compute/docs/networking#firewalls_1 is a good resource
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/20/files#r28387912