@cdklabs/cdk-appmod-catalog-blueprints 1.0.1 → 1.2.0
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.
- package/.jsii +701 -204
- package/README.md +100 -160
- package/lib/document-processing/adapter/adapter.d.ts +47 -0
- package/lib/document-processing/adapter/adapter.js +5 -0
- package/lib/document-processing/adapter/index.d.ts +2 -0
- package/lib/document-processing/adapter/index.js +19 -0
- package/lib/document-processing/adapter/queued-s3-adapter.d.ts +66 -0
- package/lib/document-processing/adapter/queued-s3-adapter.js +230 -0
- package/lib/document-processing/agentic-document-processing.d.ts +22 -0
- package/lib/document-processing/agentic-document-processing.js +11 -14
- package/lib/document-processing/base-document-processing.d.ts +8 -44
- package/lib/document-processing/base-document-processing.js +23 -190
- package/lib/document-processing/bedrock-document-processing.js +3 -13
- package/lib/document-processing/default-document-processing-config.d.ts +3 -0
- package/lib/document-processing/default-document-processing-config.js +14 -0
- package/lib/document-processing/index.d.ts +2 -0
- package/lib/document-processing/index.js +3 -1
- package/lib/document-processing/resources/default-bedrock-invoke/index.py +36 -24
- package/lib/document-processing/resources/default-sqs-consumer/index.py +10 -5
- package/lib/document-processing/resources/default-strands-agent/index.py +8 -5
- package/lib/document-processing/tests/agentic-document-processing-nag.test.js +6 -2
- package/lib/document-processing/tests/agentic-document-processing.test.js +5 -19
- package/lib/document-processing/tests/bedrock-document-processing-nag.test.js +6 -2
- package/lib/framework/custom-resource/default-runtimes.js +1 -1
- package/lib/framework/foundation/access-log.js +1 -1
- package/lib/framework/foundation/eventbridge-broker.js +1 -1
- package/lib/framework/foundation/network.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utilities/data-loader.js +1 -1
- package/lib/utilities/lambda-iam-utils.js +1 -1
- package/lib/utilities/observability/cloudfront-distribution-observability-property-injector.js +1 -1
- package/lib/utilities/observability/default-observability-config.d.ts +9 -0
- package/lib/utilities/observability/default-observability-config.js +20 -0
- package/lib/utilities/observability/index.d.ts +1 -0
- package/lib/utilities/observability/index.js +2 -1
- package/lib/utilities/observability/lambda-observability-property-injector.js +1 -1
- package/lib/utilities/observability/powertools-config.js +1 -1
- package/lib/utilities/observability/state-machine-observability-property-injector.js +1 -1
- package/lib/webapp/frontend-construct.js +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,212 +1,152 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# AppMod Catalog Blueprints
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Application Modernization (AppMod) Catalog Blueprints is a comprehensive library of production-ready, use case-driven infrastructure blueprints in the form of composable multi-layered building blocks built using [AWS Cloud Development Kit](https://aws.amazon.com/cdk/) (CDK) [L3 constructs](https://docs.aws.amazon.com/cdk/v2/guide/constructs.html). These blueprints offer use case-driven solutions with multiple implementation pathways and industry-specific implementations that are designed to accelerate serverless development and modernization on AWS.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Built with [JSII](https://aws.github.io/jsii/), these constructs are available in TypeScript, Python, Java, and .NET, enabling teams to use their preferred programming language while leveraging the same proven infrastructure patterns.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Get started by exploring the [use case constructs](use-cases) and deployable [examples](examples). Learn more from [documentation](https://cdklabs.github.io/cdk-appmod-catalog-blueprints/) and [Construct Hub](https://constructs.dev/packages/@cdklabs/cdk-appmod-catalog-blueprints).
|
|
10
12
|
|
|
11
13
|
## Core Use Cases
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
| Use Case | Description | Quick Deploy Examples |
|
|
16
|
+
|----------|-------------|----------------------|
|
|
17
|
+
| **[Document Processing](./use-cases/document-processing/)** | AI-powered document processing workflows with classification, extraction, and agentic capabilities | • [Bedrock Document Processing](./examples/document-processing/bedrock-document-processing/)<br/>• [Agentic Document Processing](./examples/document-processing/agentic-document-processing/)<br/>• [Full-Stack Insurance Claims Processing Web Application](./examples/document-processing/doc-processing-fullstack-webapp/) |
|
|
18
|
+
| **[Web Application](./use-cases/webapp/)** | Static web application hosting with global CDN, security headers, and SPA support | • [Full-Stack Insurance Claims Processing Web Application](./examples/document-processing/doc-processing-fullstack-webapp/) |
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
## Foundation and Utilities
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Key Features:**
|
|
25
|
-
- **Event-Driven Pipeline**: S3 upload triggers SQS → Step Functions workflow
|
|
26
|
-
- **AI-Powered Processing**: Amazon Bedrock for document classification and extraction
|
|
27
|
-
- **Multi-format Support**: PDF, JPG, PNG document processing
|
|
28
|
-
- **Flexible Workflows**: Base construct with extensible processing steps
|
|
29
|
-
- **State Management**: DynamoDB for workflow state and document metadata
|
|
30
|
-
- **Error Handling**: Dead letter queues and retry mechanisms with observability
|
|
31
|
-
|
|
32
|
-
**Available Constructs:**
|
|
33
|
-
|
|
34
|
-
**BaseDocumentProcessing** - Foundation construct providing:
|
|
35
|
-
- S3 bucket with organized prefixes (raw/, processed/, failed/)
|
|
36
|
-
- SQS queue with configurable visibility timeout and DLQ
|
|
37
|
-
- DynamoDB table for document metadata and workflow state
|
|
38
|
-
- Step Functions workflow with customizable processing steps
|
|
39
|
-
- Built-in observability and monitoring
|
|
22
|
+
| Component | Description |
|
|
23
|
+
|-----------|-------------|
|
|
24
|
+
| **[Observability & Monitoring](./use-cases/utilities/observability/)** | Comprehensive monitoring, logging, and alerting with automatic property injection and Lambda Powertools integration |
|
|
25
|
+
| **[Data Masking](./use-cases/utilities/lambda_layers/data-masking/)** | Lambda layer for data masking and PII protection in serverless applications |
|
|
26
|
+
| **[Infrastructure Foundation](./use-cases/framework/)** | Core infrastructure components and utilities for building scalable applications |
|
|
40
27
|
|
|
41
|
-
|
|
42
|
-
- Document classification using Claude 3.5 Sonnet
|
|
43
|
-
- Entity extraction and content analysis
|
|
44
|
-
- Configurable prompts for classification and extraction
|
|
45
|
-
- Optional enrichment Lambda function integration
|
|
46
|
-
- Automatic workflow state management
|
|
28
|
+
## Key Design Principles
|
|
47
29
|
|
|
48
|
-
|
|
49
|
-
- Advanced multi-step processing with agent coordination
|
|
50
|
-
- Complex document understanding and analysis
|
|
51
|
-
- Configurable agent behaviors and processing flows
|
|
30
|
+
AppMod Catalog Blueprints is built on Object-Oriented Programming (OOP) principles, providing a structured approach to infrastructure development through core design concepts:
|
|
52
31
|
|
|
53
|
-
###
|
|
32
|
+
### Composable Architecture
|
|
54
33
|
|
|
55
|
-
|
|
34
|
+
Build complex enterprise systems by combining independent, reusable components with standardized interfaces.
|
|
56
35
|
|
|
57
|
-
**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
↓ ↓ ↓
|
|
61
|
-
[Global CDN] [Static Assets] [Security Functions]
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**Key Features:**
|
|
65
|
-
- **Global Distribution**: CloudFront CDN for low-latency content delivery
|
|
66
|
-
- **Security Headers**: Automatic injection of security headers via CloudFront functions
|
|
67
|
-
- **SSL/TLS**: Automatic HTTPS with AWS Certificate Manager
|
|
68
|
-
- **Custom Domains**: Support for custom domain names with Route 53 integration
|
|
69
|
-
- **Error Pages**: Custom 404/403 error page handling
|
|
70
|
-
- **Access Logging**: CloudFront access logs for analytics
|
|
36
|
+
- **Independent components** with clear interfaces and loose coupling for maximum flexibility
|
|
37
|
+
- **Mix and match building blocks** to create custom solutions across different contexts and use cases
|
|
38
|
+
- **Scalable composition** that maintains consistency while enabling incremental adoption and gradual modernization
|
|
71
39
|
|
|
72
|
-
|
|
40
|
+
### Multi-Layered Building Blocks Architecture
|
|
73
41
|
|
|
74
|
-
|
|
75
|
-
- S3 bucket configured for static website hosting
|
|
76
|
-
- CloudFront distribution with optimized caching
|
|
77
|
-
- Security headers function for OWASP compliance
|
|
78
|
-
- Optional custom domain and SSL certificate
|
|
79
|
-
- Access logging and monitoring integration
|
|
42
|
+
Our blueprints use a multi-layered architecture that bridges the gap between business requirements and technical implementation:
|
|
80
43
|
|
|
81
|
-
|
|
44
|
+
| Layer | Implementation Type | Purpose | Key Features |
|
|
45
|
+
|-------|-------------------|---------|--------------|
|
|
46
|
+
| **Infrastructure Foundation** | Abstract base classes | Shared infrastructure components and common services | • Standardized interfaces and contracts<br/>• Extensible foundation for custom implementations |
|
|
47
|
+
| **General Use Case Implementation** | Concrete implementation classes | Production-ready implementations for common patterns across industries | • Configurable parameters for different environments<br/>• Abstract method implementations with general-purpose solutions |
|
|
48
|
+
| **Industry-Aligned Implementation** | Configured implementation examples | Pre-configured solutions for specific business domains | • Industry-specific validation rules and workflows<br/>• Built-in compliance requirements and domain expertise |
|
|
82
49
|
|
|
83
|
-
|
|
50
|
+
### Production-Ready with Smart Defaults
|
|
84
51
|
|
|
85
|
-
**
|
|
86
|
-
- **Property Injection**: Automatic observability configuration across AWS services
|
|
87
|
-
- **Lambda Powertools**: Structured logging, metrics, and tracing for Python/Node.js
|
|
88
|
-
- **CloudWatch Integration**: Dashboards, alarms, and custom metrics
|
|
89
|
-
- **X-Ray Tracing**: End-to-end request flow visualization
|
|
90
|
-
- **Bedrock Monitoring**: Specialized observability for Amazon Bedrock workloads
|
|
91
|
-
- **Cost Optimization**: Intelligent log retention and metric filtering
|
|
52
|
+
AppMod Catalog Blueprints serves both **rapid deployment** needs (for teams wanting immediate solutions) and **custom development** requirements (for teams needing tailored implementations), providing flexibility without compromising on production readiness.
|
|
92
53
|
|
|
93
|
-
|
|
54
|
+
| Approach | Best For | Capabilities |
|
|
55
|
+
|----------|----------|--------------|
|
|
56
|
+
| **Out-of-the-Box Deployment** | Rapid deployment and evaluation | • Deploy complete solutions in minutes using examples for immediate value<br/>• Pre-configured security, monitoring, and best practices for production readiness<br/>• Sensible defaults with production-ready configurations that work immediately<br/>• No infrastructure boilerplate required with minimal learning curve |
|
|
57
|
+
| **Intelligent Customization** | Custom development and integration | • Override defaults to modify behavior without changing core implementation<br/>• Enable/disable optional features to meet specific requirements<br/>• Inject custom logic at predefined extension points while maintaining production readiness<br/>• Configure parameters for different environments and use cases |
|
|
94
58
|
|
|
95
|
-
|
|
96
|
-
- `LambdaObservabilityPropertyInjector` - Auto-enables X-Ray tracing for Lambda functions
|
|
97
|
-
- `StateMachineObservabilityPropertyInjector` - Enables logging for Step Functions
|
|
98
|
-
- `CloudfrontDistributionObservabilityPropertyInjector` - CDN monitoring and logging
|
|
59
|
+
### Security & Compliance
|
|
99
60
|
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
**Data Protection:**
|
|
106
|
-
- `LogGroupDataProtectionProps` - Configurable data protection policies for CloudWatch logs
|
|
61
|
+
All components include enterprise-grade security by default:
|
|
62
|
+
- **CDK Nag Integration**: Automated security compliance checking
|
|
63
|
+
- **AWS Well-Architected**: Security, reliability, and performance best practices
|
|
64
|
+
- **Encryption & IAM**: At-rest/in-transit encryption with least-privilege access
|
|
65
|
+
- **Compliance Reports**: Generate reports with `npm test -- --testPathPattern="nag.test.ts"`
|
|
107
66
|
|
|
108
|
-
|
|
67
|
+
## Essential Commands
|
|
109
68
|
|
|
110
|
-
|
|
69
|
+
### Environment Setup
|
|
70
|
+
```bash
|
|
71
|
+
# Clone the repository
|
|
72
|
+
git clone https://github.com/cdklabs/cdk-appmod-catalog-blueprints.git
|
|
111
73
|
|
|
112
|
-
|
|
74
|
+
# Configure AWS credentials and region
|
|
75
|
+
aws configure
|
|
76
|
+
# OR set AWS profile: export AWS_PROFILE=your-profile-name
|
|
113
77
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- `EventBridgeBroker` - Event-driven architecture with custom EventBridge bus
|
|
78
|
+
# Bootstrap your AWS environment (one-time setup)
|
|
79
|
+
npx cdk bootstrap
|
|
80
|
+
```
|
|
118
81
|
|
|
119
|
-
|
|
120
|
-
- `DataLoader` - Custom resource for loading initial data into databases and services
|
|
121
|
-
- `LambdaIamUtils` - Utility functions for Lambda IAM role and policy management
|
|
122
|
-
- `DefaultRuntimes` - Standardized Lambda runtime configurations
|
|
82
|
+
### Quick Start
|
|
123
83
|
|
|
124
|
-
**
|
|
125
|
-
- `DataMasking` - Layer for data masking and PII protection in Lambda functions
|
|
84
|
+
Deploy a working example in **5 minutes**:
|
|
126
85
|
|
|
127
|
-
|
|
86
|
+
```bash
|
|
87
|
+
# Navigate to any example and deploy
|
|
88
|
+
cd examples/document-processing/agentic-document-processing
|
|
89
|
+
npm install
|
|
90
|
+
npm run deploy
|
|
91
|
+
```
|
|
128
92
|
|
|
129
|
-
|
|
93
|
+
### Build & Deploy Project
|
|
94
|
+
```bash
|
|
95
|
+
# Build entire project
|
|
96
|
+
npx projen build
|
|
130
97
|
|
|
131
|
-
|
|
98
|
+
# Deploy with specific profile/region
|
|
99
|
+
npx cdk deploy --require-approval never
|
|
132
100
|
|
|
133
|
-
|
|
101
|
+
# Update CDK CLI if needed
|
|
102
|
+
npm install aws-cdk@latest
|
|
103
|
+
```
|
|
134
104
|
|
|
135
|
-
|
|
105
|
+
### Development
|
|
106
|
+
```bash
|
|
107
|
+
# Run all tests
|
|
108
|
+
npm test
|
|
136
109
|
|
|
137
|
-
|
|
110
|
+
# Run specific test pattern
|
|
111
|
+
npm test -- --testPathPattern="document-processing"
|
|
138
112
|
|
|
113
|
+
# Generate CDK Nag compliance reports
|
|
114
|
+
npm test -- --testPathPattern="nag.test.ts"
|
|
139
115
|
```
|
|
140
|
-
appmod-usecase-blueprints/
|
|
141
|
-
├── use-cases/
|
|
142
|
-
│ ├── document-processing/ # Document processing components
|
|
143
|
-
│ │ ├── base-document-processing.ts
|
|
144
|
-
│ │ ├── bedrock-document-processing.ts
|
|
145
|
-
│ │ ├── agentic-document-processing.ts
|
|
146
|
-
│ │ ├── resources/ # Lambda functions
|
|
147
|
-
│ │ └── tests/ # Unit and CDK Nag tests
|
|
148
|
-
│ ├── webapp/ # Web application components
|
|
149
|
-
│ │ ├── frontend-construct.ts
|
|
150
|
-
│ │ └── tests/ # Unit and CDK Nag tests
|
|
151
|
-
│ ├── framework/ # Core infrastructure
|
|
152
|
-
│ │ ├── foundation/ # Network, access logs, EventBridge
|
|
153
|
-
│ │ ├── quickstart/ # Base quickstart patterns
|
|
154
|
-
│ │ └── custom-resource/ # Default runtimes
|
|
155
|
-
│ └── utilities/
|
|
156
|
-
│ ├── observability/ # Monitoring components
|
|
157
|
-
│ ├── lambda_layers/ # Shared Lambda layers
|
|
158
|
-
│ ├── data-loader.ts # Custom resource for data loading
|
|
159
|
-
│ └── lambda-iam-utils.ts # IAM utilities
|
|
160
|
-
├── examples/ # Ready-to-deploy examples
|
|
161
|
-
│ └── document-processing/
|
|
162
|
-
│ ├── bedrock-document-processing/
|
|
163
|
-
│ ├── agentic-document-processing/
|
|
164
|
-
│ └── doc-processing-fullstack-webapp/
|
|
165
|
-
└── README.md
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Security & Compliance
|
|
169
|
-
|
|
170
|
-
All components include:
|
|
171
|
-
- **CDK Nag Integration**: Automated security compliance checking
|
|
172
|
-
- **AWS Well-Architected**: Following best practices for security, reliability, performance
|
|
173
|
-
- **Encryption**: At-rest and in-transit encryption by default
|
|
174
|
-
- **IAM Least Privilege**: Minimal required permissions
|
|
175
|
-
- **VPC Isolation**: Private subnets and security groups
|
|
176
116
|
|
|
177
|
-
|
|
117
|
+
## How to Use This Library
|
|
178
118
|
|
|
179
|
-
|
|
119
|
+
### Quick Start (Deploy Examples)
|
|
120
|
+
1. **Browse Examples**: Start with the [examples](./examples/) folder to see working implementations
|
|
121
|
+
2. **Deploy & Test**: Use `npm run deploy` in any example to get a working system in minutes
|
|
122
|
+
3. **Customize**: Modify example parameters to fit your specific requirements
|
|
180
123
|
|
|
181
|
-
|
|
124
|
+
### Using Individual Constructs
|
|
125
|
+
1. **Import Constructs**: Add `@cdklabs/appmod-catalog-blueprints` to your CDK project
|
|
126
|
+
2. **Choose Your Layer**: Pick the right abstraction level for your needs
|
|
127
|
+
3. **Configure**: Use the configuration options documented in each construct
|
|
182
128
|
|
|
183
|
-
###
|
|
184
|
-
- **Bedrock Document Processing**: AI-powered document analysis with Claude 3.5 Sonnet
|
|
185
|
-
- **Agentic Document Processing**: Multi-agent document workflows with complex processing
|
|
186
|
-
- **Full-Stack Document Processing Webapp**: Complete document processing application with frontend interface
|
|
129
|
+
### Understanding the Layers
|
|
187
130
|
|
|
188
|
-
|
|
131
|
+
**Foundation Layer** (`use-cases/framework/`, `use-cases/utilities/`)
|
|
132
|
+
- **When to use**: Building custom solutions or need specific infrastructure components
|
|
133
|
+
- **Components**: VPC networking, observability utilities, data management tools, etc.
|
|
189
134
|
|
|
190
|
-
|
|
135
|
+
**Use Case Layer** (`use-cases/document-processing/`, `use-cases/webapp/`)
|
|
136
|
+
- **When to use**: Need proven patterns for common business problems
|
|
137
|
+
- **Components**: Document processing workflows, web application hosting, data transformation patterns, etc.
|
|
191
138
|
|
|
192
|
-
|
|
193
|
-
- **
|
|
194
|
-
- **
|
|
195
|
-
- **Networking**: VPC, CloudFront, Application Load Balancer
|
|
196
|
-
- **AI/ML**: Amazon Bedrock, Textract
|
|
197
|
-
- **Monitoring**: CloudWatch, X-Ray
|
|
198
|
-
- **Security**: KMS, Secrets Manager, IAM
|
|
139
|
+
**Example Layer** (`examples/`)
|
|
140
|
+
- **When to use**: Want complete, deployable solutions
|
|
141
|
+
- **Components**: Industry-specific configurations, end-to-end applications, reference implementations, etc.
|
|
199
142
|
|
|
200
143
|
## Contributing
|
|
201
144
|
|
|
202
|
-
|
|
203
|
-
2. **Follow Structure**: Include constructs, tests, and documentation
|
|
204
|
-
3. **Security First**: All components must pass CDK Nag checks
|
|
205
|
-
4. **Include Monitoring**: Include monitoring, error handling, and cost optimization
|
|
145
|
+
See [CONTRIBUTING.md](https://github.com/cdklabs/cdk-appmod-catalog-blueprints/blob/main/CONTRIBUTING.md) for detailed guidelines on how to contribute to this project.
|
|
206
146
|
|
|
207
147
|
## Disclaimer
|
|
208
148
|
These application solutions are not supported products in their own right, but examples to help our customers use our products from their applications. As our customer, any applications you integrate these examples in should be thoroughly tested, secured, and optimized according to your business's security standards before deploying to production or handling production workloads.
|
|
209
149
|
|
|
210
150
|
## License
|
|
211
151
|
|
|
212
|
-
Apache License 2.0 - see [LICENSE](
|
|
152
|
+
Apache License 2.0 - see [LICENSE](https://github.com/cdklabs/cdk-appmod-catalog-blueprints/blob/main/LICENSE) file for details.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PolicyStatement } from 'aws-cdk-lib/aws-iam';
|
|
2
|
+
import { Chain, StateMachine } from 'aws-cdk-lib/aws-stepfunctions';
|
|
3
|
+
import { Construct } from 'constructs';
|
|
4
|
+
import { BaseDocumentProcessingProps } from '../base-document-processing';
|
|
5
|
+
/**
|
|
6
|
+
* Abstraction to enable different types of source triggers
|
|
7
|
+
* for the intelligent document processing workflow
|
|
8
|
+
*/
|
|
9
|
+
export interface IAdapter {
|
|
10
|
+
/**
|
|
11
|
+
* Initializes the adapter
|
|
12
|
+
* @param scope Scope to use in relation to the CDK hierarchy
|
|
13
|
+
* @param props The parameters passed to the document processing L3 Construct
|
|
14
|
+
*/
|
|
15
|
+
init(scope: Construct, props: BaseDocumentProcessingProps): void;
|
|
16
|
+
/**
|
|
17
|
+
* Create resources that would receive the data and trigger the workflow.
|
|
18
|
+
*
|
|
19
|
+
* Important: resource created should trigger the state machine
|
|
20
|
+
* @param scope Scope to use in relation to the CDK hierarchy
|
|
21
|
+
* @param stateMachine The workflow of the document processor
|
|
22
|
+
* @param props The parameters passed to the document processing L3 Construct
|
|
23
|
+
* @return Resources that are created
|
|
24
|
+
*/
|
|
25
|
+
createIngressTrigger(scope: Construct, stateMachine: StateMachine, props: BaseDocumentProcessingProps): Record<string, any>;
|
|
26
|
+
/**
|
|
27
|
+
* Generate IAM statements that can be used by other resources to access the storage
|
|
28
|
+
* @param additionalIAMActions (Optional) list of additional actions in relation
|
|
29
|
+
* to the underlying storage for the adapter. @default empty string array
|
|
30
|
+
* @param narrowActions (Optional) whether the resulting permissions would only
|
|
31
|
+
* be the IAM actions indicated in the `additionalIAMActions` parameter. @default false
|
|
32
|
+
* @return PolicyStatement[] IAM policy statements that would included in the state machine IAM role
|
|
33
|
+
*/
|
|
34
|
+
generateAdapterIAMPolicies(additionalIAMActions?: string[], narrowActions?: boolean): PolicyStatement[];
|
|
35
|
+
/**
|
|
36
|
+
* Create the adapter specific handler for failed processing
|
|
37
|
+
* @param scope Scope to use in relation to the CDK hierarchy
|
|
38
|
+
* @return Chain to be added to the state machine to handle failure scenarios
|
|
39
|
+
*/
|
|
40
|
+
createFailedChain(scope: Construct): Chain;
|
|
41
|
+
/**
|
|
42
|
+
* Create the adapter specific handler for successful processing
|
|
43
|
+
* @param scope Scope to use in relation to the CDK hierarchy
|
|
44
|
+
* @return Chain to be added to the state machine to handle successful scenarios
|
|
45
|
+
*/
|
|
46
|
+
createSuccessChain(scope: Construct): Chain;
|
|
47
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRhcHRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3VzZS1jYXNlcy9kb2N1bWVudC1wcm9jZXNzaW5nL2FkYXB0ZXIvYWRhcHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEscUVBQXFFO0FBQ3JFLHNDQUFzQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIENvcHlyaWdodCBBbWF6b24uY29tLCB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XJhcmNoeVxuICAgICAqIEByZXR1cm4gQ2hhaW4gdG8gYmUgYWRkZWQgdG8gdGhlIHN0YXRlIG1hY2hpbmUgdG8gaGFuZGxlIHN1Y2Nlc3NmdWwgc2NlbmFyaW9zXG4gICAgICovXG4gIGNyZWF0ZVN1Y2Nlc3NDaGFpbihzY29wZTogQ29uc3RydWN0KTogQ2hhaW47XG59Il19
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./adapter"), exports);
|
|
18
|
+
__exportStar(require("./queued-s3-adapter"), exports);
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi91c2UtY2FzZXMvZG9jdW1lbnQtcHJvY2Vzc2luZy9hZGFwdGVyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSw0Q0FBMEI7QUFDMUIsc0RBQW9DIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9hZGFwdGVyJztcbmV4cG9ydCAqIGZyb20gJy4vcXVldWVkLXMzLWFkYXB0ZXInOyJdfQ==
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Duration } from 'aws-cdk-lib';
|
|
2
|
+
import { PolicyStatement } from 'aws-cdk-lib/aws-iam';
|
|
3
|
+
import { Bucket } from 'aws-cdk-lib/aws-s3';
|
|
4
|
+
import { Chain, StateMachine } from 'aws-cdk-lib/aws-stepfunctions';
|
|
5
|
+
import { Construct } from 'constructs';
|
|
6
|
+
import { BaseDocumentProcessingProps } from '../base-document-processing';
|
|
7
|
+
import { IAdapter } from './adapter';
|
|
8
|
+
/**
|
|
9
|
+
* Props for the Queued S3 Adapter
|
|
10
|
+
*/
|
|
11
|
+
export interface QueuedS3AdapterProps {
|
|
12
|
+
/**
|
|
13
|
+
* S3 bucket for document storage with organized prefixes (raw/, processed/, failed/).
|
|
14
|
+
* If not provided, a new bucket will be created with auto-delete enabled based on removalPolicy.
|
|
15
|
+
*
|
|
16
|
+
* @default create a new bucket
|
|
17
|
+
*/
|
|
18
|
+
readonly bucket?: Bucket;
|
|
19
|
+
/**
|
|
20
|
+
* S3 prefix where the raw files would be stored.
|
|
21
|
+
* This serves as the trigger point for processing
|
|
22
|
+
*
|
|
23
|
+
* @default "raw/"
|
|
24
|
+
*/
|
|
25
|
+
readonly rawPrefix?: string;
|
|
26
|
+
/**
|
|
27
|
+
* S3 prefix where the processed files would be stored.
|
|
28
|
+
*
|
|
29
|
+
* @default "processed/"
|
|
30
|
+
*/
|
|
31
|
+
readonly processedPrefix?: string;
|
|
32
|
+
/**
|
|
33
|
+
* S3 prefix where the files that failed processing would be stored.
|
|
34
|
+
*
|
|
35
|
+
* @default "failed/"
|
|
36
|
+
*/
|
|
37
|
+
readonly failedPrefix?: string;
|
|
38
|
+
/**
|
|
39
|
+
* SQS queue visibility timeout for processing messages.
|
|
40
|
+
* Should be longer than expected processing time to prevent duplicate processing.
|
|
41
|
+
* @default Duration.seconds(300)
|
|
42
|
+
*/
|
|
43
|
+
readonly queueVisibilityTimeout?: Duration;
|
|
44
|
+
/**
|
|
45
|
+
* The number of times a message can be unsuccessfully dequeued before being moved to the dead-letter queue.
|
|
46
|
+
*
|
|
47
|
+
* @default 5
|
|
48
|
+
*/
|
|
49
|
+
readonly dlqMaxReceiveCount?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* This adapter allows the intelligent document processing workflow
|
|
53
|
+
* to be triggered by files that are uploaded into a S3 Bucket.
|
|
54
|
+
*/
|
|
55
|
+
export declare class QueuedS3Adapter implements IAdapter {
|
|
56
|
+
private readonly adapterProps;
|
|
57
|
+
private readonly resources;
|
|
58
|
+
private readonly prefixes;
|
|
59
|
+
constructor(adapterProps?: QueuedS3AdapterProps);
|
|
60
|
+
init(scope: Construct, props: BaseDocumentProcessingProps): void;
|
|
61
|
+
createIngressTrigger(scope: Construct, stateMachine: StateMachine, props: BaseDocumentProcessingProps): Record<string, any>;
|
|
62
|
+
private createSQSConsumerLambda;
|
|
63
|
+
generateAdapterIAMPolicies(additionalIAMActions?: string[], narrowActions?: boolean): PolicyStatement[];
|
|
64
|
+
createFailedChain(scope: Construct): Chain;
|
|
65
|
+
createSuccessChain(scope: Construct): Chain;
|
|
66
|
+
}
|