Class ListenerConfig
Base class for configuring listener when registering targets.
Inheritance
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public abstract class ListenerConfig : DeputyBase
Syntax (vb)
Public MustInherit Class ListenerConfig
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
Cluster cluster;
TaskDefinition taskDefinition;
Vpc vpc;
var service = new FargateService(this, "Service", new FargateServiceProps { Cluster = cluster, TaskDefinition = taskDefinition });
var lb = new ApplicationLoadBalancer(this, "LB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true });
var listener = lb.AddListener("Listener", new BaseApplicationListenerProps { Port = 80 });
service.RegisterLoadBalancerTargets(new EcsTarget {
ContainerName = "web",
ContainerPort = 80,
NewTargetGroupId = "ECS",
Listener = ListenerConfig.ApplicationListener(listener, new AddApplicationTargetsProps {
Protocol = ApplicationProtocol.HTTPS
})
});
Synopsis
Constructors
ListenerConfig() | |
ListenerConfig(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ListenerConfig(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
AddTargets(String, ILoadBalancerTargetOptions, BaseService) | Create and attach a target group to listener. |
ApplicationListener(ApplicationListener, IAddApplicationTargetsProps) | Create a config for adding target group to ALB listener. |
NetworkListener(NetworkListener, IAddNetworkTargetsProps) | Create a config for adding target group to NLB listener. |
Constructors
ListenerConfig()
protected ListenerConfig()
ListenerConfig(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ListenerConfig(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ListenerConfig(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ListenerConfig(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
AddTargets(String, ILoadBalancerTargetOptions, BaseService)
Create and attach a target group to listener.
public abstract void AddTargets(string id, ILoadBalancerTargetOptions target, BaseService service)
Parameters
- id System.String
- target ILoadBalancerTargetOptions
- service BaseService
ApplicationListener(ApplicationListener, IAddApplicationTargetsProps)
Create a config for adding target group to ALB listener.
public static ListenerConfig ApplicationListener(ApplicationListener listener, IAddApplicationTargetsProps props = null)
Parameters
- listener ApplicationListener
- props IAddApplicationTargetsProps
Returns
NetworkListener(NetworkListener, IAddNetworkTargetsProps)
Create a config for adding target group to NLB listener.
public static ListenerConfig NetworkListener(NetworkListener listener, IAddNetworkTargetsProps props = null)
Parameters
- listener NetworkListener
- props IAddNetworkTargetsProps
Returns