mirror of https://github.com/apache/jclouds.git
JCLOUDS-661: Supporting single port firewall rules in GCE
Corresponding test added in https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=f3778b6
This commit is contained in:
parent
5ec9bdb3f3
commit
bc52da8a73
|
@ -220,8 +220,12 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
|
|||
}
|
||||
Firewall.Rule.Builder ruleBuilder = Firewall.Rule.builder();
|
||||
ruleBuilder.IpProtocol(ipPermission.getIpProtocol());
|
||||
if (ipPermission.getToPort() > 0) {
|
||||
ruleBuilder.addPortRange(ipPermission.getFromPort(), ipPermission.getToPort());
|
||||
if (ipPermission.getFromPort() > 0) {
|
||||
if (ipPermission.getFromPort() == ipPermission.getToPort()) {
|
||||
ruleBuilder.addPort(ipPermission.getToPort());
|
||||
} else {
|
||||
ruleBuilder.addPortRange(ipPermission.getFromPort(), ipPermission.getToPort());
|
||||
}
|
||||
}
|
||||
fwOptions.addAllowedRule(ruleBuilder.build());
|
||||
|
||||
|
|
Loading…
Reference in New Issue