/** * @see CreateFirewallRuleOptions#CIDRs */ public static CreateFirewallRuleOptions CIDRs(Set<String> CIDRs) { CreateFirewallRuleOptions options = new CreateFirewallRuleOptions(); return options.CIDRs(CIDRs); }
/** * @see CreateFirewallRuleOptions#CIDRs */ public static CreateFirewallRuleOptions CIDRs(Set<String> CIDRs) { CreateFirewallRuleOptions options = new CreateFirewallRuleOptions(); return options.CIDRs(CIDRs); }
/** * @see CreateFirewallRuleOptions#CIDRs */ public static CreateFirewallRuleOptions CIDRs(Set<String> CIDRs) { CreateFirewallRuleOptions options = new CreateFirewallRuleOptions(); return options.CIDRs(CIDRs); }
protected boolean systemOpenFirewall(String publicIpId, Cidr cidr, int lowerBoundPort, int upperBoundPort, FirewallRule.Protocol protocol) { try { boolean success = true; CreateFirewallRuleOptions options = CreateFirewallRuleOptions.Builder. startPort(lowerBoundPort).endPort(upperBoundPort).CIDRs(ImmutableSet.of(cidr.toString())); AsyncCreateResponse job = cloudstackClient.getCloudstackGlobalClient().getFirewallApi().createFirewallRuleForIpAndProtocol( publicIpId, protocol, options); success &= cloudstackClient.waitForJobsSuccess(Arrays.asList(job.getJobId())); if (!success) { log.error("Failed creating firewall rule on "+this+" to "+publicIpId+":"+lowerBoundPort+"-"+upperBoundPort); // it might already be created, so don't crash and burn too hard! return false; } } catch (Exception e) { log.error("Failed creating firewall rule on "+this+" to "+publicIpId+":"+lowerBoundPort+"-"+upperBoundPort); // it might already be created, so don't crash and burn too hard! return false; } return true; }
startPort(publicPort).endPort(publicPort).CIDRs(ImmutableSet.of(cidr.toString())); AsyncCreateResponse job = client.getCloudstackGlobalClient().getFirewallApi().createFirewallRuleForIpAndProtocol( publicIpId, FirewallRule.Protocol.TCP, options);