# TcpRouteSpecOptions

Properties specific for a TCP Based Routes.

Extends: [RouteSpecOptionsBase](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.RouteSpecOptionsBase.html)
Used as argument in: [RouteSpec.tcp](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.RouteSpec.html#tcp)

- 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#L253)

## Example

TypeScript:

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

declare const virtualNode: appmesh.VirtualNode;
const tcpRouteSpecOptions: appmesh.TcpRouteSpecOptions = {
  weightedTargets: [{
    virtualNode: virtualNode,

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

  // the properties below are optional
  priority: 123,
  timeout: {
    idle: cdk.Duration.minutes(30),
  },
};
```

Python:

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

# virtual_node: appmesh.VirtualNode

tcp_route_spec_options = appmesh.TcpRouteSpecOptions(
    weighted_targets=[appmesh.WeightedTarget(
        virtual_node=virtual_node,

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

    # the properties below are optional
    priority=123,
    timeout=appmesh.TcpTimeout(
        idle=cdk.Duration.minutes(30)
    )
)
```

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.*;
import software.amazon.awscdk.services.appmesh.*;

VirtualNode virtualNode;

TcpRouteSpecOptions tcpRouteSpecOptions = TcpRouteSpecOptions.builder()
        .weightedTargets(List.of(WeightedTarget.builder()
                .virtualNode(virtualNode)

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

        // the properties below are optional
        .priority(123)
        .timeout(TcpTimeout.builder()
                .idle(Duration.minutes(30))
                .build())
        .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;
using Amazon.CDK.AWS.AppMesh;

VirtualNode virtualNode;

var tcpRouteSpecOptions = new TcpRouteSpecOptions {
    WeightedTargets = new [] { new WeightedTarget {
        VirtualNode = virtualNode,

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

    // the properties below are optional
    Priority = 123,
    Timeout = new TcpTimeout {
        Idle = Duration.Minutes(30)
    }
};
```

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 cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var virtualNode VirtualNode

tcpRouteSpecOptions := &TcpRouteSpecOptions{
	WeightedTargets: []WeightedTarget{
		&WeightedTarget{
			VirtualNode: virtualNode,

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

	// the properties below are optional
	Priority: jsii.Number(123),
	Timeout: &TcpTimeout{
		Idle: cdk.Duration_Minutes(jsii.Number(30)),
	},
}
```

## Properties

- `priority`: number — The priority for the route.

  **Default:** no particular priority

  When a Virtual Router has multiple routes, route match is performed in the
  order of specified value, where 0 is the highest priority, and first matched route is selected.

- `timeout`: [TcpTimeout](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.TcpTimeout.html) = None — An object that represents a tcp timeout.

- `weightedTargets`: [WeightedTarget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.WeightedTarget.html)[] (required) — List of targets that traffic is routed to when a request matches the route.
