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.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, 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.
|
void |
addAssociationListener(PortForwardManager.AssociationListener listener,
<any> filter)
Registers a listener, which will be notified each time a new port mapping is associated.
|
void |
associate(java.lang.String publicIpId,
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,
HostAndPort publicEndpoint,
Location l,
int privatePort)
Records a location and private port against a public endpoint (ip and port),
to support
lookup(Location, int) . |
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.
|
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
|
HostAndPort |
getPublicHostAndPort(PortMapping m)
Deprecated.
since 0.7.0; this method will be internal only
|
java.lang.String |
getScope() |
HostAndPort |
lookup(Location l,
int privatePort)
Returns the public ip hostname and public port for use contacting the given endpoint.
|
HostAndPort |
lookup(java.lang.String publicIpId,
int privatePort)
Returns the public endpoint (host and port) for use contacting the given endpoint.
|
void |
removeAssociationListener(PortForwardManager.AssociationListener listener) |
java.lang.String |
toVerboseString() |
containsLocation, getChildren, getConfig, getDisplayName, getExtension, getId, getParent, hasExtension, relations, setParent
getCatalogItemId, getCatalogItemIdSearchPath, subscriptions, tags
config, getConfig
static final ConfigKey<java.lang.String> SCOPE
portForwardManager(scope=docker-fjie3)
).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, 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, HostAndPort publicEndpoint, int privatePort)
lookup(String, int)
.void addAssociationListener(PortForwardManager.AssociationListener listener, <any> filter)
associate(String, HostAndPort, int)
and associate(String, HostAndPort, Location, int)
.void removeAssociationListener(PortForwardManager.AssociationListener listener)
HostAndPort lookup(Location l, int privatePort)
Will return null if:
#recordPublicIpHostname(String, String)
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 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 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)