*/
private void getOrCreateFirewalls(GoogleComputeEngineTemplateOptions templateOptions, Network network,
FirewallTagNamingConvention naming) {
String projectName = userProject.get();
FirewallApi firewallApi = api.getFirewallApiForProject(projectName);
Set<AtomicReference<Operation>> operations = Sets.newHashSet();
for (Integer port : templateOptions.getInboundPorts()) {
String name = naming.name(port);
Firewall firewall = firewallApi.get(name);
if (firewall == null) {
ImmutableSet<Firewall.Rule> rules = ImmutableSet.of(Firewall.Rule.permitTcpRule(port), Firewall.Rule.permitUdpRule(port));
FirewallOptions firewallOptions = new FirewallOptions()
.name(name)
.network(network.getSelfLink())
.allowedRules(rules)
.sourceTags(templateOptions.getTags())
.sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE))
.targetTags(ImmutableSet.of(name));
AtomicReference<Operation> operation = new AtomicReference<Operation>(firewallApi.createInNetwork(
firewallOptions.getName(),
network.getSelfLink(),
firewallOptions));
operations.add(operation);
}