Class ListenerConfig

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ecs.ListenerConfig
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.413Z") @Stability(Stable) public abstract class ListenerConfig extends software.amazon.jsii.JsiiObject
Base class for configuring listener when registering targets.

Example:

 Cluster cluster;
 TaskDefinition taskDefinition;
 Vpc vpc;
 FargateService service = FargateService.Builder.create(this, "Service").cluster(cluster).taskDefinition(taskDefinition).build();
 ApplicationLoadBalancer lb = ApplicationLoadBalancer.Builder.create(this, "LB").vpc(vpc).internetFacing(true).build();
 ApplicationListener listener = lb.addListener("Listener", BaseApplicationListenerProps.builder().port(80).build());
 service.registerLoadBalancerTargets(EcsTarget.builder()
         .containerName("web")
         .containerPort(80)
         .newTargetGroupId("ECS")
         .listener(ListenerConfig.applicationListener(listener, AddApplicationTargetsProps.builder()
                 .protocol(ApplicationProtocol.HTTPS)
                 .build()))
         .build());
 
  • Constructor Details

    • ListenerConfig

      protected ListenerConfig(software.amazon.jsii.JsiiObjectRef objRef)
    • ListenerConfig

      protected ListenerConfig(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • ListenerConfig

      @Stability(Stable) protected ListenerConfig()
  • Method Details

    • applicationListener

      @Stability(Stable) @NotNull public static ListenerConfig applicationListener(@NotNull ApplicationListener listener, @Nullable AddApplicationTargetsProps props)
      Create a config for adding target group to ALB listener.

      Parameters:
      listener - This parameter is required.
      props -
    • applicationListener

      @Stability(Stable) @NotNull public static ListenerConfig applicationListener(@NotNull ApplicationListener listener)
      Create a config for adding target group to ALB listener.

      Parameters:
      listener - This parameter is required.
    • networkListener

      @Stability(Stable) @NotNull public static ListenerConfig networkListener(@NotNull NetworkListener listener, @Nullable AddNetworkTargetsProps props)
      Create a config for adding target group to NLB listener.

      Parameters:
      listener - This parameter is required.
      props -
    • networkListener

      @Stability(Stable) @NotNull public static ListenerConfig networkListener(@NotNull NetworkListener listener)
      Create a config for adding target group to NLB listener.

      Parameters:
      listener - This parameter is required.
    • addTargets

      @Stability(Stable) public abstract void addTargets(@NotNull String id, @NotNull LoadBalancerTargetOptions target, @NotNull BaseService service)
      Create and attach a target group to listener.

      Parameters:
      id - This parameter is required.
      target - This parameter is required.
      service - This parameter is required.