CfnListenerPropsMixin

class aws_cdk.cfn_property_mixins.aws_vpclattice.CfnListenerPropsMixin(props, *, strategy=None)

Bases: Mixin

Creates a listener for a service.

Before you start using your Amazon VPC Lattice service, you must add one or more listeners. A listener is a process that checks for connection requests to your services. For more information, see Listeners in the Amazon VPC Lattice User Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-vpclattice-listener.html

CloudformationResource:

AWS::VpcLattice::Listener

Mixin:

true

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.cfn_property_mixins import aws_vpclattice as vpclattice
import aws_cdk as cdk

# merge_strategy: cdk.IMergeStrategy

cfn_listener_props_mixin = vpclattice.CfnListenerPropsMixin(vpclattice.CfnListenerMixinProps(
    default_action=vpclattice.CfnListenerPropsMixin.DefaultActionProperty(
        fixed_response=vpclattice.CfnListenerPropsMixin.FixedResponseProperty(
            status_code=123
        ),
        forward=vpclattice.CfnListenerPropsMixin.ForwardProperty(
            target_groups=[vpclattice.CfnListenerPropsMixin.WeightedTargetGroupProperty(
                target_group_identifier="targetGroupIdentifier",
                weight=123
            )]
        )
    ),
    name="name",
    port=123,
    protocol="protocol",
    service_identifier="serviceIdentifier",
    tags=[cdk.CfnTag(
        key="key",
        value="value"
    )]
),
    strategy=merge_strategy
)

Create a mixin to apply properties to AWS::VpcLattice::Listener.

Parameters:
  • props (Union[CfnListenerMixinProps, Dict[str, Any]]) – L1 properties to apply.

  • strategy (Optional[IMergeStrategy]) – Strategy for merging nested properties. Default: - PropertyMergeStrategy.combine()

Methods

apply_to(construct)

Apply the mixin properties to the construct.

Parameters:

construct (IConstruct)

Return type:

None

supports(construct)

Check if this mixin supports the given construct.

Parameters:

construct (IConstruct)

Return type:

bool

Attributes

CFN_PROPERTY_KEYS = ['defaultAction', 'name', 'port', 'protocol', 'serviceIdentifier', 'tags']

Static Methods

classmethod is_mixin(x)

Checks if x is a Mixin.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Mixin.

DefaultActionProperty

class CfnListenerPropsMixin.DefaultActionProperty(*, fixed_response=None, forward=None)

Bases: object

The action for the default rule.

Each listener has a default rule. The default rule is used if no other rules match.

Parameters:
  • fixed_response (Union[IResolvable, FixedResponseProperty, Dict[str, Any], None]) – Describes an action that returns a custom HTTP response.

  • forward (Union[IResolvable, ForwardProperty, Dict[str, Any], None]) – Describes a forward action. You can use forward actions to route requests to one or more target groups.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-defaultaction.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.cfn_property_mixins import aws_vpclattice as vpclattice

default_action_property = vpclattice.CfnListenerPropsMixin.DefaultActionProperty(
    fixed_response=vpclattice.CfnListenerPropsMixin.FixedResponseProperty(
        status_code=123
    ),
    forward=vpclattice.CfnListenerPropsMixin.ForwardProperty(
        target_groups=[vpclattice.CfnListenerPropsMixin.WeightedTargetGroupProperty(
            target_group_identifier="targetGroupIdentifier",
            weight=123
        )]
    )
)

Attributes

fixed_response

Describes an action that returns a custom HTTP response.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-defaultaction.html#cfn-vpclattice-listener-defaultaction-fixedresponse

forward

Describes a forward action.

You can use forward actions to route requests to one or more target groups.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-defaultaction.html#cfn-vpclattice-listener-defaultaction-forward

FixedResponseProperty

class CfnListenerPropsMixin.FixedResponseProperty(*, status_code=None)

Bases: object

Describes an action that returns a custom HTTP response.

Parameters:

status_code (Union[int, float, None]) – The HTTP response code. Only 404 and 500 status codes are supported.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-fixedresponse.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.cfn_property_mixins import aws_vpclattice as vpclattice

fixed_response_property = vpclattice.CfnListenerPropsMixin.FixedResponseProperty(
    status_code=123
)

Attributes

status_code

The HTTP response code.

Only 404 and 500 status codes are supported.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-fixedresponse.html#cfn-vpclattice-listener-fixedresponse-statuscode

ForwardProperty

class CfnListenerPropsMixin.ForwardProperty(*, target_groups=None)

Bases: object

The forward action.

Traffic that matches the rule is forwarded to the specified target groups.

Parameters:

target_groups (Union[IResolvable, Sequence[Union[IResolvable, WeightedTargetGroupProperty, Dict[str, Any]]], None]) – The target groups. Traffic matching the rule is forwarded to the specified target groups. With forward actions, you can assign a weight that controls the prioritization and selection of each target group. This means that requests are distributed to individual target groups based on their weights. For example, if two target groups have the same weight, each target group receives half of the traffic. The default value is 1. This means that if only one target group is provided, there is no need to set the weight; 100% of the traffic goes to that target group.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-forward.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.cfn_property_mixins import aws_vpclattice as vpclattice

forward_property = vpclattice.CfnListenerPropsMixin.ForwardProperty(
    target_groups=[vpclattice.CfnListenerPropsMixin.WeightedTargetGroupProperty(
        target_group_identifier="targetGroupIdentifier",
        weight=123
    )]
)

Attributes

target_groups

The target groups.

Traffic matching the rule is forwarded to the specified target groups. With forward actions, you can assign a weight that controls the prioritization and selection of each target group. This means that requests are distributed to individual target groups based on their weights. For example, if two target groups have the same weight, each target group receives half of the traffic.

The default value is 1. This means that if only one target group is provided, there is no need to set the weight; 100% of the traffic goes to that target group.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-forward.html#cfn-vpclattice-listener-forward-targetgroups

WeightedTargetGroupProperty

class CfnListenerPropsMixin.WeightedTargetGroupProperty(*, target_group_identifier=None, weight=None)

Bases: object

Describes the weight of a target group.

Parameters:
  • target_group_identifier (Optional[str]) – The ID of the target group.

  • weight (Union[int, float, None]) – Only required if you specify multiple target groups for a forward action. The weight determines how requests are distributed to the target group. For example, if you specify two target groups, each with a weight of 10, each target group receives half the requests. If you specify two target groups, one with a weight of 10 and the other with a weight of 20, the target group with a weight of 20 receives twice as many requests as the other target group. If there’s only one target group specified, then the default value is 100.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-weightedtargetgroup.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.cfn_property_mixins import aws_vpclattice as vpclattice

weighted_target_group_property = vpclattice.CfnListenerPropsMixin.WeightedTargetGroupProperty(
    target_group_identifier="targetGroupIdentifier",
    weight=123
)

Attributes

target_group_identifier

The ID of the target group.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-weightedtargetgroup.html#cfn-vpclattice-listener-weightedtargetgroup-targetgroupidentifier

weight

Only required if you specify multiple target groups for a forward action.

The weight determines how requests are distributed to the target group. For example, if you specify two target groups, each with a weight of 10, each target group receives half the requests. If you specify two target groups, one with a weight of 10 and the other with a weight of 20, the target group with a weight of 20 receives twice as many requests as the other target group. If there’s only one target group specified, then the default value is 100.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-vpclattice-listener-weightedtargetgroup.html#cfn-vpclattice-listener-weightedtargetgroup-weight