Class Listener
The construct for the Listener.
Inherited Members
Namespace: Amazon.CDK.AWS.GlobalAccelerator
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Listener : Resource, IListener, IResource
Syntax (vb)
Public Class Listener
Inherits Resource
Implements IListener, IResource
Remarks
ExampleMetadata: infused
Examples
// Create an Accelerator
var accelerator = new Accelerator(this, "Accelerator");
// Create a Listener
var listener = accelerator.AddListener("Listener", new ListenerOptions {
PortRanges = new [] { new PortRange { FromPort = 80 }, new PortRange { FromPort = 443 } }
});
// Import the Load Balancers
var nlb1 = NetworkLoadBalancer.FromNetworkLoadBalancerAttributes(this, "NLB1", new NetworkLoadBalancerAttributes {
LoadBalancerArn = "arn:aws:elasticloadbalancing:us-west-2:111111111111:loadbalancer/app/my-load-balancer1/e16bef66805b"
});
var nlb2 = NetworkLoadBalancer.FromNetworkLoadBalancerAttributes(this, "NLB2", new NetworkLoadBalancerAttributes {
LoadBalancerArn = "arn:aws:elasticloadbalancing:ap-south-1:111111111111:loadbalancer/app/my-load-balancer2/5513dc2ea8a1"
});
// Add one EndpointGroup for each Region we are targeting
listener.AddEndpointGroup("Group1", new EndpointGroupOptions {
Endpoints = new [] { new NetworkLoadBalancerEndpoint(nlb1) }
});
listener.AddEndpointGroup("Group2", new EndpointGroupOptions {
// Imported load balancers automatically calculate their Region from the ARN.
// If you are load balancing to other resources, you must also pass a `region`
// parameter here.
Endpoints = new [] { new NetworkLoadBalancerEndpoint(nlb2) }
});
Synopsis
Constructors
Listener(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Listener(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Listener(Construct, String, IListenerProps) |
Properties
ListenerArn | The ARN of the listener. |
ListenerName | The name of the listener. |
Methods
AddEndpointGroup(String, IEndpointGroupOptions) | Add a new endpoint group to this listener. |
FromListenerArn(Construct, String, String) | import from ARN. |
Constructors
Listener(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Listener(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Listener(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Listener(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Listener(Construct, String, IListenerProps)
public Listener(Construct scope, string id, IListenerProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IListenerProps
Properties
ListenerArn
The ARN of the listener.
public virtual string ListenerArn { get; }
Property Value
System.String
ListenerName
The name of the listener.
public virtual string ListenerName { get; }
Property Value
System.String
Remarks
Attribute: true
Methods
AddEndpointGroup(String, IEndpointGroupOptions)
Add a new endpoint group to this listener.
public virtual EndpointGroup AddEndpointGroup(string id, IEndpointGroupOptions options = null)
Parameters
- id System.String
- options IEndpointGroupOptions
Returns
FromListenerArn(Construct, String, String)
import from ARN.
public static IListener FromListenerArn(Construct scope, string id, string listenerArn)
Parameters
- scope Constructs.Construct
- id System.String
- listenerArn System.String
Returns
Implements
Constructs.IConstruct
Constructs.IDependable