public class PortForwardManagerClient extends java.lang.Object implements PortForwardManager
Modifier and Type | Method and Description |
---|---|
int |
acquirePublicPort(java.lang.String publicIpId)
Reserves a unique public port on the given publicIpId.
|
int |
acquirePublicPort(java.lang.String publicIpId,
Location l,
int privatePort)
Reserves a unique public port for the purpose of forwarding to the given target,
associated with a given location for subsequent lookup purpose.
|
PortMapping |
acquirePublicPortExplicit(java.lang.String publicIpId,
int port)
Returns old mapping if it existed, null if it is new.
|
void |
associate(java.lang.String publicIpId,
int publicPort,
Location l,
int privatePort)
Records a location and private port against a publicIp and public port,
to support
PortForwardManager.lookup(Location, int) . |
boolean |
forgetPortMapping(PortMapping m) |
PortMapping |
forgetPortMapping(java.lang.String publicIpId,
int publicPort)
Clears the given port mapping, returning the mapping if there was one.
|
boolean |
forgetPublicIpHostname(java.lang.String publicIpId)
Clears a previous call to
PortForwardManager.recordPublicIpHostname(String, String) . |
static PortForwardManager |
fromAttributeOnEntity(Entity entity,
AttributeSensor<PortForwardManager> attributeOnEntity)
creates an instance given an entity and
AttributeSensor to retrieve the PortForwardManager |
static PortForwardManager |
fromMethodOnEntity(Entity entity,
java.lang.String getterMethodOnEntity)
creates an instance given an entity and an interface method it implements to retrieve the PortForwardManager
|
static PortForwardManager |
fromSupplier(com.google.common.base.Supplier<PortForwardManager> supplier)
creates an instance given a supplier;
the supplier should be brooklyn-persistable, that is to say
references should be in terms of entities/locations
which can retrieve an authoritative source even under cloning
|
java.util.Collection<PortMapping> |
getLocationPublicIpIds(Location l)
Returns the subset of port mappings associated with a given location.
|
PortMapping |
getPortMappingWithPrivateSide(Location l,
int privatePort)
Returns the mapping to a given private port, or null if none.
|
java.util.Collection<PortMapping> |
getPortMappingWithPublicIpId(java.lang.String publicIpId)
Returns the subset of port mappings associated with a given public IP ID.
|
PortMapping |
getPortMappingWithPublicSide(java.lang.String publicIpId,
int publicPort)
Returns the port mapping for a given publicIpId and public port.
|
com.google.common.net.HostAndPort |
getPublicHostAndPort(PortMapping m)
Returns the public host and port for use accessing the given mapping.
|
java.lang.String |
getPublicIpHostname(java.lang.String publicIpId)
Returns a recorded public hostname or address.
|
boolean |
isClient()
Returns true if this implementation is a client which is immutable/safe for serialization
i.e.
|
com.google.common.net.HostAndPort |
lookup(Location l,
int privatePort)
Returns the public ip hostname and public port for use contacting the given endpoint.
|
void |
recordPublicIpHostname(java.lang.String publicIpId,
java.lang.String hostnameOrPublicIpAddress)
Records a public hostname or address to be associated with the given publicIpId for lookup purposes.
|
public static PortForwardManager fromSupplier(com.google.common.base.Supplier<PortForwardManager> supplier)
public static PortForwardManager fromMethodOnEntity(Entity entity, java.lang.String getterMethodOnEntity)
public static PortForwardManager fromAttributeOnEntity(Entity entity, AttributeSensor<PortForwardManager> attributeOnEntity)
AttributeSensor
to retrieve the PortForwardManagerpublic int acquirePublicPort(java.lang.String publicIpId)
PortForwardManager
Often followed by PortForwardManager.associate(String, int, Location, int)
to enable PortForwardManager.lookup(Location, int)
.
acquirePublicPort
in interface PortForwardManager
public PortMapping acquirePublicPortExplicit(java.lang.String publicIpId, int port)
PortForwardManager
acquirePublicPortExplicit
in interface PortForwardManager
public PortMapping getPortMappingWithPublicSide(java.lang.String publicIpId, int publicPort)
PortForwardManager
getPortMappingWithPublicSide
in interface PortForwardManager
public java.util.Collection<PortMapping> getPortMappingWithPublicIpId(java.lang.String publicIpId)
PortForwardManager
getPortMappingWithPublicIpId
in interface PortForwardManager
public PortMapping forgetPortMapping(java.lang.String publicIpId, int publicPort)
PortForwardManager
forgetPortMapping
in interface PortForwardManager
public boolean forgetPortMapping(PortMapping m)
forgetPortMapping
in interface PortForwardManager
PortForwardManager.forgetPortMapping(String, int)
public void recordPublicIpHostname(java.lang.String publicIpId, java.lang.String hostnameOrPublicIpAddress)
PortForwardManager
Conceivably this may have to be access-location specific.
recordPublicIpHostname
in interface PortForwardManager
public java.lang.String getPublicIpHostname(java.lang.String publicIpId)
PortForwardManager
getPublicIpHostname
in interface PortForwardManager
public boolean forgetPublicIpHostname(java.lang.String publicIpId)
PortForwardManager
PortForwardManager.recordPublicIpHostname(String, String)
.forgetPublicIpHostname
in interface PortForwardManager
public com.google.common.net.HostAndPort getPublicHostAndPort(PortMapping m)
PortForwardManager
Conceivably this may have to be access-location specific.
getPublicHostAndPort
in interface PortForwardManager
public int acquirePublicPort(java.lang.String publicIpId, Location l, int privatePort)
PortForwardManager
If already allocated, returns the previously allocated.
acquirePublicPort
in interface PortForwardManager
public com.google.common.net.HostAndPort lookup(Location l, int privatePort)
PortForwardManager
Will return null if:
lookup
in interface PortForwardManager
PortForwardManager.recordPublicIpHostname(String, String)
public void associate(java.lang.String publicIpId, int publicPort, Location l, int privatePort)
PortForwardManager
PortForwardManager.lookup(Location, int)
.
Superfluous if PortForwardManager.acquirePublicPort(String, Location, int)
was used,
but strongly recommended if PortForwardManager.acquirePublicPortExplicit(String, int)
was used
e.g. if the location is not known ahead of time.
associate
in interface PortForwardManager
public java.util.Collection<PortMapping> getLocationPublicIpIds(Location l)
PortForwardManager
getLocationPublicIpIds
in interface PortForwardManager
public PortMapping getPortMappingWithPrivateSide(Location l, int privatePort)
PortForwardManager
getPortMappingWithPrivateSide
in interface PortForwardManager
public boolean isClient()
PortForwardManager
isClient
in interface PortForwardManager