@Beta public interface PortForwardManager extends Location
acquirePublicPort(String)
(e.g. for port-mapping with DNAT, then which port to use for the public side).
Implementations typically will not know anything about what the firewall/IP actually is, they just
handle a unique identifier for it.
To use, see PortForwardManagerLocationResolver
, with code such as
managementContext.getLocationRegistry().resolve("portForwardManager(scope=global)")
.Modifier and Type | Interface and Description |
---|---|
static interface |
PortForwardManager.AssociationListener |
static class |
PortForwardManager.AssociationMetadata |
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
Modifier and Type | Field and Description |
---|---|
static ConfigKey<java.lang.Integer> |
PORT_FORWARD_MANAGER_STARTING_PORT |
static ConfigKey<java.lang.String> |
SCOPE
The intention is that there is one PortForwardManager instance per "scope".
|
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)
Deprecated.
since 0.7.0; use
acquirePublicPort(String) , and then use associate(String, HostAndPort, int) or associate(String, HostAndPort, Location, int) |
PortMapping |
acquirePublicPortExplicit(java.lang.String publicIpId,
int port)
Deprecated.
since 0.7.0; use
associate(String, HostAndPort, int) or associate(String, HostAndPort, Location, int) |
void |
addAssociationListener(PortForwardManager.AssociationListener listener,
com.google.common.base.Predicate<? super PortForwardManager.AssociationMetadata> filter)
Registers a listener, which will be notified each time a new port mapping is associated.
|
void |
associate(java.lang.String publicIpId,
com.google.common.net.HostAndPort publicEndpoint,
int privatePort)
Records a mapping for publicIpId:privatePort to a public endpoint, such that it can
subsequently be looked up using
lookup(String, int) . |
void |
associate(java.lang.String publicIpId,
com.google.common.net.HostAndPort publicEndpoint,
Location l,
int privatePort)
Records a location and private port against a public endpoint (ip and port),
to support
lookup(Location, int) . |
void |
associate(java.lang.String publicIpId,
int publicPort,
Location l,
int privatePort)
Deprecated.
|
boolean |
forgetPortMapping(PortMapping m)
Deprecated.
since 0.7.0; this method will be internal only
|
boolean |
forgetPortMapping(java.lang.String publicIpId,
int publicPort)
Clears the given port mapping, returning true if there was a match.
|
boolean |
forgetPortMappings(Location location)
Clears the port mappings associated with the given location, returning true if there were any matches.
|
boolean |
forgetPortMappings(java.lang.String publicIpId)
Clears the port mappings associated with the given publicIpId, returning true if there were any matches.
|
boolean |
forgetPublicIpHostname(java.lang.String publicIpId)
Deprecated.
|
java.util.Collection<PortMapping> |
getLocationPublicIpIds(Location l)
Deprecated.
since 0.7.0; this method will be internal only
|
PortMapping |
getPortMappingWithPrivateSide(Location l,
int privatePort)
Deprecated.
since 0.7.0; this method will be internal only
|
java.util.Collection<PortMapping> |
getPortMappingWithPublicIpId(java.lang.String publicIpId)
Deprecated.
since 0.7.0; this method will be internal only
|
PortMapping |
getPortMappingWithPublicSide(java.lang.String publicIpId,
int publicPort)
Deprecated.
since 0.7.0; this method will be internal only
|
com.google.common.net.HostAndPort |
getPublicHostAndPort(PortMapping m)
Deprecated.
since 0.7.0; this method will be internal only
|
java.lang.String |
getPublicIpHostname(java.lang.String publicIpId)
Deprecated.
|
java.lang.String |
getScope() |
boolean |
isClient()
Deprecated.
since 0.7.0; no need to separate client-proxy from impl
|
com.google.common.net.HostAndPort |
lookup(Location l,
int privatePort)
Returns the public ip hostname and public port for use contacting the given endpoint.
|
com.google.common.net.HostAndPort |
lookup(java.lang.String publicIpId,
int privatePort)
Returns the public endpoint (host and port) for use contacting the given endpoint.
|
void |
recordPublicIpHostname(java.lang.String publicIpId,
java.lang.String hostnameOrPublicIpAddress)
Deprecated.
|
void |
removeAssociationListener(PortForwardManager.AssociationListener listener) |
java.lang.String |
toVerboseString() |
containsLocation, getAllConfig, getChildren, getConfig, getConfig, getDisplayName, getExtension, getId, getParent, hasConfig, hasExtension, setParent
getCatalogItemId, getTagSupport, tags
config, setConfig
static final ConfigKey<java.lang.String> SCOPE
portForwardManager(scope=docker-fjie3)
).@Beta static final ConfigKey<java.lang.Integer> PORT_FORWARD_MANAGER_STARTING_PORT
java.lang.String getScope()
int acquirePublicPort(java.lang.String publicIpId)
Often followed by associate(String, HostAndPort, int)
or associate(String, HostAndPort, Location, int)
to enable lookup(String, int)
or lookup(Location, int)
respectively.
void associate(java.lang.String publicIpId, com.google.common.net.HostAndPort publicEndpoint, Location l, int privatePort)
lookup(Location, int)
.
Superfluous if acquirePublicPort(String, Location, int)
was used,
but strongly recommended if acquirePublicPortExplicit(String, int)
was used
e.g. if the location is not known ahead of time.
void associate(java.lang.String publicIpId, com.google.common.net.HostAndPort publicEndpoint, int privatePort)
lookup(String, int)
.@Beta void addAssociationListener(PortForwardManager.AssociationListener listener, com.google.common.base.Predicate<? super PortForwardManager.AssociationMetadata> filter)
associate(String, HostAndPort, int)
and associate(String, HostAndPort, Location, int)
.@Beta void removeAssociationListener(PortForwardManager.AssociationListener listener)
com.google.common.net.HostAndPort lookup(Location l, int privatePort)
Will return null if:
com.google.common.net.HostAndPort lookup(java.lang.String publicIpId, int privatePort)
associate(String, HostAndPort, int)
, to register
the endpoint.
Will return null if there has not been a public endpoint associated with this pairing.boolean forgetPortMapping(java.lang.String publicIpId, int publicPort)
boolean forgetPortMappings(Location location)
boolean forgetPortMappings(java.lang.String publicIpId)
java.lang.String toVerboseString()
toVerboseString
in interface Location
@Deprecated int acquirePublicPort(java.lang.String publicIpId, Location l, int privatePort)
acquirePublicPort(String)
, and then use associate(String, HostAndPort, int)
or associate(String, HostAndPort, Location, int)
If already allocated, returns the previously allocated.
@Deprecated PortMapping acquirePublicPortExplicit(java.lang.String publicIpId, int port)
associate(String, HostAndPort, int)
or associate(String, HostAndPort, Location, int)
@Deprecated void associate(java.lang.String publicIpId, int publicPort, Location l, int privatePort)
associate(String, HostAndPort, Location, int)
lookup(Location, int)
.
Superfluous if acquirePublicPort(String, Location, int)
was used,
but strongly recommended if acquirePublicPortExplicit(String, int)
was used
e.g. if the location is not known ahead of time.
@Deprecated void recordPublicIpHostname(java.lang.String publicIpId, java.lang.String hostnameOrPublicIpAddress)
associate(String, HostAndPort, int)
or associate(String, HostAndPort, Location, int)
Conceivably this may have to be access-location specific.
@Deprecated java.lang.String getPublicIpHostname(java.lang.String publicIpId)
@Deprecated boolean forgetPublicIpHostname(java.lang.String publicIpId)
recordPublicIpHostname(String, String)
.@Deprecated boolean isClient()
@Deprecated PortMapping getPortMappingWithPublicSide(java.lang.String publicIpId, int publicPort)
@Deprecated java.util.Collection<PortMapping> getPortMappingWithPublicIpId(java.lang.String publicIpId)
@Deprecated boolean forgetPortMapping(PortMapping m)
#forgetPortMapping(String, int)} and {@link #forgetPortMappings(Location)}
@Deprecated com.google.common.net.HostAndPort getPublicHostAndPort(PortMapping m)
Conceivably this may have to be access-location specific.
@Deprecated java.util.Collection<PortMapping> getLocationPublicIpIds(Location l)
@Deprecated PortMapping getPortMappingWithPrivateSide(Location l, int privatePort)