Class NetworkTargetGroup

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.elasticloadbalancingv2.TargetGroupBase
software.amazon.awscdk.services.elasticloadbalancingv2.NetworkTargetGroup
All Implemented Interfaces:
INetworkTargetGroup, ITargetGroup, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:17.083Z") @Stability(Stable) public class NetworkTargetGroup extends TargetGroupBase implements INetworkTargetGroup
Define a Network Target Group.

Example:

 import software.amazon.awscdk.services.elasticloadbalancing.*;
 import software.amazon.awscdk.services.elasticloadbalancingv2.*;
 LoadBalancer clb;
 ApplicationLoadBalancer alb;
 NetworkLoadBalancer nlb;
 ApplicationListener albListener = alb.addListener("ALBListener", BaseApplicationListenerProps.builder().port(80).build());
 ApplicationTargetGroup albTargetGroup = albListener.addTargets("ALBFleet", AddApplicationTargetsProps.builder().port(80).build());
 NetworkListener nlbListener = nlb.addListener("NLBListener", BaseNetworkListenerProps.builder().port(80).build());
 NetworkTargetGroup nlbTargetGroup = nlbListener.addTargets("NLBFleet", AddNetworkTargetsProps.builder().port(80).build());
 ServerDeploymentGroup deploymentGroup = ServerDeploymentGroup.Builder.create(this, "DeploymentGroup")
         .loadBalancers(List.of(LoadBalancer.classic(clb), LoadBalancer.application(albTargetGroup), LoadBalancer.network(nlbTargetGroup)))
         .build();
 
  • Constructor Details

    • NetworkTargetGroup

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

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

      @Stability(Stable) public NetworkTargetGroup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkTargetGroupProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromTargetGroupAttributes

      @Stability(Stable) @NotNull public static INetworkTargetGroup fromTargetGroupAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TargetGroupAttributes attrs)
      Import an existing target group.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • addTarget

      @Stability(Stable) public void addTarget(@NotNull @NotNull INetworkLoadBalancerTarget... targets)
      Add a load balancing target to this target group.

      Specified by:
      addTarget in interface INetworkTargetGroup
      Parameters:
      targets - This parameter is required.
    • metricHealthyHostCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricHealthyHostCount(@Nullable MetricOptions props)
      Deprecated.
      Use NetworkTargetGroup.metrics.healthyHostCount instead
      (deprecated) The number of targets that are considered healthy.

      Default: Average over 5 minutes

      Parameters:
      props -
    • metricHealthyHostCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricHealthyHostCount()
      Deprecated.
      Use NetworkTargetGroup.metrics.healthyHostCount instead
      (deprecated) The number of targets that are considered healthy.

      Default: Average over 5 minutes

    • metricUnHealthyHostCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricUnHealthyHostCount(@Nullable MetricOptions props)
      Deprecated.
      Use NetworkTargetGroup.metrics.healthyHostCount instead
      (deprecated) The number of targets that are considered unhealthy.

      Default: Average over 5 minutes

      Parameters:
      props -
    • metricUnHealthyHostCount

      @Stability(Deprecated) @Deprecated @NotNull public Metric metricUnHealthyHostCount()
      Deprecated.
      Use NetworkTargetGroup.metrics.healthyHostCount instead
      (deprecated) The number of targets that are considered unhealthy.

      Default: Average over 5 minutes

    • registerListener

      @Stability(Stable) public void registerListener(@NotNull INetworkListener listener)
      Register a listener that is load balancing to this target group.

      Don't call this directly. It will be called by listeners.

      Specified by:
      registerListener in interface INetworkTargetGroup
      Parameters:
      listener - This parameter is required.
    • validateTargetGroup

      @Stability(Stable) @NotNull protected List<String> validateTargetGroup()
      Overrides:
      validateTargetGroup in class TargetGroupBase
    • getFirstLoadBalancerFullName

      @Stability(Stable) @NotNull public String getFirstLoadBalancerFullName()
      Full name of first load balancer.
      Specified by:
      getFirstLoadBalancerFullName in class TargetGroupBase
    • getMetrics

      @Stability(Stable) @NotNull public INetworkTargetGroupMetrics getMetrics()
      All metrics available for this target group.
      Specified by:
      getMetrics in interface INetworkTargetGroup