Class NetworkListenerAction

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.elasticloadbalancingv2.NetworkListenerAction
All Implemented Interfaces:
IListenerAction, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-09-11T18:01:15.950Z") @Stability(Stable) public class NetworkListenerAction extends software.amazon.jsii.JsiiObject implements IListenerAction
What to do when a client makes a request to a listener.

Some actions can be combined with other ones (specifically, you can perform authentication before serving the request).

Multiple actions form a linked chain; the chain must always terminate in a (weighted)forward, fixedResponse or redirect action.

If an action supports chaining, the next action can be indicated by passing it in the next property.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.*;
 import software.amazon.awscdk.services.elasticloadbalancingv2.*;
 NetworkTargetGroup networkTargetGroup;
 NetworkListenerAction networkListenerAction = NetworkListenerAction.forward(List.of(networkTargetGroup), NetworkForwardOptions.builder()
         .stickinessDuration(Duration.minutes(30))
         .build());
 
  • Constructor Details

    • NetworkListenerAction

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

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

      @Stability(Stable) protected NetworkListenerAction(@NotNull CfnListener.ActionProperty defaultActionJson, @Nullable NetworkListenerAction next)
      Create an instance of NetworkListenerAction.

      The default class should be good enough for most cases and should be created by using one of the static factory functions, but allow overriding to make sure we allow flexibility for the future.

      Parameters:
      defaultActionJson - This parameter is required.
      next -
    • NetworkListenerAction

      @Stability(Stable) protected NetworkListenerAction(@NotNull CfnListener.ActionProperty defaultActionJson)
      Create an instance of NetworkListenerAction.

      The default class should be good enough for most cases and should be created by using one of the static factory functions, but allow overriding to make sure we allow flexibility for the future.

      Parameters:
      defaultActionJson - This parameter is required.
  • Method Details

    • forward

      @Stability(Stable) @NotNull public static NetworkListenerAction forward(@NotNull List<? extends INetworkTargetGroup> targetGroups, @Nullable NetworkForwardOptions options)
      Forward to one or more Target Groups.

      Parameters:
      targetGroups - This parameter is required.
      options -
    • forward

      @Stability(Stable) @NotNull public static NetworkListenerAction forward(@NotNull List<? extends INetworkTargetGroup> targetGroups)
      Forward to one or more Target Groups.

      Parameters:
      targetGroups - This parameter is required.
    • weightedForward

      @Stability(Stable) @NotNull public static NetworkListenerAction weightedForward(@NotNull List<? extends NetworkWeightedTargetGroup> targetGroups, @Nullable NetworkForwardOptions options)
      Forward to one or more Target Groups which are weighted differently.

      Parameters:
      targetGroups - This parameter is required.
      options -
    • weightedForward

      @Stability(Stable) @NotNull public static NetworkListenerAction weightedForward(@NotNull List<? extends NetworkWeightedTargetGroup> targetGroups)
      Forward to one or more Target Groups which are weighted differently.

      Parameters:
      targetGroups - This parameter is required.
    • bind

      @Stability(Stable) public void bind(@NotNull software.constructs.Construct scope, @NotNull INetworkListener listener)
      Called when the action is being used in a listener.

      Parameters:
      scope - This parameter is required.
      listener - This parameter is required.
    • renderActions

      @Stability(Stable) @NotNull public List<CfnListener.ActionProperty> renderActions()
      Render the listener default actions in this chain.
      Specified by:
      renderActions in interface IListenerAction
    • renderRuleActions

      @Stability(Stable) @NotNull public List<CfnListenerRule.ActionProperty> renderRuleActions()
      Render the listener rule actions in this chain.
      Specified by:
      renderRuleActions in interface IListenerAction
    • renumber

      @Stability(Stable) @NotNull protected List<CfnListener.ActionProperty> renumber(@NotNull List<CfnListener.ActionProperty> actions)
      Renumber the "order" fields in the actions array.

      We don't number for 0 or 1 elements, but otherwise number them 1...#actions so ELB knows about the right order.

      Do this in NetworkListenerAction instead of in Listener so that we give users the opportunity to override by subclassing and overriding renderActions.

      Parameters:
      actions - This parameter is required.
    • getNext

      @Stability(Stable) @Nullable protected NetworkListenerAction getNext()