# WeightedTarget

Properties for the Weighted Targets in the route.

- Source: [`aws-appmesh/lib/route-spec.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts#L17)
- Type last changed: v2.88.0 · 20 Jul 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appmesh as appmesh } from 'aws-cdk-lib';

declare const virtualNode: appmesh.VirtualNode;
const weightedTarget: appmesh.WeightedTarget = {
  virtualNode: virtualNode,

  // the properties below are optional
  port: 123,
  weight: 123,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appmesh as appmesh

# virtual_node: appmesh.VirtualNode

weighted_target = appmesh.WeightedTarget(
    virtual_node=virtual_node,

    # the properties below are optional
    port=123,
    weight=123
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appmesh.*;

VirtualNode virtualNode;

WeightedTarget weightedTarget = WeightedTarget.builder()
        .virtualNode(virtualNode)

        // the properties below are optional
        .port(123)
        .weight(123)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppMesh;

VirtualNode virtualNode;

var weightedTarget = new WeightedTarget {
    VirtualNode = virtualNode,

    // the properties below are optional
    Port = 123,
    Weight = 123
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var virtualNode VirtualNode

weightedTarget := &WeightedTarget{
	VirtualNode: virtualNode,

	// the properties below are optional
	Port: jsii.Number(123),
	Weight: jsii.Number(123),
}
```

## Properties

- `port`: number — The port to match from the request.

  **Default:** do not match on port

- `virtualNode`: [IVirtualNode](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.IVirtualNode.html) (required) — The VirtualNode the route points to.

- `weight`: number = 1 — The weight for the target.
