Class ApplicationListener
Define an ApplicationListener.
Inherited Members
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2
Assembly: Amazon.CDK.AWS.ElasticLoadBalancingV2.dll
Syntax (csharp)
public class ApplicationListener : BaseListener, IApplicationListener, IResource, IConstruct, IDependable, IConnectable
Syntax (vb)
Public Class ApplicationListener
Inherits BaseListener
Implements IApplicationListener, IResource, IConstruct, IDependable, IConnectable
Remarks
Resource: AWS::ElasticLoadBalancingV2::Listener
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
ApplicationLoadBalancer alb;
var listener = alb.AddListener("Listener", new BaseApplicationListenerProps { Port = 80 });
var targetGroup = listener.AddTargets("Fleet", new AddApplicationTargetsProps { Port = 80 });
var deploymentGroup = new ServerDeploymentGroup(this, "DeploymentGroup", new ServerDeploymentGroupProps {
LoadBalancer = LoadBalancer.Application(targetGroup)
});
Synopsis
Constructors
ApplicationListener(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ApplicationListener(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
ApplicationListener(Construct, String, IApplicationListenerProps) |
Properties
Connections | Manage connections to this ApplicationListener. |
LoadBalancer | Load balancer this listener is associated with. |
Methods
Constructors
ApplicationListener(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ApplicationListener(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ApplicationListener(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ApplicationListener(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
ApplicationListener(Construct, String, IApplicationListenerProps)
public ApplicationListener(Construct scope, string id, IApplicationListenerProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IApplicationListenerProps
Properties
Connections
Manage connections to this ApplicationListener.
public virtual Connections_ Connections { get; }
Property Value
LoadBalancer
Load balancer this listener is associated with.
public virtual IApplicationLoadBalancer LoadBalancer { get; }
Property Value
Methods
AddAction(String, IAddApplicationActionProps)
Perform the given default action on incoming requests.
public virtual void AddAction(string id, IAddApplicationActionProps props)
Parameters
- id System.String
- props IAddApplicationActionProps
Remarks
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).
AddCertificateArns(String, String[])
(deprecated) Add one or more certificates to this listener.
public virtual void AddCertificateArns(string id, string[] arns)
Parameters
- id System.String
- arns System.String[]
Remarks
After the first certificate, this creates ApplicationListenerCertificates resources since cloudformation requires the certificates array on the listener resource to have a length of 1.
Stability: Deprecated
AddCertificates(String, IListenerCertificate[])
Add one or more certificates to this listener.
public virtual void AddCertificates(string id, IListenerCertificate[] certificates)
Parameters
- id System.String
- certificates IListenerCertificate[]
Remarks
After the first certificate, this creates ApplicationListenerCertificates resources since cloudformation requires the certificates array on the listener resource to have a length of 1.
AddFixedResponse(String, IAddFixedResponseProps)
(deprecated) Add a fixed response.
public virtual void AddFixedResponse(string id, IAddFixedResponseProps props)
Parameters
- id System.String
- props IAddFixedResponseProps
Remarks
Stability: Deprecated
AddRedirectResponse(String, IAddRedirectResponseProps)
(deprecated) Add a redirect response.
public virtual void AddRedirectResponse(string id, IAddRedirectResponseProps props)
Parameters
- id System.String
- props IAddRedirectResponseProps
Remarks
Stability: Deprecated
AddTargetGroups(String, IAddApplicationTargetGroupsProps)
Load balance incoming requests to the given target groups.
public virtual void AddTargetGroups(string id, IAddApplicationTargetGroupsProps props)
Parameters
- id System.String
- props IAddApplicationTargetGroupsProps
Remarks
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).
AddTargets(String, IAddApplicationTargetsProps)
Load balance incoming requests to the given load balancing targets.
public virtual ApplicationTargetGroup AddTargets(string id, IAddApplicationTargetsProps props)
Parameters
- id System.String
- props IAddApplicationTargetsProps
Returns
The newly created target group
Remarks
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.
FromApplicationListenerAttributes(Construct, String, IApplicationListenerAttributes)
Import an existing listener.
public static IApplicationListener FromApplicationListenerAttributes(Construct scope, string id, IApplicationListenerAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IApplicationListenerAttributes
Returns
FromLookup(Construct, String, IApplicationListenerLookupOptions)
Look up an ApplicationListener.
public static IApplicationListener FromLookup(Construct scope, string id, IApplicationListenerLookupOptions options)
Parameters
- scope Constructs.Construct
- id System.String
- options IApplicationListenerLookupOptions
Returns
RegisterConnectable(IConnectable, Port)
Register that a connectable that has been added to this load balancer.
public virtual void RegisterConnectable(IConnectable connectable, Port portRange)
Parameters
- connectable IConnectable
- portRange Port
Remarks
Don't call this directly. It is called by ApplicationTargetGroup.
Validate()
Validate this listener.
protected override string[] Validate()
Returns
System.String[]