Skip to content

(app-mesh): WeightedTarget construct is missing port property #26083

@neovasili

Description

@neovasili

Describe the bug

While the CfnRoute give us the ability to define a route with weighted targets with a port, the L2 construct WeightedTarget does not have that property (only have virtual_node and weight), leveraging us to use L1 constructs instead if we want to use the port specification.

Port is required for routes to nodes that have multiple listeners.

Expected Behavior

WeightedTarget L2 construct also let us specify the port option.

Current Behavior

WeightedTarget L2 construct does not have the property port.

Reproduction Steps

Example in python; the following is not valid code:

appmesh.RouteSpec.grpc(
    weighted_targets=[appmesh.WeightedTarget(virtual_node=node, port=myPortNumber)],
    match=appmesh.GrpcRouteMatch(port=myPortNumber),
)

We need to use L1 construct, to get the same result:

appmesh.CfnRoute.RouteSpecProperty(
    grpc_route=appmesh.CfnRoute.GrpcRouteProperty(
        action=appmesh.CfnRoute.GrpcRouteActionProperty(
            weighted_targets=[appmesh.CfnRoute.WeightedTargetProperty(
                virtual_node=node.virtual_node_name,
                weight=1,
                port=myPortNumber,
            )],
        ),
        match=appmesh.CfnRoute.GrpcRouteMatchProperty(port=myPortNumber),
    ),
)

Possible Solution

Add the Port property to the construct interface, since is already a property in the CloudFormation specs.

Additional Information/Context

No response

CDK CLI Version

2.85.0

Framework Version

2.85.0

Node.js Version

v16.14.2

OS

MacOs Ventura

Language

Python

Language Version

python 3.11.1

Other information

I have checked through the CDK docs that typescript CDK version have the same issue, so I guess this applies to all languages available.

I can work in a fix if there is no reason to not work on this fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-appmeshRelated to AWS App Mesheffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions