class Mesh (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppMesh.Mesh |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsappmesh#Mesh |
Java | software.amazon.awscdk.services.appmesh.Mesh |
Python | aws_cdk.aws_appmesh.Mesh |
TypeScript (source) | aws-cdk-lib » aws_appmesh » Mesh |
Implements
IConstruct
, IDependable
, IResource
, IMesh
Define a new AppMesh mesh.
See also: https://docs.aws.amazon.com/app-mesh/latest/userguide/meshes.html
Example
// This is the ARN for the mesh from different AWS IAM account ID.
// Ensure mesh is properly shared with your account. For more details, see: https://github.com/aws/aws-cdk/issues/15404
const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh';
const sharedMesh = appmesh.Mesh.fromMeshArn(this, 'imported-mesh', arn);
// This VirtualNode resource can communicate with the resources in the mesh from different AWS IAM account ID.
new appmesh.VirtualNode(this, 'test-node', {
mesh: sharedMesh,
});
Initializer
new Mesh(scope: Construct, id: string, props?: MeshProps)
Parameters
Construct Props
Name | Type | Description |
---|---|---|
egress | Mesh | Egress filter to be applied to the Mesh. |
mesh | string | The name of the Mesh being defined. |
service | Mesh | Defines how upstream clients will discover VirtualNodes in the Mesh. |
egressFilter?
Type:
Mesh
(optional, default: DROP_ALL)
Egress filter to be applied to the Mesh.
meshName?
Type:
string
(optional, default: A name is automatically generated)
The name of the Mesh being defined.
serviceDiscovery?
Type:
Mesh
(optional, default: No Service Discovery)
Defines how upstream clients will discover VirtualNodes in the Mesh.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
mesh | string | The Amazon Resource Name (ARN) of the AppMesh mesh. |
mesh | string | The name of the AppMesh mesh. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
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.
meshArn
Type:
string
The Amazon Resource Name (ARN) of the AppMesh mesh.
meshName
Type:
string
The name of the AppMesh mesh.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
add | Adds a VirtualGateway to the Mesh. |
add | Adds a VirtualNode to the Mesh. |
add | Adds a VirtualRouter to the Mesh with the given id and props. |
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import an existing mesh by arn. |
static from | Import an existing mesh by name. |
addVirtualGateway(id, props?)
public addVirtualGateway(id: string, props?: VirtualGatewayBaseProps): VirtualGateway
Parameters
- id
string
- props
Virtual
Gateway Base Props
Returns
Adds a VirtualGateway to the Mesh.
addVirtualNode(id, props?)
public addVirtualNode(id: string, props?: VirtualNodeBaseProps): VirtualNode
Parameters
- id
string
- props
Virtual
Node Base Props
Returns
Adds a VirtualNode to the Mesh.
addVirtualRouter(id, props?)
public addVirtualRouter(id: string, props?: VirtualRouterBaseProps): VirtualRouter
Parameters
- id
string
- props
Virtual
Router Base Props
Returns
Adds a VirtualRouter to the Mesh with the given id and props.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromMeshArn(scope, id, meshArn)
public static fromMeshArn(scope: Construct, id: string, meshArn: string): IMesh
Parameters
- scope
Construct
- id
string
- meshArn
string
Returns
Import an existing mesh by arn.
static fromMeshName(scope, id, meshName)
public static fromMeshName(scope: Construct, id: string, meshName: string): IMesh
Parameters
- scope
Construct
- id
string
- meshName
string
Returns
Import an existing mesh by name.