VirtualNode
- class aws_cdk.aws_appmesh.VirtualNode(scope, id, *, mesh, access_log=None, backend_defaults=None, backends=None, listeners=None, service_discovery=None, virtual_node_name=None)
Bases:
Resource
VirtualNode represents a newly defined AppMesh VirtualNode.
Any inbound traffic that your virtual node expects should be specified as a listener. Any outbound traffic that your virtual node expects to reach should be specified as a backend.
- See:
https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_nodes.html
- ExampleMetadata:
infused
Example:
# mesh: appmesh.Mesh # Cloud Map service discovery is currently required for host ejection by outlier detection vpc = ec2.Vpc(self, "vpc") namespace = cloudmap.PrivateDnsNamespace(self, "test-namespace", vpc=vpc, name="domain.local" ) service = namespace.create_service("Svc") node = mesh.add_virtual_node("virtual-node", service_discovery=appmesh.ServiceDiscovery.cloud_map(service), listeners=[appmesh.VirtualNodeListener.http( outlier_detection=appmesh.OutlierDetection( base_ejection_duration=Duration.seconds(10), interval=Duration.seconds(30), max_ejection_percent=50, max_server_errors=5 ) )] )
- Parameters:
scope (
Construct
) –id (
str
) –mesh (
IMesh
) – The Mesh which the VirtualNode belongs to.access_log (
Optional
[AccessLog
]) – Access Logging Configuration for the virtual node. Default: - No access loggingbackend_defaults (
Union
[BackendDefaults
,Dict
[str
,Any
],None
]) – Default Configuration Virtual Node uses to communicate with Virtual Service. Default: - No Configbackends (
Optional
[Sequence
[Backend
]]) – Virtual Services that this is node expected to send outbound traffic to. Default: - No backendslisteners (
Optional
[Sequence
[VirtualNodeListener
]]) – Initial listener for the virtual node. Default: - No listenersservice_discovery (
Optional
[ServiceDiscovery
]) – Defines how upstream clients will discover this VirtualNode. Default: - No Service Discoveryvirtual_node_name (
Optional
[str
]) – The name of the VirtualNode. Default: - A name is automatically determined
Methods
- add_backend(backend)
Add a Virtual Services that this node is expected to send outbound traffic to.
- Parameters:
backend (
Backend
) –- Return type:
None
- add_listener(listener)
Utility method to add an inbound listener for this VirtualNode.
Note: At this time, Virtual Nodes support at most one listener. Adding more than one will result in a failure to deploy the CloudFormation stack. However, the App Mesh team has plans to add support for multiple listeners on Virtual Nodes and Virtual Routers.
- Parameters:
listener (
VirtualNodeListener
) –- See:
- Return type:
None
- 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
- grant_stream_aggregated_resources(identity)
Grants the given entity
appmesh:StreamAggregatedResources
.- Parameters:
identity (
IGrantable
) –- Return type:
- 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
The Mesh which the VirtualNode belongs to.
- node
The tree node.
- stack
The stack in which this resource is defined.
- virtual_node_arn
The Amazon Resource Name belonging to the VirtualNode.
- virtual_node_name
The name of the VirtualNode.
Static Methods
- classmethod from_virtual_node_arn(scope, id, virtual_node_arn)
Import an existing VirtualNode given an ARN.
- Parameters:
scope (
Construct
) –id (
str
) –virtual_node_arn (
str
) –
- Return type:
- classmethod from_virtual_node_attributes(scope, id, *, mesh, virtual_node_name)
Import an existing VirtualNode given its name.
- Parameters:
- Return type:
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
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 classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
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 theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, 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 extendsConstruct
.
- 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