>           retry(operationDonePredicate, operationCompleteCheckTimeout, 
> operationCompleteCheckInterval,
>                   MILLISECONDS).apply(operation);
>           checkState(!operation.get().getHttpError().isPresent(),"Could not 
> create firewall, operation failed" + operation);
> +      } else {
> +         rules.addAll(firewall.getAllowed());
> +         FirewallOptions firewallOptions = new FirewallOptions()
> +                 .name(firewallName)
> +                 .network(network.getSelfLink())
> +                 .allowedRules(rules)
> +                 .sourceTags(templateOptions.getTags())
> +                 .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, 
> EXTERIOR_RANGE));
> +         AtomicReference<Operation> operation = 
> newReference(firewallApi.patch(firewallOptions.getName(), firewallOptions));
> +         retry(operationDonePredicate, operationCompleteCheckTimeout, 
> operationCompleteCheckInterval,
> +                 MILLISECONDS).apply(operation);
> +         checkState(!operation.get().getHttpError().isPresent(),"Could not 
> patch firewall, operation failed" + operation);

I haven't checked in full detail, but would this work?
```
List... rules = ...
FirewallOptions firewallOptions = ... // without allowedRules
if (firewall == null) {
  firewallOptions.allowedRules(rules)
  ...
} else {
  rules.addAll(...)
  firewallOptions.allowedRules(rules)
  ...
}
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/20/files#r9468874

Reply via email to