@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:46.973Z") public class ApplicationListener extends BaseListener implements IApplicationListener
Example:
import software.amazon.awscdk.services.elasticloadbalancingv2.*; ApplicationLoadBalancer alb; ApplicationListener listener = alb.addListener("Listener", BaseApplicationListenerProps.builder().port(80).build()); ApplicationTargetGroup targetGroup = listener.addTargets("Fleet", AddApplicationTargetsProps.builder().port(80).build()); ServerDeploymentGroup deploymentGroup = ServerDeploymentGroup.Builder.create(this, "DeploymentGroup") .loadBalancer(LoadBalancer.application(targetGroup)) .build();
Modifier and Type | Class and Description |
---|---|
static class |
ApplicationListener.Builder
A fluent builder for
ApplicationListener . |
IApplicationListener.Jsii$Default, IApplicationListener.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
ApplicationListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ApplicationListener(software.amazon.jsii.JsiiObjectRef objRef) |
|
ApplicationListener(software.constructs.Construct scope,
java.lang.String id,
ApplicationListenerProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addAction(java.lang.String id,
AddApplicationActionProps props)
Perform the given default action on incoming requests.
|
void |
addCertificateArns(java.lang.String id,
java.util.List<java.lang.String> arns)
Deprecated.
Use `addCertificates` instead.
|
void |
addCertificates(java.lang.String id,
java.util.List<IListenerCertificate> certificates)
Add one or more certificates to this listener.
|
void |
addFixedResponse(java.lang.String id,
AddFixedResponseProps props)
Deprecated.
Use `addAction()` instead
|
void |
addRedirectResponse(java.lang.String id,
AddRedirectResponseProps props)
Deprecated.
Use `addAction()` instead
|
void |
addTargetGroups(java.lang.String id,
AddApplicationTargetGroupsProps props)
Load balance incoming requests to the given target groups.
|
ApplicationTargetGroup |
addTargets(java.lang.String id,
AddApplicationTargetsProps props)
Load balance incoming requests to the given load balancing targets.
|
static IApplicationListener |
fromApplicationListenerAttributes(software.constructs.Construct scope,
java.lang.String id,
ApplicationListenerAttributes attrs)
Import an existing listener.
|
static IApplicationListener |
fromLookup(software.constructs.Construct scope,
java.lang.String id,
ApplicationListenerLookupOptions options)
Look up an ApplicationListener.
|
Connections |
getConnections()
Manage connections to this ApplicationListener.
|
IApplicationLoadBalancer |
getLoadBalancer()
Load balancer this listener is associated with.
|
void |
registerConnectable(IConnectable connectable,
Port portRange)
Register that a connectable that has been added to this load balancer.
|
protected java.util.List<java.lang.String> |
validate()
Validate this listener.
|
getListenerArn
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getListenerArn
applyRemovalPolicy, getEnv, getStack
getNode
protected ApplicationListener(software.amazon.jsii.JsiiObjectRef objRef)
protected ApplicationListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public ApplicationListener(software.constructs.Construct scope, java.lang.String id, ApplicationListenerProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static IApplicationListener fromApplicationListenerAttributes(software.constructs.Construct scope, java.lang.String id, ApplicationListenerAttributes attrs)
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.public static IApplicationListener fromLookup(software.constructs.Construct scope, java.lang.String id, ApplicationListenerLookupOptions options)
scope
- This parameter is required.id
- This parameter is required.options
- This parameter is required.public void addAction(java.lang.String id, AddApplicationActionProps props)
This allows full control of the default action of the load balancer,
including Action chaining, fixed responses and redirect responses. See
the ListenerAction
class for all options.
It's possible to add routing conditions to the Action added in this way. At least one Action must be added without conditions (which becomes the default Action).
addAction
in interface IApplicationListener
id
- This parameter is required.props
- This parameter is required.@Deprecated public void addCertificateArns(java.lang.String id, java.util.List<java.lang.String> arns)
After the first certificate, this creates ApplicationListenerCertificates resources since cloudformation requires the certificates array on the listener resource to have a length of 1.
addCertificateArns
in interface IApplicationListener
id
- This parameter is required.arns
- This parameter is required.public void addCertificates(java.lang.String id, java.util.List<IListenerCertificate> certificates)
After the first certificate, this creates ApplicationListenerCertificates resources since cloudformation requires the certificates array on the listener resource to have a length of 1.
addCertificates
in interface IApplicationListener
id
- This parameter is required.certificates
- This parameter is required.@Deprecated public void addFixedResponse(java.lang.String id, AddFixedResponseProps props)
id
- This parameter is required.props
- This parameter is required.@Deprecated public void addRedirectResponse(java.lang.String id, AddRedirectResponseProps props)
id
- This parameter is required.props
- This parameter is required.public void addTargetGroups(java.lang.String id, AddApplicationTargetGroupsProps props)
All target groups will be load balanced to with equal weight and without
stickiness. For a more complex configuration than that, use addAction()
.
It's possible to add routing conditions to the TargetGroups added in this way. At least one TargetGroup must be added without conditions (which will become the default Action for this listener).
addTargetGroups
in interface IApplicationListener
id
- This parameter is required.props
- This parameter is required.public ApplicationTargetGroup addTargets(java.lang.String id, AddApplicationTargetsProps props)
This method implicitly creates an ApplicationTargetGroup for the targets involved, and a 'forward' action to route traffic to the given TargetGroup.
If you want more control over the precise setup, create the TargetGroup
and use addAction
yourself.
It's possible to add conditions to the targets added in this way. At least one set of targets must be added without conditions.
addTargets
in interface IApplicationListener
id
- This parameter is required.props
- This parameter is required.public void registerConnectable(IConnectable connectable, Port portRange)
Don't call this directly. It is called by ApplicationTargetGroup.
registerConnectable
in interface IApplicationListener
connectable
- This parameter is required.portRange
- This parameter is required.protected java.util.List<java.lang.String> validate()
validate
in class BaseListener
public Connections getConnections()
getConnections
in interface IConnectable
public IApplicationLoadBalancer getLoadBalancer()