Mesh

class aws_cdk.aws_appmesh.Mesh(scope, id, *, egress_filter=None, mesh_name=None, service_discovery=None)

Bases: Resource

Define a new AppMesh mesh.

See:

https://docs.aws.amazon.com/app-mesh/latest/userguide/meshes.html

ExampleMetadata:

infused

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
arn = "arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh"
shared_mesh = appmesh.Mesh.from_mesh_arn(self, "imported-mesh", arn)

# This VirtualNode resource can communicate with the resources in the mesh from different AWS IAM account ID.
appmesh.VirtualNode(self, "test-node",
    mesh=shared_mesh
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • egress_filter (Optional[MeshFilterType]) – Egress filter to be applied to the Mesh. Default: DROP_ALL

  • mesh_name (Optional[str]) – The name of the Mesh being defined. Default: - A name is automatically generated

  • service_discovery (Union[MeshServiceDiscovery, Dict[str, Any], None]) – Defines how upstream clients will discover VirtualNodes in the Mesh. Default: - No Service Discovery

Methods

add_virtual_gateway(id, *, access_log=None, backend_defaults=None, listeners=None, virtual_gateway_name=None)

Adds a VirtualGateway to the Mesh.

Parameters:
  • id (str) –

  • access_log (Optional[AccessLog]) – Access Logging Configuration for the VirtualGateway. Default: - no access logging

  • backend_defaults (Union[BackendDefaults, Dict[str, Any], None]) – Default Configuration Virtual Node uses to communicate with Virtual Service. Default: - No Config

  • listeners (Optional[Sequence[VirtualGatewayListener]]) – Listeners for the VirtualGateway. Only one is supported. Default: - Single HTTP listener on port 8080

  • virtual_gateway_name (Optional[str]) – Name of the VirtualGateway. Default: - A name is automatically determined

Return type:

VirtualGateway

add_virtual_node(id, *, access_log=None, backend_defaults=None, backends=None, listeners=None, service_discovery=None, virtual_node_name=None)

Adds a VirtualNode to the Mesh.

Parameters:
  • id (str) –

  • access_log (Optional[AccessLog]) – Access Logging Configuration for the virtual node. Default: - No access logging

  • backend_defaults (Union[BackendDefaults, Dict[str, Any], None]) – Default Configuration Virtual Node uses to communicate with Virtual Service. Default: - No Config

  • backends (Optional[Sequence[Backend]]) – Virtual Services that this is node expected to send outbound traffic to. Default: - No backends

  • listeners (Optional[Sequence[VirtualNodeListener]]) – Initial listener for the virtual node. Default: - No listeners

  • service_discovery (Optional[ServiceDiscovery]) – Defines how upstream clients will discover this VirtualNode. Default: - No Service Discovery

  • virtual_node_name (Optional[str]) – The name of the VirtualNode. Default: - A name is automatically determined

Return type:

VirtualNode

add_virtual_router(id, *, listeners=None, virtual_router_name=None)

Adds a VirtualRouter to the Mesh with the given id and props.

Parameters:
  • id (str) –

  • listeners (Optional[Sequence[VirtualRouterListener]]) – Listener specification for the VirtualRouter. Default: - A listener on HTTP port 8080

  • virtual_router_name (Optional[str]) – The name of the VirtualRouter. Default: - A name is automatically determined

Return type:

VirtualRouter

apply_removal_policy(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).

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

env

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.

mesh_arn

The Amazon Resource Name (ARN) of the AppMesh mesh.

mesh_name

The name of the AppMesh mesh.

node

The tree node.

stack

The stack in which this resource is defined.

Static Methods

classmethod from_mesh_arn(scope, id, mesh_arn)

Import an existing mesh by arn.

Parameters:
  • scope (Construct) –

  • id (str) –

  • mesh_arn (str) –

Return type:

IMesh

classmethod from_mesh_name(scope, id, mesh_name)

Import an existing mesh by name.

Parameters:
  • scope (Construct) –

  • id (str) –

  • mesh_name (str) –

Return type:

IMesh

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool