aws-cdk-lib.aws_appmesh.VirtualGateway

class VirtualGateway (construct)

LanguageType name
.NETAmazon.CDK.AWS.AppMesh.VirtualGateway
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappmesh#VirtualGateway
Javasoftware.amazon.awscdk.services.appmesh.VirtualGateway
Pythonaws_cdk.aws_appmesh.VirtualGateway
TypeScript (source)aws-cdk-lib » aws_appmesh » VirtualGateway

Implements IConstruct, IDependable, IResource, IVirtualGateway

VirtualGateway represents a newly defined App Mesh Virtual Gateway.

A virtual gateway allows resources that are outside of your mesh to communicate to resources that are inside of your mesh.

See also: https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_gateways.html

Example

// A Virtual Node with a gRPC listener with a connection pool set
declare const mesh: appmesh.Mesh;
const node = new appmesh.VirtualNode(this, 'node', {
  mesh,
  // DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS.
  // LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints,
  // whereas ENDPOINTS means that the DNS resolver is returning all the endpoints.
  // By default, the response type is assumed to be LOAD_BALANCER
  serviceDiscovery: appmesh.ServiceDiscovery.dns('node', appmesh.DnsResponseType.ENDPOINTS),
  listeners: [appmesh.VirtualNodeListener.http({
    port: 80,
    connectionPool: {
      maxConnections: 100,
      maxPendingRequests: 10,
    },
  })],
});

// A Virtual Gateway with a gRPC listener with a connection pool set
const gateway = new appmesh.VirtualGateway(this, 'gateway', {
  mesh,
  listeners: [appmesh.VirtualGatewayListener.grpc({
    port: 8080,
    connectionPool: {
      maxRequests: 10,
    },
  })],
  virtualGatewayName: 'gateway',
});

Initializer

new VirtualGateway(scope: Construct, id: string, props: VirtualGatewayProps)

Parameters

  • scope Construct
  • id string
  • props VirtualGatewayProps

Construct Props

NameTypeDescription
meshIMeshThe Mesh which the VirtualGateway belongs to.
accessLog?AccessLogAccess Logging Configuration for the VirtualGateway.
backendDefaults?BackendDefaultsDefault Configuration Virtual Node uses to communicate with Virtual Service.
listeners?VirtualGatewayListener[]Listeners for the VirtualGateway.
virtualGatewayName?stringName of the VirtualGateway.

mesh

Type: IMesh

The Mesh which the VirtualGateway belongs to.


accessLog?

Type: AccessLog (optional, default: no access logging)

Access Logging Configuration for the VirtualGateway.


backendDefaults?

Type: BackendDefaults (optional, default: No Config)

Default Configuration Virtual Node uses to communicate with Virtual Service.


listeners?

Type: VirtualGatewayListener[] (optional, default: Single HTTP listener on port 8080)

Listeners for the VirtualGateway.

Only one is supported.


virtualGatewayName?

Type: string (optional, default: A name is automatically determined)

Name of the VirtualGateway.

Properties

NameTypeDescription
envResourceEnvironmentThe environment this resource belongs to.
listenersVirtualGatewayListenerConfig[]
meshIMeshThe Mesh that the VirtualGateway belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.
virtualGatewayArnstringThe Amazon Resource Name (ARN) for the VirtualGateway.
virtualGatewayNamestringThe name of the VirtualGateway.

env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


listeners

Type: VirtualGatewayListenerConfig[]


mesh

Type: IMesh

The Mesh that the VirtualGateway belongs to.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.


virtualGatewayArn

Type: string

The Amazon Resource Name (ARN) for the VirtualGateway.


virtualGatewayName

Type: string

The name of the VirtualGateway.

Methods

NameDescription
addGatewayRoute(id, props)Utility method to add a new GatewayRoute to the VirtualGateway.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
grantStreamAggregatedResources(identity)Grants the given entity appmesh:StreamAggregatedResources.
toString()Returns a string representation of this construct.
static fromVirtualGatewayArn(scope, id, virtualGatewayArn)Import an existing VirtualGateway given an ARN.
static fromVirtualGatewayAttributes(scope, id, attrs)Import an existing VirtualGateway given its attributes.

addGatewayRoute(id, props)

public addGatewayRoute(id: string, props: GatewayRouteBaseProps): GatewayRoute

Parameters

  • id string
  • props GatewayRouteBaseProps

Returns

  • GatewayRoute

Utility method to add a new GatewayRoute to the VirtualGateway.


applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


grantStreamAggregatedResources(identity)

public grantStreamAggregatedResources(identity: IGrantable): Grant

Parameters

  • identity IGrantable

Returns

  • Grant

Grants the given entity appmesh:StreamAggregatedResources.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromVirtualGatewayArn(scope, id, virtualGatewayArn)

public static fromVirtualGatewayArn(scope: Construct, id: string, virtualGatewayArn: string): IVirtualGateway

Parameters

  • scope Construct
  • id string
  • virtualGatewayArn string

Returns

  • IVirtualGateway

Import an existing VirtualGateway given an ARN.


static fromVirtualGatewayAttributes(scope, id, attrs)

public static fromVirtualGatewayAttributes(scope: Construct, id: string, attrs: VirtualGatewayAttributes): IVirtualGateway

Parameters

  • scope Construct
  • id string
  • attrs VirtualGatewayAttributes

Returns

  • IVirtualGateway

Import an existing VirtualGateway given its attributes.