CfnListenerRule
- class aws_cdk.aws_elasticloadbalancingv2.CfnListenerRule(scope, id, *, actions, conditions, priority, listener_arn=None)
Bases:
CfnResource
A CloudFormation
AWS::ElasticLoadBalancingV2::ListenerRule
.Specifies a listener rule. The listener must be associated with an Application Load Balancer. Each rule consists of a priority, one or more actions, and one or more conditions.
For more information, see Quotas for your Application Load Balancers in the User Guide for Application Load Balancers .
- CloudformationResource:
AWS::ElasticLoadBalancingV2::ListenerRule
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 cfn_listener_rule = elbv2.CfnListenerRule(self, "MyCfnListenerRule", actions=[elbv2.CfnListenerRule.ActionProperty( type="type", # the properties below are optional authenticate_cognito_config=elbv2.CfnListenerRule.AuthenticateCognitoConfigProperty( user_pool_arn="userPoolArn", user_pool_client_id="userPoolClientId", user_pool_domain="userPoolDomain", # the properties below are optional authentication_request_extra_params={ "authentication_request_extra_params_key": "authenticationRequestExtraParams" }, on_unauthenticated_request="onUnauthenticatedRequest", scope="scope", session_cookie_name="sessionCookieName", session_timeout=123 ), authenticate_oidc_config=elbv2.CfnListenerRule.AuthenticateOidcConfigProperty( authorization_endpoint="authorizationEndpoint", client_id="clientId", issuer="issuer", token_endpoint="tokenEndpoint", user_info_endpoint="userInfoEndpoint", # the properties below are optional authentication_request_extra_params={ "authentication_request_extra_params_key": "authenticationRequestExtraParams" }, client_secret="clientSecret", on_unauthenticated_request="onUnauthenticatedRequest", scope="scope", session_cookie_name="sessionCookieName", session_timeout=123, use_existing_client_secret=False ), fixed_response_config=elbv2.CfnListenerRule.FixedResponseConfigProperty( status_code="statusCode", # the properties below are optional content_type="contentType", message_body="messageBody" ), forward_config=elbv2.CfnListenerRule.ForwardConfigProperty( target_groups=[elbv2.CfnListenerRule.TargetGroupTupleProperty( target_group_arn="targetGroupArn", weight=123 )], target_group_stickiness_config=elbv2.CfnListenerRule.TargetGroupStickinessConfigProperty( duration_seconds=123, enabled=False ) ), order=123, redirect_config=elbv2.CfnListenerRule.RedirectConfigProperty( status_code="statusCode", # the properties below are optional host="host", path="path", port="port", protocol="protocol", query="query" ), target_group_arn="targetGroupArn" )], conditions=[elbv2.CfnListenerRule.RuleConditionProperty( field="field", host_header_config=elbv2.CfnListenerRule.HostHeaderConfigProperty( values=["values"] ), http_header_config=elbv2.CfnListenerRule.HttpHeaderConfigProperty( http_header_name="httpHeaderName", values=["values"] ), http_request_method_config=elbv2.CfnListenerRule.HttpRequestMethodConfigProperty( values=["values"] ), path_pattern_config=elbv2.CfnListenerRule.PathPatternConfigProperty( values=["values"] ), query_string_config=elbv2.CfnListenerRule.QueryStringConfigProperty( values=[elbv2.CfnListenerRule.QueryStringKeyValueProperty( key="key", value="value" )] ), source_ip_config=elbv2.CfnListenerRule.SourceIpConfigProperty( values=["values"] ), values=["values"] )], priority=123, # the properties below are optional listener_arn="listenerArn" )
Create a new
AWS::ElasticLoadBalancingV2::ListenerRule
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
actions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,ActionProperty
,Dict
[str
,Any
]]]]) – The actions. The rule must include exactly one of the following types of actions:forward
,fixed-response
, orredirect
, and it must be the last action to be performed. If the rule is for an HTTPS listener, it can also optionally include an authentication action.conditions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,RuleConditionProperty
,Dict
[str
,Any
]]]]) – The conditions. The rule can optionally include up to one of each of the following conditions:http-request-method
,host-header
,path-pattern
, andsource-ip
. A rule can also optionally include one or more of each of the following conditions:http-header
andquery-string
.priority (
Union
[int
,float
]) – The rule priority. A listener can’t have multiple rules with the same priority. If you try to reorder rules by updating their priorities, do not specify a new priority if an existing rule already uses this priority, as this can cause an error. If you need to reuse a priority with a different rule, you must remove it as a priority first, and then specify it in a subsequent update.listener_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the listener.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::ElasticLoadBalancingV2::ListenerRule'
- actions
The actions.
The rule must include exactly one of the following types of actions:
forward
,fixed-response
, orredirect
, and it must be the last action to be performed. If the rule is for an HTTPS listener, it can also optionally include an authentication action.
- attr_is_default
Indicates whether this is the default rule.
- CloudformationAttribute:
IsDefault
- attr_rule_arn
The Amazon Resource Name (ARN) of the rule.
- CloudformationAttribute:
RuleArn
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- conditions
The conditions.
The rule can optionally include up to one of each of the following conditions:
http-request-method
,host-header
,path-pattern
, andsource-ip
. A rule can also optionally include one or more of each of the following conditions:http-header
andquery-string
.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- listener_arn
The Amazon Resource Name (ARN) of the listener.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- priority
The rule priority. A listener can’t have multiple rules with the same priority.
If you try to reorder rules by updating their priorities, do not specify a new priority if an existing rule already uses this priority, as this can cause an error. If you need to reuse a priority with a different rule, you must remove it as a priority first, and then specify it in a subsequent update.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
) –- Return type:
bool
ActionProperty
- class CfnListenerRule.ActionProperty(*, type, authenticate_cognito_config=None, authenticate_oidc_config=None, fixed_response_config=None, forward_config=None, order=None, redirect_config=None, target_group_arn=None)
Bases:
object
Specifies an action for a listener rule.
- Parameters:
type (
str
) – The type of action.authenticate_cognito_config (
Union
[IResolvable
,AuthenticateCognitoConfigProperty
,Dict
[str
,Any
],None
]) – [HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only whenType
isauthenticate-cognito
.authenticate_oidc_config (
Union
[IResolvable
,AuthenticateOidcConfigProperty
,Dict
[str
,Any
],None
]) – [HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only whenType
isauthenticate-oidc
.fixed_response_config (
Union
[IResolvable
,FixedResponseConfigProperty
,Dict
[str
,Any
],None
]) – [Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only whenType
isfixed-response
.forward_config (
Union
[IResolvable
,ForwardConfigProperty
,Dict
[str
,Any
],None
]) – Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only whenType
isforward
. If you specify bothForwardConfig
andTargetGroupArn
, you can specify only one target group usingForwardConfig
and it must be the same target group specified inTargetGroupArn
.order (
Union
[int
,float
,None
]) – The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.redirect_config (
Union
[IResolvable
,RedirectConfigProperty
,Dict
[str
,Any
],None
]) – [Application Load Balancer] Information for creating a redirect action. Specify only whenType
isredirect
.target_group_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the target group. Specify only whenType
isforward
and you want to route to a single target group. To route to one or more target groups, useForwardConfig
instead.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 action_property = elbv2.CfnListenerRule.ActionProperty( type="type", # the properties below are optional authenticate_cognito_config=elbv2.CfnListenerRule.AuthenticateCognitoConfigProperty( user_pool_arn="userPoolArn", user_pool_client_id="userPoolClientId", user_pool_domain="userPoolDomain", # the properties below are optional authentication_request_extra_params={ "authentication_request_extra_params_key": "authenticationRequestExtraParams" }, on_unauthenticated_request="onUnauthenticatedRequest", scope="scope", session_cookie_name="sessionCookieName", session_timeout=123 ), authenticate_oidc_config=elbv2.CfnListenerRule.AuthenticateOidcConfigProperty( authorization_endpoint="authorizationEndpoint", client_id="clientId", issuer="issuer", token_endpoint="tokenEndpoint", user_info_endpoint="userInfoEndpoint", # the properties below are optional authentication_request_extra_params={ "authentication_request_extra_params_key": "authenticationRequestExtraParams" }, client_secret="clientSecret", on_unauthenticated_request="onUnauthenticatedRequest", scope="scope", session_cookie_name="sessionCookieName", session_timeout=123, use_existing_client_secret=False ), fixed_response_config=elbv2.CfnListenerRule.FixedResponseConfigProperty( status_code="statusCode", # the properties below are optional content_type="contentType", message_body="messageBody" ), forward_config=elbv2.CfnListenerRule.ForwardConfigProperty( target_groups=[elbv2.CfnListenerRule.TargetGroupTupleProperty( target_group_arn="targetGroupArn", weight=123 )], target_group_stickiness_config=elbv2.CfnListenerRule.TargetGroupStickinessConfigProperty( duration_seconds=123, enabled=False ) ), order=123, redirect_config=elbv2.CfnListenerRule.RedirectConfigProperty( status_code="statusCode", # the properties below are optional host="host", path="path", port="port", protocol="protocol", query="query" ), target_group_arn="targetGroupArn" )
Attributes
- authenticate_cognito_config
[HTTPS listeners] Information for using Amazon Cognito to authenticate users.
Specify only when
Type
isauthenticate-cognito
.
- authenticate_oidc_config
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC).
Specify only when
Type
isauthenticate-oidc
.
- fixed_response_config
[Application Load Balancer] Information for creating an action that returns a custom HTTP response.
Specify only when
Type
isfixed-response
.
- forward_config
Information for creating an action that distributes requests among one or more target groups.
For Network Load Balancers, you can specify a single target group. Specify only when
Type
isforward
. If you specify bothForwardConfig
andTargetGroupArn
, you can specify only one target group usingForwardConfig
and it must be the same target group specified inTargetGroupArn
.
- order
The order for the action.
This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
- redirect_config
[Application Load Balancer] Information for creating a redirect action.
Specify only when
Type
isredirect
.
- target_group_arn
The Amazon Resource Name (ARN) of the target group.
Specify only when
Type
isforward
and you want to route to a single target group. To route to one or more target groups, useForwardConfig
instead.
AuthenticateCognitoConfigProperty
- class CfnListenerRule.AuthenticateCognitoConfigProperty(*, user_pool_arn, user_pool_client_id, user_pool_domain, authentication_request_extra_params=None, on_unauthenticated_request=None, scope=None, session_cookie_name=None, session_timeout=None)
Bases:
object
Specifies information required when integrating with Amazon Cognito to authenticate users.
- Parameters:
user_pool_arn (
str
) – The Amazon Resource Name (ARN) of the Amazon Cognito user pool.user_pool_client_id (
str
) – The ID of the Amazon Cognito user pool client.user_pool_domain (
str
) – The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.authentication_request_extra_params (
Union
[IResolvable
,Mapping
[str
,str
],None
]) – The query parameters (up to 10) to include in the redirect request to the authorization endpoint.on_unauthenticated_request (
Optional
[str
]) – The behavior if the user is not authenticated. The following are possible values:. - deny `` - Return an HTTP 401 Unauthorized error. - allow `` - Allow the request to be forwarded to the target. - authenticate `` - Redirect the request to the IdP authorization endpoint. This is the default value.scope (
Optional
[str
]) – The set of user claims to be requested from the IdP. The default isopenid
. To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.session_cookie_name (
Optional
[str
]) – The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.session_timeout (
Union
[int
,float
,None
]) – The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 authenticate_cognito_config_property = elbv2.CfnListenerRule.AuthenticateCognitoConfigProperty( user_pool_arn="userPoolArn", user_pool_client_id="userPoolClientId", user_pool_domain="userPoolDomain", # the properties below are optional authentication_request_extra_params={ "authentication_request_extra_params_key": "authenticationRequestExtraParams" }, on_unauthenticated_request="onUnauthenticatedRequest", scope="scope", session_cookie_name="sessionCookieName", session_timeout=123 )
Attributes
- authentication_request_extra_params
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
- on_unauthenticated_request
.
deny `` - Return an HTTP 401 Unauthorized error.
allow `` - Allow the request to be forwarded to the target.
authenticate `` - Redirect the request to the IdP authorization endpoint. This is the default value.
- Link:
- Type:
The behavior if the user is not authenticated. The following are possible values
- scope
The set of user claims to be requested from the IdP. The default is
openid
.To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.
- session_cookie_name
The name of the cookie used to maintain session information.
The default is AWSELBAuthSessionCookie.
- session_timeout
The maximum duration of the authentication session, in seconds.
The default is 604800 seconds (7 days).
- user_pool_arn
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
- user_pool_client_id
The ID of the Amazon Cognito user pool client.
- user_pool_domain
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
AuthenticateOidcConfigProperty
- class CfnListenerRule.AuthenticateOidcConfigProperty(*, authorization_endpoint, client_id, issuer, token_endpoint, user_info_endpoint, authentication_request_extra_params=None, client_secret=None, on_unauthenticated_request=None, scope=None, session_cookie_name=None, session_timeout=None, use_existing_client_secret=None)
Bases:
object
Specifies information required using an identity provide (IdP) that is compliant with OpenID Connect (OIDC) to authenticate users.
- Parameters:
authorization_endpoint (
str
) – The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.client_id (
str
) – The OAuth 2.0 client identifier.issuer (
str
) – The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.token_endpoint (
str
) – The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.user_info_endpoint (
str
) – The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.authentication_request_extra_params (
Union
[IResolvable
,Mapping
[str
,str
],None
]) – The query parameters (up to 10) to include in the redirect request to the authorization endpoint.client_secret (
Optional
[str
]) – The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you setUseExistingClientSecret
to true.on_unauthenticated_request (
Optional
[str
]) – The behavior if the user is not authenticated. The following are possible values:. - deny `` - Return an HTTP 401 Unauthorized error. - allow `` - Allow the request to be forwarded to the target. - authenticate `` - Redirect the request to the IdP authorization endpoint. This is the default value.scope (
Optional
[str
]) – The set of user claims to be requested from the IdP. The default isopenid
. To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.session_cookie_name (
Optional
[str
]) – The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.session_timeout (
Union
[int
,float
,None
]) – The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).use_existing_client_secret (
Union
[bool
,IResolvable
,None
]) – Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 authenticate_oidc_config_property = elbv2.CfnListenerRule.AuthenticateOidcConfigProperty( authorization_endpoint="authorizationEndpoint", client_id="clientId", issuer="issuer", token_endpoint="tokenEndpoint", user_info_endpoint="userInfoEndpoint", # the properties below are optional authentication_request_extra_params={ "authentication_request_extra_params_key": "authenticationRequestExtraParams" }, client_secret="clientSecret", on_unauthenticated_request="onUnauthenticatedRequest", scope="scope", session_cookie_name="sessionCookieName", session_timeout=123, use_existing_client_secret=False )
Attributes
- authentication_request_extra_params
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
- authorization_endpoint
The authorization endpoint of the IdP.
This must be a full URL, including the HTTPS protocol, the domain, and the path.
- client_id
The OAuth 2.0 client identifier.
- client_secret
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set
UseExistingClientSecret
to true.
- issuer
The OIDC issuer identifier of the IdP.
This must be a full URL, including the HTTPS protocol, the domain, and the path.
- on_unauthenticated_request
.
deny `` - Return an HTTP 401 Unauthorized error.
allow `` - Allow the request to be forwarded to the target.
authenticate `` - Redirect the request to the IdP authorization endpoint. This is the default value.
- Link:
- Type:
The behavior if the user is not authenticated. The following are possible values
- scope
The set of user claims to be requested from the IdP. The default is
openid
.To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.
- session_cookie_name
The name of the cookie used to maintain session information.
The default is AWSELBAuthSessionCookie.
- session_timeout
The maximum duration of the authentication session, in seconds.
The default is 604800 seconds (7 days).
- token_endpoint
The token endpoint of the IdP.
This must be a full URL, including the HTTPS protocol, the domain, and the path.
- use_existing_client_secret
Indicates whether to use the existing client secret when modifying a rule.
If you are creating a rule, you can omit this parameter or set it to false.
- user_info_endpoint
The user info endpoint of the IdP.
This must be a full URL, including the HTTPS protocol, the domain, and the path.
FixedResponseConfigProperty
- class CfnListenerRule.FixedResponseConfigProperty(*, status_code, content_type=None, message_body=None)
Bases:
object
Specifies information required when returning a custom HTTP response.
- Parameters:
status_code (
str
) – The HTTP response code (2XX, 4XX, or 5XX).content_type (
Optional
[str
]) – The content type. Valid Values: text/plain | text/css | text/html | application/javascript | application/jsonmessage_body (
Optional
[str
]) – The message.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 fixed_response_config_property = elbv2.CfnListenerRule.FixedResponseConfigProperty( status_code="statusCode", # the properties below are optional content_type="contentType", message_body="messageBody" )
Attributes
- content_type
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
- message_body
The message.
- status_code
The HTTP response code (2XX, 4XX, or 5XX).
ForwardConfigProperty
- class CfnListenerRule.ForwardConfigProperty(*, target_groups=None, target_group_stickiness_config=None)
Bases:
object
Information for creating an action that distributes requests among one or more target groups.
For Network Load Balancers, you can specify a single target group. Specify only when
Type
isforward
. If you specify bothForwardConfig
andTargetGroupArn
, you can specify only one target group usingForwardConfig
and it must be the same target group specified inTargetGroupArn
.- Parameters:
target_groups (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetGroupTupleProperty
,Dict
[str
,Any
]]],None
]) – Information about how traffic will be distributed between multiple target groups in a forward rule.target_group_stickiness_config (
Union
[IResolvable
,TargetGroupStickinessConfigProperty
,Dict
[str
,Any
],None
]) – Information about the target group stickiness for a rule.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 forward_config_property = elbv2.CfnListenerRule.ForwardConfigProperty( target_groups=[elbv2.CfnListenerRule.TargetGroupTupleProperty( target_group_arn="targetGroupArn", weight=123 )], target_group_stickiness_config=elbv2.CfnListenerRule.TargetGroupStickinessConfigProperty( duration_seconds=123, enabled=False ) )
Attributes
- target_group_stickiness_config
Information about the target group stickiness for a rule.
- target_groups
Information about how traffic will be distributed between multiple target groups in a forward rule.
HostHeaderConfigProperty
- class CfnListenerRule.HostHeaderConfigProperty(*, values=None)
Bases:
object
Information about a host header condition.
- Parameters:
values (
Optional
[Sequence
[str
]]) – The host names. The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 host_header_config_property = elbv2.CfnListenerRule.HostHeaderConfigProperty( values=["values"] )
Attributes
- values
The host names.
The maximum size of each name is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.
HttpHeaderConfigProperty
- class CfnListenerRule.HttpHeaderConfigProperty(*, http_header_name=None, values=None)
Bases:
object
Information about an HTTP header condition.
There is a set of standard HTTP header fields. You can also define custom HTTP header fields.
- Parameters:
http_header_name (
Optional
[str
]) – The name of the HTTP header field. The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.values (
Optional
[Sequence
[str
]]) – The strings to compare against the value of the HTTP header. The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). If the same header appears multiple times in the request, we search them in order until a match is found. If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 http_header_config_property = elbv2.CfnListenerRule.HttpHeaderConfigProperty( http_header_name="httpHeaderName", values=["values"] )
Attributes
- http_header_name
The name of the HTTP header field.
The maximum size is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.
- values
The strings to compare against the value of the HTTP header.
The maximum size of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If the same header appears multiple times in the request, we search them in order until a match is found.
If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
HttpRequestMethodConfigProperty
- class CfnListenerRule.HttpRequestMethodConfigProperty(*, values=None)
Bases:
object
Information about an HTTP method condition.
HTTP defines a set of request methods, also referred to as HTTP verbs. For more information, see the HTTP Method Registry . You can also define custom HTTP methods.
- Parameters:
values (
Optional
[Sequence
[str
]]) – The name of the request method. The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match. If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 http_request_method_config_property = elbv2.CfnListenerRule.HttpRequestMethodConfigProperty( values=["values"] )
Attributes
- values
The name of the request method.
The maximum size is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.
If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.
PathPatternConfigProperty
- class CfnListenerRule.PathPatternConfigProperty(*, values=None)
Bases:
object
Information about a path pattern condition.
- Parameters:
values (
Optional
[Sequence
[str
]]) – The path patterns to compare against the request URL. The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 path_pattern_config_property = elbv2.CfnListenerRule.PathPatternConfigProperty( values=["values"] )
Attributes
- values
The path patterns to compare against the request URL.
The maximum size of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string.
QueryStringConfigProperty
- class CfnListenerRule.QueryStringConfigProperty(*, values=None)
Bases:
object
Information about a query string condition.
The query string component of a URI starts after the first ‘?’ character and is terminated by either a ‘#’ character or the end of the URI. A typical query string contains key/value pairs separated by ‘&’ characters. The allowed characters are specified by RFC 3986. Any character can be percentage encoded.
- Parameters:
values (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,QueryStringKeyValueProperty
,Dict
[str
,Any
]]],None
]) – The key/value pairs or values to find in the query string. The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal ‘*’ or ‘?’ character in a query string, you must escape these characters inValues
using a ‘’ character. If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 query_string_config_property = elbv2.CfnListenerRule.QueryStringConfigProperty( values=[elbv2.CfnListenerRule.QueryStringKeyValueProperty( key="key", value="value" )] )
Attributes
- values
The key/value pairs or values to find in the query string.
The maximum size of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal ‘*’ or ‘?’ character in a query string, you must escape these characters in
Values
using a ‘’ character.If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.
QueryStringKeyValueProperty
- class CfnListenerRule.QueryStringKeyValueProperty(*, key=None, value=None)
Bases:
object
Information about a key/value pair.
- Parameters:
key (
Optional
[str
]) – The key. You can omit the key.value (
Optional
[str
]) – The value.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 query_string_key_value_property = elbv2.CfnListenerRule.QueryStringKeyValueProperty( key="key", value="value" )
Attributes
- key
The key.
You can omit the key.
RedirectConfigProperty
- class CfnListenerRule.RedirectConfigProperty(*, status_code, host=None, path=None, port=None, protocol=None, query=None)
Bases:
object
Information about a redirect action.
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”.
- Parameters:
status_code (
str
) – The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).host (
Optional
[str
]) – The hostname. This component is not percent-encoded. The hostname can contain #{host}.path (
Optional
[str
]) – The absolute path, starting with the leading “/”. This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.port (
Optional
[str
]) – The port. You can specify a value from 1 to 65535 or #{port}.protocol (
Optional
[str
]) – The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.query (
Optional
[str
]) – The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading “?”, as it is automatically added. You can specify any of the reserved keywords.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 redirect_config_property = elbv2.CfnListenerRule.RedirectConfigProperty( status_code="statusCode", # the properties below are optional host="host", path="path", port="port", protocol="protocol", query="query" )
Attributes
- host
The hostname.
This component is not percent-encoded. The hostname can contain #{host}.
- path
The absolute path, starting with the leading “/”.
This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
- port
The port.
You can specify a value from 1 to 65535 or #{port}.
- protocol
The protocol.
You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.
- query
The query parameters, URL-encoded when necessary, but not percent-encoded.
Do not include the leading “?”, as it is automatically added. You can specify any of the reserved keywords.
- status_code
The HTTP redirect code.
The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
RuleConditionProperty
- class CfnListenerRule.RuleConditionProperty(*, field=None, host_header_config=None, http_header_config=None, http_request_method_config=None, path_pattern_config=None, query_string_config=None, source_ip_config=None, values=None)
Bases:
object
Specifies a condition for a listener rule.
- Parameters:
field (
Optional
[str
]) – The field in the HTTP request. The following are the possible values:. -http-header
-http-request-method
-host-header
-path-pattern
-query-string
-source-ip
host_header_config (
Union
[IResolvable
,HostHeaderConfigProperty
,Dict
[str
,Any
],None
]) – Information for a host header condition. Specify only whenField
ishost-header
.http_header_config (
Union
[IResolvable
,HttpHeaderConfigProperty
,Dict
[str
,Any
],None
]) – Information for an HTTP header condition. Specify only whenField
ishttp-header
.http_request_method_config (
Union
[IResolvable
,HttpRequestMethodConfigProperty
,Dict
[str
,Any
],None
]) – Information for an HTTP method condition. Specify only whenField
ishttp-request-method
.path_pattern_config (
Union
[IResolvable
,PathPatternConfigProperty
,Dict
[str
,Any
],None
]) – Information for a path pattern condition. Specify only whenField
ispath-pattern
.query_string_config (
Union
[IResolvable
,QueryStringConfigProperty
,Dict
[str
,Any
],None
]) – Information for a query string condition. Specify only whenField
isquery-string
.source_ip_config (
Union
[IResolvable
,SourceIpConfigProperty
,Dict
[str
,Any
],None
]) – Information for a source IP condition. Specify only whenField
issource-ip
.values (
Optional
[Sequence
[str
]]) – The condition value. Specify only whenField
ishost-header
orpath-pattern
. Alternatively, to specify multiple host names or multiple path patterns, useHostHeaderConfig
orPathPatternConfig
. IfField
ishost-header
and you’re not usingHostHeaderConfig
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. - A-Z, a-z, 0-9 - - . - - (matches 0 or more characters) - ? (matches exactly 1 character) IfField
ispath-pattern
and you’re not usingPathPatternConfig
, you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. - A-Z, a-z, 0-9 - _ - . $ / ~ ” ‘ @ : + - & (using &) - - (matches 0 or more characters) - ? (matches exactly 1 character)
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 rule_condition_property = elbv2.CfnListenerRule.RuleConditionProperty( field="field", host_header_config=elbv2.CfnListenerRule.HostHeaderConfigProperty( values=["values"] ), http_header_config=elbv2.CfnListenerRule.HttpHeaderConfigProperty( http_header_name="httpHeaderName", values=["values"] ), http_request_method_config=elbv2.CfnListenerRule.HttpRequestMethodConfigProperty( values=["values"] ), path_pattern_config=elbv2.CfnListenerRule.PathPatternConfigProperty( values=["values"] ), query_string_config=elbv2.CfnListenerRule.QueryStringConfigProperty( values=[elbv2.CfnListenerRule.QueryStringKeyValueProperty( key="key", value="value" )] ), source_ip_config=elbv2.CfnListenerRule.SourceIpConfigProperty( values=["values"] ), values=["values"] )
Attributes
- field
.
http-header
http-request-method
host-header
path-pattern
query-string
source-ip
- Link:
- Type:
The field in the HTTP request. The following are the possible values
- host_header_config
Information for a host header condition.
Specify only when
Field
ishost-header
.
- http_header_config
Information for an HTTP header condition.
Specify only when
Field
ishttp-header
.
- http_request_method_config
Information for an HTTP method condition.
Specify only when
Field
ishttp-request-method
.
- path_pattern_config
Information for a path pattern condition.
Specify only when
Field
ispath-pattern
.
- query_string_config
Information for a query string condition.
Specify only when
Field
isquery-string
.
- source_ip_config
Information for a source IP condition.
Specify only when
Field
issource-ip
.
- values
The condition value.
Specify only when
Field
ishost-header
orpath-pattern
. Alternatively, to specify multiple host names or multiple path patterns, useHostHeaderConfig
orPathPatternConfig
.If
Field
ishost-header
and you’re not usingHostHeaderConfig
, you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.A-Z, a-z, 0-9
.
(matches 0 or more characters)
? (matches exactly 1 character)
If
Field
ispath-pattern
and you’re not usingPathPatternConfig
, you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.A-Z, a-z, 0-9
_ - . $ / ~ ” ‘ @ : +
& (using &)
(matches 0 or more characters)
? (matches exactly 1 character)
SourceIpConfigProperty
- class CfnListenerRule.SourceIpConfigProperty(*, values=None)
Bases:
object
Information about a source IP condition.
You can use this condition to route based on the IP address of the source that connects to the load balancer. If a client is behind a proxy, this is the IP address of the proxy not the IP address of the client.
- Parameters:
values (
Optional
[Sequence
[str
]]) – The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported. If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 source_ip_config_property = elbv2.CfnListenerRule.SourceIpConfigProperty( values=["values"] )
Attributes
- values
The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.
If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header.
TargetGroupStickinessConfigProperty
- class CfnListenerRule.TargetGroupStickinessConfigProperty(*, duration_seconds=None, enabled=None)
Bases:
object
Information about the target group stickiness for a rule.
- Parameters:
duration_seconds (
Union
[int
,float
,None
]) – The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days).enabled (
Union
[bool
,IResolvable
,None
]) – Indicates whether target group stickiness is enabled.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 target_group_stickiness_config_property = elbv2.CfnListenerRule.TargetGroupStickinessConfigProperty( duration_seconds=123, enabled=False )
Attributes
- duration_seconds
The time period, in seconds, during which requests from a client should be routed to the same target group.
The range is 1-604800 seconds (7 days).
- enabled
Indicates whether target group stickiness is enabled.
TargetGroupTupleProperty
- class CfnListenerRule.TargetGroupTupleProperty(*, target_group_arn=None, weight=None)
Bases:
object
Information about how traffic will be distributed between multiple target groups in a forward rule.
- Parameters:
target_group_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the target group.weight (
Union
[int
,float
,None
]) – The weight. The range is 0 to 999.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_elasticloadbalancingv2 as elbv2 target_group_tuple_property = elbv2.CfnListenerRule.TargetGroupTupleProperty( target_group_arn="targetGroupArn", weight=123 )
Attributes
- target_group_arn
The Amazon Resource Name (ARN) of the target group.