NetworkListenerAction

class aws_cdk.aws_elasticloadbalancingv2.NetworkListenerAction(default_action_json, next=None)

Bases: object

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.

ExampleMetadata:

infused

Example:

# lb: elbv2.NetworkLoadBalancer
# group: elbv2.NetworkTargetGroup


listener = lb.add_listener("Listener",
    port=80,
    default_action=elbv2.NetworkListenerAction.forward([group]),

    # The tcp idle timeout value. The valid range is 60-6000 seconds. The default is 350 seconds.
    tcp_idle_timeout=Duration.seconds(100)
)

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:

Methods

bind(scope, listener)

Called when the action is being used in a listener.

Parameters:
Return type:

None

render_actions()

Render the listener default actions in this chain.

Return type:

List[ActionProperty]

render_rule_actions()

Render the listener rule actions in this chain.

Return type:

List[ActionProperty]

Static Methods

classmethod forward(target_groups, *, stickiness_duration=None)

Forward to one or more Target Groups.

Parameters:
  • target_groups (Sequence[INetworkTargetGroup]) –

  • stickiness_duration (Optional[Duration]) – For how long clients should be directed to the same target group. Range between 1 second and 7 days. Default: - No stickiness

Return type:

NetworkListenerAction

classmethod weighted_forward(target_groups, *, stickiness_duration=None)

Forward to one or more Target Groups which are weighted differently.

Parameters:
  • target_groups (Sequence[Union[NetworkWeightedTargetGroup, Dict[str, Any]]]) –

  • stickiness_duration (Optional[Duration]) – For how long clients should be directed to the same target group. Range between 1 second and 7 days. Default: - No stickiness

Return type:

NetworkListenerAction