# VirtualRouterProps

The properties used when creating a new VirtualRouter.

Extends: [VirtualRouterBaseProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.VirtualRouterBaseProps.html)
Used as props by: [VirtualRouter](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.VirtualRouter.html)

- Source: [`aws-appmesh/lib/virtual-router.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appmesh/lib/virtual-router.ts#L101)

## Example

TypeScript:

```ts
declare const infraStack: cdk.Stack;
declare const appStack: cdk.Stack;

const mesh = new appmesh.Mesh(infraStack, 'AppMesh', {
  meshName: 'myAwsMesh',
  egressFilter: appmesh.MeshFilterType.ALLOW_ALL,
});

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
const router = new appmesh.VirtualRouter(appStack, 'router', {
  mesh, // notice that mesh is a required property when creating a router with the 'new' statement
  listeners: [appmesh.VirtualRouterListener.http(8081)],
});
```

Python:

```python
# infra_stack: cdk.Stack
# app_stack: cdk.Stack

mesh = appmesh.Mesh(infra_stack, "AppMesh",
    mesh_name="myAwsMesh",
    egress_filter=appmesh.MeshFilterType.ALLOW_ALL
)

# the VirtualRouter will belong to 'appStack',
# even though the Mesh belongs to 'infraStack'
router = appmesh.VirtualRouter(app_stack, "router",
    mesh=mesh,  # notice that mesh is a required property when creating a router with the 'new' statement
    listeners=[appmesh.VirtualRouterListener.http(8081)]
)
```

Java:

```java
Stack infraStack;
Stack appStack;

Mesh mesh = Mesh.Builder.create(infraStack, "AppMesh")
        .meshName("myAwsMesh")
        .egressFilter(MeshFilterType.ALLOW_ALL)
        .build();

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
VirtualRouter router = VirtualRouter.Builder.create(appStack, "router")
        .mesh(mesh) // notice that mesh is a required property when creating a router with the 'new' statement
        .listeners(List.of(VirtualRouterListener.http(8081)))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Stack infraStack;
Stack appStack;

var mesh = new Mesh(infraStack, "AppMesh", new MeshProps {
    MeshName = "myAwsMesh",
    EgressFilter = MeshFilterType.ALLOW_ALL
});

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
var router = new VirtualRouter(appStack, "router", new VirtualRouterProps {
    Mesh = mesh,  // notice that mesh is a required property when creating a router with the 'new' statement
    Listeners = new [] { VirtualRouterListener.Http(8081) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var infraStack Stack
var appStack Stack

mesh := appmesh.NewMesh(infraStack, jsii.String("AppMesh"), &MeshProps{
	MeshName: jsii.String("myAwsMesh"),
	EgressFilter: appmesh.MeshFilterType_ALLOW_ALL,
})

// the VirtualRouter will belong to 'appStack',
// even though the Mesh belongs to 'infraStack'
router := appmesh.NewVirtualRouter(appStack, jsii.String("router"), &VirtualRouterProps{
	Mesh: Mesh,
	 // notice that mesh is a required property when creating a router with the 'new' statement
	Listeners: []VirtualRouterListener{
		appmesh.VirtualRouterListener_Http(jsii.Number(8081)),
	},
})
```

## Properties

- `listeners`: [VirtualRouterListener](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.VirtualRouterListener.html)[] — Listener specification for the VirtualRouter.

  **Default:** A listener on HTTP port 8080

- `mesh`: [IMesh](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appmesh.IMesh.html) (required) — The Mesh which the VirtualRouter belongs to.

- `virtualRouterName`: string — The name of the VirtualRouter.

  **Default:** A name is automatically determined
