You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Sunil Shah <su...@mesosphere.io> on 2014/08/09 09:59:07 UTC

Adding firewall exception for single port on GCE

Hey all,

Is there a preferred way to add a single port firewall rule on GCE? We can
get an IllegalStateException exception when trying to add a rule as follows:
IpPermission.builder()
          .ipProtocol(protocol)
          .cidrBlock(Cidr.WORLD)
          .fromPort(number)
          .toPort(number)
          .build()

securityGroupsExtension.addIpPermission(ipPermission, securityGroup)


Exception:
java.lang.IllegalStateException: start of range must be lower than end of
range
at com.google.common.base.Preconditions.checkState(Preconditions.java:150)
~[poseidon-0.2-SNAPSHOT-jar-with-dependencies.jar:na]
at
org.jclouds.googlecomputeengine.domain.Firewall$Rule$Builder.addPortRange(Firewall.java:354)
~[poseidon-0.2-SNAPSHOT-jar-with-dependencies.jar:na]
at
org.jclouds.googlecomputeengine.compute.extensions.GoogleComputeEngineSecurityGroupExtension.addIpPermission(GoogleComputeEngineSecurityGroupExtension.java:224)
~[poseidon-0.2-SNAPSHOT-jar-with-dependencies.jar:na]

Thanks,

Sunil