@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:39.122Z") @Stability(value=Stable) public class ListenerAction extends software.amazon.jsii.JsiiObject implements IListenerAction
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.
(Called ListenerAction instead of the more strictly correct
ListenerAction because this is the class most users interact
with, and we want to make it not too visually overwhelming).
Example:
ApplicationListener listener;
listener.addAction("Fixed", AddApplicationActionProps.builder()
.priority(10)
.conditions(List.of(ListenerCondition.pathPatterns(List.of("/ok"))))
.action(ListenerAction.fixedResponse(200, FixedResponseOptions.builder()
.contentType(ContentType.TEXT_PLAIN)
.messageBody("OK")
.build()))
.build());
software.amazon.jsii.JsiiObject.InitializationModeIListenerAction.Jsii$Default, IListenerAction.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
protected |
ListenerAction(CfnListener.ActionProperty actionJson)
Create an instance of ListenerAction.
|
protected |
ListenerAction(CfnListener.ActionProperty actionJson,
ListenerAction next)
Create an instance of ListenerAction.
|
protected |
ListenerAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ListenerAction(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static ListenerAction |
authenticateOidc(AuthenticateOidcOptions options)
Authenticate using an identity provider (IdP) that is compliant with OpenID Connect (OIDC).
|
void |
bind(software.constructs.Construct scope,
IApplicationListener listener)
Called when the action is being used in a listener.
|
void |
bind(software.constructs.Construct scope,
IApplicationListener listener,
software.constructs.IConstruct associatingConstruct)
Called when the action is being used in a listener.
|
static ListenerAction |
fixedResponse(Number statusCode)
Return a fixed response.
|
static ListenerAction |
fixedResponse(Number statusCode,
FixedResponseOptions options)
Return a fixed response.
|
static ListenerAction |
forward(List<? extends IApplicationTargetGroup> targetGroups)
Forward to one or more Target Groups.
|
static ListenerAction |
forward(List<? extends IApplicationTargetGroup> targetGroups,
ForwardOptions options)
Forward to one or more Target Groups.
|
protected ListenerAction |
getNext() |
static ListenerAction |
redirect(RedirectOptions options)
Redirect to a different URI.
|
List<CfnListener.ActionProperty> |
renderActions()
Render the actions in this chain.
|
protected List<CfnListener.ActionProperty> |
renumber(List<CfnListener.ActionProperty> actions)
Renumber the "order" fields in the actions array.
|
static ListenerAction |
weightedForward(List<? extends WeightedTargetGroup> targetGroups)
Forward to one or more Target Groups which are weighted differently.
|
static ListenerAction |
weightedForward(List<? extends WeightedTargetGroup> targetGroups,
ForwardOptions options)
Forward to one or more Target Groups which are weighted differently.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected ListenerAction(software.amazon.jsii.JsiiObjectRef objRef)
protected ListenerAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
protected ListenerAction(@NotNull
CfnListener.ActionProperty actionJson,
@Nullable
ListenerAction next)
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.
actionJson - This parameter is required.next - @Stability(value=Stable)
protected ListenerAction(@NotNull
CfnListener.ActionProperty actionJson)
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.
actionJson - This parameter is required.@Stability(value=Stable) @NotNull public static ListenerAction authenticateOidc(@NotNull AuthenticateOidcOptions options)
options - This parameter is required.@Stability(value=Stable) @NotNull public static ListenerAction fixedResponse(@NotNull Number statusCode, @Nullable FixedResponseOptions options)
statusCode - This parameter is required.options - @Stability(value=Stable) @NotNull public static ListenerAction fixedResponse(@NotNull Number statusCode)
statusCode - This parameter is required.@Stability(value=Stable) @NotNull public static ListenerAction forward(@NotNull List<? extends IApplicationTargetGroup> targetGroups, @Nullable ForwardOptions options)
targetGroups - This parameter is required.options - @Stability(value=Stable) @NotNull public static ListenerAction forward(@NotNull List<? extends IApplicationTargetGroup> targetGroups)
targetGroups - This parameter is required.@Stability(value=Stable) @NotNull public static ListenerAction redirect(@NotNull RedirectOptions options)
A URI consists of the following components: protocol://hostname:port/path?query. You must modify at least one of the following components to avoid a redirect loop: protocol, hostname, port, or path. Any components that you do not modify retain their original values.
You can reuse URI components using the following reserved keywords:
#{protocol}#{host}#{port}#{path} (the leading "/" is removed)#{query}For example, you can change the path to "/new/#{path}", the hostname to "example.#{host}", or the query to "#{query}&value=xyz".
options - This parameter is required.@Stability(value=Stable) @NotNull public static ListenerAction weightedForward(@NotNull List<? extends WeightedTargetGroup> targetGroups, @Nullable ForwardOptions options)
targetGroups - This parameter is required.options - @Stability(value=Stable) @NotNull public static ListenerAction weightedForward(@NotNull List<? extends WeightedTargetGroup> targetGroups)
targetGroups - This parameter is required.@Stability(value=Stable)
public void bind(@NotNull
software.constructs.Construct scope,
@NotNull
IApplicationListener listener,
@Nullable
software.constructs.IConstruct associatingConstruct)
scope - This parameter is required.listener - This parameter is required.associatingConstruct - @Stability(value=Stable)
public void bind(@NotNull
software.constructs.Construct scope,
@NotNull
IApplicationListener listener)
scope - This parameter is required.listener - This parameter is required.@Stability(value=Stable) @NotNull public List<CfnListener.ActionProperty> renderActions()
renderActions in interface IListenerAction@Stability(value=Stable) @NotNull protected List<CfnListener.ActionProperty> renumber(@NotNull List<CfnListener.ActionProperty> actions)
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 ListenerAction instead of in Listener so that we give
users the opportunity to override by subclassing and overriding renderActions.
actions - This parameter is required.@Stability(value=Stable) @Nullable protected ListenerAction getNext()
Copyright © 2022. All rights reserved.