agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

13
cdk/node_modules/aws-cdk-lib/aws-appmesh/.jsiirc.json generated vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"targets": {
"java": {
"package": "software.amazon.awscdk.services.appmesh"
},
"dotnet": {
"namespace": "Amazon.CDK.AWS.AppMesh"
},
"python": {
"module": "aws_cdk.aws_appmesh"
}
}
}

944
cdk/node_modules/aws-cdk-lib/aws-appmesh/README.md generated vendored Normal file
View File

@@ -0,0 +1,944 @@
# AWS App Mesh Construct Library
AWS App Mesh is a service mesh based on the [Envoy](https://www.envoyproxy.io/) proxy that makes it easy to monitor and control microservices. App Mesh standardizes how your microservices communicate, giving you end-to-end visibility and helping to ensure high-availability for your applications.
App Mesh gives you consistent visibility and network traffic controls for every microservice in an application.
App Mesh supports microservice applications that use service discovery naming for their components. To use App Mesh, you must have an existing application running on AWS Fargate, Amazon ECS, Amazon EKS, Kubernetes on AWS, or Amazon EC2.
For further information on **AWS App Mesh**, visit the [AWS App Mesh Documentation](https://docs.aws.amazon.com/app-mesh/index.html).
## Create the App and Stack
```ts
const app = new cdk.App();
const stack = new cdk.Stack(app, 'stack');
```
## Creating the Mesh
A service mesh is a logical boundary for network traffic between the services that reside within it.
After you create your service mesh, you can create virtual services, virtual nodes, virtual routers, and routes to distribute traffic between the applications in your mesh.
The following example creates the `AppMesh` service mesh with the default egress filter of `DROP_ALL`. See [the AWS CloudFormation `EgressFilter` resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-mesh-egressfilter.html) for more info on egress filters.
```ts
const mesh = new appmesh.Mesh(this, 'AppMesh', {
meshName: 'myAwsMesh',
});
```
The mesh can instead be created with the `ALLOW_ALL` egress filter by providing the `egressFilter` property.
```ts
const mesh = new appmesh.Mesh(this, 'AppMesh', {
meshName: 'myAwsMesh',
egressFilter: appmesh.MeshFilterType.ALLOW_ALL,
});
```
A mesh with an IP preference can be created by providing the property `serviceDiscovery` that specifes an `ipPreference`.
```ts
const mesh = new appmesh.Mesh(this, 'AppMesh', {
meshName: 'myAwsMesh',
serviceDiscovery: {
ipPreference: appmesh.IpPreference.IPV4_ONLY,
},
});
```
## Adding VirtualRouters
A _mesh_ uses _virtual routers_ as logical units to route requests to _virtual nodes_.
Virtual routers handle traffic for one or more virtual services within your mesh.
After you create a virtual router, you can create and associate routes to your virtual router that direct incoming requests to different virtual nodes.
```ts
declare const mesh: appmesh.Mesh;
const router = mesh.addVirtualRouter('router', {
listeners: [appmesh.VirtualRouterListener.http(8080)],
});
```
Note that creating the router using the `addVirtualRouter()` method places it in the same stack as the mesh
(which might be different from the current stack).
The router can also be created using the `VirtualRouter` constructor (passing in the mesh) instead of calling the `addVirtualRouter()` method.
This is particularly useful when splitting your resources between many stacks: for example, defining the mesh itself as part of an infrastructure stack, but defining the other resources, such as routers, in the application stack:
```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)],
});
```
The same is true for other `add*()` methods in the App Mesh construct library.
The `VirtualRouterListener` class lets you define protocol-specific listeners.
The `http()`, `http2()`, `grpc()` and `tcp()` methods create listeners for the named protocols.
They accept a single parameter that defines the port to on which requests will be matched.
The port parameter defaults to 8080 if omitted.
## Adding a VirtualService
A _virtual service_ is an abstraction of a real service that is provided by a virtual node directly, or indirectly by means of a virtual router. Dependent services call your virtual service by its `virtualServiceName`, and those requests are routed to the virtual node or virtual router specified as the provider for the virtual service.
We recommend that you use the service discovery name of the real service that you're targeting (such as `my-service.default.svc.cluster.local`).
When creating a virtual service:
- If you want the virtual service to spread traffic across multiple virtual nodes, specify a virtual router.
- If you want the virtual service to reach a virtual node directly, without a virtual router, specify a virtual node.
Adding a virtual router as the provider:
```ts
declare const router: appmesh.VirtualRouter;
new appmesh.VirtualService(this, 'virtual-service', {
virtualServiceName: 'my-service.default.svc.cluster.local', // optional
virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(router),
});
```
Adding a virtual node as the provider:
```ts
declare const node: appmesh.VirtualNode;
new appmesh.VirtualService(this, 'virtual-service', {
virtualServiceName: `my-service.default.svc.cluster.local`, // optional
virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node),
});
```
## Adding a VirtualNode
A _virtual node_ acts as a logical pointer to a particular task group, such as an Amazon ECS service or a Kubernetes deployment.
When you create a virtual node, accept inbound traffic by specifying a *listener*. Outbound traffic that your virtual node expects to send should be specified as a *back end*.
The response metadata for your new virtual node contains the Amazon Resource Name (ARN) that is associated with the virtual node. Set this value (either the full ARN or the truncated resource name) as the `APPMESH_VIRTUAL_NODE_NAME` environment variable for your task group's Envoy proxy container in your task definition or pod spec. For example, the value could be `mesh/default/virtualNode/simpleapp`. This is then mapped to the `node.id` and `node.cluster` Envoy parameters.
> **Note**
> If you require your Envoy stats or tracing to use a different name, you can override the `node.cluster` value that is set by `APPMESH_VIRTUAL_NODE_NAME` with the `APPMESH_VIRTUAL_NODE_CLUSTER` environment variable.
```ts
const vpc = new ec2.Vpc(this, 'vpc');
const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', {
vpc,
name: 'domain.local',
});
const service = namespace.createService('Svc');
declare const mesh: appmesh.Mesh;
const node = mesh.addVirtualNode('virtual-node', {
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
listeners: [appmesh.VirtualNodeListener.http({
port: 8081,
healthCheck: appmesh.HealthCheck.http({
healthyThreshold: 3,
interval: Duration.seconds(5), // minimum
path: '/health-check-path',
timeout: Duration.seconds(2), // minimum
unhealthyThreshold: 2,
}),
})],
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
});
```
Create a `VirtualNode` with the constructor and add tags.
```ts
declare const mesh: appmesh.Mesh;
declare const service: cloudmap.Service;
const node = new appmesh.VirtualNode(this, 'node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
listeners: [appmesh.VirtualNodeListener.http({
port: 8080,
healthCheck: appmesh.HealthCheck.http({
healthyThreshold: 3,
interval: Duration.seconds(5),
path: '/ping',
timeout: Duration.seconds(2),
unhealthyThreshold: 2,
}),
timeout: {
idle: Duration.seconds(5),
},
})],
backendDefaults: {
tlsClientPolicy: {
validation: {
trust: appmesh.TlsValidationTrust.file('/keys/local_cert_chain.pem'),
},
},
},
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
});
cdk.Tags.of(node).add('Environment', 'Dev');
```
Create a `VirtualNode` with the customized access logging format.
```ts
declare const mesh: appmesh.Mesh;
declare const service: cloudmap.Service;
const node = new appmesh.VirtualNode(this, 'node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
listeners: [appmesh.VirtualNodeListener.http({
port: 8080,
healthCheck: appmesh.HealthCheck.http({
healthyThreshold: 3,
interval: cdk.Duration.seconds(5),
path: '/ping',
timeout: cdk.Duration.seconds(2),
unhealthyThreshold: 2,
}),
timeout: {
idle: cdk.Duration.seconds(5),
},
})],
backendDefaults: {
tlsClientPolicy: {
validation: {
trust: appmesh.TlsValidationTrust.file('/keys/local_cert_chain.pem'),
},
},
},
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout',
appmesh.LoggingFormat.fromJson(
{testKey1: 'testValue1', testKey2: 'testValue2'})),
});
```
By using a key-value pair indexed signature, you can specify json key pairs to customize the log entry pattern. You can also use text format as below. You can only specify one of these 2 formats.
```text
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout', appmesh.LoggingFormat.fromText('test_pattern')),
```
For what values and operators you can use for these two formats, please visit the latest envoy documentation. (https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage)
Create a `VirtualNode` with the constructor and add backend virtual service.
```ts
declare const mesh: appmesh.Mesh;
declare const router: appmesh.VirtualRouter;
declare const service: cloudmap.Service;
const node = new appmesh.VirtualNode(this, 'node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
listeners: [appmesh.VirtualNodeListener.http({
port: 8080,
healthCheck: appmesh.HealthCheck.http({
healthyThreshold: 3,
interval: Duration.seconds(5),
path: '/ping',
timeout: Duration.seconds(2),
unhealthyThreshold: 2,
}),
timeout: {
idle: Duration.seconds(5),
},
})],
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
});
const virtualService = new appmesh.VirtualService(this, 'service-1', {
virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(router),
virtualServiceName: 'service1.domain.local',
});
node.addBackend(appmesh.Backend.virtualService(virtualService));
```
The `listeners` property can be left blank and added later with the `node.addListener()` method. The `serviceDiscovery` property must be specified when specifying a listener.
The `backends` property can be added with `node.addBackend()`. In the example, we define a virtual service and add it to the virtual node to allow egress traffic to other nodes.
The `backendDefaults` property is added to the node while creating the virtual node. These are the virtual node's default settings for all backends.
The `VirtualNode.addBackend()` method is especially useful if you want to create a circular traffic flow by having a Virtual Service as a backend whose provider is that same Virtual Node:
```ts
declare const mesh: appmesh.Mesh;
const node = new appmesh.VirtualNode(this, 'node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.dns('node'),
});
const virtualService = new appmesh.VirtualService(this, 'service-1', {
virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node),
virtualServiceName: 'service1.domain.local',
});
node.addBackend(appmesh.Backend.virtualService(virtualService));
```
### Adding TLS to a listener
The `tls` property specifies TLS configuration when creating a listener for a virtual node or a virtual gateway.
Provide the TLS certificate to the proxy in one of the following ways:
- A certificate from AWS Certificate Manager (ACM).
- A customer-provided certificate (specify a `certificateChain` path file and a `privateKey` file path).
- A certificate provided by a Secrets Discovery Service (SDS) endpoint over local Unix Domain Socket (specify its `secretName`).
```ts
// A Virtual Node with listener TLS from an ACM provided certificate
declare const cert: certificatemanager.Certificate;
declare const mesh: appmesh.Mesh;
const node = new appmesh.VirtualNode(this, 'node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.dns('node'),
listeners: [appmesh.VirtualNodeListener.grpc({
port: 80,
tls: {
mode: appmesh.TlsMode.STRICT,
certificate: appmesh.TlsCertificate.acm(cert),
},
})],
});
// A Virtual Gateway with listener TLS from a customer provided file certificate
const gateway = new appmesh.VirtualGateway(this, 'gateway', {
mesh,
listeners: [appmesh.VirtualGatewayListener.grpc({
port: 8080,
tls: {
mode: appmesh.TlsMode.STRICT,
certificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'),
},
})],
virtualGatewayName: 'gateway',
});
// A Virtual Gateway with listener TLS from a SDS provided certificate
const gateway2 = new appmesh.VirtualGateway(this, 'gateway2', {
mesh,
listeners: [appmesh.VirtualGatewayListener.http2({
port: 8080,
tls: {
mode: appmesh.TlsMode.STRICT,
certificate: appmesh.TlsCertificate.sds('secrete_certificate'),
},
})],
virtualGatewayName: 'gateway2',
});
```
### Adding mutual TLS authentication
Mutual TLS authentication is an optional component of TLS that offers two-way peer authentication.
To enable mutual TLS authentication, add the `mutualTlsCertificate` property to TLS client policy and/or the `mutualTlsValidation` property to your TLS listener.
`tls.mutualTlsValidation` and `tlsClientPolicy.mutualTlsCertificate` can be sourced from either:
- A customer-provided certificate (specify a `certificateChain` path file and a `privateKey` file path).
- A certificate provided by a Secrets Discovery Service (SDS) endpoint over local Unix Domain Socket (specify its `secretName`).
> **Note**
> Currently, a certificate from AWS Certificate Manager (ACM) cannot be used for mutual TLS authentication.
```ts
declare const mesh: appmesh.Mesh;
const node1 = new appmesh.VirtualNode(this, 'node1', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.dns('node'),
listeners: [appmesh.VirtualNodeListener.grpc({
port: 80,
tls: {
mode: appmesh.TlsMode.STRICT,
certificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'),
// Validate a file client certificates to enable mutual TLS authentication when a client provides a certificate.
mutualTlsValidation: {
trust: appmesh.TlsValidationTrust.file('path-to-certificate'),
},
},
})],
});
const certificateAuthorityArn = 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012';
const node2 = new appmesh.VirtualNode(this, 'node2', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.dns('node2'),
backendDefaults: {
tlsClientPolicy: {
ports: [8080, 8081],
validation: {
subjectAlternativeNames: appmesh.SubjectAlternativeNames.matchingExactly('mesh-endpoint.apps.local'),
trust: appmesh.TlsValidationTrust.acm([
acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'certificate', certificateAuthorityArn)]),
},
// Provide a SDS client certificate when a server requests it and enable mutual TLS authentication.
mutualTlsCertificate: appmesh.TlsCertificate.sds('secret_certificate'),
},
},
});
```
### Adding outlier detection to a Virtual Node listener
The `outlierDetection` property adds outlier detection to a Virtual Node listener. The properties
`baseEjectionDuration`, `interval`, `maxEjectionPercent`, and `maxServerErrors` are required.
```ts
// Cloud Map service discovery is currently required for host ejection by outlier detection
const vpc = new ec2.Vpc(this, 'vpc');
const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', {
vpc,
name: 'domain.local',
});
const service = namespace.createService('Svc');
declare const mesh: appmesh.Mesh;
const node = mesh.addVirtualNode('virtual-node', {
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
listeners: [appmesh.VirtualNodeListener.http({
outlierDetection: {
baseEjectionDuration: Duration.seconds(10),
interval: Duration.seconds(30),
maxEjectionPercent: 50,
maxServerErrors: 5,
},
})],
});
```
### Adding a connection pool to a listener
The `connectionPool` property can be added to a Virtual Node listener or Virtual Gateway listener to add a request connection pool. Each listener protocol type has its own connection pool properties.
```ts
// 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',
});
```
### Adding an IP Preference to a Virtual Node
An `ipPreference` can be specified as part of a Virtual Node's service discovery. An IP preference defines how clients for this Virtual Node will interact with it.
There a four different IP preferences available to use which each specify what IP versions this Virtual Node will use and prefer.
- `IPv4_ONLY` - Only use IPv4. For CloudMap service discovery, only IPv4 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv4.
- `IPv4_PREFERRED` - Prefer IPv4 and fall back to IPv6. For CloudMap service discovery, an IPv4 address will be used if returned from CloudMap. Otherwise, an IPv6 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv4 and fall back to IPv6.
- `IPv6_ONLY` - Only use IPv6. For CloudMap service discovery, only IPv6 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv6.
- `IPv6_PREFERRED` - Prefer IPv6 and fall back to IPv4. For CloudMap service discovery, an IPv6 address will be used if returned from CloudMap. Otherwise, an IPv4 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv6 and fall back to IPv4.
```ts
const mesh = new appmesh.Mesh(this, 'mesh', {
meshName: 'mesh-with-preference',
});
// Virtual Node with DNS service discovery and an IP preference
const dnsNode = new appmesh.VirtualNode(this, 'dns-node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.dns('test', appmesh.DnsResponseType.LOAD_BALANCER, appmesh.IpPreference.IPV4_ONLY),
});
// Virtual Node with CloudMap service discovery and an IP preference
const vpc = new ec2.Vpc(this, 'vpc');
const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', {
vpc,
name: 'domain.local',
});
const service = namespace.createService('Svc');
const instanceAttribute : { [key: string]: string} = {};
instanceAttribute.testKey = 'testValue';
const cloudmapNode = new appmesh.VirtualNode(this, 'cloudmap-node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service, instanceAttribute, appmesh.IpPreference.IPV4_ONLY),
});
```
## Adding a Route
A _route_ matches requests with an associated virtual router and distributes traffic to its associated virtual nodes.
The route distributes matching requests to one or more target virtual nodes with relative weighting.
The `RouteSpec` class lets you define protocol-specific route specifications.
The `tcp()`, `http()`, `http2()`, and `grpc()` methods create a specification for the named protocols.
For HTTP-based routes, the match field can match on path (prefix, exact, or regex), HTTP method, scheme,
HTTP headers, and query parameters. By default, HTTP-based routes match all requests.
For gRPC-based routes, the match field can match on service name, method name, and metadata.
When specifying the method name, the service name must also be specified.
For example, here's how to add an HTTP route that matches based on a prefix of the URL path:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-http', {
routeSpec: appmesh.RouteSpec.http({
weightedTargets: [
{
virtualNode: node,
},
],
match: {
// Path that is passed to this method must start with '/'.
path: appmesh.HttpRoutePathMatch.startsWith('/path-to-app'),
},
}),
});
```
Add an HTTP2 route that matches based on exact path, method, scheme, headers, and query parameters:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-http2', {
routeSpec: appmesh.RouteSpec.http2({
weightedTargets: [
{
virtualNode: node,
},
],
match: {
path: appmesh.HttpRoutePathMatch.exactly('/exact'),
method: appmesh.HttpRouteMethod.POST,
protocol: appmesh.HttpRouteProtocol.HTTPS,
headers: [
// All specified headers must match for the route to match.
appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'),
appmesh.HeaderMatch.valueIsNot('Content-Type', 'application/json'),
],
queryParameters: [
// All specified query parameters must match for the route to match.
appmesh.QueryParameterMatch.valueIs('query-field', 'value')
],
},
}),
});
```
Add a single route with two targets and split traffic 50/50:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-http', {
routeSpec: appmesh.RouteSpec.http({
weightedTargets: [
{
virtualNode: node,
weight: 50,
},
{
virtualNode: node,
weight: 50,
},
],
match: {
path: appmesh.HttpRoutePathMatch.startsWith('/path-to-app'),
},
}),
});
```
Add an http2 route with retries:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-http2-retry', {
routeSpec: appmesh.RouteSpec.http2({
weightedTargets: [{ virtualNode: node }],
retryPolicy: {
// Retry if the connection failed
tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR],
// Retry if HTTP responds with a gateway error (502, 503, 504)
httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR],
// Retry five times
retryAttempts: 5,
// Use a 1 second timeout per retry
retryTimeout: Duration.seconds(1),
},
}),
});
```
Add a gRPC route with retries:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-grpc-retry', {
routeSpec: appmesh.RouteSpec.grpc({
weightedTargets: [{ virtualNode: node }],
match: { serviceName: 'servicename' },
retryPolicy: {
tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR],
httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR],
// Retry if gRPC responds that the request was cancelled, a resource
// was exhausted, or if the service is unavailable
grpcRetryEvents: [
appmesh.GrpcRetryEvent.CANCELLED,
appmesh.GrpcRetryEvent.RESOURCE_EXHAUSTED,
appmesh.GrpcRetryEvent.UNAVAILABLE,
],
retryAttempts: 5,
retryTimeout: Duration.seconds(1),
},
}),
});
```
Add an gRPC route that matches based on method name and metadata:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-grpc-retry', {
routeSpec: appmesh.RouteSpec.grpc({
weightedTargets: [{ virtualNode: node }],
match: {
// When method name is specified, service name must be also specified.
methodName: 'methodname',
serviceName: 'servicename',
metadata: [
// All specified metadata must match for the route to match.
appmesh.HeaderMatch.valueStartsWith('Content-Type', 'application/'),
appmesh.HeaderMatch.valueDoesNotStartWith('Content-Type', 'text/'),
],
},
}),
});
```
Add a gRPC route that matches based on port:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-grpc-port', {
routeSpec: appmesh.RouteSpec.grpc({
weightedTargets: [
{
virtualNode: node,
},
],
match: {
port: 1234,
},
}),
});
```
Add a gRPC route with timeout:
```ts
declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;
router.addRoute('route-http', {
routeSpec: appmesh.RouteSpec.grpc({
weightedTargets: [
{
virtualNode: node,
},
],
match: {
serviceName: 'my-service.default.svc.cluster.local',
},
timeout: {
idle : Duration.seconds(2),
perRequest: Duration.seconds(1),
},
}),
});
```
## Adding a Virtual Gateway
A _virtual gateway_ allows resources outside your mesh to communicate with resources inside your mesh.
The virtual gateway represents an Envoy proxy running in an Amazon ECS task, in a Kubernetes service, or on an Amazon EC2 instance.
Unlike a virtual node, which represents Envoy running with an application, a virtual gateway represents Envoy deployed by itself.
A virtual gateway is similar to a virtual node in that it has a listener that accepts traffic for a particular port and protocol (HTTP, HTTP2, gRPC).
Traffic received by the virtual gateway is directed to other services in your mesh
using rules defined in gateway routes which can be added to your virtual gateway.
Create a virtual gateway with the constructor:
```ts
declare const mesh: appmesh.Mesh;
const certificateAuthorityArn = 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012';
const gateway = new appmesh.VirtualGateway(this, 'gateway', {
mesh: mesh,
listeners: [appmesh.VirtualGatewayListener.http({
port: 443,
healthCheck: appmesh.HealthCheck.http({
interval: Duration.seconds(10),
}),
})],
backendDefaults: {
tlsClientPolicy: {
ports: [8080, 8081],
validation: {
trust: appmesh.TlsValidationTrust.acm([
acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'certificate', certificateAuthorityArn)]),
},
},
},
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
virtualGatewayName: 'virtualGateway',
});
```
Add a virtual gateway directly to the mesh:
```ts
declare const mesh: appmesh.Mesh;
const gateway = mesh.addVirtualGateway('gateway', {
accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
virtualGatewayName: 'virtualGateway',
listeners: [appmesh.VirtualGatewayListener.http({
port: 443,
healthCheck: appmesh.HealthCheck.http({
interval: Duration.seconds(10),
}),
})],
});
```
The `listeners` field defaults to an HTTP Listener on port 8080 if omitted.
A gateway route can be added using the `gateway.addGatewayRoute()` method.
The `backendDefaults` property, provided when creating the virtual gateway, specifies the virtual gateway's default settings for all backends.
## Adding a Gateway Route
A _gateway route_ is attached to a virtual gateway and routes matching traffic to an existing virtual service.
For HTTP-based gateway routes, the `match` field can be used to match on
path (prefix, exact, or regex), HTTP method, host name, HTTP headers, and query parameters.
By default, HTTP-based gateway routes match all requests.
```ts
declare const gateway: appmesh.VirtualGateway;
declare const virtualService: appmesh.VirtualService;
gateway.addGatewayRoute('gateway-route-http', {
routeSpec: appmesh.GatewayRouteSpec.http({
routeTarget: virtualService,
match: {
path: appmesh.HttpGatewayRoutePathMatch.regex('regex'),
},
}),
});
```
For gRPC-based gateway routes, the `match` field can be used to match on service name, host name, port and metadata.
```ts
declare const gateway: appmesh.VirtualGateway;
declare const virtualService: appmesh.VirtualService;
gateway.addGatewayRoute('gateway-route-grpc', {
routeSpec: appmesh.GatewayRouteSpec.grpc({
routeTarget: virtualService,
match: {
hostname: appmesh.GatewayRouteHostnameMatch.endsWith('.example.com'),
},
}),
});
```
For HTTP based gateway routes, App Mesh automatically rewrites the matched prefix path in Gateway Route to “/”.
This automatic rewrite configuration can be overwritten in following ways:
```ts
declare const gateway: appmesh.VirtualGateway;
declare const virtualService: appmesh.VirtualService;
gateway.addGatewayRoute('gateway-route-http', {
routeSpec: appmesh.GatewayRouteSpec.http({
routeTarget: virtualService,
match: {
// This disables the default rewrite to '/', and retains original path.
path: appmesh.HttpGatewayRoutePathMatch.startsWith('/path-to-app/', ''),
},
}),
});
gateway.addGatewayRoute('gateway-route-http-1', {
routeSpec: appmesh.GatewayRouteSpec.http({
routeTarget: virtualService,
match: {
// If the request full path is '/path-to-app/xxxxx', this rewrites the path to '/rewrittenUri/xxxxx'.
// Please note both `prefixPathMatch` and `rewriteTo` must start and end with the `/` character.
path: appmesh.HttpGatewayRoutePathMatch.startsWith('/path-to-app/', '/rewrittenUri/'),
},
}),
});
```
If matching other path (exact or regex), only specific rewrite path can be specified.
Unlike `startsWith()` method above, no default rewrite is performed.
```ts
declare const gateway: appmesh.VirtualGateway;
declare const virtualService: appmesh.VirtualService;
gateway.addGatewayRoute('gateway-route-http-2', {
routeSpec: appmesh.GatewayRouteSpec.http({
routeTarget: virtualService,
match: {
// This rewrites the path from '/test' to '/rewrittenPath'.
path: appmesh.HttpGatewayRoutePathMatch.exactly('/test', '/rewrittenPath'),
},
}),
});
```
For HTTP/gRPC based routes, App Mesh automatically rewrites
the original request received at the Virtual Gateway to the destination Virtual Service name.
This default host name rewrite can be configured by specifying the rewrite rule as one of the `match` property:
```ts
declare const gateway: appmesh.VirtualGateway;
declare const virtualService: appmesh.VirtualService;
gateway.addGatewayRoute('gateway-route-grpc', {
routeSpec: appmesh.GatewayRouteSpec.grpc({
routeTarget: virtualService,
match: {
hostname: appmesh.GatewayRouteHostnameMatch.exactly('example.com'),
// This disables the default rewrite to virtual service name and retain original request.
rewriteRequestHostname: false,
},
}),
});
```
## Importing Resources
Each App Mesh resource class comes with two static methods, `from<Resource>Arn` and `from<Resource>Attributes` (where `<Resource>` is replaced with the resource name, such as `VirtualNode`) for importing a reference to an existing App Mesh resource.
These imported resources can be used with other resources in your mesh as if they were defined directly in your CDK application.
```ts
const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh/virtualNode/testNode';
appmesh.VirtualNode.fromVirtualNodeArn(this, 'importedVirtualNode', arn);
```
```ts
const virtualNodeName = 'my-virtual-node';
appmesh.VirtualNode.fromVirtualNodeAttributes(this, 'imported-virtual-node', {
mesh: appmesh.Mesh.fromMeshName(this, 'Mesh', 'testMesh'),
virtualNodeName: virtualNodeName,
});
```
To import a mesh, again there are two static methods, `fromMeshArn` and `fromMeshName`.
```ts
const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh';
appmesh.Mesh.fromMeshArn(this, 'imported-mesh', arn);
```
```ts
appmesh.Mesh.fromMeshName(this, 'imported-mesh', 'abc');
```
## IAM Grants
`VirtualNode` and `VirtualGateway` have a `grants` property that provides a `streamAggregatedResources`
methods that grant identities that are running Envoy access to stream generated config from App Mesh.
```ts
declare const mesh: appmesh.Mesh;
const gateway = new appmesh.VirtualGateway(this, 'testGateway', { mesh });
const envoyUser = new iam.User(this, 'envoyUser');
/**
* This will grant `appmesh:StreamAggregatedResources` ONLY for this gateway.
*/
gateway.grants.streamAggregatedResources(envoyUser)
```
## Adding Resources to shared meshes
A shared mesh allows resources created by different accounts to communicate with each other in the same mesh:
```ts
// 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,
});
```

24
cdk/node_modules/aws-cdk-lib/aws-appmesh/grants.json generated vendored Normal file
View File

@@ -0,0 +1,24 @@
{
"resources": {
"VirtualGateway": {
"grants": {
"streamAggregatedResources": {
"actions": [
"appmesh:StreamAggregatedResources"
],
"docSummary": "Grants the given entity `appmesh:StreamAggregatedResources`."
}
}
},
"VirtualNode": {
"grants": {
"streamAggregatedResources": {
"actions": [
"appmesh:StreamAggregatedResources"
]
}
}
}
}
}

1
cdk/node_modules/aws-cdk-lib/aws-appmesh/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './lib';

1
cdk/node_modules/aws-cdk-lib/aws-appmesh/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,41 @@
import * as appmesh from "./appmesh.generated";
import * as iam from "../../aws-iam";
import * as cdk from "../../core/lib";
/**
* Collection of grant methods for a IVirtualGatewayRef
*/
export declare class VirtualGatewayGrants {
/**
* Creates grants for VirtualGatewayGrants
*/
static fromVirtualGateway(resource: appmesh.IVirtualGatewayRef): VirtualGatewayGrants;
protected readonly resource: appmesh.IVirtualGatewayRef;
private constructor();
/**
* Grant the given identity custom permissions
*/
actions(grantee: iam.IGrantable, actions: Array<string>, options?: cdk.PermissionsOptions): iam.Grant;
/**
* Grants the given entity `appmesh:StreamAggregatedResources`.
*/
streamAggregatedResources(grantee: iam.IGrantable): iam.Grant;
}
/**
* Collection of grant methods for a IVirtualNodeRef
*/
export declare class VirtualNodeGrants {
/**
* Creates grants for VirtualNodeGrants
*/
static fromVirtualNode(resource: appmesh.IVirtualNodeRef): VirtualNodeGrants;
protected readonly resource: appmesh.IVirtualNodeRef;
private constructor();
/**
* Grant the given identity custom permissions
*/
actions(grantee: iam.IGrantable, actions: Array<string>, options?: cdk.PermissionsOptions): iam.Grant;
/**
* Grants streamAggregatedResources permissions
*/
streamAggregatedResources(grantee: iam.IGrantable): iam.Grant;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VirtualNodeGrants=exports.VirtualGatewayGrants=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var appmesh=()=>{var tmp=require("./appmesh.generated");return appmesh=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp};class VirtualGatewayGrants{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.VirtualGatewayGrants",version:"2.252.0"};static fromVirtualGateway(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_appmesh_IVirtualGatewayRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromVirtualGateway),error}return new VirtualGatewayGrants({resource})}resource;constructor(props){this.resource=props.resource}actions(grantee,actions,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee),jsiiDeprecationWarnings().aws_cdk_lib_PermissionsOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.actions),error}return iam().Grant.addToPrincipal({actions,grantee,resourceArns:options.resourceArns??[appmesh().CfnVirtualGateway.arnForVirtualGateway(this.resource)]})}streamAggregatedResources(grantee){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.streamAggregatedResources),error}const actions=["appmesh:StreamAggregatedResources"];return this.actions(grantee,actions,{})}}exports.VirtualGatewayGrants=VirtualGatewayGrants;class VirtualNodeGrants{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.VirtualNodeGrants",version:"2.252.0"};static fromVirtualNode(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_interfaces_aws_appmesh_IVirtualNodeRef(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromVirtualNode),error}return new VirtualNodeGrants({resource})}resource;constructor(props){this.resource=props.resource}actions(grantee,actions,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee),jsiiDeprecationWarnings().aws_cdk_lib_PermissionsOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.actions),error}return iam().Grant.addToPrincipal({actions,grantee,resourceArns:options.resourceArns??[appmesh().CfnVirtualNode.arnForVirtualNode(this.resource)]})}streamAggregatedResources(grantee){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.streamAggregatedResources),error}const actions=["appmesh:StreamAggregatedResources"];return this.actions(grantee,actions,{})}}exports.VirtualNodeGrants=VirtualNodeGrants;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,225 @@
import type { Construct } from 'constructs';
import type { CfnGatewayRoute } from './appmesh.generated';
import type { HeaderMatch } from './header-match';
import type { HttpRouteMethod } from './http-route-method';
import { HttpGatewayRoutePathMatch } from './http-route-path-match';
import type { QueryParameterMatch } from './query-parameter-match';
import type { IVirtualService } from './virtual-service';
/**
* Configuration for gateway route host name match.
*/
export interface GatewayRouteHostnameMatchConfig {
/**
* GatewayRoute CFN configuration for host name match.
*/
readonly hostnameMatch: CfnGatewayRoute.GatewayRouteHostnameMatchProperty;
}
/**
* Used to generate host name matching methods.
*/
export declare abstract class GatewayRouteHostnameMatch {
/**
* The value of the host name must match the specified value exactly.
*
* @param name The exact host name to match on
*/
static exactly(name: string): GatewayRouteHostnameMatch;
/**
* The value of the host name with the given name must end with the specified characters.
*
* @param suffix The specified ending characters of the host name to match on
*/
static endsWith(suffix: string): GatewayRouteHostnameMatch;
/**
* Returns the gateway route host name match configuration.
*/
abstract bind(scope: Construct): GatewayRouteHostnameMatchConfig;
}
/**
* The criterion for determining a request match for this GatewayRoute.
*/
export interface HttpGatewayRouteMatch {
/**
* Specify how to match requests based on the 'path' part of their URL.
*
* @default - matches requests with any path
*/
readonly path?: HttpGatewayRoutePathMatch;
/**
* Specifies the client request headers to match on. All specified headers
* must match for the gateway route to match.
*
* @default - do not match on headers
*/
readonly headers?: HeaderMatch[];
/**
* The gateway route host name to be matched on.
*
* @default - do not match on host name
*/
readonly hostname?: GatewayRouteHostnameMatch;
/**
* The method to match on.
*
* @default - do not match on method
*/
readonly method?: HttpRouteMethod;
/**
* The query parameters to match on.
* All specified query parameters must match for the route to match.
*
* @default - do not match on query parameters
*/
readonly queryParameters?: QueryParameterMatch[];
/**
* When `true`, rewrites the original request received at the Virtual Gateway to the destination Virtual Service name.
* When `false`, retains the original hostname from the request.
*
* @default true
*/
readonly rewriteRequestHostname?: boolean;
/**
* The port number to match on.
*
* @default - no default port
*/
readonly port?: number;
}
/**
* The criterion for determining a request match for this GatewayRoute
*/
export interface GrpcGatewayRouteMatch {
/**
* Create service name based gRPC gateway route match.
*
* @default - no matching on service name
*/
readonly serviceName?: string;
/**
* Create host name based gRPC gateway route match.
*
* @default - no matching on host name
*/
readonly hostname?: GatewayRouteHostnameMatch;
/**
* Create metadata based gRPC gateway route match.
* All specified metadata must match for the route to match.
*
* @default - no matching on metadata
*/
readonly metadata?: HeaderMatch[];
/**
* When `true`, rewrites the original request received at the Virtual Gateway to the destination Virtual Service name.
* When `false`, retains the original hostname from the request.
*
* @default true
*/
readonly rewriteRequestHostname?: boolean;
/**
* The port to match from the request.
*
* @default - do not match on port
*/
readonly port?: number;
}
/**
* Base options for all gateway route specs.
*/
export interface CommonGatewayRouteSpecOptions {
/**
* The priority for the gateway route. When a Virtual Gateway has multiple gateway routes, gateway route match
* is performed in the order of specified value, where 0 is the highest priority,
* and first matched gateway route is selected.
*
* @default - no particular priority
*/
readonly priority?: number;
}
/**
* Properties specific for HTTP Based GatewayRoutes
*/
export interface HttpGatewayRouteSpecOptions extends CommonGatewayRouteSpecOptions {
/**
* The criterion for determining a request match for this GatewayRoute.
* When path match is defined, this may optionally determine the path rewrite configuration.
*
* @default - matches any path and automatically rewrites the path to '/'
*/
readonly match?: HttpGatewayRouteMatch;
/**
* The VirtualService this GatewayRoute directs traffic to
*/
readonly routeTarget: IVirtualService;
}
/**
* Properties specific for a gRPC GatewayRoute
*/
export interface GrpcGatewayRouteSpecOptions extends CommonGatewayRouteSpecOptions {
/**
* The criterion for determining a request match for this GatewayRoute
*/
readonly match: GrpcGatewayRouteMatch;
/**
* The VirtualService this GatewayRoute directs traffic to
*/
readonly routeTarget: IVirtualService;
}
/**
* All Properties for GatewayRoute Specs
*/
export interface GatewayRouteSpecConfig {
/**
* The spec for an http gateway route
*
* @default - no http spec
*/
readonly httpSpecConfig?: CfnGatewayRoute.HttpGatewayRouteProperty;
/**
* The spec for an http2 gateway route
*
* @default - no http2 spec
*/
readonly http2SpecConfig?: CfnGatewayRoute.HttpGatewayRouteProperty;
/**
* The spec for a grpc gateway route
*
* @default - no grpc spec
*/
readonly grpcSpecConfig?: CfnGatewayRoute.GrpcGatewayRouteProperty;
/**
* The priority for the gateway route. When a Virtual Gateway has multiple gateway routes, gateway route match
* is performed in the order of specified value, where 0 is the highest priority,
* and first matched gateway route is selected.
*
* @default - no particular priority
*/
readonly priority?: number;
}
/**
* Used to generate specs with different protocols for a GatewayRoute
*/
export declare abstract class GatewayRouteSpec {
/**
* Creates an HTTP Based GatewayRoute
*
* @param options - no http gateway route
*/
static http(options: HttpGatewayRouteSpecOptions): GatewayRouteSpec;
/**
* Creates an HTTP2 Based GatewayRoute
*
* @param options - no http2 gateway route
*/
static http2(options: HttpGatewayRouteSpecOptions): GatewayRouteSpec;
/**
* Creates an gRPC Based GatewayRoute
*
* @param options - no grpc gateway route
*/
static grpc(options: GrpcGatewayRouteSpecOptions): GatewayRouteSpec;
/**
* Called when the GatewayRouteSpec type is initialized. Can be used to enforce
* mutual exclusivity with future properties
*/
abstract bind(scope: Construct): GatewayRouteSpecConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GatewayRouteSpec=exports.GatewayRouteHostnameMatch=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var http_route_path_match_1=()=>{var tmp=require("./http-route-path-match");return http_route_path_match_1=()=>tmp,tmp},utils_1=()=>{var tmp=require("./private/utils");return utils_1=()=>tmp,tmp},shared_interfaces_1=()=>{var tmp=require("./shared-interfaces");return shared_interfaces_1=()=>tmp,tmp};class GatewayRouteHostnameMatch{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.GatewayRouteHostnameMatch",version:"2.252.0"};static exactly(name){return new GatewayRouteHostnameMatchImpl({exact:name})}static endsWith(suffix){return new GatewayRouteHostnameMatchImpl({suffix})}}exports.GatewayRouteHostnameMatch=GatewayRouteHostnameMatch;class GatewayRouteHostnameMatchImpl extends GatewayRouteHostnameMatch{matchProperty;constructor(matchProperty){super(),this.matchProperty=matchProperty}bind(_scope){return{hostnameMatch:this.matchProperty}}}class GatewayRouteSpec{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.GatewayRouteSpec",version:"2.252.0"};static http(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpGatewayRouteSpecOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http),error}return new HttpGatewayRouteSpec(options,shared_interfaces_1().Protocol.HTTP)}static http2(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpGatewayRouteSpecOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http2),error}return new HttpGatewayRouteSpec(options,shared_interfaces_1().Protocol.HTTP2)}static grpc(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_GrpcGatewayRouteSpecOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grpc),error}return new GrpcGatewayRouteSpec(options)}}exports.GatewayRouteSpec=GatewayRouteSpec;class HttpGatewayRouteSpec extends GatewayRouteSpec{match;routeTarget;routeType;priority;constructor(options,protocol){super(),this.routeTarget=options.routeTarget,this.routeType=protocol,this.match=options.match,this.priority=options.priority}bind(scope){const pathMatchConfig=(this.match?.path??http_route_path_match_1().HttpGatewayRoutePathMatch.startsWith("/")).bind(scope),rewriteRequestHostname=this.match?.rewriteRequestHostname,prefixPathRewrite=pathMatchConfig.prefixPathRewrite,wholePathRewrite=pathMatchConfig.wholePathRewrite,httpConfig={match:{prefix:pathMatchConfig.prefixPathMatch,path:pathMatchConfig.wholePathMatch,hostname:this.match?.hostname?.bind(scope).hostnameMatch,method:this.match?.method,headers:this.match?.headers?.map(header=>header.bind(scope).headerMatch),queryParameters:this.match?.queryParameters?.map(queryParameter=>queryParameter.bind(scope).queryParameterMatch),port:this.match?.port},action:{target:{virtualService:{virtualServiceName:this.routeTarget.virtualServiceName}},rewrite:rewriteRequestHostname!==void 0||prefixPathRewrite||wholePathRewrite?{hostname:rewriteRequestHostname===void 0?void 0:{defaultTargetHostname:rewriteRequestHostname?"ENABLED":"DISABLED"},prefix:prefixPathRewrite,path:wholePathRewrite}:void 0}};return{priority:this.priority,httpSpecConfig:this.routeType===shared_interfaces_1().Protocol.HTTP?httpConfig:void 0,http2SpecConfig:this.routeType===shared_interfaces_1().Protocol.HTTP2?httpConfig:void 0}}}class GrpcGatewayRouteSpec extends GatewayRouteSpec{match;routeTarget;priority;constructor(options){super(),this.match=options.match,this.routeTarget=options.routeTarget,this.priority=options.priority}bind(scope){const metadataMatch=this.match.metadata;return(0,utils_1().validateGrpcGatewayRouteMatch)(scope,this.match),(0,utils_1().validateGrpcMatchArrayLength)(scope,metadataMatch),{grpcSpecConfig:{match:{serviceName:this.match.serviceName,hostname:this.match.hostname?.bind(scope).hostnameMatch,port:this.match.port,metadata:metadataMatch?.map(metadata=>metadata.bind(scope).headerMatch)},action:{target:{virtualService:{virtualServiceName:this.routeTarget.virtualServiceName}},rewrite:this.match.rewriteRequestHostname===void 0?void 0:{hostname:{defaultTargetHostname:this.match.rewriteRequestHostname?"ENABLED":"DISABLED"}}}},priority:this.priority}}}

View File

@@ -0,0 +1,95 @@
import type { Construct } from 'constructs';
import type { GatewayRouteReference, IGatewayRouteRef } from './appmesh.generated';
import type { GatewayRouteSpec } from './gateway-route-spec';
import type { IVirtualGateway } from './virtual-gateway';
import * as cdk from '../../core';
/**
* Interface for which all GatewayRoute based classes MUST implement
*/
export interface IGatewayRoute extends cdk.IResource, IGatewayRouteRef {
/**
* The name of the GatewayRoute
*
* @attribute
*/
readonly gatewayRouteName: string;
/**
* The Amazon Resource Name (ARN) for the GatewayRoute
*
* @attribute
*/
readonly gatewayRouteArn: string;
/**
* The VirtualGateway the GatewayRoute belongs to
*/
readonly virtualGateway: IVirtualGateway;
}
/**
* Basic configuration properties for a GatewayRoute
*/
export interface GatewayRouteBaseProps {
/**
* The name of the GatewayRoute
*
* @default - an automatically generated name
*/
readonly gatewayRouteName?: string;
/**
* What protocol the route uses
*/
readonly routeSpec: GatewayRouteSpec;
}
/**
* Properties to define a new GatewayRoute
*/
export interface GatewayRouteProps extends GatewayRouteBaseProps {
/**
* The VirtualGateway this GatewayRoute is associated with
*/
readonly virtualGateway: IVirtualGateway;
}
/**
* GatewayRoute represents a new or existing gateway route attached to a VirtualGateway and Mesh
*
* @see https://docs.aws.amazon.com/app-mesh/latest/userguide/gateway-routes.html
*/
export declare class GatewayRoute extends cdk.Resource implements IGatewayRoute {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an existing GatewayRoute given an ARN
*/
static fromGatewayRouteArn(scope: Construct, id: string, gatewayRouteArn: string): IGatewayRoute;
/**
* Import an existing GatewayRoute given attributes
*/
static fromGatewayRouteAttributes(scope: Construct, id: string, attrs: GatewayRouteAttributes): IGatewayRoute;
/**
* The name of the GatewayRoute
*/
get gatewayRouteName(): string;
/**
* The Amazon Resource Name (ARN) for the GatewayRoute
*/
get gatewayRouteArn(): string;
/**
* The VirtualGateway this GatewayRoute is a part of
*/
readonly virtualGateway: IVirtualGateway;
private readonly gatewayRoute;
constructor(scope: Construct, id: string, props: GatewayRouteProps);
get gatewayRouteRef(): GatewayRouteReference;
}
/**
* Interface with properties necessary to import a reusable GatewayRoute
*/
export interface GatewayRouteAttributes {
/**
* The name of the GatewayRoute
*/
readonly gatewayRouteName: string;
/**
* The VirtualGateway this GatewayRoute is associated with.
*/
readonly virtualGateway: IVirtualGateway;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,102 @@
import type { Construct } from 'constructs';
import type { CfnRoute } from './index';
/**
* Configuration for `HeaderMatch`
*/
export interface HeaderMatchConfig {
/**
* Route CFN configuration for the route header match.
*/
readonly headerMatch: CfnRoute.HttpRouteHeaderProperty;
}
/**
* Used to generate header matching methods.
*/
export declare abstract class HeaderMatch {
/**
* The value of the header with the given name in the request must match the
* specified value exactly.
*
* @param headerName the name of the header to match against
* @param headerValue The exact value to test against
*/
static valueIs(headerName: string, headerValue: string): HeaderMatch;
/**
* The value of the header with the given name in the request must not match
* the specified value exactly.
*
* @param headerName the name of the header to match against
* @param headerValue The exact value to test against
*/
static valueIsNot(headerName: string, headerValue: string): HeaderMatch;
/**
* The value of the header with the given name in the request must start with
* the specified characters.
*
* @param headerName the name of the header to match against
* @param prefix The prefix to test against
*/
static valueStartsWith(headerName: string, prefix: string): HeaderMatch;
/**
* The value of the header with the given name in the request must not start
* with the specified characters.
*
* @param headerName the name of the header to match against
* @param prefix The prefix to test against
*/
static valueDoesNotStartWith(headerName: string, prefix: string): HeaderMatch;
/**
* The value of the header with the given name in the request must end with
* the specified characters.
*
* @param headerName the name of the header to match against
* @param suffix The suffix to test against
*/
static valueEndsWith(headerName: string, suffix: string): HeaderMatch;
/**
* The value of the header with the given name in the request must not end
* with the specified characters.
*
* @param headerName the name of the header to match against
* @param suffix The suffix to test against
*/
static valueDoesNotEndWith(headerName: string, suffix: string): HeaderMatch;
/**
* The value of the header with the given name in the request must include
* the specified characters.
*
* @param headerName the name of the header to match against
* @param regex The regex to test against
*/
static valueMatchesRegex(headerName: string, regex: string): HeaderMatch;
/**
* The value of the header with the given name in the request must not
* include the specified characters.
*
* @param headerName the name of the header to match against
* @param regex The regex to test against
*/
static valueDoesNotMatchRegex(headerName: string, regex: string): HeaderMatch;
/**
* The value of the header with the given name in the request must be in a
* range of values.
*
* @param headerName the name of the header to match against
* @param start Match on values starting at and including this value
* @param end Match on values up to but not including this value
*/
static valuesIsInRange(headerName: string, start: number, end: number): HeaderMatch;
/**
* The value of the header with the given name in the request must not be in
* a range of values.
*
* @param headerName the name of the header to match against
* @param start Match on values starting at and including this value
* @param end Match on values up to but not including this value
*/
static valuesIsNotInRange(headerName: string, start: number, end: number): HeaderMatch;
/**
* Returns the header match configuration.
*/
abstract bind(scope: Construct): HeaderMatchConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HeaderMatch=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");class HeaderMatch{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.HeaderMatch",version:"2.252.0"};static valueIs(headerName,headerValue){return new HeaderMatchImpl(headerName,!1,{exact:headerValue})}static valueIsNot(headerName,headerValue){return new HeaderMatchImpl(headerName,!0,{exact:headerValue})}static valueStartsWith(headerName,prefix){return new HeaderMatchImpl(headerName,!1,{prefix})}static valueDoesNotStartWith(headerName,prefix){return new HeaderMatchImpl(headerName,!0,{prefix})}static valueEndsWith(headerName,suffix){return new HeaderMatchImpl(headerName,!1,{suffix})}static valueDoesNotEndWith(headerName,suffix){return new HeaderMatchImpl(headerName,!0,{suffix})}static valueMatchesRegex(headerName,regex){return new HeaderMatchImpl(headerName,!1,{regex})}static valueDoesNotMatchRegex(headerName,regex){return new HeaderMatchImpl(headerName,!0,{regex})}static valuesIsInRange(headerName,start,end){return new HeaderMatchImpl(headerName,!1,{range:{start,end}})}static valuesIsNotInRange(headerName,start,end){return new HeaderMatchImpl(headerName,!0,{range:{start,end}})}}exports.HeaderMatch=HeaderMatch;class HeaderMatchImpl extends HeaderMatch{headerName;invert;matchProperty;constructor(headerName,invert,matchProperty){super(),this.headerName=headerName,this.invert=invert,this.matchProperty=matchProperty}bind(_scope){return{headerMatch:{name:this.headerName,invert:this.invert,match:this.matchProperty}}}}

View File

@@ -0,0 +1,108 @@
import type { Construct } from 'constructs';
import type { CfnVirtualGateway, CfnVirtualNode } from './appmesh.generated';
import * as cdk from '../../core';
/**
* Properties used to define healthchecks.
*/
interface HealthCheckCommonOptions {
/**
* The number of consecutive successful health checks that must occur before declaring listener healthy.
*
* @default 2
*/
readonly healthyThreshold?: number;
/**
* The time period between each health check execution.
*
* @default Duration.seconds(5)
*/
readonly interval?: cdk.Duration;
/**
* The amount of time to wait when receiving a response from the health check.
*
* @default Duration.seconds(2)
*/
readonly timeout?: cdk.Duration;
/**
* The number of consecutive failed health checks that must occur before declaring a listener unhealthy.
*
* @default - 2
*/
readonly unhealthyThreshold?: number;
}
/**
* Properties used to define HTTP Based healthchecks.
*/
export interface HttpHealthCheckOptions extends HealthCheckCommonOptions {
/**
* The destination path for the health check request.
*
* @default /
*/
readonly path?: string;
}
/**
* Properties used to define GRPC Based healthchecks.
*/
export interface GrpcHealthCheckOptions extends HealthCheckCommonOptions {
}
/**
* Properties used to define TCP Based healthchecks.
*/
export interface TcpHealthCheckOptions extends HealthCheckCommonOptions {
}
/**
* All Properties for Health Checks for mesh endpoints
*/
export interface HealthCheckConfig {
/**
* VirtualNode CFN configuration for Health Checks
*
* @default - no health checks
*/
readonly virtualNodeHealthCheck?: CfnVirtualNode.HealthCheckProperty;
/**
* VirtualGateway CFN configuration for Health Checks
*
* @default - no health checks
*/
readonly virtualGatewayHealthCheck?: CfnVirtualGateway.VirtualGatewayHealthCheckPolicyProperty;
}
/**
* Options used for creating the Health Check object
*/
export interface HealthCheckBindOptions {
/**
* Port for Health Check interface
*
* @default - no default port is provided
*/
readonly defaultPort?: number;
}
/**
* Contains static factory methods for creating health checks for different protocols
*/
export declare abstract class HealthCheck {
/**
* Construct a HTTP health check
*/
static http(options?: HttpHealthCheckOptions): HealthCheck;
/**
* Construct a HTTP2 health check
*/
static http2(options?: HttpHealthCheckOptions): HealthCheck;
/**
* Construct a GRPC health check
*/
static grpc(options?: GrpcHealthCheckOptions): HealthCheck;
/**
* Construct a TCP health check
*/
static tcp(options?: TcpHealthCheckOptions): HealthCheck;
/**
* Called when the AccessLog type is initialized. Can be used to enforce
* mutual exclusivity with future properties
*/
abstract bind(scope: Construct, options: HealthCheckBindOptions): HealthCheckConfig;
}
export {};

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HealthCheck=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var shared_interfaces_1=()=>{var tmp=require("./shared-interfaces");return shared_interfaces_1=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class HealthCheck{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.HealthCheck",version:"2.252.0"};static http(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.HTTP,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout,options.path)}static http2(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http2),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.HTTP2,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout,options.path)}static grpc(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_GrpcHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grpc),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.GRPC,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout)}static tcp(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_TcpHealthCheckOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.tcp),error}return new HealthCheckImpl(shared_interfaces_1().Protocol.TCP,options.healthyThreshold,options.unhealthyThreshold,options.interval,options.timeout)}}exports.HealthCheck=HealthCheck;class HealthCheckImpl extends HealthCheck{protocol;healthyThreshold;unhealthyThreshold;interval;timeout;path;constructor(protocol,healthyThreshold=2,unhealthyThreshold=2,interval=cdk().Duration.seconds(5),timeout=cdk().Duration.seconds(2),path){if(super(),this.protocol=protocol,this.healthyThreshold=healthyThreshold,this.unhealthyThreshold=unhealthyThreshold,this.interval=interval,this.timeout=timeout,this.path=path,healthyThreshold<2||healthyThreshold>10)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`HealthyThresholdOutOfRange`,"healthyThreshold must be between 2 and 10");if(unhealthyThreshold<2||unhealthyThreshold>10)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`UnhealthyThresholdOutOfRange`,"unhealthyThreshold must be between 2 and 10");if(interval.toMilliseconds()<5e3||interval.toMilliseconds()>3e5)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`IntervalOutOfRange`,"interval must be between 5 seconds and 300 seconds");if(timeout.toMilliseconds()<2e3||timeout.toMilliseconds()>6e4)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`TimeoutOutOfRange`,"timeout must be between 2 seconds and 60 seconds");path===void 0&&(protocol===shared_interfaces_1().Protocol.HTTP||protocol===shared_interfaces_1().Protocol.HTTP2)&&(this.path="/")}bind(_scope,options){return{virtualNodeHealthCheck:{protocol:this.protocol,healthyThreshold:this.healthyThreshold,unhealthyThreshold:this.unhealthyThreshold,intervalMillis:this.interval.toMilliseconds(),timeoutMillis:this.timeout.toMilliseconds(),path:this.path,port:options.defaultPort},virtualGatewayHealthCheck:{protocol:this.protocol,healthyThreshold:this.healthyThreshold,unhealthyThreshold:this.unhealthyThreshold,intervalMillis:this.interval.toMilliseconds(),timeoutMillis:this.timeout.toMilliseconds(),path:this.path,port:options.defaultPort}}}}

View File

@@ -0,0 +1,41 @@
/**
* Supported values for matching routes based on the HTTP request method
*/
export declare enum HttpRouteMethod {
/**
* GET request
*/
GET = "GET",
/**
* HEAD request
*/
HEAD = "HEAD",
/**
* POST request
*/
POST = "POST",
/**
* PUT request
*/
PUT = "PUT",
/**
* DELETE request
*/
DELETE = "DELETE",
/**
* CONNECT request
*/
CONNECT = "CONNECT",
/**
* OPTIONS request
*/
OPTIONS = "OPTIONS",
/**
* TRACE request
*/
TRACE = "TRACE",
/**
* PATCH request
*/
PATCH = "PATCH"
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpRouteMethod=void 0;var HttpRouteMethod;(function(HttpRouteMethod2){HttpRouteMethod2.GET="GET",HttpRouteMethod2.HEAD="HEAD",HttpRouteMethod2.POST="POST",HttpRouteMethod2.PUT="PUT",HttpRouteMethod2.DELETE="DELETE",HttpRouteMethod2.CONNECT="CONNECT",HttpRouteMethod2.OPTIONS="OPTIONS",HttpRouteMethod2.TRACE="TRACE",HttpRouteMethod2.PATCH="PATCH"})(HttpRouteMethod||(exports.HttpRouteMethod=HttpRouteMethod={}));

View File

@@ -0,0 +1,119 @@
import type { Construct } from 'constructs';
import type { CfnGatewayRoute, CfnRoute } from './appmesh.generated';
/**
* The type returned from the `bind()` method in `HttpRoutePathMatch`.
*/
export interface HttpRoutePathMatchConfig {
/**
* Route configuration for matching on the complete URL path of the request.
*
* @default - no matching will be performed on the complete URL path
*/
readonly wholePathMatch?: CfnRoute.HttpPathMatchProperty;
/**
* Route configuration for matching on the prefix of the URL path of the request.
*
* @default - no matching will be performed on the prefix of the URL path
*/
readonly prefixPathMatch?: string;
}
/**
* Defines HTTP route matching based on the URL path of the request.
*/
export declare abstract class HttpRoutePathMatch {
/**
* The value of the path must match the specified value exactly.
* The provided `path` must start with the '/' character.
*
* @param path the exact path to match on
*/
static exactly(path: string): HttpRoutePathMatch;
/**
* The value of the path must match the specified regex.
*
* @param regex the regex used to match the path
*/
static regex(regex: string): HttpRoutePathMatch;
/**
* The value of the path must match the specified prefix.
*
* @param prefix the value to use to match the beginning of the path part of the URL of the request.
* It must start with the '/' character. If provided as "/", matches all requests.
* For example, if your virtual service name is "my-service.local"
* and you want the route to match requests to "my-service.local/metrics", your prefix should be "/metrics".
*/
static startsWith(prefix: string): HttpRoutePathMatch;
/**
* Returns the route path match configuration.
*/
abstract bind(scope: Construct): HttpRoutePathMatchConfig;
}
/**
* The type returned from the `bind()` method in `HttpGatewayRoutePathMatch`.
*/
export interface HttpGatewayRoutePathMatchConfig {
/**
* Gateway route configuration for matching on the complete URL path of the request.
*
* @default - no matching will be performed on the complete URL path
*/
readonly wholePathMatch?: CfnGatewayRoute.HttpPathMatchProperty;
/**
* Gateway route configuration for matching on the prefix of the URL path of the request.
*
* @default - no matching will be performed on the prefix of the URL path
*/
readonly prefixPathMatch?: string;
/**
* Gateway route configuration for rewriting the complete URL path of the request..
*
* @default - no rewrite will be performed on the request's complete URL path
*/
readonly wholePathRewrite?: CfnGatewayRoute.HttpGatewayRoutePathRewriteProperty;
/**
* Gateway route configuration for rewriting the prefix of the URL path of the request.
*
* @default - rewrites the request's URL path to '/'
*/
readonly prefixPathRewrite?: CfnGatewayRoute.HttpGatewayRoutePrefixRewriteProperty;
}
/**
* Defines HTTP gateway route matching based on the URL path of the request.
*/
export declare abstract class HttpGatewayRoutePathMatch {
/**
* The value of the path must match the specified prefix.
*
* @param prefix the value to use to match the beginning of the path part of the URL of the request.
* It must start with the '/' character.
* When `rewriteTo` is provided, it must also end with the '/' character.
* If provided as "/", matches all requests.
* For example, if your virtual service name is "my-service.local"
* and you want the route to match requests to "my-service.local/metrics", your prefix should be "/metrics".
* @param rewriteTo Specify either disabling automatic rewrite or rewriting to specified prefix path.
* To disable automatic rewrite, provide `''`.
* As a default, request's URL path is automatically rewritten to '/'.
*/
static startsWith(prefix: string, rewriteTo?: string): HttpGatewayRoutePathMatch;
/**
* The value of the path must match the specified value exactly.
* The provided `path` must start with the '/' character.
*
* @param path the exact path to match on
* @param rewriteTo the value to substitute for the matched part of the path of the gateway request URL
* As a default, retains original request's URL path.
*/
static exactly(path: string, rewriteTo?: string): HttpGatewayRoutePathMatch;
/**
* The value of the path must match the specified regex.
*
* @param regex the regex used to match the path
* @param rewriteTo the value to substitute for the matched part of the path of the gateway request URL
* As a default, retains original request's URL path.
*/
static regex(regex: string, rewriteTo?: string): HttpGatewayRoutePathMatch;
/**
* Returns the gateway route path match configuration.
*/
abstract bind(scope: Construct): HttpGatewayRoutePathMatchConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpGatewayRoutePathMatch=exports.HttpRoutePathMatch=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class HttpRoutePathMatch{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.HttpRoutePathMatch",version:"2.252.0"};static exactly(path){return new HttpRouteWholePathMatch({exact:path})}static regex(regex){return new HttpRouteWholePathMatch({regex})}static startsWith(prefix){return new HttpRoutePrefixPathMatch(prefix)}}exports.HttpRoutePathMatch=HttpRoutePathMatch;class HttpRoutePrefixPathMatch extends HttpRoutePathMatch{prefix;constructor(prefix){if(super(),this.prefix=prefix,prefix&&prefix[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathMustStartWithSlash`,`Prefix Path for the match must start with '/', got: ${prefix}`)}bind(_scope){return{prefixPathMatch:this.prefix}}}class HttpRouteWholePathMatch extends HttpRoutePathMatch{match;constructor(match){if(super(),this.match=match,match.exact&&match.exact[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathMustStartWithSlash`,`Exact Path for the match must start with '/', got: ${match.exact}`)}bind(_scope){return{wholePathMatch:this.match}}}class HttpGatewayRoutePathMatch{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.HttpGatewayRoutePathMatch",version:"2.252.0"};static startsWith(prefix,rewriteTo){return new HttpGatewayRoutePrefixPathMatch(prefix,rewriteTo)}static exactly(path,rewriteTo){return new HttpGatewayRouteWholePathMatch({exact:path},rewriteTo)}static regex(regex,rewriteTo){return new HttpGatewayRouteWholePathMatch({regex},rewriteTo)}}exports.HttpGatewayRoutePathMatch=HttpGatewayRoutePathMatch;class HttpGatewayRoutePrefixPathMatch extends HttpGatewayRoutePathMatch{prefixPathMatch;rewriteTo;constructor(prefixPathMatch,rewriteTo){if(super(),this.prefixPathMatch=prefixPathMatch,this.rewriteTo=rewriteTo,prefixPathMatch[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathMustStartWithSlash`,`Prefix path for the match must start with '/', got: ${prefixPathMatch}`);if(rewriteTo){if(prefixPathMatch[prefixPathMatch.length-1]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathMustEndWithSlash`,`When prefix path for the rewrite is specified, prefix path for the match must end with '/', got: ${prefixPathMatch}`);if(rewriteTo[0]!=="/"||rewriteTo[rewriteTo.length-1]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathRewriteMustStartAndEndWithSlash`,`Prefix path for the rewrite must start and end with '/', got: ${rewriteTo}`)}}bind(_scope){return{prefixPathMatch:this.prefixPathMatch,prefixPathRewrite:this.rewriteTo===void 0?void 0:{defaultPrefix:this.rewriteTo===""?"DISABLED":void 0,value:this.rewriteTo===""?void 0:this.rewriteTo}}}}class HttpGatewayRouteWholePathMatch extends HttpGatewayRoutePathMatch{wholePathMatch;exactPathRewrite;constructor(wholePathMatch,exactPathRewrite){if(super(),this.wholePathMatch=wholePathMatch,this.exactPathRewrite=exactPathRewrite,wholePathMatch.exact&&wholePathMatch.exact[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathMustStartWithSlash`,`Exact Path for the match must start with '/', got: ${wholePathMatch.exact}`);if(exactPathRewrite==="")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathRewriteCannotBeEmpty`,"Exact Path for the rewrite cannot be empty. Unlike startsWith() method, no automatic rewrite on whole path match");if(exactPathRewrite&&exactPathRewrite[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathRewriteMustStartWithSlash`,`Exact Path for the rewrite must start with '/', got: ${exactPathRewrite}`)}bind(_scope){return{wholePathMatch:this.wholePathMatch,wholePathRewrite:this.exactPathRewrite===void 0?void 0:{exact:this.exactPathRewrite}}}}

View File

@@ -0,0 +1,25 @@
export * from './appmesh.generated';
export * from './appmesh-grants.generated';
export * from './mesh';
export * from './route';
export * from './service-discovery';
export * from './route-spec';
export * from './shared-interfaces';
export * from './tls-certificate';
export * from './virtual-node';
export * from './virtual-router';
export * from './virtual-router-listener';
export * from './virtual-service';
export * from './virtual-node-listener';
export * from './virtual-gateway';
export * from './virtual-gateway-listener';
export * from './gateway-route';
export * from './gateway-route-spec';
export * from './health-checks';
export * from './listener-tls-options';
export * from './tls-validation';
export * from './tls-client-policy';
export * from './http-route-method';
export * from './header-match';
export * from './query-parameter-match';
export * from './http-route-path-match';

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,39 @@
import type { TlsCertificate } from './tls-certificate';
import type { MutualTlsValidation } from './tls-validation';
/**
* Enum of supported TLS modes
*/
export declare enum TlsMode {
/**
* Only accept encrypted traffic
*/
STRICT = "STRICT",
/**
* Accept encrypted and plaintext traffic.
*/
PERMISSIVE = "PERMISSIVE",
/**
* TLS is disabled, only accept plaintext traffic.
*/
DISABLED = "DISABLED"
}
/**
* Represents TLS properties for listener
*/
export interface ListenerTlsOptions {
/**
* Represents TLS certificate
*/
readonly certificate: TlsCertificate;
/**
* The TLS mode.
*/
readonly mode: TlsMode;
/**
* Represents a listener's TLS validation context.
* The client certificate will only be validated if the client provides it, enabling mutual TLS.
*
* @default - client TLS certificate is not required
*/
readonly mutualTlsValidation?: MutualTlsValidation;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TlsMode=void 0;var TlsMode;(function(TlsMode2){TlsMode2.STRICT="STRICT",TlsMode2.PERMISSIVE="PERMISSIVE",TlsMode2.DISABLED="DISABLED"})(TlsMode||(exports.TlsMode=TlsMode={}));

138
cdk/node_modules/aws-cdk-lib/aws-appmesh/lib/mesh.d.ts generated vendored Normal file
View File

@@ -0,0 +1,138 @@
import type { Construct } from 'constructs';
import type { IMeshRef, MeshReference } from './appmesh.generated';
import type { MeshServiceDiscovery } from './service-discovery';
import type { VirtualGatewayBaseProps } from './virtual-gateway';
import { VirtualGateway } from './virtual-gateway';
import type { VirtualNodeBaseProps } from './virtual-node';
import { VirtualNode } from './virtual-node';
import type { VirtualRouterBaseProps } from './virtual-router';
import { VirtualRouter } from './virtual-router';
import * as cdk from '../../core';
/**
* A utility enum defined for the egressFilter type property, the default of DROP_ALL,
* allows traffic only to other resources inside the mesh, or API calls to amazon resources.
*
* @default DROP_ALL
*/
export declare enum MeshFilterType {
/**
* Allows all outbound traffic
*/
ALLOW_ALL = "ALLOW_ALL",
/**
* Allows traffic only to other resources inside the mesh, or API calls to amazon resources
*/
DROP_ALL = "DROP_ALL"
}
/**
* Interface which all Mesh based classes MUST implement
*/
export interface IMesh extends cdk.IResource, IMeshRef {
/**
* The name of the AppMesh mesh
*
* @attribute
*/
readonly meshName: string;
/**
* The Amazon Resource Name (ARN) of the AppMesh mesh
*
* @attribute
*/
readonly meshArn: string;
/**
* Creates a new VirtualRouter in this Mesh.
* Note that the Router is created in the same Stack that this Mesh belongs to,
* which might be different than the current stack.
*/
addVirtualRouter(id: string, props?: VirtualRouterBaseProps): VirtualRouter;
/**
* Creates a new VirtualNode in this Mesh.
* Note that the Node is created in the same Stack that this Mesh belongs to,
* which might be different than the current stack.
*/
addVirtualNode(id: string, props?: VirtualNodeBaseProps): VirtualNode;
/**
* Creates a new VirtualGateway in this Mesh.
* Note that the Gateway is created in the same Stack that this Mesh belongs to,
* which might be different than the current stack.
*/
addVirtualGateway(id: string, props?: VirtualGatewayBaseProps): VirtualGateway;
}
/**
* Represents a new or imported AppMesh mesh
*/
declare abstract class MeshBase extends cdk.Resource implements IMesh {
/**
* The name of the AppMesh mesh
*/
abstract readonly meshName: string;
/**
* The Amazon Resource Name (ARN) of the AppMesh mesh
*/
abstract readonly meshArn: string;
/**
* Adds a VirtualRouter to the Mesh with the given id and props
*/
addVirtualRouter(id: string, props?: VirtualRouterBaseProps): VirtualRouter;
/**
* Adds a VirtualNode to the Mesh
*/
addVirtualNode(id: string, props?: VirtualNodeBaseProps): VirtualNode;
/**
* Adds a VirtualGateway to the Mesh
*/
addVirtualGateway(id: string, props?: VirtualGatewayBaseProps): VirtualGateway;
get meshRef(): MeshReference;
}
/**
* The set of properties used when creating a Mesh
*/
export interface MeshProps {
/**
* The name of the Mesh being defined
*
* @default - A name is automatically generated
*/
readonly meshName?: string;
/**
* Egress filter to be applied to the Mesh
*
* @default DROP_ALL
*/
readonly egressFilter?: MeshFilterType;
/**
* Defines how upstream clients will discover VirtualNodes in the Mesh
*
* @default - No Service Discovery
*/
readonly serviceDiscovery?: MeshServiceDiscovery;
}
/**
* Define a new AppMesh mesh
*
* @see https://docs.aws.amazon.com/app-mesh/latest/userguide/meshes.html
*/
export declare class Mesh extends MeshBase {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an existing mesh by arn
*/
static fromMeshArn(scope: Construct, id: string, meshArn: string): IMesh;
/**
* Import an existing mesh by name
*/
static fromMeshName(scope: Construct, id: string, meshName: string): IMesh;
/**
* The name of the AppMesh mesh
*/
get meshName(): string;
/**
* The Amazon Resource Name (ARN) of the AppMesh mesh
*/
get meshArn(): string;
private readonly resource;
constructor(scope: Construct, id: string, props?: MeshProps);
}
export {};

1
cdk/node_modules/aws-cdk-lib/aws-appmesh/lib/mesh.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,59 @@
import type { Construct } from 'constructs';
import type { CfnVirtualNode } from '../appmesh.generated';
import type { GrpcGatewayRouteMatch } from '../gateway-route-spec';
import type { HeaderMatch } from '../header-match';
import type { ListenerTlsOptions } from '../listener-tls-options';
import type { QueryParameterMatch } from '../query-parameter-match';
import type { GrpcRouteMatch } from '../route-spec';
import type { TlsClientPolicy } from '../tls-client-policy';
/**
* Generated Connection pool config
*/
export interface ConnectionPoolConfig {
/**
* The maximum connections in the pool
*
* @default - none
*/
readonly maxConnections?: number;
/**
* The maximum pending requests in the pool
*
* @default - none
*/
readonly maxPendingRequests?: number;
/**
* The maximum requests in the pool
*
* @default - none
*/
readonly maxRequests?: number;
}
/**
* This is the helper method to render TLS property of client policy.
*/
export declare function renderTlsClientPolicy(scope: Construct, tlsClientPolicy: TlsClientPolicy | undefined): CfnVirtualNode.ClientPolicyTlsProperty | undefined;
/**
* This is the helper method to render the TLS config for a listener.
*/
export declare function renderListenerTlsOptions(scope: Construct, listenerTls: ListenerTlsOptions | undefined): CfnVirtualNode.ListenerTlsProperty | undefined;
/**
* This is the helper method to populate mesh owner when it is a shared mesh scenario
*/
export declare function renderMeshOwner(resourceAccount: string, meshAccount: string): string | undefined;
/**
* This is the helper method to validate the length of HTTP match array when it is specified.
*/
export declare function validateHttpMatchArrayLength(scope: Construct, headers?: HeaderMatch[], queryParameters?: QueryParameterMatch[]): void;
/**
* This is the helper method to validate the length of gRPC match array when it is specified.
*/
export declare function validateGrpcMatchArrayLength(scope: Construct, metadata?: HeaderMatch[]): void;
/**
* This is the helper method to validate at least one of gRPC route match type is defined.
*/
export declare function validateGrpcRouteMatch(scope: Construct, match: GrpcRouteMatch): void;
/**
* This is the helper method to validate at least one of gRPC gateway route match type is defined.
*/
export declare function validateGrpcGatewayRouteMatch(scope: Construct, match: GrpcGatewayRouteMatch): void;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.renderTlsClientPolicy=renderTlsClientPolicy,exports.renderListenerTlsOptions=renderListenerTlsOptions,exports.renderMeshOwner=renderMeshOwner,exports.validateHttpMatchArrayLength=validateHttpMatchArrayLength,exports.validateGrpcMatchArrayLength=validateGrpcMatchArrayLength,exports.validateGrpcRouteMatch=validateGrpcRouteMatch,exports.validateGrpcGatewayRouteMatch=validateGrpcGatewayRouteMatch;var core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};function renderTlsClientPolicy(scope,tlsClientPolicy){const certificate=tlsClientPolicy?.mutualTlsCertificate?.bind(scope).tlsCertificate,sans=tlsClientPolicy?.validation.subjectAlternativeNames;return tlsClientPolicy?{certificate,ports:tlsClientPolicy.ports,enforce:tlsClientPolicy.enforce,validation:{subjectAlternativeNames:sans?{match:sans.bind(scope).subjectAlternativeNamesMatch}:void 0,trust:tlsClientPolicy.validation.trust.bind(scope).tlsValidationTrust}}:void 0}function renderListenerTlsOptions(scope,listenerTls){const tlsValidation=listenerTls?.mutualTlsValidation;return listenerTls?{certificate:listenerTls.certificate.bind(scope).tlsCertificate,mode:listenerTls.mode,validation:tlsValidation?{subjectAlternativeNames:tlsValidation.subjectAlternativeNames?{match:tlsValidation.subjectAlternativeNames.bind(scope).subjectAlternativeNamesMatch}:void 0,trust:tlsValidation.trust.bind(scope).tlsValidationTrust}:void 0}:void 0}function renderMeshOwner(resourceAccount,meshAccount){const comparison=core_1().Token.compareStrings(resourceAccount,meshAccount);return comparison===core_1().TokenComparison.DIFFERENT||comparison===core_1().TokenComparison.ONE_UNRESOLVED?meshAccount:void 0}function validateHttpMatchArrayLength(scope,headers,queryParameters){if(headers&&(headers.length<1||headers.length>10))throw new(core_1()).ValidationError((0,literal_string_1().lit)`HeaderCountOutOfRange`,`Number of headers provided for matching must be between 1 and 10, got: ${headers.length}`,scope);if(queryParameters&&(queryParameters.length<1||queryParameters.length>10))throw new(core_1()).ValidationError((0,literal_string_1().lit)`QueryParameterCountOutOfRange`,`Number of query parameters provided for matching must be between 1 and 10, got: ${queryParameters.length}`,scope)}function validateGrpcMatchArrayLength(scope,metadata){if(metadata&&(metadata.length<1||metadata.length>10))throw new(core_1()).ValidationError((0,literal_string_1().lit)`MetadataCountOutOfRange`,`Number of metadata provided for matching must be between 1 and 10, got: ${metadata.length}`,scope)}function validateGrpcRouteMatch(scope,match){if(match.serviceName===void 0&&match.metadata===void 0&&match.methodName===void 0&&match.port===void 0)throw new(core_1()).ValidationError((0,literal_string_1().lit)`GrpcRouteMatchRequired`,"At least one gRPC route match property must be provided",scope)}function validateGrpcGatewayRouteMatch(scope,match){if(match.serviceName===void 0&&match.metadata===void 0&&match.hostname===void 0&&match.port===void 0)throw new(core_1()).ValidationError((0,literal_string_1().lit)`GrpcGatewayRouteMatchRequired`,"At least one gRPC gateway route match property beside rewriteRequestHostname must be provided",scope)}

View File

@@ -0,0 +1,28 @@
import type { Construct } from 'constructs';
import type { CfnRoute } from './appmesh.generated';
/**
* Configuration for `QueryParameterMatch`
*/
export interface QueryParameterMatchConfig {
/**
* Route CFN configuration for route query parameter match.
*/
readonly queryParameterMatch: CfnRoute.QueryParameterProperty;
}
/**
* Used to generate query parameter matching methods.
*/
export declare abstract class QueryParameterMatch {
/**
* The value of the query parameter with the given name in the request must match the
* specified value exactly.
*
* @param queryParameterName the name of the query parameter to match against
* @param queryParameterValue The exact value to test against
*/
static valueIs(queryParameterName: string, queryParameterValue: string): QueryParameterMatch;
/**
* Returns the query parameter match configuration.
*/
abstract bind(scope: Construct): QueryParameterMatchConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueryParameterMatch=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");class QueryParameterMatch{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.QueryParameterMatch",version:"2.252.0"};static valueIs(queryParameterName,queryParameterValue){return new QueryParameterMatchImpl(queryParameterName,{exact:queryParameterValue})}}exports.QueryParameterMatch=QueryParameterMatch;class QueryParameterMatchImpl extends QueryParameterMatch{queryParameterName;matchProperty;constructor(queryParameterName,matchProperty){super(),this.queryParameterName=queryParameterName,this.matchProperty=matchProperty}bind(_scope){return{queryParameterMatch:{match:this.matchProperty,name:this.queryParameterName}}}}

View File

@@ -0,0 +1,364 @@
import type { Construct } from 'constructs';
import type { CfnRoute } from './appmesh.generated';
import type { HeaderMatch } from './header-match';
import type { HttpRouteMethod } from './http-route-method';
import { HttpRoutePathMatch } from './http-route-path-match';
import type { QueryParameterMatch } from './query-parameter-match';
import type { GrpcTimeout, HttpTimeout, TcpTimeout } from './shared-interfaces';
import type { IVirtualNode } from './virtual-node';
import * as cdk from '../../core';
/**
* Properties for the Weighted Targets in the route
*/
export interface WeightedTarget {
/**
* The VirtualNode the route points to
*/
readonly virtualNode: IVirtualNode;
/**
* The weight for the target
*
* @default 1
*/
readonly weight?: number;
/**
* The port to match from the request.
*
* @default - do not match on port
*/
readonly port?: number;
}
/**
* The criterion for determining a request match for this Route
*/
export interface HttpRouteMatch {
/**
* Specifies how is the request matched based on the path part of its URL.
*
* @default - matches requests with all paths
*/
readonly path?: HttpRoutePathMatch;
/**
* Specifies the client request headers to match on. All specified headers
* must match for the route to match.
*
* @default - do not match on headers
*/
readonly headers?: HeaderMatch[];
/**
* The HTTP client request method to match on.
*
* @default - do not match on request method
*/
readonly method?: HttpRouteMethod;
/**
* The client request protocol to match on. Applicable only for HTTP2 routes.
*
* @default - do not match on HTTP2 request protocol
*/
readonly protocol?: HttpRouteProtocol;
/**
* The query parameters to match on.
* All specified query parameters must match for the route to match.
*
* @default - do not match on query parameters
*/
readonly queryParameters?: QueryParameterMatch[];
/**
* The port to match from the request.
*
* @default - do not match on port
*/
readonly port?: number;
}
/**
* Supported :scheme options for HTTP2
*/
export declare enum HttpRouteProtocol {
/**
* Match HTTP requests
*/
HTTP = "http",
/**
* Match HTTPS requests
*/
HTTPS = "https"
}
/**
* The criterion for determining a request match for this Route.
* At least one match type must be selected.
*/
export interface GrpcRouteMatch {
/**
* Create service name based gRPC route match.
*
* @default - do not match on service name
*/
readonly serviceName?: string;
/**
* Create metadata based gRPC route match.
* All specified metadata must match for the route to match.
*
* @default - do not match on metadata
*/
readonly metadata?: HeaderMatch[];
/**
* The method name to match from the request.
* If the method name is specified, service name must be also provided.
*
* @default - do not match on method name
*/
readonly methodName?: string;
/**
* The port to match from the request.
*
* @default - do not match on port
*/
readonly port?: number;
}
/**
* Base options for all route specs.
*/
export interface RouteSpecOptionsBase {
/**
* The priority for the route. When a Virtual Router has multiple routes, route match is performed in the
* order of specified value, where 0 is the highest priority, and first matched route is selected.
*
* @default - no particular priority
*/
readonly priority?: number;
}
/**
* Properties specific for HTTP Based Routes
*/
export interface HttpRouteSpecOptions extends RouteSpecOptionsBase {
/**
* The criterion for determining a request match for this Route
*
* @default - matches on '/'
*/
readonly match?: HttpRouteMatch;
/**
* List of targets that traffic is routed to when a request matches the route
*/
readonly weightedTargets: WeightedTarget[];
/**
* An object that represents a http timeout
*
* @default - None
*/
readonly timeout?: HttpTimeout;
/**
* The retry policy
*
* @default - no retry policy
*/
readonly retryPolicy?: HttpRetryPolicy;
}
/**
* HTTP retry policy
*/
export interface HttpRetryPolicy {
/**
* Specify HTTP events on which to retry. You must specify at least one value
* for at least one types of retry events.
*
* @default - no retries for http events
*/
readonly httpRetryEvents?: HttpRetryEvent[];
/**
* The maximum number of retry attempts
*/
readonly retryAttempts: number;
/**
* The timeout for each retry attempt
*/
readonly retryTimeout: cdk.Duration;
/**
* TCP events on which to retry. The event occurs before any processing of a
* request has started and is encountered when the upstream is temporarily or
* permanently unavailable. You must specify at least one value for at least
* one types of retry events.
*
* @default - no retries for tcp events
*/
readonly tcpRetryEvents?: TcpRetryEvent[];
}
/**
* HTTP events on which to retry.
*/
export declare enum HttpRetryEvent {
/**
* HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511
*/
SERVER_ERROR = "server-error",
/**
* HTTP status codes 502, 503, and 504
*/
GATEWAY_ERROR = "gateway-error",
/**
* HTTP status code 409
*/
CLIENT_ERROR = "client-error",
/**
* Retry on refused stream
*/
STREAM_ERROR = "stream-error"
}
/**
* TCP events on which you may retry
*/
export declare enum TcpRetryEvent {
/**
* A connection error
*/
CONNECTION_ERROR = "connection-error"
}
/**
* Properties specific for a TCP Based Routes
*/
export interface TcpRouteSpecOptions extends RouteSpecOptionsBase {
/**
* List of targets that traffic is routed to when a request matches the route
*/
readonly weightedTargets: WeightedTarget[];
/**
* An object that represents a tcp timeout
*
* @default - None
*/
readonly timeout?: TcpTimeout;
}
/**
* Properties specific for a GRPC Based Routes
*/
export interface GrpcRouteSpecOptions extends RouteSpecOptionsBase {
/**
* The criterion for determining a request match for this Route
*/
readonly match: GrpcRouteMatch;
/**
* An object that represents a grpc timeout
*
* @default - None
*/
readonly timeout?: GrpcTimeout;
/**
* List of targets that traffic is routed to when a request matches the route
*/
readonly weightedTargets: WeightedTarget[];
/**
* The retry policy
*
* @default - no retry policy
*/
readonly retryPolicy?: GrpcRetryPolicy;
}
/** gRPC retry policy */
export interface GrpcRetryPolicy extends HttpRetryPolicy {
/**
* gRPC events on which to retry. You must specify at least one value
* for at least one types of retry events.
*
* @default - no retries for gRPC events
*/
readonly grpcRetryEvents?: GrpcRetryEvent[];
}
/**
* gRPC events
*/
export declare enum GrpcRetryEvent {
/**
* Request was cancelled
*
* @see https://grpc.github.io/grpc/core/md_doc_statuscodes.html
*/
CANCELLED = "cancelled",
/**
* The deadline was exceeded
*
* @see https://grpc.github.io/grpc/core/md_doc_statuscodes.html
*/
DEADLINE_EXCEEDED = "deadline-exceeded",
/**
* Internal error
*
* @see https://grpc.github.io/grpc/core/md_doc_statuscodes.html
*/
INTERNAL_ERROR = "internal",
/**
* A resource was exhausted
*
* @see https://grpc.github.io/grpc/core/md_doc_statuscodes.html
*/
RESOURCE_EXHAUSTED = "resource-exhausted",
/**
* The service is unavailable
*
* @see https://grpc.github.io/grpc/core/md_doc_statuscodes.html
*/
UNAVAILABLE = "unavailable"
}
/**
* All Properties for Route Specs
*/
export interface RouteSpecConfig {
/**
* The spec for an http route
*
* @default - no http spec
*/
readonly httpRouteSpec?: CfnRoute.HttpRouteProperty;
/**
* The spec for an http2 route
*
* @default - no http2 spec
*/
readonly http2RouteSpec?: CfnRoute.HttpRouteProperty;
/**
* The spec for a grpc route
*
* @default - no grpc spec
*/
readonly grpcRouteSpec?: CfnRoute.GrpcRouteProperty;
/**
* The spec for a tcp route
*
* @default - no tcp spec
*/
readonly tcpRouteSpec?: CfnRoute.TcpRouteProperty;
/**
* The priority for the route. When a Virtual Router has multiple routes, route match is performed in the
* order of specified value, where 0 is the highest priority, and first matched route is selected.
*
* @default - no particular priority
*/
readonly priority?: number;
}
/**
* Used to generate specs with different protocols for a RouteSpec
*/
export declare abstract class RouteSpec {
/**
* Creates an HTTP Based RouteSpec
*/
static http(options: HttpRouteSpecOptions): RouteSpec;
/**
* Creates an HTTP2 Based RouteSpec
*
*/
static http2(options: HttpRouteSpecOptions): RouteSpec;
/**
* Creates a TCP Based RouteSpec
*/
static tcp(options: TcpRouteSpecOptions): RouteSpec;
/**
* Creates a GRPC Based RouteSpec
*/
static grpc(options: GrpcRouteSpecOptions): RouteSpec;
/**
* Called when the RouteSpec type is initialized. Can be used to enforce
* mutual exclusivity with future properties
*/
abstract bind(scope: Construct): RouteSpecConfig;
}

File diff suppressed because one or more lines are too long

101
cdk/node_modules/aws-cdk-lib/aws-appmesh/lib/route.d.ts generated vendored Normal file
View File

@@ -0,0 +1,101 @@
import type { Construct } from 'constructs';
import type { IRouteRef, RouteReference } from './appmesh.generated';
import type { IMesh } from './mesh';
import type { RouteSpec } from './route-spec';
import type { IVirtualRouter } from './virtual-router';
import * as cdk from '../../core';
/**
* Interface for which all Route based classes MUST implement
*/
export interface IRoute extends cdk.IResource, IRouteRef {
/**
* The name of the route
*
* @attribute
*/
readonly routeName: string;
/**
* The Amazon Resource Name (ARN) for the route
*
* @attribute
*/
readonly routeArn: string;
/**
* The VirtualRouter the Route belongs to
*/
readonly virtualRouter: IVirtualRouter;
}
/**
* Base interface properties for all Routes
*/
export interface RouteBaseProps {
/**
* The name of the route
*
* @default - An automatically generated name
*/
readonly routeName?: string;
/**
* Protocol specific spec
*/
readonly routeSpec: RouteSpec;
}
/**
* Properties to define new Routes
*/
export interface RouteProps extends RouteBaseProps {
/**
* The service mesh to define the route in
*/
readonly mesh: IMesh;
/**
* The VirtualRouter the Route belongs to
*/
readonly virtualRouter: IVirtualRouter;
}
/**
* Route represents a new or existing route attached to a VirtualRouter and Mesh
*
* @see https://docs.aws.amazon.com/app-mesh/latest/userguide/routes.html
*/
export declare class Route extends cdk.Resource implements IRoute {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an existing Route given an ARN
*/
static fromRouteArn(scope: Construct, id: string, routeArn: string): IRoute;
/**
* Import an existing Route given attributes
*/
static fromRouteAttributes(scope: Construct, id: string, attrs: RouteAttributes): IRoute;
/**
* The name of the Route
*/
get routeName(): string;
/**
* The Amazon Resource Name (ARN) for the route
*/
get routeArn(): string;
/**
* The VirtualRouter the Route belongs to
*/
readonly virtualRouter: IVirtualRouter;
private readonly resource;
private readonly mesh;
constructor(scope: Construct, id: string, props: RouteProps);
get routeRef(): RouteReference;
}
/**
* Interface with properties ncecessary to import a reusable Route
*/
export interface RouteAttributes {
/**
* The name of the Route
*/
readonly routeName: string;
/**
* The VirtualRouter the Route belongs to
*/
readonly virtualRouter: IVirtualRouter;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,108 @@
import type { Construct } from 'constructs';
import type { CfnVirtualNode } from './appmesh.generated';
import type * as cloudmap from '../../aws-servicediscovery';
/**
* Enum of supported IP preferences.
* Used to dictate the IP version for mesh wide and virtual node service discovery.
* Also used to specify the IP version that a sidecar Envoy uses when sending traffic to a local application.
*/
export declare enum IpPreference {
/**
* Use IPv4 when sending traffic to a local application.
* Only use IPv4 for service discovery.
*/
IPV4_ONLY = "IPv4_ONLY",
/**
* Use IPv4 when sending traffic to a local application.
* First attempt to use IPv4 and fall back to IPv6 for service discovery.
*/
IPV4_PREFERRED = "IPv4_PREFERRED",
/**
* Use IPv6 when sending traffic to a local application.
* Only use IPv6 for service discovery.
*/
IPV6_ONLY = "IPv6_ONLY",
/**
* Use IPv6 when sending traffic to a local application.
* First attempt to use IPv6 and fall back to IPv4 for service discovery.
*/
IPV6_PREFERRED = "IPv6_PREFERRED"
}
/**
* Properties for Mesh Service Discovery
*/
export interface MeshServiceDiscovery {
/**
* IP preference applied to all Virtual Nodes in the Mesh
*
* @default - No IP preference is applied to any of the Virtual Nodes in the Mesh.
* Virtual Nodes without an IP preference will have the following configured.
* Envoy listeners are configured to bind only to IPv4.
* Envoy will use IPv4 when sending traffic to a local application.
* For DNS service discovery, the Envoy DNS resolver to prefer using IPv6 and fall back to IPv4.
* For CloudMap service discovery, App Mesh will prefer using IPv4 and fall back to IPv6 for IPs returned by CloudMap.
*/
readonly ipPreference?: IpPreference;
}
/**
* Properties for VirtualNode Service Discovery
*/
export interface ServiceDiscoveryConfig {
/**
* DNS based Service Discovery
*
* @default - no DNS based service discovery
*/
readonly dns?: CfnVirtualNode.DnsServiceDiscoveryProperty;
/**
* Cloud Map based Service Discovery
*
* @default - no Cloud Map based service discovery
*/
readonly cloudmap?: CfnVirtualNode.AwsCloudMapServiceDiscoveryProperty;
}
/**
* Enum of DNS service discovery response type
*/
export declare enum DnsResponseType {
/**
* DNS resolver returns a loadbalanced set of endpoints and the traffic would be sent to the given endpoints.
* It would not drain existing connections to other endpoints that are not part of this list.
*/
LOAD_BALANCER = "LOADBALANCER",
/**
* DNS resolver is returning all the endpoints.
* This also means that if an endpoint is missing, it would drain the current connections to the missing endpoint.
*/
ENDPOINTS = "ENDPOINTS"
}
/**
* Provides the Service Discovery method a VirtualNode uses
*/
export declare abstract class ServiceDiscovery {
/**
* Returns DNS based service discovery
*
* @param responseType Specifies the DNS response type for the virtual node.
* The default is `DnsResponseType.LOAD_BALANCER`.
* @param ipPreference No IP preference is applied to the Virtual Node.
*/
static dns(hostname: string, responseType?: DnsResponseType, ipPreference?: IpPreference): ServiceDiscovery;
/**
* Returns Cloud Map based service discovery
*
* @param service The AWS Cloud Map Service to use for service discovery
* @param instanceAttributes A string map that contains attributes with values that you can use to
* filter instances by any custom attribute that you specified when you
* registered the instance. Only instances that match all of the specified
* key/value pairs will be returned.
* @param ipPreference No IP preference is applied to the Virtual Node.
*/
static cloudMap(service: cloudmap.IService, instanceAttributes?: {
[key: string]: string;
}, ipPreference?: IpPreference): ServiceDiscovery;
/**
* Binds the current object when adding Service Discovery to a VirtualNode
*/
abstract bind(scope: Construct): ServiceDiscoveryConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServiceDiscovery=exports.DnsResponseType=exports.IpPreference=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var IpPreference;(function(IpPreference2){IpPreference2.IPV4_ONLY="IPv4_ONLY",IpPreference2.IPV4_PREFERRED="IPv4_PREFERRED",IpPreference2.IPV6_ONLY="IPv6_ONLY",IpPreference2.IPV6_PREFERRED="IPv6_PREFERRED"})(IpPreference||(exports.IpPreference=IpPreference={}));var DnsResponseType;(function(DnsResponseType2){DnsResponseType2.LOAD_BALANCER="LOADBALANCER",DnsResponseType2.ENDPOINTS="ENDPOINTS"})(DnsResponseType||(exports.DnsResponseType=DnsResponseType={}));class ServiceDiscovery{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.ServiceDiscovery",version:"2.252.0"};static dns(hostname,responseType,ipPreference){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_DnsResponseType(responseType),jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_IpPreference(ipPreference)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.dns),error}return new DnsServiceDiscovery(hostname,responseType,ipPreference)}static cloudMap(service,instanceAttributes,ipPreference){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_servicediscovery_IService(service),jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_IpPreference(ipPreference)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.cloudMap),error}return new CloudMapServiceDiscovery(service,instanceAttributes,ipPreference)}}exports.ServiceDiscovery=ServiceDiscovery;class DnsServiceDiscovery extends ServiceDiscovery{hostname;responseType;ipPreference;constructor(hostname,responseType,ipPreference){super(),this.hostname=hostname,this.responseType=responseType,this.ipPreference=ipPreference}bind(_scope){return{dns:{hostname:this.hostname,responseType:this.responseType,ipPreference:this.ipPreference}}}}class CloudMapServiceDiscovery extends ServiceDiscovery{service;instanceAttributes;ipPreference;constructor(service,instanceAttributes,ipPreference){super(),this.service=service,this.instanceAttributes=instanceAttributes,this.ipPreference=ipPreference}bind(_scope){return{cloudmap:{namespaceName:this.service.namespace.namespaceName,serviceName:this.service.serviceName,attributes:renderAttributes(this.instanceAttributes),ipPreference:this.ipPreference}}}}function renderAttributes(attrs){if(attrs!==void 0)return Object.entries(attrs).map(([key,value])=>({key,value}))}

View File

@@ -0,0 +1,230 @@
import type { Construct } from 'constructs';
import type { CfnVirtualGateway, CfnVirtualNode } from './appmesh.generated';
import type { TlsClientPolicy } from './tls-client-policy';
import type { IVirtualService } from './virtual-service';
import * as cdk from '../../core';
/**
* Represents timeouts for HTTP protocols.
*/
export interface HttpTimeout {
/**
* Represents an idle timeout. The amount of time that a connection may be idle.
*
* @default - none
*/
readonly idle?: cdk.Duration;
/**
* Represents per request timeout.
*
* @default - 15 s
*/
readonly perRequest?: cdk.Duration;
}
/**
* Represents timeouts for GRPC protocols.
*/
export interface GrpcTimeout {
/**
* Represents an idle timeout. The amount of time that a connection may be idle.
*
* @default - none
*/
readonly idle?: cdk.Duration;
/**
* Represents per request timeout.
*
* @default - 15 s
*/
readonly perRequest?: cdk.Duration;
}
/**
* Represents timeouts for TCP protocols.
*/
export interface TcpTimeout {
/**
* Represents an idle timeout. The amount of time that a connection may be idle.
*
* @default - none
*/
readonly idle?: cdk.Duration;
}
/**
* Represents the outlier detection for a listener.
*/
export interface OutlierDetection {
/**
* The base amount of time for which a host is ejected.
*/
readonly baseEjectionDuration: cdk.Duration;
/**
* The time interval between ejection sweep analysis.
*/
readonly interval: cdk.Duration;
/**
* Maximum percentage of hosts in load balancing pool for upstream service that can be ejected. Will eject at
* least one host regardless of the value.
*/
readonly maxEjectionPercent: number;
/**
* Number of consecutive 5xx errors required for ejection.
*/
readonly maxServerErrors: number;
}
/**
* All Properties for Envoy Access logs for mesh endpoints
*/
export interface AccessLogConfig {
/**
* VirtualNode CFN configuration for Access Logging
*
* @default - no access logging
*/
readonly virtualNodeAccessLog?: CfnVirtualNode.AccessLogProperty;
/**
* VirtualGateway CFN configuration for Access Logging
*
* @default - no access logging
*/
readonly virtualGatewayAccessLog?: CfnVirtualGateway.VirtualGatewayAccessLogProperty;
}
/**
* Configuration for Envoy Access logs for mesh endpoints
*/
export declare abstract class AccessLog {
/**
* Path to a file to write access logs to
*
* @default - no file based access logging
*/
static fromFilePath(filePath: string, loggingFormat?: LoggingFormat): AccessLog;
/**
* Called when the AccessLog type is initialized. Can be used to enforce
* mutual exclusivity with future properties
*/
abstract bind(scope: Construct): AccessLogConfig;
}
/**
* All Properties for Envoy Access Logging Format for mesh endpoints
*/
export interface LoggingFormatConfig {
/**
* CFN configuration for Access Logging Format
*
* @default - no access logging format
*/
readonly formatConfig?: CfnVirtualNode.LoggingFormatProperty;
}
/**
* Configuration for Envoy Access Logging Format for mesh endpoints
*/
export declare abstract class LoggingFormat {
/**
* Generate logging format from text pattern
*/
static fromText(text: string): LoggingFormat;
/**
* Generate logging format from json key pairs
*/
static fromJson(jsonLoggingFormat: {
[key: string]: string;
}): LoggingFormat;
/**
* Called when the Access Log Format is initialized. Can be used to enforce
* mutual exclusivity with future properties
*/
abstract bind(): LoggingFormatConfig;
}
/**
* Represents the properties needed to define backend defaults
*/
export interface BackendDefaults {
/**
* TLS properties for Client policy for backend defaults
*
* @default - none
*/
readonly tlsClientPolicy?: TlsClientPolicy;
}
/**
* Represents the properties needed to define a Virtual Service backend
*/
export interface VirtualServiceBackendOptions {
/**
* TLS properties for Client policy for the backend
*
* @default - none
*/
readonly tlsClientPolicy?: TlsClientPolicy;
}
/**
* Properties for a backend
*/
export interface BackendConfig {
/**
* Config for a Virtual Service backend
*/
readonly virtualServiceBackend: CfnVirtualNode.BackendProperty;
}
/**
* Contains static factory methods to create backends
*/
export declare abstract class Backend {
/**
* Construct a Virtual Service backend
*/
static virtualService(virtualService: IVirtualService, props?: VirtualServiceBackendOptions): Backend;
/**
* Return backend config
*/
abstract bind(_scope: Construct): BackendConfig;
}
/**
* Connection pool properties for HTTP listeners
*/
export interface HttpConnectionPool {
/**
* The maximum connections in the pool
*
* @default - none
*/
readonly maxConnections: number;
/**
* The maximum pending requests in the pool
*
* @default - none
*/
readonly maxPendingRequests: number;
}
/**
* Connection pool properties for TCP listeners
*/
export interface TcpConnectionPool {
/**
* The maximum connections in the pool
*
* @default - none
*/
readonly maxConnections: number;
}
/**
* Connection pool properties for gRPC listeners
*/
export interface GrpcConnectionPool {
/**
* The maximum requests in the pool
*
* @default - none
*/
readonly maxRequests: number;
}
/**
* Connection pool properties for HTTP2 listeners
*/
export interface Http2ConnectionPool {
/**
* The maximum requests in the pool
*
* @default - none
*/
readonly maxRequests: number;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Backend=exports.LoggingFormat=exports.AccessLog=exports.Protocol=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var utils_1=()=>{var tmp=require("./private/utils");return utils_1=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},Protocol;(function(Protocol2){Protocol2.HTTP="http",Protocol2.TCP="tcp",Protocol2.HTTP2="http2",Protocol2.GRPC="grpc"})(Protocol||(exports.Protocol=Protocol={}));class AccessLog{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.AccessLog",version:"2.252.0"};static fromFilePath(filePath,loggingFormat){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_LoggingFormat(loggingFormat)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromFilePath),error}return new FileAccessLog(filePath,loggingFormat)}}exports.AccessLog=AccessLog;class FileAccessLog extends AccessLog{filePath;virtualNodeLoggingFormat;virtualGatewayLoggingFormat;constructor(filePath,loggingFormat){super(),this.filePath=filePath,this.virtualGatewayLoggingFormat=loggingFormat?.bind().formatConfig,this.virtualNodeLoggingFormat=loggingFormat?.bind().formatConfig}bind(_scope){return{virtualNodeAccessLog:{file:{path:this.filePath,format:this.virtualNodeLoggingFormat}},virtualGatewayAccessLog:{file:{path:this.filePath,format:this.virtualGatewayLoggingFormat}}}}}class LoggingFormat{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.LoggingFormat",version:"2.252.0"};static fromText(text){return new TextLoggingFormat(text)}static fromJson(jsonLoggingFormat){if(Object.keys(jsonLoggingFormat).length==0)throw new(cdk()).UnscopedValidationError((0,literal_string_1().lit)`JsonKeyPairsEmpty`,"Json key pairs cannot be empty.");return new JsonLoggingFormat(jsonLoggingFormat)}}exports.LoggingFormat=LoggingFormat;class JsonLoggingFormat extends LoggingFormat{json;constructor(json){super(),this.json=Object.entries(json).map(([key,value])=>({key,value}))}bind(){return{formatConfig:{json:this.json}}}}class TextLoggingFormat extends LoggingFormat{text;constructor(text){super(),this.text=text}bind(){return{formatConfig:{text:this.text}}}}class Backend{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.Backend",version:"2.252.0"};static virtualService(virtualService,props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_IVirtualService(virtualService),jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_VirtualServiceBackendOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.virtualService),error}return new VirtualServiceBackend(virtualService,props.tlsClientPolicy)}}exports.Backend=Backend;class VirtualServiceBackend extends Backend{virtualService;tlsClientPolicy;constructor(virtualService,tlsClientPolicy){super(),this.virtualService=virtualService,this.tlsClientPolicy=tlsClientPolicy}bind(scope){return{virtualServiceBackend:{virtualService:{virtualServiceName:cdk().Token.isUnresolved(this.virtualService.virtualServiceName)?this.virtualService.physicalName:this.virtualService.virtualServiceName,clientPolicy:this.tlsClientPolicy?{tls:(0,utils_1().renderTlsClientPolicy)(scope,this.tlsClientPolicy)}:void 0}}}}}

View File

@@ -0,0 +1,39 @@
import type { Construct } from 'constructs';
import type { CfnVirtualNode } from './appmesh.generated';
import type * as acm from '../../aws-certificatemanager';
/**
* A wrapper for the tls config returned by `TlsCertificate.bind`
*/
export interface TlsCertificateConfig {
/**
* The CFN shape for a TLS certificate
*/
readonly tlsCertificate: CfnVirtualNode.ListenerTlsCertificateProperty;
}
/**
* Represents a TLS certificate
*/
export declare abstract class TlsCertificate {
/**
* Returns an File TLS Certificate
*/
static file(certificateChainPath: string, privateKeyPath: string): MutualTlsCertificate;
/**
* Returns an ACM TLS Certificate
*/
static acm(certificate: acm.ICertificate): TlsCertificate;
/**
* Returns an SDS TLS Certificate
*/
static sds(secretName: string): MutualTlsCertificate;
/**
* Returns TLS certificate based provider.
*/
abstract bind(_scope: Construct): TlsCertificateConfig;
}
/**
* Represents a TLS certificate that is supported for mutual TLS authentication.
*/
export declare abstract class MutualTlsCertificate extends TlsCertificate {
protected readonly differentiator = false;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MutualTlsCertificate=exports.TlsCertificate=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");class TlsCertificate{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.TlsCertificate",version:"2.252.0"};static file(certificateChainPath,privateKeyPath){return new FileTlsCertificate(certificateChainPath,privateKeyPath)}static acm(certificate){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_certificatemanager_ICertificate(certificate)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.acm),error}return new AcmTlsCertificate(certificate)}static sds(secretName){return new SdsTlsCertificate(secretName)}}exports.TlsCertificate=TlsCertificate;class MutualTlsCertificate extends TlsCertificate{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.MutualTlsCertificate",version:"2.252.0"};differentiator=!1}exports.MutualTlsCertificate=MutualTlsCertificate;class AcmTlsCertificate extends TlsCertificate{acmCertificate;constructor(certificate){super(),this.acmCertificate=certificate}bind(_scope){return{tlsCertificate:{acm:{certificateArn:this.acmCertificate.certificateArn}}}}}class FileTlsCertificate extends MutualTlsCertificate{certificateChain;privateKey;constructor(certificateChainPath,privateKeyPath){super(),this.certificateChain=certificateChainPath,this.privateKey=privateKeyPath}bind(_scope){return{tlsCertificate:{file:{certificateChain:this.certificateChain,privateKey:this.privateKey}}}}}class SdsTlsCertificate extends MutualTlsCertificate{secretName;constructor(secretName){super(),this.secretName=secretName}bind(_scope){return{tlsCertificate:{sds:{secretName:this.secretName}}}}}

View File

@@ -0,0 +1,31 @@
import type { MutualTlsCertificate } from './tls-certificate';
import type { TlsValidation } from './tls-validation';
/**
* Represents the properties needed to define client policy
*/
export interface TlsClientPolicy {
/**
* Whether the policy is enforced.
*
* @default true
*/
readonly enforce?: boolean;
/**
* TLS is enforced on the ports specified here.
* If no ports are specified, TLS will be enforced on all the ports.
*
* @default - all ports
*/
readonly ports?: number[];
/**
* Represents the object for TLS validation context
*/
readonly validation: TlsValidation;
/**
* Represents a client TLS certificate.
* The certificate will be sent only if the server requests it, enabling mutual TLS.
*
* @default - client TLS certificate is not provided
*/
readonly mutualTlsCertificate?: MutualTlsCertificate;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});

View File

@@ -0,0 +1,97 @@
import type { Construct } from 'constructs';
import type { CfnVirtualNode } from './appmesh.generated';
import type * as acmpca from '../../aws-acmpca';
/**
* Represents the properties needed to define TLS Validation context
*/
interface TlsValidationCommon {
/**
* Represents the subject alternative names (SANs) secured by the certificate.
* SANs must be in the FQDN or URI format.
*
* @default - If you don't specify SANs on the terminating mesh endpoint,
* the Envoy proxy for that node doesn't verify the SAN on a peer client certificate.
* If you don't specify SANs on the originating mesh endpoint,
* the SAN on the certificate provided by the terminating endpoint must match the mesh endpoint service discovery configuration.
*/
readonly subjectAlternativeNames?: SubjectAlternativeNames;
}
/**
* Represents the properties needed to define TLS Validation context
*/
export interface TlsValidation extends TlsValidationCommon {
/**
* Reference to where to retrieve the trust chain.
*/
readonly trust: TlsValidationTrust;
}
/**
* Represents the properties needed to define TLS Validation context that is supported for mutual TLS authentication.
*/
export interface MutualTlsValidation extends TlsValidationCommon {
/**
* Reference to where to retrieve the trust chain.
*/
readonly trust: MutualTlsValidationTrust;
}
/**
* All Properties for TLS Validation Trusts for both Client Policy and Listener.
*/
export interface TlsValidationTrustConfig {
/**
* VirtualNode CFN configuration for client policy's TLS Validation Trust
*/
readonly tlsValidationTrust: CfnVirtualNode.TlsValidationContextTrustProperty;
}
/**
* Defines the TLS Validation Context Trust.
*/
export declare abstract class TlsValidationTrust {
/**
* Tells envoy where to fetch the validation context from
*/
static file(certificateChain: string): MutualTlsValidationTrust;
/**
* TLS Validation Context Trust for ACM Private Certificate Authority (CA).
*/
static acm(certificateAuthorities: acmpca.ICertificateAuthorityRef[]): TlsValidationTrust;
/**
* TLS Validation Context Trust for Envoy' service discovery service.
*/
static sds(secretName: string): MutualTlsValidationTrust;
/**
* Returns Trust context based on trust type.
*/
abstract bind(scope: Construct): TlsValidationTrustConfig;
}
/**
* Represents a TLS Validation Context Trust that is supported for mutual TLS authentication.
*/
export declare abstract class MutualTlsValidationTrust extends TlsValidationTrust {
protected readonly differentiator = false;
}
/**
* All Properties for Subject Alternative Names Matcher for both Client Policy and Listener.
*/
export interface SubjectAlternativeNamesMatcherConfig {
/**
* VirtualNode CFN configuration for subject alternative names secured by the certificate.
*/
readonly subjectAlternativeNamesMatch: CfnVirtualNode.SubjectAlternativeNameMatchersProperty;
}
/**
* Used to generate Subject Alternative Names Matchers
*/
export declare abstract class SubjectAlternativeNames {
/**
* The values of the SAN must match the specified values exactly.
*
* @param names The exact values to test against.
*/
static matchingExactly(...names: string[]): SubjectAlternativeNames;
/**
* Returns Subject Alternative Names Matcher based on method type.
*/
abstract bind(scope: Construct): SubjectAlternativeNamesMatcherConfig;
}
export {};

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubjectAlternativeNames=exports.MutualTlsValidationTrust=exports.TlsValidationTrust=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class TlsValidationTrust{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.TlsValidationTrust",version:"2.252.0"};static file(certificateChain){return new TlsValidationFileTrust(certificateChain)}static acm(certificateAuthorities){return new TlsValidationAcmTrust(certificateAuthorities)}static sds(secretName){return new TlsValidationSdsTrust(secretName)}}exports.TlsValidationTrust=TlsValidationTrust;class MutualTlsValidationTrust extends TlsValidationTrust{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.MutualTlsValidationTrust",version:"2.252.0"};differentiator=!1}exports.MutualTlsValidationTrust=MutualTlsValidationTrust;class TlsValidationAcmTrust extends TlsValidationTrust{_certificateAuthorities;constructor(certificateAuthorities){super(),this._certificateAuthorities=certificateAuthorities}get certificateAuthorities(){if(this._certificateAuthorities.some(x=>!("certificateAuthorityArn"in x)))throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`CertificateAuthoritiesNotImplemented`,"Not all elements of 'certificateAuthorities' parameter implement ICertificateAuthority");return this._certificateAuthorities}bind(scope){if(this.certificateAuthorities.length===0)throw new(errors_1()).ValidationError((0,literal_string_1().lit)`CertificateAuthorityRequired`,"you must provide at least one Certificate Authority when creating an ACM Trust ClientPolicy",scope);return{tlsValidationTrust:{acm:{certificateAuthorityArns:this.certificateAuthorities.map(certificateArn=>certificateArn.certificateAuthorityArn)}}}}}class TlsValidationFileTrust extends MutualTlsValidationTrust{certificateChain;constructor(certificateChain){super(),this.certificateChain=certificateChain}bind(_scope){return{tlsValidationTrust:{file:{certificateChain:this.certificateChain}}}}}class TlsValidationSdsTrust extends MutualTlsValidationTrust{secretName;constructor(secretName){super(),this.secretName=secretName}bind(_scope){return{tlsValidationTrust:{sds:{secretName:this.secretName}}}}}class SubjectAlternativeNames{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.SubjectAlternativeNames",version:"2.252.0"};static matchingExactly(...names){return new SubjectAlternativeNamesImpl({exact:names})}}exports.SubjectAlternativeNames=SubjectAlternativeNames;class SubjectAlternativeNamesImpl extends SubjectAlternativeNames{matchProperty;constructor(matchProperty){super(),this.matchProperty=matchProperty}bind(_scope){return{subjectAlternativeNamesMatch:this.matchProperty}}}

View File

@@ -0,0 +1,93 @@
import type { Construct } from 'constructs';
import type { CfnVirtualGateway } from './appmesh.generated';
import type { HealthCheck } from './health-checks';
import type { ListenerTlsOptions } from './listener-tls-options';
import type { GrpcConnectionPool, Http2ConnectionPool, HttpConnectionPool } from './shared-interfaces';
/**
* Represents the properties needed to define a Listeners for a VirtualGateway
*/
interface VirtualGatewayListenerCommonOptions {
/**
* Port to listen for connections on
*
* @default - 8080
*/
readonly port?: number;
/**
* The health check information for the listener
*
* @default - no healthcheck
*/
readonly healthCheck?: HealthCheck;
/**
* Represents the configuration for enabling TLS on a listener
*
* @default - none
*/
readonly tls?: ListenerTlsOptions;
}
/**
* Represents the properties needed to define HTTP Listeners for a VirtualGateway
*/
export interface HttpGatewayListenerOptions extends VirtualGatewayListenerCommonOptions {
/**
* Connection pool for http listeners
*
* @default - None
*/
readonly connectionPool?: HttpConnectionPool;
}
/**
* Represents the properties needed to define HTTP2 Listeners for a VirtualGateway
*/
export interface Http2GatewayListenerOptions extends VirtualGatewayListenerCommonOptions {
/**
* Connection pool for http listeners
*
* @default - None
*/
readonly connectionPool?: Http2ConnectionPool;
}
/**
* Represents the properties needed to define GRPC Listeners for a VirtualGateway
*/
export interface GrpcGatewayListenerOptions extends VirtualGatewayListenerCommonOptions {
/**
* Connection pool for http listeners
*
* @default - None
*/
readonly connectionPool?: GrpcConnectionPool;
}
/**
* Properties for a VirtualGateway listener
*/
export interface VirtualGatewayListenerConfig {
/**
* Single listener config for a VirtualGateway
*/
readonly listener: CfnVirtualGateway.VirtualGatewayListenerProperty;
}
/**
* Represents the properties needed to define listeners for a VirtualGateway
*/
export declare abstract class VirtualGatewayListener {
/**
* Returns an HTTP Listener for a VirtualGateway
*/
static http(options?: HttpGatewayListenerOptions): VirtualGatewayListener;
/**
* Returns an HTTP2 Listener for a VirtualGateway
*/
static http2(options?: Http2GatewayListenerOptions): VirtualGatewayListener;
/**
* Returns a GRPC Listener for a VirtualGateway
*/
static grpc(options?: GrpcGatewayListenerOptions): VirtualGatewayListener;
/**
* Called when the GatewayListener type is initialized. Can be used to enforce
* mutual exclusivity
*/
abstract bind(scope: Construct): VirtualGatewayListenerConfig;
}
export {};

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VirtualGatewayListener=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var utils_1=()=>{var tmp=require("./private/utils");return utils_1=()=>tmp,tmp},shared_interfaces_1=()=>{var tmp=require("./shared-interfaces");return shared_interfaces_1=()=>tmp,tmp};class VirtualGatewayListener{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.VirtualGatewayListener",version:"2.252.0"};static http(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpGatewayListenerOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http),error}return new VirtualGatewayListenerImpl(shared_interfaces_1().Protocol.HTTP,options.healthCheck,options.port,options.tls,options.connectionPool)}static http2(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_Http2GatewayListenerOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http2),error}return new VirtualGatewayListenerImpl(shared_interfaces_1().Protocol.HTTP2,options.healthCheck,options.port,options.tls,options.connectionPool)}static grpc(options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_GrpcGatewayListenerOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grpc),error}return new VirtualGatewayListenerImpl(shared_interfaces_1().Protocol.GRPC,options.healthCheck,options.port,options.tls,options.connectionPool)}}exports.VirtualGatewayListener=VirtualGatewayListener;class VirtualGatewayListenerImpl extends VirtualGatewayListener{protocol;healthCheck;port;listenerTls;connectionPool;constructor(protocol,healthCheck,port=8080,listenerTls,connectionPool){super(),this.protocol=protocol,this.healthCheck=healthCheck,this.port=port,this.listenerTls=listenerTls,this.connectionPool=connectionPool}bind(scope){return{listener:{portMapping:{port:this.port,protocol:this.protocol},healthCheck:this.healthCheck?.bind(scope,{defaultPort:this.port}).virtualGatewayHealthCheck,tls:(0,utils_1().renderListenerTlsOptions)(scope,this.listenerTls),connectionPool:this.connectionPool?renderConnectionPool(this.connectionPool,this.protocol):void 0}}}}function renderConnectionPool(connectionPool,listenerProtocol){return{[listenerProtocol]:{maxRequests:connectionPool?.maxRequests!==void 0?connectionPool.maxRequests:void 0,maxConnections:connectionPool?.maxConnections!==void 0?connectionPool.maxConnections:void 0,maxPendingRequests:connectionPool?.maxPendingRequests!==void 0?connectionPool.maxPendingRequests:void 0}}}

View File

@@ -0,0 +1,154 @@
import type { Construct } from 'constructs';
import { VirtualGatewayGrants } from './appmesh-grants.generated';
import type { IVirtualGatewayRef, VirtualGatewayReference } from './appmesh.generated';
import type { GatewayRouteBaseProps } from './gateway-route';
import { GatewayRoute } from './gateway-route';
import type { IMesh } from './mesh';
import type { AccessLog, BackendDefaults } from './shared-interfaces';
import type { VirtualGatewayListenerConfig } from './virtual-gateway-listener';
import { VirtualGatewayListener } from './virtual-gateway-listener';
import type * as iam from '../../aws-iam';
import * as cdk from '../../core';
/**
* Interface which all Virtual Gateway based classes must implement
*/
export interface IVirtualGateway extends cdk.IResource, IVirtualGatewayRef {
/**
* Name of the VirtualGateway
*
* @attribute
*/
readonly virtualGatewayName: string;
/**
* The Amazon Resource Name (ARN) for the VirtualGateway
*
* @attribute
*/
readonly virtualGatewayArn: string;
/**
* The Mesh which the VirtualGateway belongs to
*/
readonly mesh: IMesh;
/**
* Utility method to add a new GatewayRoute to the VirtualGateway
*/
addGatewayRoute(id: string, route: GatewayRouteBaseProps): GatewayRoute;
/**
* Grants the given entity `appmesh:StreamAggregatedResources`.
* [disable-awslint:no-grants]
*/
grantStreamAggregatedResources(identity: iam.IGrantable): iam.Grant;
}
/**
* Basic configuration properties for a VirtualGateway
*/
export interface VirtualGatewayBaseProps {
/**
* Name of the VirtualGateway
*
* @default - A name is automatically determined
*/
readonly virtualGatewayName?: string;
/**
* Listeners for the VirtualGateway. Only one is supported.
*
* @default - Single HTTP listener on port 8080
*/
readonly listeners?: VirtualGatewayListener[];
/**
* Access Logging Configuration for the VirtualGateway
*
* @default - no access logging
*/
readonly accessLog?: AccessLog;
/**
* Default Configuration Virtual Node uses to communicate with Virtual Service
*
* @default - No Config
*/
readonly backendDefaults?: BackendDefaults;
}
/**
* Properties used when creating a new VirtualGateway
*/
export interface VirtualGatewayProps extends VirtualGatewayBaseProps {
/**
* The Mesh which the VirtualGateway belongs to
*/
readonly mesh: IMesh;
}
declare abstract class VirtualGatewayBase extends cdk.Resource implements IVirtualGateway {
/**
* Name of the VirtualGateway
*/
abstract readonly virtualGatewayName: string;
/**
* The Amazon Resource Name (ARN) for the VirtualGateway
*/
abstract readonly virtualGatewayArn: string;
/**
* The Mesh which the VirtualGateway belongs to
*/
abstract readonly mesh: IMesh;
/**
* Collection of grant methods for a VirtualGateway
*/
readonly grants: VirtualGatewayGrants;
get virtualGatewayRef(): VirtualGatewayReference;
/**
* Utility method to add a new GatewayRoute to the VirtualGateway
*/
addGatewayRoute(id: string, props: GatewayRouteBaseProps): GatewayRoute;
grantStreamAggregatedResources(identity: iam.IGrantable): iam.Grant;
}
/**
* 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 https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_gateways.html
*/
export declare class VirtualGateway extends VirtualGatewayBase {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an existing VirtualGateway given an ARN
*/
static fromVirtualGatewayArn(scope: Construct, id: string, virtualGatewayArn: string): IVirtualGateway;
/**
* Import an existing VirtualGateway given its attributes
*/
static fromVirtualGatewayAttributes(scope: Construct, id: string, attrs: VirtualGatewayAttributes): IVirtualGateway;
/**
* The name of the VirtualGateway
*/
get virtualGatewayName(): string;
/**
* The Amazon Resource Name (ARN) for the VirtualGateway
*/
get virtualGatewayArn(): string;
/**
* The Mesh that the VirtualGateway belongs to
*/
readonly mesh: IMesh;
protected readonly listeners: VirtualGatewayListenerConfig[];
private readonly resource;
constructor(scope: Construct, id: string, props: VirtualGatewayProps);
}
/**
* Unterface with properties necessary to import a reusable VirtualGateway
*/
export interface VirtualGatewayAttributes {
/**
* The name of the VirtualGateway
*/
readonly virtualGatewayName: string;
/**
* The Mesh that the VirtualGateway belongs to
*/
readonly mesh: IMesh;
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,133 @@
import type { Construct } from 'constructs';
import type { CfnVirtualNode } from './appmesh.generated';
import type { HealthCheck } from './health-checks';
import type { ListenerTlsOptions } from './listener-tls-options';
import type { GrpcConnectionPool, GrpcTimeout, Http2ConnectionPool, HttpConnectionPool, HttpTimeout, OutlierDetection, TcpConnectionPool, TcpTimeout } from './shared-interfaces';
/**
* Properties for a VirtualNode listener
*/
export interface VirtualNodeListenerConfig {
/**
* Single listener config for a VirtualNode
*/
readonly listener: CfnVirtualNode.ListenerProperty;
}
/**
* Represents the properties needed to define a Listeners for a VirtualNode
*/
interface VirtualNodeListenerCommonOptions {
/**
* Port to listen for connections on
*
* @default - 8080
*/
readonly port?: number;
/**
* The health check information for the listener
*
* @default - no healthcheck
*/
readonly healthCheck?: HealthCheck;
/**
* Represents the configuration for enabling TLS on a listener
*
* @default - none
*/
readonly tls?: ListenerTlsOptions;
/**
* Represents the configuration for enabling outlier detection
*
* @default - none
*/
readonly outlierDetection?: OutlierDetection;
}
interface CommonHttpVirtualNodeListenerOptions extends VirtualNodeListenerCommonOptions {
/**
* Timeout for HTTP protocol
*
* @default - None
*/
readonly timeout?: HttpTimeout;
}
/**
* Represent the HTTP Node Listener property
*/
export interface HttpVirtualNodeListenerOptions extends CommonHttpVirtualNodeListenerOptions {
/**
* Connection pool for http listeners
*
* @default - None
*/
readonly connectionPool?: HttpConnectionPool;
}
/**
* Represent the HTTP2 Node Listener property
*/
export interface Http2VirtualNodeListenerOptions extends CommonHttpVirtualNodeListenerOptions {
/**
* Connection pool for http2 listeners
*
* @default - None
*/
readonly connectionPool?: Http2ConnectionPool;
}
/**
* Represent the GRPC Node Listener property
*/
export interface GrpcVirtualNodeListenerOptions extends VirtualNodeListenerCommonOptions {
/**
* Timeout for GRPC protocol
*
* @default - None
*/
readonly timeout?: GrpcTimeout;
/**
* Connection pool for http listeners
*
* @default - None
*/
readonly connectionPool?: GrpcConnectionPool;
}
/**
* Represent the TCP Node Listener property
*/
export interface TcpVirtualNodeListenerOptions extends VirtualNodeListenerCommonOptions {
/**
* Timeout for TCP protocol
*
* @default - None
*/
readonly timeout?: TcpTimeout;
/**
* Connection pool for http listeners
*
* @default - None
*/
readonly connectionPool?: TcpConnectionPool;
}
/**
* Defines listener for a VirtualNode
*/
export declare abstract class VirtualNodeListener {
/**
* Returns an HTTP Listener for a VirtualNode
*/
static http(props?: HttpVirtualNodeListenerOptions): VirtualNodeListener;
/**
* Returns an HTTP2 Listener for a VirtualNode
*/
static http2(props?: Http2VirtualNodeListenerOptions): VirtualNodeListener;
/**
* Returns an GRPC Listener for a VirtualNode
*/
static grpc(props?: GrpcVirtualNodeListenerOptions): VirtualNodeListener;
/**
* Returns an TCP Listener for a VirtualNode
*/
static tcp(props?: TcpVirtualNodeListenerOptions): VirtualNodeListener;
/**
* Binds the current object when adding Listener to a VirtualNode
*/
abstract bind(scope: Construct): VirtualNodeListenerConfig;
}
export {};

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VirtualNodeListener=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var utils_1=()=>{var tmp=require("./private/utils");return utils_1=()=>tmp,tmp},shared_interfaces_1=()=>{var tmp=require("./shared-interfaces");return shared_interfaces_1=()=>tmp,tmp};class VirtualNodeListener{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.VirtualNodeListener",version:"2.252.0"};static http(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_HttpVirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.HTTP,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}static http2(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_Http2VirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.http2),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.HTTP2,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}static grpc(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_GrpcVirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grpc),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.GRPC,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}static tcp(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appmesh_TcpVirtualNodeListenerOptions(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.tcp),error}return new VirtualNodeListenerImpl(shared_interfaces_1().Protocol.TCP,props.healthCheck,props.timeout,props.port,props.tls,props.outlierDetection,props.connectionPool)}}exports.VirtualNodeListener=VirtualNodeListener;class VirtualNodeListenerImpl extends VirtualNodeListener{protocol;healthCheck;timeout;port;tls;outlierDetection;connectionPool;constructor(protocol,healthCheck,timeout,port=8080,tls,outlierDetection,connectionPool){super(),this.protocol=protocol,this.healthCheck=healthCheck,this.timeout=timeout,this.port=port,this.tls=tls,this.outlierDetection=outlierDetection,this.connectionPool=connectionPool}bind(scope){return{listener:{portMapping:{port:this.port,protocol:this.protocol},healthCheck:this.healthCheck?.bind(scope,{defaultPort:this.port}).virtualNodeHealthCheck,timeout:this.timeout?this.renderTimeout(this.timeout):void 0,tls:(0,utils_1().renderListenerTlsOptions)(scope,this.tls),outlierDetection:this.outlierDetection?this.renderOutlierDetection(this.outlierDetection):void 0,connectionPool:this.connectionPool?this.renderConnectionPool(this.connectionPool):void 0}}}renderTimeout(timeout){return{[this.protocol]:{idle:timeout?.idle!==void 0?{unit:"ms",value:timeout?.idle.toMilliseconds()}:void 0,perRequest:timeout?.perRequest!==void 0?{unit:"ms",value:timeout?.perRequest.toMilliseconds()}:void 0}}}renderOutlierDetection(outlierDetection){return{baseEjectionDuration:{unit:"ms",value:outlierDetection.baseEjectionDuration.toMilliseconds()},interval:{unit:"ms",value:outlierDetection.interval.toMilliseconds()},maxEjectionPercent:outlierDetection.maxEjectionPercent,maxServerErrors:outlierDetection.maxServerErrors}}renderConnectionPool(connectionPool){return{[this.protocol]:{maxRequests:connectionPool?.maxRequests!==void 0?connectionPool.maxRequests:void 0,maxConnections:connectionPool?.maxConnections!==void 0?connectionPool.maxConnections:void 0,maxPendingRequests:connectionPool?.maxPendingRequests!==void 0?connectionPool.maxPendingRequests:void 0}}}}

View File

@@ -0,0 +1,184 @@
import type { Construct } from 'constructs';
import { VirtualNodeGrants } from './appmesh-grants.generated';
import type { IVirtualNodeRef, VirtualNodeReference } from './appmesh.generated';
import type { IMesh } from './mesh';
import type { ServiceDiscovery } from './service-discovery';
import type { AccessLog, BackendDefaults, Backend } from './shared-interfaces';
import type { VirtualNodeListener } from './virtual-node-listener';
import type * as iam from '../../aws-iam';
import * as cdk from '../../core';
/**
* Interface which all VirtualNode based classes must implement
*/
export interface IVirtualNode extends cdk.IResource, IVirtualNodeRef {
/**
* The name of the VirtualNode
*
* @attribute
*/
readonly virtualNodeName: string;
/**
* The Amazon Resource Name belonging to the VirtualNode
*
* Set this value as the APPMESH_VIRTUAL_NODE_NAME environment variable for
* your task group's Envoy proxy container in your task definition or pod
* spec.
*
* @attribute
*/
readonly virtualNodeArn: string;
/**
* The Mesh which the VirtualNode belongs to
*/
readonly mesh: IMesh;
/**
* Grants the given entity `appmesh:StreamAggregatedResources`.
*/
grantStreamAggregatedResources(identity: iam.IGrantable): iam.Grant;
}
/**
* Basic configuration properties for a VirtualNode
*/
export interface VirtualNodeBaseProps {
/**
* The name of the VirtualNode
*
* @default - A name is automatically determined
*/
readonly virtualNodeName?: string;
/**
* Defines how upstream clients will discover this VirtualNode
*
* @default - No Service Discovery
*/
readonly serviceDiscovery?: ServiceDiscovery;
/**
* Virtual Services that this is node expected to send outbound traffic to
*
* @default - No backends
*/
readonly backends?: Backend[];
/**
* Initial listener for the virtual node
*
* @default - No listeners
*/
readonly listeners?: VirtualNodeListener[];
/**
* Access Logging Configuration for the virtual node
*
* @default - No access logging
*/
readonly accessLog?: AccessLog;
/**
* Default Configuration Virtual Node uses to communicate with Virtual Service
*
* @default - No Config
*/
readonly backendDefaults?: BackendDefaults;
}
/**
* The properties used when creating a new VirtualNode
*/
export interface VirtualNodeProps extends VirtualNodeBaseProps {
/**
* The Mesh which the VirtualNode belongs to
*/
readonly mesh: IMesh;
}
declare abstract class VirtualNodeBase extends cdk.Resource implements IVirtualNode {
/**
* The name of the VirtualNode
*/
abstract readonly virtualNodeName: string;
/**
* The Amazon Resource Name belonging to the VirtualNode
*/
abstract readonly virtualNodeArn: string;
/**
* The Mesh which the VirtualNode belongs to
*/
abstract readonly mesh: IMesh;
/**
* Collection of grants for this Virtual Node
*/
readonly grants: VirtualNodeGrants;
get virtualNodeRef(): VirtualNodeReference;
/**
*
* The use of this method is discouraged. Please use `grants.streamAggregatedResources()` instead.
*
* [disable-awslint:no-grants]
*/
grantStreamAggregatedResources(identity: iam.IGrantable): iam.Grant;
}
/**
* 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.
* [disable-awslint:no-grants]
*
* @see https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_nodes.html
*/
export declare class VirtualNode extends VirtualNodeBase {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an existing VirtualNode given an ARN
*/
static fromVirtualNodeArn(scope: Construct, id: string, virtualNodeArn: string): IVirtualNode;
/**
* Import an existing VirtualNode given its name
*/
static fromVirtualNodeAttributes(scope: Construct, id: string, attrs: VirtualNodeAttributes): IVirtualNode;
/**
* The name of the VirtualNode
*/
get virtualNodeName(): string;
/**
* The Amazon Resource Name belonging to the VirtualNode
*/
get virtualNodeArn(): string;
/**
* The Mesh which the VirtualNode belongs to
*/
readonly mesh: IMesh;
private readonly serviceDiscoveryConfig?;
private readonly backends;
private readonly listeners;
private readonly resource;
constructor(scope: Construct, id: string, props: VirtualNodeProps);
/**
* 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.
*
* @see https://github.com/aws/aws-app-mesh-roadmap/issues/120
*/
addListener(listener: VirtualNodeListener): void;
/**
* Add a Virtual Services that this node is expected to send outbound traffic to
*/
addBackend(backend: Backend): void;
}
/**
* Interface with properties necessary to import a reusable VirtualNode
*/
export interface VirtualNodeAttributes {
/**
* The name of the VirtualNode
*/
readonly virtualNodeName: string;
/**
* The Mesh that the VirtualNode belongs to
*/
readonly mesh: IMesh;
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
import type { Construct } from 'constructs';
import type { CfnVirtualRouter } from './appmesh.generated';
/**
* Properties for a VirtualRouter listener
*/
export interface VirtualRouterListenerConfig {
/**
* Single listener config for a VirtualRouter
*/
readonly listener: CfnVirtualRouter.VirtualRouterListenerProperty;
}
/**
* Represents the properties needed to define listeners for a VirtualRouter
*/
export declare abstract class VirtualRouterListener {
/**
* Returns an HTTP Listener for a VirtualRouter
*
* @param port the optional port of the listener, 8080 by default
*/
static http(port?: number): VirtualRouterListener;
/**
* Returns an HTTP2 Listener for a VirtualRouter
*
* @param port the optional port of the listener, 8080 by default
*/
static http2(port?: number): VirtualRouterListener;
/**
* Returns a GRPC Listener for a VirtualRouter
*
* @param port the optional port of the listener, 8080 by default
*/
static grpc(port?: number): VirtualRouterListener;
/**
* Returns a TCP Listener for a VirtualRouter
*
* @param port the optional port of the listener, 8080 by default
*/
static tcp(port?: number): VirtualRouterListener;
/**
* Called when the VirtualRouterListener type is initialized. Can be used to enforce
* mutual exclusivity
*/
abstract bind(scope: Construct): VirtualRouterListenerConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VirtualRouterListener=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var shared_interfaces_1=()=>{var tmp=require("./shared-interfaces");return shared_interfaces_1=()=>tmp,tmp};class VirtualRouterListener{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.VirtualRouterListener",version:"2.252.0"};static http(port){return new VirtualRouterListenerImpl(shared_interfaces_1().Protocol.HTTP,port)}static http2(port){return new VirtualRouterListenerImpl(shared_interfaces_1().Protocol.HTTP2,port)}static grpc(port){return new VirtualRouterListenerImpl(shared_interfaces_1().Protocol.GRPC,port)}static tcp(port){return new VirtualRouterListenerImpl(shared_interfaces_1().Protocol.TCP,port)}}exports.VirtualRouterListener=VirtualRouterListener;class VirtualRouterListenerImpl extends VirtualRouterListener{protocol;port;constructor(protocol,port){super(),this.protocol=protocol,this.port=port??8080}bind(_scope){return{listener:{portMapping:{port:this.port,protocol:this.protocol}}}}}

View File

@@ -0,0 +1,122 @@
import type { Construct } from 'constructs';
import type { IVirtualRouterRef, VirtualRouterReference } from './appmesh.generated';
import type { IMesh } from './mesh';
import type { RouteBaseProps } from './route';
import { Route } from './route';
import { VirtualRouterListener } from './virtual-router-listener';
import * as cdk from '../../core';
/**
* Interface which all VirtualRouter based classes MUST implement
*/
export interface IVirtualRouter extends cdk.IResource, IVirtualRouterRef {
/**
* The name of the VirtualRouter
*
* @attribute
*/
readonly virtualRouterName: string;
/**
* The Amazon Resource Name (ARN) for the VirtualRouter
*
* @attribute
*/
readonly virtualRouterArn: string;
/**
* The Mesh which the VirtualRouter belongs to
*/
readonly mesh: IMesh;
/**
* Add a single route to the router
*/
addRoute(id: string, props: RouteBaseProps): Route;
}
/**
* Interface with base properties all routers willl inherit
*/
export interface VirtualRouterBaseProps {
/**
* Listener specification for the VirtualRouter
*
* @default - A listener on HTTP port 8080
*/
readonly listeners?: VirtualRouterListener[];
/**
* The name of the VirtualRouter
*
* @default - A name is automatically determined
*/
readonly virtualRouterName?: string;
}
declare abstract class VirtualRouterBase extends cdk.Resource implements IVirtualRouter {
/**
* The name of the VirtualRouter
*/
abstract readonly virtualRouterName: string;
/**
* The Amazon Resource Name (ARN) for the VirtualRouter
*/
abstract readonly virtualRouterArn: string;
/**
* The Mesh which the VirtualRouter belongs to
*/
abstract readonly mesh: IMesh;
/**
* Add a single route to the router
*/
addRoute(id: string, props: RouteBaseProps): Route;
get virtualRouterRef(): VirtualRouterReference;
}
/**
* The properties used when creating a new VirtualRouter
*/
export interface VirtualRouterProps extends VirtualRouterBaseProps {
/**
* The Mesh which the VirtualRouter belongs to
*/
readonly mesh: IMesh;
}
export declare class VirtualRouter extends VirtualRouterBase {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an existing VirtualRouter given an ARN
*/
static fromVirtualRouterArn(scope: Construct, id: string, virtualRouterArn: string): IVirtualRouter;
/**
* Import an existing VirtualRouter given attributes
*/
static fromVirtualRouterAttributes(scope: Construct, id: string, attrs: VirtualRouterAttributes): IVirtualRouter;
/**
* The name of the VirtualRouter
*/
get virtualRouterName(): string;
/**
* The Amazon Resource Name (ARN) for the VirtualRouter
*/
get virtualRouterArn(): string;
/**
* The Mesh which the VirtualRouter belongs to
*/
readonly mesh: IMesh;
private readonly listeners;
private readonly resource;
constructor(scope: Construct, id: string, props: VirtualRouterProps);
/**
* Add port mappings to the router
*/
private addListener;
}
/**
* Interface with properties ncecessary to import a reusable VirtualRouter
*/
export interface VirtualRouterAttributes {
/**
* The name of the VirtualRouter
*/
readonly virtualRouterName: string;
/**
* The Mesh which the VirtualRouter belongs to
*/
readonly mesh: IMesh;
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,139 @@
import type { Construct } from 'constructs';
import type { IVirtualServiceRef, VirtualServiceReference } from './appmesh.generated';
import { CfnVirtualService } from './appmesh.generated';
import type { IMesh } from './mesh';
import type { IVirtualNode } from './virtual-node';
import type { IVirtualRouter } from './virtual-router';
import * as cdk from '../../core';
/**
* Represents the interface which all VirtualService based classes MUST implement
*/
export interface IVirtualService extends cdk.IResource, IVirtualServiceRef {
/**
* The name of the VirtualService
*
* @attribute
*/
readonly virtualServiceName: string;
/**
* The Amazon Resource Name (ARN) for the virtual service
*
* @attribute
*/
readonly virtualServiceArn: string;
/**
* The Mesh which the VirtualService belongs to
*/
readonly mesh: IMesh;
}
/**
* The properties applied to the VirtualService being defined
*/
export interface VirtualServiceProps {
/**
* The name of the VirtualService.
*
* It is recommended this follows the fully-qualified domain name format,
* such as "my-service.default.svc.cluster.local".
*
* Example value: `service.domain.local`
* @default - A name is automatically generated
*/
readonly virtualServiceName?: string;
/**
* The VirtualNode or VirtualRouter which the VirtualService uses as its provider
*/
readonly virtualServiceProvider: VirtualServiceProvider;
}
/**
* VirtualService represents a service inside an AppMesh
*
* It routes traffic either to a Virtual Node or to a Virtual Router.
*
* @see https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_services.html
*/
export declare class VirtualService extends cdk.Resource implements IVirtualService {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an existing VirtualService given an ARN
*/
static fromVirtualServiceArn(scope: Construct, id: string, virtualServiceArn: string): IVirtualService;
/**
* Import an existing VirtualService given its attributes
*/
static fromVirtualServiceAttributes(scope: Construct, id: string, attrs: VirtualServiceAttributes): IVirtualService;
/**
* The name of the VirtualService, it is recommended this follows the fully-qualified domain name format.
*/
get virtualServiceName(): string;
/**
* The Amazon Resource Name (ARN) for the virtual service
*/
get virtualServiceArn(): string;
/**
* The Mesh which the VirtualService belongs to
*/
readonly mesh: IMesh;
private readonly resource;
constructor(scope: Construct, id: string, props: VirtualServiceProps);
get virtualServiceRef(): VirtualServiceReference;
}
/**
* Interface with properties ncecessary to import a reusable VirtualService
*/
export interface VirtualServiceAttributes {
/**
* The name of the VirtualService, it is recommended this follows the fully-qualified domain name format.
*/
readonly virtualServiceName: string;
/**
* The Mesh which the VirtualService belongs to
*/
readonly mesh: IMesh;
}
/**
* Properties for a VirtualService provider
*/
export interface VirtualServiceProviderConfig {
/**
* Virtual Node based provider
*
* @default - none
*/
readonly virtualNodeProvider?: CfnVirtualService.VirtualNodeServiceProviderProperty;
/**
* Virtual Router based provider
*
* @default - none
*/
readonly virtualRouterProvider?: CfnVirtualService.VirtualRouterServiceProviderProperty;
/**
* Mesh the Provider is using
*
* @default - none
*/
readonly mesh: IMesh;
}
/**
* Represents the properties needed to define the provider for a VirtualService
*/
export declare abstract class VirtualServiceProvider {
/**
* Returns a VirtualNode based Provider for a VirtualService
*/
static virtualNode(virtualNode: IVirtualNode): VirtualServiceProvider;
/**
* Returns a VirtualRouter based Provider for a VirtualService
*/
static virtualRouter(virtualRouter: IVirtualRouter): VirtualServiceProvider;
/**
* Returns an Empty Provider for a VirtualService. This provides no routing capabilities
* and should only be used as a placeholder
*/
static none(mesh: IMesh): VirtualServiceProvider;
/**
* Enforces mutual exclusivity for VirtualService provider types.
*/
abstract bind(_construct: Construct): VirtualServiceProviderConfig;
}

File diff suppressed because one or more lines are too long