@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.052Z") @Stability(value=Stable) 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. |
software.amazon.jsii.JsiiObject.InitializationModeIApplicationListener.Jsii$Default, IApplicationListener.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
ApplicationListener(software.constructs.Construct scope,
String id,
ApplicationListenerProps props) |
protected |
ApplicationListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ApplicationListener(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAction(String id,
AddApplicationActionProps props)
Perform the given default action on incoming requests.
|
void |
addCertificates(String id,
List<IListenerCertificate> certificates)
Add one or more certificates to this listener.
|
void |
addTargetGroups(String id,
AddApplicationTargetGroupsProps props)
Load balance incoming requests to the given target groups.
|
ApplicationTargetGroup |
addTargets(String id,
AddApplicationTargetsProps props)
Load balance incoming requests to the given load balancing targets.
|
static IApplicationListener |
fromApplicationListenerAttributes(software.constructs.Construct scope,
String id,
ApplicationListenerAttributes attrs)
Import an existing listener.
|
static IApplicationListener |
fromLookup(software.constructs.Construct scope,
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 List<String> |
validateListener()
Validate this listener.
|
getListenerArnapplyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetListenerArnapplyRemovalPolicy, getEnv, getStackprotected ApplicationListener(software.amazon.jsii.JsiiObjectRef objRef)
protected ApplicationListener(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public ApplicationListener(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
ApplicationListenerProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static IApplicationListener fromApplicationListenerAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ApplicationListenerAttributes attrs)
scope - This parameter is required.id - This parameter is required.attrs - This parameter is required.@Stability(value=Stable) @NotNull public static IApplicationListener fromLookup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ApplicationListenerLookupOptions options)
scope - This parameter is required.id - This parameter is required.options - This parameter is required.@Stability(value=Stable)
public void addAction(@NotNull
String id,
@NotNull
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 IApplicationListenerid - This parameter is required.props - This parameter is required.@Stability(value=Stable)
public void addCertificates(@NotNull
String id,
@NotNull
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 IApplicationListenerid - This parameter is required.certificates - This parameter is required.@Stability(value=Stable)
public void addTargetGroups(@NotNull
String id,
@NotNull
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 IApplicationListenerid - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public ApplicationTargetGroup addTargets(@NotNull String id, @NotNull 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 IApplicationListenerid - This parameter is required.props - This parameter is required.@Stability(value=Stable)
public void registerConnectable(@NotNull
IConnectable connectable,
@NotNull
Port portRange)
Don't call this directly. It is called by ApplicationTargetGroup.
registerConnectable in interface IApplicationListenerconnectable - This parameter is required.portRange - This parameter is required.@Stability(value=Stable) @NotNull protected List<String> validateListener()
validateListener in class BaseListener@Stability(value=Stable) @NotNull public Connections getConnections()
getConnections in interface IConnectable@Stability(value=Stable) @NotNull public IApplicationLoadBalancer getLoadBalancer()
Copyright © 2022. All rights reserved.