konokenj.cdk-api-mcp-server 0.38.0__py3-none-any.whl → 0.40.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of konokenj.cdk-api-mcp-server might be problematic. Click here for more details.
- cdk_api_mcp_server/__about__.py +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/custom-resource-handlers/README.md +78 -15
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api-dualstack.ts +4 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api.ts +4 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.stage.ts +20 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.iam.ts +38 -34
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.sqs.ts +71 -58
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-autoscaling/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codedeploy/integ.deployment-config.ts +15 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codedeploy/integ.deployment-group.ts +40 -218
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/README.md +62 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.table-v2-mrsc.ts +31 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/README.md +12 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.vpc-endpoint.lit.ts +6 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md +5 -86
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.availability-zone-rebalancing.ts +4 -14
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.blue-green-deployment-strategy.ts +5 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.enable-execute-command.ts +29 -35
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.exec-command.ts +22 -16
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.lb-awsvpc-nw.ts +16 -26
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.pseudo-terminal.ts +8 -18
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-notifications/integ.bucket-notifications.ts +80 -42
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.invoke-jsonata.ts +80 -87
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.invoke.ts +69 -87
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.start-job-run.ts +104 -102
- {konokenj_cdk_api_mcp_server-0.38.0.dist-info → konokenj_cdk_api_mcp_server-0.40.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.38.0.dist-info → konokenj_cdk_api_mcp_server-0.40.0.dist-info}/RECORD +30 -29
- {konokenj_cdk_api_mcp_server-0.38.0.dist-info → konokenj_cdk_api_mcp_server-0.40.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.38.0.dist-info → konokenj_cdk_api_mcp_server-0.40.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.38.0.dist-info → konokenj_cdk_api_mcp_server-0.40.0.dist-info}/licenses/LICENSE.txt +0 -0
cdk_api_mcp_server/__about__.py
CHANGED
|
@@ -1,20 +1,83 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CDK Handler Framework
|
|
2
2
|
|
|
3
|
-
`
|
|
4
|
-
types defined in `aws-cdk-lib`.
|
|
3
|
+
The CDK handler framework is an internal framework used to code generate constructs that extend a lambda `Function`, lambda `SingletonFunction`, or core `CustomResourceProvider` construct and prohibit the user from directly configuring the `handler`, `runtime`, `code`, and `codeDirectory` properties. In doing this, we are able to establish best practices, runtime enforcement, and consistency across all handlers we build and vend within the aws-cdk.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
break the cycle, we're just copying some types over from `aws-cdk-lib`.
|
|
5
|
+
## CDK Handler Framework Concepts
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`aws-cdk-lib` with `bundledDependencies` and that requires us writing a
|
|
14
|
-
replacement for `npm pack`, because by default NPM will refuse to bundle
|
|
15
|
-
`bundledDependencies` that have been symlinked into a local workspace (in fact,
|
|
16
|
-
it will silently ignore them).
|
|
7
|
+
This framework allows for the creation of three component types:
|
|
8
|
+
1. `ComponentType.FUNCTION` - This is a wrapper around the lambda `Function` construct. It offers the same behavior and performance as a lambda `Function`, but it restricts the consumer from configuring the `handler`, `runtime`, and `code` properties.
|
|
9
|
+
2. `ComponentType.SINGLETON_FUNCTION` - This is a wrapper around the lambda `SingletonFunction` construct. It offers the same behavior and performance as a lambda `SingletonFunction`, but it restricts the consumer from configuring the `handler`, `runtime`, and `code` properties.
|
|
10
|
+
3. `ComponentType.CUSTOM_RESOURCE_PROVIDER` - This is a wrapper around the core `CustomResourceProvider` construct. It offers the same behavior and performance as a `CustomResourceProvider` and can be instantiated via the `getOrCreate` or `getOrCreateProvider` methods. This component restricts the consumer from configuring the `runtime` and `codeDirectory` properties.
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
Code generating one of these three component types requires adding the component properties to the [config](./config.ts) file by providing `ComponentProps`. The `ComponentProps` are responsible for code generating the specified `ComponentType` with the `handler`, `runtime`, `code`, and `codeDirectory` properties set internally. `ComponentProps` includes the following properties:
|
|
13
|
+
- `type` - the framework component type to generate.
|
|
14
|
+
- `sourceCode` - the source code that will be excuted by the framework component.
|
|
15
|
+
- `runtime` - the runtime that is compatible with the framework component's source code. This is an optional property with a default node runtime that will be the latest available node runtime in the `Stack` deployment region. In general, you should not configure this property unless a `runtime` override is absolutely necessary.
|
|
16
|
+
- `handler` - the name of the method with the source code that the framework component will call. This is an optional property and the default is `index.handler`.
|
|
17
|
+
- `minifyAndBundle` - whether the source code should be minified and bundled. This an optional property and the default is `true`. This should only be set to `false` for python files or for typescript/javascript files with a require import.
|
|
20
18
|
|
|
19
|
+
The [config](./config.ts) file is structured with the top level mapping to an aws-cdk module, i.e., aws-s3, aws-dynamodb, etc. Each service can contain one or more component modules. Component modules are containers for handler framework components and will be rendered as a code generated file. Each component module can contain one or more `ComponentProps` objects. The following example shows a more structural breakdown of how the [config](./config.ts) file is configured:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
const config = {
|
|
23
|
+
'aws-s3': { // the aws-cdk-lib module
|
|
24
|
+
'replica-provider': [ // the component module
|
|
25
|
+
// handler framework component defined as a `ComponentProps` object
|
|
26
|
+
{
|
|
27
|
+
// the handler framework component type
|
|
28
|
+
type: ComponentType.FUNCTION,
|
|
29
|
+
// the source code that the component will use
|
|
30
|
+
sourceCode: path.resolve(__dirname, '..', 'aws-dynamodb', 'replica-handler', 'index.ts'),
|
|
31
|
+
// the handler in the source code that the component will execute
|
|
32
|
+
handler: 'index.onEventHandler',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
'aws-stepfunctions-tasks': {
|
|
37
|
+
// contains multiple component modules
|
|
38
|
+
'eval-nodejs-provider': [
|
|
39
|
+
{
|
|
40
|
+
type: ComponentType.SINGLETON_FUNCTION,
|
|
41
|
+
sourceCode: path.resolve(__dirname, '..', 'aws-stepfunctions-tasks', 'eval-nodejs-handler', 'index.ts'),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
'role-policy-provider': [
|
|
45
|
+
{
|
|
46
|
+
type: ComponentType.SINGLETON_FUNCTION,
|
|
47
|
+
sourceCode: path.resolve(__dirname, '..', 'aws-stepfunctions-tasks', 'role-policy-handler', 'index.py'),
|
|
48
|
+
runtime: Runtime.PYTHON_3_9,
|
|
49
|
+
// prevent minify and bundle since the source code is a python file
|
|
50
|
+
minifyAndBundle: false,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Code generation for the component modules is triggered when this package - `@aws-cdk/custom-resource-handlers` - is built. Importantly, this framework is also responsible for minifying and bundling the custom resource providers' source code and dependencies. A flag named `minifyAndBundle` can be configured as part of the `ComponentProps` to prevent minifying and bundling the source code for a specific provider. This flag is only needed for python files or for typescript/javascript files containing require imports.
|
|
58
|
+
|
|
59
|
+
Once built, all generated code and bundled source code will be written to `@aws-cdk/custom-resource-handlers/dist`. The top level field in the [config](./config.ts) file defining individual aws-cdk modules will be used to create specific directories within `@aws-cdk/custom-resource-handlers/dist` and each component module will be a separate code generated file within these directories named `<component-module>.generated.ts`. As an example, the sample [config](./config.ts) file above would create the following file structure:
|
|
60
|
+
|
|
61
|
+
|--- @aws-cdk
|
|
62
|
+
| |--- custom-resource-handlers
|
|
63
|
+
| | |--- dist
|
|
64
|
+
| | | |--- aws-s3
|
|
65
|
+
| | | | |--- replica-handler
|
|
66
|
+
| | | | | |--- index.js
|
|
67
|
+
| | | | |--- replica-provider.generated.ts
|
|
68
|
+
| | | |--- aws-stepfunctions-tasks
|
|
69
|
+
| | | | |--- eval-nodejs-handler
|
|
70
|
+
| | | | | |--- index.js
|
|
71
|
+
| | | | |--- role-policy-handler
|
|
72
|
+
| | | | | |--- index.py
|
|
73
|
+
| | | | |--- eval-nodejs-provider.generated.ts
|
|
74
|
+
| | | | |--- role-policy-provider.generated.ts
|
|
75
|
+
|
|
76
|
+
The code generated handler framework components are consumable from `aws-cdk-lib/custom-resource-handlers/dist` once `aws-cdk-lib` is built. The file structure of `aws-cdk-lib/custom-resource-handlers/dist` will have the same structure as `@aws-cdk/custom-resource-handlers/dist` with the exception of `core`. To prevent circular dependencies, all handler framework components defined in `core`and any associated source code will be consumable from `aws-cdk-lib/core/dist/core`.
|
|
77
|
+
|
|
78
|
+
## Creating a Handler Framework Component
|
|
79
|
+
|
|
80
|
+
Creating a new handler framework component involves three steps:
|
|
81
|
+
1. Add the source code to `@aws-cdk/custom-resource-handlers/lib/<aws-cdk-lib-module>`
|
|
82
|
+
2. Update the [config](./config.ts) file by specifying all required `ComponentProps`.
|
|
83
|
+
3. At this point you can directly build `@aws-cdk/custom-resource-handlers` with `yarn build` to view the generated component in `@aws-cdk/custom-resource-handlers/dist`. Alternatively, you can build `aws-cdk-lib` with `npx lerna run build --scope=aws-cdk-lib --skip-nx-cache` to make the generated component available for use within `aws-cdk-lib`
|
cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api-dualstack.ts
CHANGED
|
@@ -4,13 +4,14 @@ import * as cdk from 'aws-cdk-lib';
|
|
|
4
4
|
import * as apigw from 'aws-cdk-lib/aws-apigatewayv2';
|
|
5
5
|
|
|
6
6
|
const app = new cdk.App();
|
|
7
|
-
const stack = new cdk.Stack(app, '
|
|
7
|
+
const stack = new cdk.Stack(app, 'DualStackHttpApiStack');
|
|
8
8
|
|
|
9
|
-
new apigw.
|
|
9
|
+
new apigw.HttpApi(stack, 'HttpApi', {
|
|
10
|
+
routeSelectionExpression: true,
|
|
10
11
|
ipAddressType: apigw.IpAddressType.DUAL_STACK,
|
|
11
12
|
});
|
|
12
13
|
|
|
13
|
-
new IntegTest(app, '
|
|
14
|
+
new IntegTest(app, 'DualStackHttpApiInteg', {
|
|
14
15
|
testCases: [stack],
|
|
15
16
|
});
|
|
16
17
|
|
|
@@ -6,9 +6,11 @@ import * as apigw from 'aws-cdk-lib/aws-apigatewayv2';
|
|
|
6
6
|
const app = new cdk.App();
|
|
7
7
|
const stack = new cdk.Stack(app, 'aws-cdk-aws-apigatewayv2');
|
|
8
8
|
|
|
9
|
-
new apigw.
|
|
9
|
+
new apigw.HttpApi(stack, 'HttpApi', {
|
|
10
|
+
routeSelectionExpression: true,
|
|
11
|
+
});
|
|
10
12
|
|
|
11
|
-
new IntegTest(app, '
|
|
13
|
+
new IntegTest(app, 'http-api', {
|
|
12
14
|
testCases: [stack],
|
|
13
15
|
});
|
|
14
16
|
|
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
2
3
|
import * as cdk from 'aws-cdk-lib';
|
|
3
|
-
import * as
|
|
4
|
+
import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2';
|
|
5
|
+
import * as apigw from 'aws-cdk-lib/aws-apigateway';
|
|
6
|
+
import * as logs from 'aws-cdk-lib/aws-logs';
|
|
4
7
|
|
|
5
8
|
const app = new cdk.App();
|
|
6
|
-
const stack = new cdk.Stack(app, 'aws-cdk-aws-apigatewayv2-
|
|
9
|
+
const stack = new cdk.Stack(app, 'aws-cdk-aws-apigatewayv2-http-stage');
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const testLogGroup = new logs.LogGroup(stack, 'MyLogGroup');
|
|
12
|
+
|
|
13
|
+
const httpApi = new apigwv2.HttpApi(stack, 'HttpApi', { createDefaultStage: false });
|
|
14
|
+
new apigwv2.HttpStage(stack, 'HttpStageWithProperties', {
|
|
15
|
+
httpApi,
|
|
12
16
|
throttle: {
|
|
13
17
|
rateLimit: 1000,
|
|
14
18
|
burstLimit: 1000,
|
|
15
19
|
},
|
|
16
20
|
detailedMetricsEnabled: true,
|
|
17
21
|
description: 'My Stage',
|
|
22
|
+
accessLogSettings: {
|
|
23
|
+
destination: new apigwv2.LogGroupLogDestination(testLogGroup),
|
|
24
|
+
format: apigw.AccessLogFormat.custom(JSON.stringify({
|
|
25
|
+
extendedRequestId: apigw.AccessLogField.contextExtendedRequestId(),
|
|
26
|
+
requestTime: apigw.AccessLogField.contextRequestTime(),
|
|
27
|
+
})),
|
|
28
|
+
},
|
|
18
29
|
});
|
|
19
30
|
|
|
20
|
-
app
|
|
31
|
+
new IntegTest(app, 'aws-cdk-aws-apigatewayv2-http-stage-test', {
|
|
32
|
+
testCases: [stack],
|
|
33
|
+
});
|
|
@@ -1,53 +1,46 @@
|
|
|
1
1
|
import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2';
|
|
2
|
-
import { WebSocketLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
|
|
3
2
|
import * as iam from 'aws-cdk-lib/aws-iam';
|
|
4
|
-
import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';
|
|
5
3
|
import * as cdk from 'aws-cdk-lib';
|
|
6
|
-
import {
|
|
7
|
-
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
8
|
-
import { WebSocketIamAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
|
|
4
|
+
import { HttpIamAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
class ExampleComIntegration extends apigatewayv2.HttpRouteIntegration {
|
|
7
|
+
public bind(): apigatewayv2.HttpRouteIntegrationConfig {
|
|
8
|
+
return {
|
|
9
|
+
type: apigatewayv2.HttpIntegrationType.HTTP_PROXY,
|
|
10
|
+
payloadFormatVersion: apigatewayv2.PayloadFormatVersion.VERSION_1_0,
|
|
11
|
+
method: apigatewayv2.HttpMethod.GET,
|
|
12
|
+
uri: 'https://www.example.com/',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const app = new cdk.App();
|
|
15
18
|
const stack = new cdk.Stack(app, 'IntegApiGatewayV2Iam');
|
|
16
19
|
const user = new iam.User(stack, 'User');
|
|
17
20
|
const userAccessKey = new iam.AccessKey(stack, 'UserAccess', {
|
|
18
21
|
user,
|
|
19
22
|
});
|
|
20
23
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
code: Code.fromInline('exports.handler = () => {return true}'),
|
|
24
|
-
handler: 'index.handler',
|
|
24
|
+
const httpApi = new apigatewayv2.HttpApi(stack, 'HttpApi', {
|
|
25
|
+
defaultAuthorizer: new HttpIamAuthorizer(),
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
authorizer: new WebSocketIamAuthorizer(),
|
|
31
|
-
},
|
|
28
|
+
const [fooRoute] = httpApi.addRoutes({
|
|
29
|
+
integration: new ExampleComIntegration('examplecom'),
|
|
30
|
+
path: '/foo',
|
|
32
31
|
});
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
fooRoute.grantInvoke(user);
|
|
34
|
+
|
|
35
|
+
const [booksRoute] = httpApi.addRoutes({
|
|
36
|
+
integration: new ExampleComIntegration('examplecom'),
|
|
37
|
+
path: '/books/{book}',
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
statements: [
|
|
41
|
-
new iam.PolicyStatement({
|
|
42
|
-
actions: ['execute-api:Invoke'],
|
|
43
|
-
effect: iam.Effect.ALLOW,
|
|
44
|
-
resources: [arn],
|
|
45
|
-
}),
|
|
46
|
-
],
|
|
47
|
-
}));
|
|
40
|
+
booksRoute.grantInvoke(user);
|
|
48
41
|
|
|
49
|
-
new
|
|
50
|
-
|
|
42
|
+
new cdk.CfnOutput(stack, 'API', {
|
|
43
|
+
value: httpApi.url!,
|
|
51
44
|
});
|
|
52
45
|
|
|
53
46
|
new cdk.CfnOutput(stack, 'TESTACCESSKEYID', {
|
|
@@ -62,4 +55,15 @@ new cdk.CfnOutput(stack, 'TESTREGION', {
|
|
|
62
55
|
value: stack.region,
|
|
63
56
|
});
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
/*
|
|
59
|
+
* Stack verification steps:
|
|
60
|
+
* * Get cURL version 7.75.0 or later so you can use the --aws-sigv4 option
|
|
61
|
+
* * Curl <url>/foo without sigv4 and expect a 403
|
|
62
|
+
* * Curl <url>/books/something without sigv4 and expect a 403
|
|
63
|
+
* * Curl <url>/foo with sigv4 from the authorized user and expect 200
|
|
64
|
+
* * Curl <url>/books/something with sigv4 from the authorized user and expect 200
|
|
65
|
+
*
|
|
66
|
+
* Reference:
|
|
67
|
+
* * Using cURL 7.75.0 or later via the official docker image: docker run --rm curlimages/curl -s -o/dev/null -w"%{http_code}" <url>
|
|
68
|
+
* * Args to enable sigv4 with authorized credentials: --user "$TESTACCESSKEYID:$TESTSECRETACCESSKEY" --aws-sigv4 "aws:amz:$TESTREGION:execute-api"
|
|
69
|
+
*/
|
|
@@ -1,72 +1,85 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2';
|
|
2
2
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
* Stack verification steps:
|
|
10
|
-
* 1. Verify manually that the integration has type "AWS"
|
|
11
|
-
*/
|
|
3
|
+
import { App, Stack } from 'aws-cdk-lib';
|
|
4
|
+
import { HttpSqsIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
|
|
5
|
+
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
12
6
|
|
|
13
7
|
const app = new App();
|
|
14
|
-
const stack = new Stack(app, '
|
|
8
|
+
const stack = new Stack(app, 'sqs-integration');
|
|
15
9
|
|
|
16
|
-
const
|
|
17
|
-
fifo: true,
|
|
18
|
-
queueName: 'MessageSQSQueue.fifo',
|
|
19
|
-
});
|
|
10
|
+
const queue = new sqs.Queue(stack, 'Queue');
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
const httpApi = new apigwv2.HttpApi(stack, 'Api');
|
|
13
|
+
httpApi.addRoutes({
|
|
14
|
+
path: '/default',
|
|
15
|
+
methods: [apigwv2.HttpMethod.POST],
|
|
16
|
+
integration: new HttpSqsIntegration('defaultIntegration', {
|
|
17
|
+
queue,
|
|
18
|
+
}),
|
|
25
19
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
httpApi.addRoutes({
|
|
21
|
+
path: '/send-message',
|
|
22
|
+
methods: [apigwv2.HttpMethod.POST],
|
|
23
|
+
integration: new HttpSqsIntegration('sendMessageIntegration', {
|
|
24
|
+
queue,
|
|
25
|
+
subtype: apigwv2.HttpIntegrationSubtype.SQS_SEND_MESSAGE,
|
|
26
|
+
}),
|
|
32
27
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
httpApi.addRoutes({
|
|
29
|
+
path: '/receive-message',
|
|
30
|
+
methods: [apigwv2.HttpMethod.POST],
|
|
31
|
+
integration: new HttpSqsIntegration('receiveMessageIntegration', {
|
|
32
|
+
queue,
|
|
33
|
+
subtype: apigwv2.HttpIntegrationSubtype.SQS_RECEIVE_MESSAGE,
|
|
34
|
+
}),
|
|
37
35
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
httpApi.addRoutes({
|
|
37
|
+
path: '/delete-message',
|
|
38
|
+
methods: [apigwv2.HttpMethod.POST],
|
|
39
|
+
integration: new HttpSqsIntegration('deleteMessageIntegration', {
|
|
40
|
+
queue,
|
|
41
|
+
subtype: apigwv2.HttpIntegrationSubtype.SQS_DELETE_MESSAGE,
|
|
44
42
|
}),
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
passthroughBehavior: PassthroughBehavior.NEVER,
|
|
53
|
-
templateSelectionExpression: '\\$default',
|
|
54
|
-
requestTemplates: {
|
|
55
|
-
$default: 'Action=SendMessage&MessageGroupId=$input.path(\'$.MessageGroupId\')&MessageDeduplicationId=$context.requestId&MessageAttribute.1.Name=connectionId&MessageAttribute.1.Value.StringValue=$context.connectionId&MessageAttribute.1.Value.DataType=String&MessageAttribute.2.Name=requestId&MessageAttribute.2.Value.StringValue=$context.requestId&MessageAttribute.2.Value.DataType=String&MessageBody=$input.json(\'$\')',
|
|
56
|
-
},
|
|
57
|
-
requestParameters: {
|
|
58
|
-
'integration.request.header.Content-Type': '\'application/x-www-form-urlencoded\'',
|
|
59
|
-
},
|
|
43
|
+
});
|
|
44
|
+
httpApi.addRoutes({
|
|
45
|
+
path: '/purge-queue',
|
|
46
|
+
methods: [apigwv2.HttpMethod.POST],
|
|
47
|
+
integration: new HttpSqsIntegration('purgeQueueIntegration', {
|
|
48
|
+
queue,
|
|
49
|
+
subtype: apigwv2.HttpIntegrationSubtype.SQS_PURGE_QUEUE,
|
|
60
50
|
}),
|
|
61
51
|
});
|
|
62
52
|
|
|
63
|
-
new IntegTest(app, '
|
|
53
|
+
const integTest = new integ.IntegTest(app, 'SqsIntegrationIntegTest', {
|
|
64
54
|
testCases: [stack],
|
|
65
|
-
cdkCommandOptions: {
|
|
66
|
-
deploy: {
|
|
67
|
-
args: {
|
|
68
|
-
rollback: true,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
55
|
});
|
|
56
|
+
|
|
57
|
+
const defaultAssertion = integTest.assertions.httpApiCall(
|
|
58
|
+
`${httpApi.apiEndpoint}/default`, {
|
|
59
|
+
body: JSON.stringify({ MessageBody: 'Hello World!' }),
|
|
60
|
+
method: 'POST',
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
defaultAssertion.expect(integ.ExpectedResult.objectLike({ status: 200, statusText: 'OK' }));
|
|
64
|
+
|
|
65
|
+
const sendMessageAssertion = integTest.assertions.httpApiCall(
|
|
66
|
+
`${httpApi.apiEndpoint}/send-message`, {
|
|
67
|
+
body: JSON.stringify({ MessageBody: 'Hello World!' }),
|
|
68
|
+
method: 'POST',
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
sendMessageAssertion.expect(integ.ExpectedResult.objectLike({ status: 200, statusText: 'OK' }));
|
|
72
|
+
|
|
73
|
+
const receiveMessageAssertion = integTest.assertions.httpApiCall(
|
|
74
|
+
`${httpApi.apiEndpoint}/receive-message`, {
|
|
75
|
+
method: 'POST',
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
receiveMessageAssertion.expect(integ.ExpectedResult.objectLike({ status: 200, statusText: 'OK' }));
|
|
79
|
+
|
|
80
|
+
const purgeQueueAssertion = integTest.assertions.httpApiCall(
|
|
81
|
+
`${httpApi.apiEndpoint}/purge-queue`, {
|
|
82
|
+
method: 'POST',
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
purgeQueueAssertion.expect(integ.ExpectedResult.objectLike({ status: 200, statusText: 'OK' }));
|
|
@@ -531,7 +531,7 @@ about allowing connections between resources backed by instances.
|
|
|
531
531
|
## Max Instance Lifetime
|
|
532
532
|
|
|
533
533
|
To enable the max instance lifetime support, specify `maxInstanceLifetime` property
|
|
534
|
-
for the `AutoscalingGroup` resource. The value must be between
|
|
534
|
+
for the `AutoscalingGroup` resource. The value must be between 1 and 365 days(inclusive).
|
|
535
535
|
To clear a previously set value, leave this property undefined.
|
|
536
536
|
|
|
537
537
|
## Instance Monitoring
|
|
@@ -2,17 +2,28 @@ import * as cdk from 'aws-cdk-lib';
|
|
|
2
2
|
import * as integ from '@aws-cdk/integ-tests-alpha';
|
|
3
3
|
import * as codedeploy from 'aws-cdk-lib/aws-codedeploy';
|
|
4
4
|
|
|
5
|
-
const app = new cdk.App(
|
|
6
|
-
|
|
5
|
+
const app = new cdk.App({
|
|
6
|
+
postCliContext: {
|
|
7
|
+
'@aws-cdk/aws-lambda:useCdkManagedLogGroup': false,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda-config');
|
|
7
11
|
|
|
8
|
-
new codedeploy.
|
|
12
|
+
new codedeploy.LambdaDeploymentConfig(stack, 'LinearConfig', {
|
|
9
13
|
trafficRouting: codedeploy.TrafficRouting.timeBasedLinear({
|
|
10
14
|
interval: cdk.Duration.minutes(1),
|
|
11
15
|
percentage: 5,
|
|
12
16
|
}),
|
|
13
17
|
});
|
|
14
18
|
|
|
15
|
-
new
|
|
19
|
+
new codedeploy.CustomLambdaDeploymentConfig(stack, 'CustomConfig', {
|
|
20
|
+
interval: cdk.Duration.minutes(1),
|
|
21
|
+
percentage: 5,
|
|
22
|
+
type: cdk.aws_codedeploy.CustomLambdaDeploymentConfigType.LINEAR,
|
|
23
|
+
deploymentConfigName: 'hello',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
new integ.IntegTest(app, 'LambdaDeploymentConfigTest', {
|
|
16
27
|
testCases: [stack],
|
|
17
28
|
});
|
|
18
29
|
|