@ts-cloud/core 0.2.3 → 0.2.4
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/dist/advanced-features.test.d.ts +1 -0
- package/dist/aws/cloudformation.d.ts +136 -0
- package/dist/aws/cloudfront.d.ts +45 -0
- package/dist/aws/credentials.d.ts +77 -0
- package/dist/aws/credentials.test.d.ts +4 -0
- package/dist/aws/index.d.ts +10 -0
- package/dist/aws/s3.d.ts +256 -0
- package/dist/aws/s3.test.d.ts +4 -0
- package/dist/aws/signature.d.ts +142 -0
- package/dist/aws/signature.test.d.ts +4 -0
- package/dist/backup/disaster-recovery.d.ts +140 -0
- package/dist/backup/disaster-recovery.test.d.ts +1 -0
- package/dist/backup/index.d.ts +8 -0
- package/dist/backup/manager.d.ts +172 -0
- package/dist/backup/manager.test.d.ts +1 -0
- package/dist/cicd/circleci.d.ts +50 -0
- package/dist/cicd/github-actions.d.ts +62 -0
- package/dist/cicd/gitlab-ci.d.ts +50 -0
- package/dist/cicd/index.d.ts +7 -0
- package/dist/cli/history.d.ts +137 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/progress.d.ts +193 -0
- package/dist/cli/repl.d.ts +148 -0
- package/dist/cli/suggestions.d.ts +74 -0
- package/dist/cli/table.d.ts +73 -0
- package/dist/cli/table.test.d.ts +1 -0
- package/dist/cloudformation/builder.d.ts +93 -0
- package/dist/cloudformation/builder.test.d.ts +4 -0
- package/dist/cloudformation/builders/api-gateway.d.ts +30 -0
- package/dist/cloudformation/builders/cache.d.ts +35 -0
- package/dist/cloudformation/builders/cdn.d.ts +34 -0
- package/dist/cloudformation/builders/compute.d.ts +68 -0
- package/dist/cloudformation/builders/database.d.ts +61 -0
- package/dist/cloudformation/builders/functions.d.ts +32 -0
- package/dist/cloudformation/builders/messaging.d.ts +17 -0
- package/dist/cloudformation/builders/monitoring.d.ts +39 -0
- package/dist/cloudformation/builders/network.d.ts +14 -0
- package/dist/cloudformation/builders/queue.d.ts +16 -0
- package/dist/cloudformation/builders/security.d.ts +31 -0
- package/dist/cloudformation/builders/storage.d.ts +36 -0
- package/dist/cloudformation/index.d.ts +10 -0
- package/dist/cloudformation/types.d.ts +200 -0
- package/dist/compliance/aws-config.d.ts +175 -0
- package/dist/compliance/cloudtrail.d.ts +132 -0
- package/dist/compliance/compliance.test.d.ts +1 -0
- package/dist/compliance/guardduty.d.ts +176 -0
- package/dist/compliance/index.d.ts +12 -0
- package/dist/compliance/security-hub.d.ts +178 -0
- package/dist/containers/build-optimization.d.ts +155 -0
- package/dist/containers/containers.test.d.ts +1 -0
- package/dist/containers/image-scanning.d.ts +144 -0
- package/dist/containers/index.d.ts +8 -0
- package/dist/containers/registry.d.ts +129 -0
- package/dist/containers/service-mesh.d.ts +254 -0
- package/dist/database/database.test.d.ts +1 -0
- package/dist/database/index.d.ts +8 -0
- package/dist/database/migrations.d.ts +153 -0
- package/dist/database/performance.d.ts +219 -0
- package/dist/database/replicas.d.ts +218 -0
- package/dist/database/users.d.ts +165 -0
- package/dist/dependency-graph.d.ts +37 -0
- package/dist/deployment/ab-testing.d.ts +165 -0
- package/dist/deployment/blue-green.d.ts +140 -0
- package/dist/deployment/canary.d.ts +165 -0
- package/dist/deployment/deployment.test.d.ts +1 -0
- package/dist/deployment/index.d.ts +12 -0
- package/dist/deployment/progressive.d.ts +50 -0
- package/dist/dns/dns.test.d.ts +1 -0
- package/dist/dns/dnssec.d.ts +120 -0
- package/dist/dns/index.d.ts +7 -0
- package/dist/dns/resolver.d.ts +216 -0
- package/dist/dns/routing.d.ts +277 -0
- package/dist/email/advanced/analytics.d.ts +107 -0
- package/dist/email/advanced/index.d.ts +10 -0
- package/dist/email/advanced/rules.d.ts +131 -0
- package/dist/email/advanced/scheduling.d.ts +81 -0
- package/dist/email/advanced/search.d.ts +91 -0
- package/dist/email/advanced/shared-mailboxes.d.ts +109 -0
- package/dist/email/advanced/templates.d.ts +95 -0
- package/dist/email/advanced/threading.d.ts +65 -0
- package/dist/email/analytics.d.ts +189 -0
- package/dist/email/bounce-handling.d.ts +171 -0
- package/dist/email/email.test.d.ts +1 -0
- package/dist/email/handlers/__tests__/inbound.test.d.ts +1 -0
- package/dist/email/handlers/__tests__/outbound.test.d.ts +1 -0
- package/dist/email/handlers/converter.d.ts +11 -0
- package/dist/email/handlers/feedback.d.ts +11 -0
- package/dist/email/handlers/inbound.d.ts +13 -0
- package/dist/email/handlers/outbound.d.ts +13 -0
- package/dist/email/index.d.ts +10 -0
- package/dist/email/reputation.d.ts +133 -0
- package/dist/email/templates.d.ts +124 -0
- package/dist/errors/index.d.ts +177 -0
- package/dist/errors/index.test.d.ts +4 -0
- package/dist/health-checks/index.d.ts +35 -0
- package/dist/index.d.ts +15 -256
- package/dist/index.js +228 -80
- package/dist/intrinsic-functions.d.ts +77 -0
- package/dist/lambda/concurrency.d.ts +146 -0
- package/dist/lambda/destinations.d.ts +141 -0
- package/dist/lambda/dlq.d.ts +160 -0
- package/dist/lambda/index.d.ts +10 -0
- package/dist/lambda/lambda.test.d.ts +1 -0
- package/dist/lambda/layers.d.ts +117 -0
- package/dist/lambda/versions.d.ts +145 -0
- package/dist/lambda/vpc.d.ts +164 -0
- package/dist/local/config.d.ts +44 -0
- package/dist/local/index.d.ts +5 -0
- package/dist/local/mock-aws.d.ts +69 -0
- package/dist/modules/ai.d.ts +108 -0
- package/dist/modules/api.d.ts +157 -0
- package/dist/modules/auth.d.ts +262 -0
- package/dist/modules/cache.d.ts +108 -0
- package/dist/modules/cdn.d.ts +305 -0
- package/dist/modules/communication.d.ts +117 -0
- package/dist/modules/compute.d.ts +1376 -0
- package/dist/modules/database.d.ts +144 -0
- package/dist/modules/deployment.d.ts +372 -0
- package/dist/modules/dns.d.ts +143 -0
- package/dist/modules/email.d.ts +314 -0
- package/dist/modules/filesystem.d.ts +132 -0
- package/dist/modules/index.d.ts +31 -0
- package/dist/modules/messaging.d.ts +210 -0
- package/dist/modules/monitoring.d.ts +574 -0
- package/dist/modules/network.d.ts +148 -0
- package/dist/modules/parameter-store.d.ts +143 -0
- package/dist/modules/permissions.d.ts +245 -0
- package/dist/modules/phone.d.ts +125 -0
- package/dist/modules/queue.d.ts +411 -0
- package/dist/modules/redirects.d.ts +140 -0
- package/dist/modules/registry.d.ts +189 -0
- package/dist/modules/search.d.ts +135 -0
- package/dist/modules/secrets.d.ts +149 -0
- package/dist/modules/security.d.ts +219 -0
- package/dist/modules/sms.d.ts +130 -0
- package/dist/modules/storage.d.ts +344 -0
- package/dist/modules/workflow.d.ts +288 -0
- package/dist/multi-account/config.d.ts +166 -0
- package/dist/multi-account/index.d.ts +6 -0
- package/dist/multi-account/manager.d.ts +181 -0
- package/dist/multi-region/cross-region.d.ts +204 -0
- package/dist/multi-region/index.d.ts +7 -0
- package/dist/multi-region/manager.d.ts +136 -0
- package/dist/multi-region/regions.d.ts +98 -0
- package/dist/network-security/index.d.ts +55 -0
- package/dist/observability/index.d.ts +8 -0
- package/dist/observability/logs.d.ts +213 -0
- package/dist/observability/metrics.d.ts +187 -0
- package/dist/observability/observability.test.d.ts +1 -0
- package/dist/observability/synthetics.d.ts +189 -0
- package/dist/observability/xray.d.ts +193 -0
- package/dist/phone/advanced/analytics.d.ts +83 -0
- package/dist/phone/advanced/callbacks.d.ts +67 -0
- package/dist/phone/advanced/index.d.ts +7 -0
- package/dist/phone/advanced/ivr-builder.d.ts +130 -0
- package/dist/phone/advanced/recording.d.ts +62 -0
- package/dist/phone/handlers/__tests__/incoming-call.test.d.ts +1 -0
- package/dist/phone/handlers/incoming-call.d.ts +10 -0
- package/dist/phone/handlers/missed-call.d.ts +9 -0
- package/dist/phone/handlers/voicemail.d.ts +10 -0
- package/dist/phone/index.d.ts +5 -0
- package/dist/presets/api-backend.d.ts +11 -0
- package/dist/presets/data-pipeline.d.ts +11 -0
- package/dist/presets/extend.d.ts +194 -0
- package/dist/presets/extend.test.d.ts +4 -0
- package/dist/presets/fullstack-app.d.ts +12 -0
- package/dist/presets/index.d.ts +13 -0
- package/dist/presets/jamstack.d.ts +12 -0
- package/dist/presets/microservices.d.ts +18 -0
- package/dist/presets/ml-api.d.ts +13 -0
- package/dist/presets/nodejs-server.d.ts +14 -0
- package/dist/presets/nodejs-serverless.d.ts +14 -0
- package/dist/presets/realtime-app.d.ts +11 -0
- package/dist/presets/static-site.d.ts +12 -0
- package/dist/presets/traditional-web-app.d.ts +16 -0
- package/dist/presets/wordpress.d.ts +12 -0
- package/dist/preview/github.d.ts +32 -0
- package/dist/preview/github.test.d.ts +1 -0
- package/dist/preview/index.d.ts +10 -0
- package/dist/preview/manager.d.ts +101 -0
- package/dist/preview/manager.test.d.ts +1 -0
- package/dist/preview/notifications.d.ts +89 -0
- package/dist/preview/notifications.test.d.ts +1 -0
- package/dist/queue/batch-processing.d.ts +138 -0
- package/dist/queue/dlq-monitoring.d.ts +143 -0
- package/dist/queue/fifo.d.ts +131 -0
- package/dist/queue/index.d.ts +8 -0
- package/dist/queue/management.d.ts +162 -0
- package/dist/queue/queue.test.d.ts +1 -0
- package/dist/resource-mgmt/index.d.ts +44 -0
- package/dist/resource-naming.d.ts +26 -0
- package/dist/s3/index.d.ts +227 -0
- package/dist/schema/index.d.ts +12 -0
- package/dist/security/certificate-manager.d.ts +184 -0
- package/dist/security/index.d.ts +8 -0
- package/dist/security/scanning.d.ts +196 -0
- package/dist/security/secrets-manager.d.ts +204 -0
- package/dist/security/secrets-rotation.d.ts +167 -0
- package/dist/security/security.test.d.ts +1 -0
- package/dist/sms/advanced/ab-testing.d.ts +74 -0
- package/dist/sms/advanced/analytics.d.ts +75 -0
- package/dist/sms/advanced/campaigns.d.ts +96 -0
- package/dist/sms/advanced/chatbot.d.ts +67 -0
- package/dist/sms/advanced/index.d.ts +9 -0
- package/dist/sms/advanced/link-tracking.d.ts +60 -0
- package/dist/sms/advanced/mms.d.ts +60 -0
- package/dist/sms/handlers/__tests__/send.test.d.ts +1 -0
- package/dist/sms/handlers/delivery-status.d.ts +10 -0
- package/dist/sms/handlers/receive.d.ts +10 -0
- package/dist/sms/handlers/send.d.ts +10 -0
- package/dist/sms/index.d.ts +5 -0
- package/dist/stack-diff.d.ts +38 -0
- package/dist/static-site/index.d.ts +49 -0
- package/dist/template-builder.d.ts +42 -0
- package/dist/template-validator.d.ts +28 -0
- package/dist/types.d.ts +2514 -0
- package/dist/utils/cache.d.ts +117 -0
- package/dist/utils/diff.d.ts +52 -0
- package/dist/utils/hash.d.ts +73 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/parallel.d.ts +78 -0
- package/dist/validators/credentials.d.ts +30 -0
- package/dist/validators/credentials.test.d.ts +4 -0
- package/dist/validators/quotas.d.ts +64 -0
- package/dist/validators/quotas.test.d.ts +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { ECRRepository } from '@ts-cloud/aws-types';
|
|
2
|
+
import type { EnvironmentType } from '../types';
|
|
3
|
+
export interface RegistryOptions {
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
environment: EnvironmentType;
|
|
7
|
+
scanOnPush?: boolean;
|
|
8
|
+
imageMutability?: 'MUTABLE' | 'IMMUTABLE';
|
|
9
|
+
encryption?: 'AES256' | 'KMS';
|
|
10
|
+
kmsKey?: string;
|
|
11
|
+
lifecyclePolicy?: LifecyclePolicyConfig;
|
|
12
|
+
tags?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface LifecyclePolicyConfig {
|
|
15
|
+
maxImageCount?: number;
|
|
16
|
+
maxImageAgeDays?: number;
|
|
17
|
+
untaggedImageExpireDays?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Registry Module - ECR Container Registry Management
|
|
21
|
+
* Provides clean API for creating and configuring ECR repositories
|
|
22
|
+
*/
|
|
23
|
+
export declare class Registry {
|
|
24
|
+
/**
|
|
25
|
+
* Create an ECR repository with the specified options
|
|
26
|
+
*/
|
|
27
|
+
static createRepository(options: RegistryOptions): {
|
|
28
|
+
repository: ECRRepository;
|
|
29
|
+
logicalId: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Generate lifecycle policy from config
|
|
33
|
+
*/
|
|
34
|
+
private static generateLifecyclePolicy;
|
|
35
|
+
/**
|
|
36
|
+
* Common lifecycle policy presets
|
|
37
|
+
*/
|
|
38
|
+
static readonly LifecyclePolicies: {
|
|
39
|
+
/**
|
|
40
|
+
* Keep only the 10 most recent images, delete untagged after 7 days
|
|
41
|
+
*/
|
|
42
|
+
production: {
|
|
43
|
+
maxImageCount: number;
|
|
44
|
+
untaggedImageExpireDays: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Keep only the 5 most recent images, delete untagged after 3 days
|
|
48
|
+
*/
|
|
49
|
+
development: {
|
|
50
|
+
maxImageCount: number;
|
|
51
|
+
untaggedImageExpireDays: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Aggressive cleanup - keep 3 images, delete untagged after 1 day
|
|
55
|
+
*/
|
|
56
|
+
minimal: {
|
|
57
|
+
maxImageCount: number;
|
|
58
|
+
untaggedImageExpireDays: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Long-term storage - keep 50 images, delete untagged after 30 days
|
|
62
|
+
*/
|
|
63
|
+
archive: {
|
|
64
|
+
maxImageCount: number;
|
|
65
|
+
untaggedImageExpireDays: number;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Enable immutable tags on an existing repository
|
|
70
|
+
*/
|
|
71
|
+
static enableImmutableTags(repository: ECRRepository): ECRRepository;
|
|
72
|
+
/**
|
|
73
|
+
* Enable scan on push
|
|
74
|
+
*/
|
|
75
|
+
static enableScanOnPush(repository: ECRRepository): ECRRepository;
|
|
76
|
+
/**
|
|
77
|
+
* Set lifecycle policy on an existing repository
|
|
78
|
+
*/
|
|
79
|
+
static setLifecyclePolicy(repository: ECRRepository, config: LifecyclePolicyConfig): ECRRepository;
|
|
80
|
+
/**
|
|
81
|
+
* Add repository policy for cross-account access
|
|
82
|
+
*/
|
|
83
|
+
static addCrossAccountAccess(repository: ECRRepository, accountIds: string[]): ECRRepository;
|
|
84
|
+
/**
|
|
85
|
+
* Add repository policy for Lambda service access
|
|
86
|
+
*/
|
|
87
|
+
static addLambdaAccess(repository: ECRRepository): ECRRepository;
|
|
88
|
+
/**
|
|
89
|
+
* Generate a Dockerfile for Bun-based applications
|
|
90
|
+
*/
|
|
91
|
+
static generateBunDockerfile(options: {
|
|
92
|
+
baseImage?: string;
|
|
93
|
+
serverPath: string;
|
|
94
|
+
port?: number;
|
|
95
|
+
additionalDirs?: string[];
|
|
96
|
+
healthCheckEndpoint?: string;
|
|
97
|
+
nodeCompatible?: boolean;
|
|
98
|
+
envVars?: Record<string, string>;
|
|
99
|
+
buildCommands?: string[];
|
|
100
|
+
runCommand?: string;
|
|
101
|
+
}): string;
|
|
102
|
+
/**
|
|
103
|
+
* Generate Docker build commands
|
|
104
|
+
*/
|
|
105
|
+
static generateDockerBuildCommands(options: {
|
|
106
|
+
repositoryUri: string;
|
|
107
|
+
tag?: string;
|
|
108
|
+
dockerfilePath?: string;
|
|
109
|
+
context?: string;
|
|
110
|
+
additionalTags?: string[];
|
|
111
|
+
buildArgs?: Record<string, string>;
|
|
112
|
+
platform?: string;
|
|
113
|
+
noCache?: boolean;
|
|
114
|
+
}): {
|
|
115
|
+
build: string;
|
|
116
|
+
tag: string[];
|
|
117
|
+
push: string[];
|
|
118
|
+
all: string[];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Generate ECR login command
|
|
122
|
+
*/
|
|
123
|
+
static generateEcrLoginCommand(region: string, accountId: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* Build ECR repository URI
|
|
126
|
+
*/
|
|
127
|
+
static buildRepositoryUri(options: {
|
|
128
|
+
accountId: string;
|
|
129
|
+
region: string;
|
|
130
|
+
repositoryName: string;
|
|
131
|
+
}): string;
|
|
132
|
+
/**
|
|
133
|
+
* Generate image tags based on deployment info
|
|
134
|
+
*/
|
|
135
|
+
static generateImageTags(options: {
|
|
136
|
+
version?: string;
|
|
137
|
+
gitSha?: string;
|
|
138
|
+
gitBranch?: string;
|
|
139
|
+
environment?: string;
|
|
140
|
+
timestamp?: boolean;
|
|
141
|
+
}): string[];
|
|
142
|
+
/**
|
|
143
|
+
* Docker deployment workflow steps
|
|
144
|
+
*/
|
|
145
|
+
static readonly DeploymentWorkflow: {
|
|
146
|
+
/**
|
|
147
|
+
* Generate a complete deployment script
|
|
148
|
+
*/
|
|
149
|
+
generateDeployScript: (options: {
|
|
150
|
+
region: string;
|
|
151
|
+
accountId: string;
|
|
152
|
+
repositoryName: string;
|
|
153
|
+
dockerfilePath?: string;
|
|
154
|
+
serverPath: string;
|
|
155
|
+
tags?: string[];
|
|
156
|
+
}) => string;
|
|
157
|
+
/**
|
|
158
|
+
* Generate GitHub Actions workflow for ECR deployment
|
|
159
|
+
*/
|
|
160
|
+
generateGitHubActionsWorkflow: (options: {
|
|
161
|
+
region: string;
|
|
162
|
+
repositoryName: string;
|
|
163
|
+
dockerfilePath?: string;
|
|
164
|
+
ecsCluster?: string;
|
|
165
|
+
ecsService?: string;
|
|
166
|
+
}) => string;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Common Dockerfile templates
|
|
170
|
+
*/
|
|
171
|
+
static readonly DockerfileTemplates: {
|
|
172
|
+
/**
|
|
173
|
+
* Minimal Bun server
|
|
174
|
+
*/
|
|
175
|
+
bunServer: (serverPath: string, port?: number) => string;
|
|
176
|
+
/**
|
|
177
|
+
* Bun with build step
|
|
178
|
+
*/
|
|
179
|
+
bunWithBuild: (serverPath: string, buildCommand: string, port?: number) => string;
|
|
180
|
+
/**
|
|
181
|
+
* Full-stack Bun app with static files
|
|
182
|
+
*/
|
|
183
|
+
bunFullStack: (serverPath: string, port?: number) => string;
|
|
184
|
+
/**
|
|
185
|
+
* API-only Bun server
|
|
186
|
+
*/
|
|
187
|
+
bunApi: (serverPath: string, port?: number) => string;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search Module (OpenSearch/Elasticsearch)
|
|
3
|
+
* Clean API for AWS OpenSearch Service
|
|
4
|
+
*/
|
|
5
|
+
import type { OpenSearchDomain } from '@ts-cloud/aws-types';
|
|
6
|
+
export interface SearchDomainOptions {
|
|
7
|
+
slug: string;
|
|
8
|
+
environment: string;
|
|
9
|
+
domainName?: string;
|
|
10
|
+
engineVersion?: string;
|
|
11
|
+
instanceType?: string;
|
|
12
|
+
instanceCount?: number;
|
|
13
|
+
volumeSize?: number;
|
|
14
|
+
volumeType?: 'gp2' | 'gp3' | 'io1';
|
|
15
|
+
dedicatedMaster?: boolean;
|
|
16
|
+
dedicatedMasterType?: string;
|
|
17
|
+
dedicatedMasterCount?: number;
|
|
18
|
+
multiAz?: boolean;
|
|
19
|
+
availabilityZoneCount?: number;
|
|
20
|
+
vpc?: {
|
|
21
|
+
subnetIds: Array<string | {
|
|
22
|
+
Ref: string;
|
|
23
|
+
}>;
|
|
24
|
+
securityGroupIds: Array<string | {
|
|
25
|
+
Ref: string;
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
encryption?: {
|
|
29
|
+
atRest?: boolean;
|
|
30
|
+
kmsKeyId?: string | {
|
|
31
|
+
Ref: string;
|
|
32
|
+
};
|
|
33
|
+
nodeToNode?: boolean;
|
|
34
|
+
};
|
|
35
|
+
enforceHttps?: boolean;
|
|
36
|
+
tlsSecurityPolicy?: 'Policy-Min-TLS-1-0-2019-07' | 'Policy-Min-TLS-1-2-2019-07';
|
|
37
|
+
advancedSecurity?: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
internalUserDatabase?: boolean;
|
|
40
|
+
masterUserName?: string;
|
|
41
|
+
masterUserPassword?: string;
|
|
42
|
+
masterUserArn?: string | {
|
|
43
|
+
Ref: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
autoSnapshotHour?: number;
|
|
47
|
+
autoTune?: boolean;
|
|
48
|
+
tags?: Record<string, string>;
|
|
49
|
+
}
|
|
50
|
+
export interface AccessPolicyOptions {
|
|
51
|
+
ipAddresses?: string[];
|
|
52
|
+
iamPrincipalArns?: Array<string | {
|
|
53
|
+
Ref: string;
|
|
54
|
+
}>;
|
|
55
|
+
allowAll?: boolean;
|
|
56
|
+
vpcEndpoint?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Search class for OpenSearch/Elasticsearch operations
|
|
60
|
+
*/
|
|
61
|
+
export declare class Search {
|
|
62
|
+
/**
|
|
63
|
+
* Create an OpenSearch domain
|
|
64
|
+
*/
|
|
65
|
+
static createDomain(options: SearchDomainOptions): {
|
|
66
|
+
domain: OpenSearchDomain;
|
|
67
|
+
logicalId: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Create access policy for OpenSearch domain
|
|
71
|
+
*/
|
|
72
|
+
static createAccessPolicy(domainArn: string | {
|
|
73
|
+
'Fn::GetAtt': [string, string];
|
|
74
|
+
}, options: AccessPolicyOptions): Record<string, any>;
|
|
75
|
+
/**
|
|
76
|
+
* Common domain configurations
|
|
77
|
+
*/
|
|
78
|
+
static readonly DomainPresets: {
|
|
79
|
+
/**
|
|
80
|
+
* Development domain (small, single node)
|
|
81
|
+
*/
|
|
82
|
+
development: (slug: string, environment: string) => {
|
|
83
|
+
domain: OpenSearchDomain;
|
|
84
|
+
logicalId: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Production domain (HA, multi-AZ)
|
|
88
|
+
*/
|
|
89
|
+
production: (slug: string, environment: string, vpc?: SearchDomainOptions["vpc"]) => {
|
|
90
|
+
domain: OpenSearchDomain;
|
|
91
|
+
logicalId: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Cost-optimized domain (bursting workloads)
|
|
95
|
+
*/
|
|
96
|
+
costOptimized: (slug: string, environment: string) => {
|
|
97
|
+
domain: OpenSearchDomain;
|
|
98
|
+
logicalId: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* High-performance domain (analytics, large datasets)
|
|
102
|
+
*/
|
|
103
|
+
highPerformance: (slug: string, environment: string, vpc: SearchDomainOptions["vpc"]) => {
|
|
104
|
+
domain: OpenSearchDomain;
|
|
105
|
+
logicalId: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Common instance types
|
|
110
|
+
*/
|
|
111
|
+
static readonly InstanceTypes: {
|
|
112
|
+
't3.small.search': string;
|
|
113
|
+
't3.medium.search': string;
|
|
114
|
+
'm6g.large.search': string;
|
|
115
|
+
'm6g.xlarge.search': string;
|
|
116
|
+
'm6g.2xlarge.search': string;
|
|
117
|
+
'r6g.large.search': string;
|
|
118
|
+
'r6g.xlarge.search': string;
|
|
119
|
+
'r6g.2xlarge.search': string;
|
|
120
|
+
'r6g.4xlarge.search': string;
|
|
121
|
+
'c6g.large.search': string;
|
|
122
|
+
'c6g.xlarge.search': string;
|
|
123
|
+
'c6g.2xlarge.search': string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Common engine versions
|
|
127
|
+
*/
|
|
128
|
+
static readonly EngineVersions: {
|
|
129
|
+
'OpenSearch_2.11': string;
|
|
130
|
+
'OpenSearch_2.9': string;
|
|
131
|
+
'OpenSearch_2.7': string;
|
|
132
|
+
'OpenSearch_1.3': string;
|
|
133
|
+
'Elasticsearch_7.10': string;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secrets Manager Module
|
|
3
|
+
* Clean API for AWS Secrets Manager
|
|
4
|
+
*/
|
|
5
|
+
import type { SecretsManagerSecret, SecretsManagerSecretTargetAttachment, SecretsManagerRotationSchedule } from '@ts-cloud/aws-types';
|
|
6
|
+
export interface SecretOptions {
|
|
7
|
+
slug: string;
|
|
8
|
+
environment: string;
|
|
9
|
+
secretName?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
secretString?: string;
|
|
12
|
+
kmsKeyId?: string;
|
|
13
|
+
tags?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
export interface GeneratedSecretOptions {
|
|
16
|
+
slug: string;
|
|
17
|
+
environment: string;
|
|
18
|
+
secretName?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
excludeCharacters?: string;
|
|
21
|
+
excludeLowercase?: boolean;
|
|
22
|
+
excludeNumbers?: boolean;
|
|
23
|
+
excludePunctuation?: boolean;
|
|
24
|
+
excludeUppercase?: boolean;
|
|
25
|
+
passwordLength?: number;
|
|
26
|
+
requireEachIncludedType?: boolean;
|
|
27
|
+
kmsKeyId?: string;
|
|
28
|
+
tags?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
export interface SecretTargetAttachmentOptions {
|
|
31
|
+
slug: string;
|
|
32
|
+
environment: string;
|
|
33
|
+
secretId: string;
|
|
34
|
+
targetId: string;
|
|
35
|
+
targetType: 'AWS::RDS::DBInstance' | 'AWS::RDS::DBCluster' | 'AWS::Redshift::Cluster' | 'AWS::DocDB::DBInstance' | 'AWS::DocDB::DBCluster';
|
|
36
|
+
}
|
|
37
|
+
export interface SecretRotationOptions {
|
|
38
|
+
slug: string;
|
|
39
|
+
environment: string;
|
|
40
|
+
secretId: string;
|
|
41
|
+
rotationLambdaArn?: string;
|
|
42
|
+
automaticallyAfterDays?: number;
|
|
43
|
+
rotationType?: string;
|
|
44
|
+
kmsKeyArn?: string;
|
|
45
|
+
vpcSecurityGroupIds?: string;
|
|
46
|
+
vpcSubnetIds?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Secrets Manager Module
|
|
50
|
+
*/
|
|
51
|
+
export declare class Secrets {
|
|
52
|
+
/**
|
|
53
|
+
* Create a secret with explicit value
|
|
54
|
+
*/
|
|
55
|
+
static createSecret(options: SecretOptions): {
|
|
56
|
+
secret: SecretsManagerSecret;
|
|
57
|
+
logicalId: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Create a secret with auto-generated value
|
|
61
|
+
*/
|
|
62
|
+
static createGeneratedSecret(options: GeneratedSecretOptions): {
|
|
63
|
+
secret: SecretsManagerSecret;
|
|
64
|
+
logicalId: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Create a database secret with username and password
|
|
68
|
+
*/
|
|
69
|
+
static createDatabaseSecret(options: {
|
|
70
|
+
slug: string;
|
|
71
|
+
environment: string;
|
|
72
|
+
secretName?: string;
|
|
73
|
+
username: string;
|
|
74
|
+
dbname?: string;
|
|
75
|
+
engine?: string;
|
|
76
|
+
host?: string;
|
|
77
|
+
port?: number;
|
|
78
|
+
kmsKeyId?: string;
|
|
79
|
+
}): {
|
|
80
|
+
secret: SecretsManagerSecret;
|
|
81
|
+
logicalId: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Attach secret to RDS database for automatic rotation
|
|
85
|
+
*/
|
|
86
|
+
static attachToDatabase(options: SecretTargetAttachmentOptions): {
|
|
87
|
+
attachment: SecretsManagerSecretTargetAttachment;
|
|
88
|
+
logicalId: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Enable automatic rotation for a secret
|
|
92
|
+
*/
|
|
93
|
+
static enableRotation(options: SecretRotationOptions): {
|
|
94
|
+
rotation: SecretsManagerRotationSchedule;
|
|
95
|
+
logicalId: string;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Common secret types
|
|
99
|
+
*/
|
|
100
|
+
static readonly SecretTypes: {
|
|
101
|
+
/**
|
|
102
|
+
* API key secret (32 chars, alphanumeric only)
|
|
103
|
+
*/
|
|
104
|
+
apiKey: (slug: string, environment: string, serviceName: string) => {
|
|
105
|
+
secret: SecretsManagerSecret;
|
|
106
|
+
logicalId: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* OAuth client secret (strong password)
|
|
110
|
+
*/
|
|
111
|
+
oauthClientSecret: (slug: string, environment: string, clientName: string) => {
|
|
112
|
+
secret: SecretsManagerSecret;
|
|
113
|
+
logicalId: string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* JWT signing secret
|
|
117
|
+
*/
|
|
118
|
+
jwtSecret: (slug: string, environment: string) => {
|
|
119
|
+
secret: SecretsManagerSecret;
|
|
120
|
+
logicalId: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Encryption key (base64-compatible)
|
|
124
|
+
*/
|
|
125
|
+
encryptionKey: (slug: string, environment: string) => {
|
|
126
|
+
secret: SecretsManagerSecret;
|
|
127
|
+
logicalId: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Common rotation types for hosted rotation
|
|
132
|
+
*/
|
|
133
|
+
static readonly RotationTypes: {
|
|
134
|
+
MySQLSingleUser: string;
|
|
135
|
+
MySQLMultiUser: string;
|
|
136
|
+
PostgreSQLSingleUser: string;
|
|
137
|
+
PostgreSQLMultiUser: string;
|
|
138
|
+
OracleSingleUser: string;
|
|
139
|
+
OracleMultiUser: string;
|
|
140
|
+
MariaDBSingleUser: string;
|
|
141
|
+
MariaDBMultiUser: string;
|
|
142
|
+
SQLServerSingleUser: string;
|
|
143
|
+
SQLServerMultiUser: string;
|
|
144
|
+
RedshiftSingleUser: string;
|
|
145
|
+
RedshiftMultiUser: string;
|
|
146
|
+
MongoDBSingleUser: string;
|
|
147
|
+
MongoDBMultiUser: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type { ACMCertificate, KMSAlias, KMSKey, WAFv2IPSet, WAFv2WebACL } from '@ts-cloud/aws-types';
|
|
2
|
+
import type { EnvironmentType } from '../types';
|
|
3
|
+
export interface CertificateOptions {
|
|
4
|
+
domain: string;
|
|
5
|
+
subdomains?: string[];
|
|
6
|
+
slug: string;
|
|
7
|
+
environment: EnvironmentType;
|
|
8
|
+
validationMethod?: 'DNS' | 'EMAIL';
|
|
9
|
+
hostedZoneId?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface KmsKeyOptions {
|
|
12
|
+
description: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
environment: EnvironmentType;
|
|
15
|
+
enableRotation?: boolean;
|
|
16
|
+
multiRegion?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface FirewallOptions {
|
|
19
|
+
slug: string;
|
|
20
|
+
environment: EnvironmentType;
|
|
21
|
+
scope?: 'CLOUDFRONT' | 'REGIONAL';
|
|
22
|
+
defaultAction?: 'allow' | 'block';
|
|
23
|
+
}
|
|
24
|
+
export interface RateLimitRule {
|
|
25
|
+
name: string;
|
|
26
|
+
priority: number;
|
|
27
|
+
requestsPerWindow: number;
|
|
28
|
+
aggregateKeyType?: 'IP' | 'FORWARDED_IP';
|
|
29
|
+
}
|
|
30
|
+
export interface GeoBlockRule {
|
|
31
|
+
name: string;
|
|
32
|
+
priority: number;
|
|
33
|
+
countryCodes: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface IpBlockRule {
|
|
36
|
+
name: string;
|
|
37
|
+
priority: number;
|
|
38
|
+
ipAddresses: string[];
|
|
39
|
+
ipVersion?: 'IPV4' | 'IPV6';
|
|
40
|
+
}
|
|
41
|
+
export interface ManagedRuleGroup {
|
|
42
|
+
name: string;
|
|
43
|
+
priority: number;
|
|
44
|
+
vendorName: string;
|
|
45
|
+
ruleName: string;
|
|
46
|
+
excludedRules?: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Security Module - ACM, KMS, WAF Management
|
|
50
|
+
* Provides clean API for creating and configuring security resources
|
|
51
|
+
*/
|
|
52
|
+
export declare class Security {
|
|
53
|
+
/**
|
|
54
|
+
* Create an SSL/TLS certificate with ACM
|
|
55
|
+
*/
|
|
56
|
+
static createCertificate(options: CertificateOptions): {
|
|
57
|
+
certificate: ACMCertificate;
|
|
58
|
+
logicalId: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Create a KMS encryption key
|
|
62
|
+
*/
|
|
63
|
+
static createKmsKey(options: KmsKeyOptions): {
|
|
64
|
+
key: KMSKey;
|
|
65
|
+
alias?: KMSAlias;
|
|
66
|
+
logicalId: string;
|
|
67
|
+
aliasId?: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Create a WAF Web ACL
|
|
71
|
+
*/
|
|
72
|
+
static createFirewall(options: FirewallOptions): {
|
|
73
|
+
webAcl: WAFv2WebACL;
|
|
74
|
+
logicalId: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Add rate limiting to a Web ACL
|
|
78
|
+
*/
|
|
79
|
+
static setRateLimit(webAcl: WAFv2WebACL, rule: RateLimitRule): WAFv2WebACL;
|
|
80
|
+
/**
|
|
81
|
+
* Block specific countries
|
|
82
|
+
*/
|
|
83
|
+
static blockCountries(webAcl: WAFv2WebACL, rule: GeoBlockRule): WAFv2WebACL;
|
|
84
|
+
/**
|
|
85
|
+
* Block specific IP addresses
|
|
86
|
+
*/
|
|
87
|
+
static blockIpAddresses(webAcl: WAFv2WebACL, rule: IpBlockRule, slug: string, environment: EnvironmentType): {
|
|
88
|
+
webAcl: WAFv2WebACL;
|
|
89
|
+
ipSet: WAFv2IPSet;
|
|
90
|
+
ipSetLogicalId: string;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Add AWS Managed Rules
|
|
94
|
+
*/
|
|
95
|
+
static addManagedRules(webAcl: WAFv2WebACL, rule: ManagedRuleGroup): WAFv2WebACL;
|
|
96
|
+
/**
|
|
97
|
+
* Common managed rule groups from AWS
|
|
98
|
+
*/
|
|
99
|
+
static readonly ManagedRuleGroups: {
|
|
100
|
+
/**
|
|
101
|
+
* AWS Core Rule Set - protects against common threats
|
|
102
|
+
*/
|
|
103
|
+
readonly CoreRuleSet: {
|
|
104
|
+
readonly vendorName: "AWS";
|
|
105
|
+
readonly ruleName: "AWSManagedRulesCommonRuleSet";
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Known Bad Inputs - blocks patterns known to be invalid
|
|
109
|
+
*/
|
|
110
|
+
readonly KnownBadInputs: {
|
|
111
|
+
readonly vendorName: "AWS";
|
|
112
|
+
readonly ruleName: "AWSManagedRulesKnownBadInputsRuleSet";
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* SQL Database - protects against SQL injection
|
|
116
|
+
*/
|
|
117
|
+
readonly SqlDatabase: {
|
|
118
|
+
readonly vendorName: "AWS";
|
|
119
|
+
readonly ruleName: "AWSManagedRulesSQLiRuleSet";
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Linux Operating System - protects against Linux-specific exploits
|
|
123
|
+
*/
|
|
124
|
+
readonly LinuxOS: {
|
|
125
|
+
readonly vendorName: "AWS";
|
|
126
|
+
readonly ruleName: "AWSManagedRulesLinuxRuleSet";
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* POSIX Operating System - protects against POSIX-specific exploits
|
|
130
|
+
*/
|
|
131
|
+
readonly PosixOS: {
|
|
132
|
+
readonly vendorName: "AWS";
|
|
133
|
+
readonly ruleName: "AWSManagedRulesUnixRuleSet";
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Amazon IP Reputation List - blocks IPs with poor reputation
|
|
137
|
+
*/
|
|
138
|
+
readonly AmazonIpReputation: {
|
|
139
|
+
readonly vendorName: "AWS";
|
|
140
|
+
readonly ruleName: "AWSManagedRulesAmazonIpReputationList";
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Anonymous IP List - blocks requests from anonymizing services
|
|
144
|
+
*/
|
|
145
|
+
readonly AnonymousIpList: {
|
|
146
|
+
readonly vendorName: "AWS";
|
|
147
|
+
readonly ruleName: "AWSManagedRulesAnonymousIpList";
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Bot Control - protects against bots and scrapers
|
|
151
|
+
*/
|
|
152
|
+
readonly BotControl: {
|
|
153
|
+
readonly vendorName: "AWS";
|
|
154
|
+
readonly ruleName: "AWSManagedRulesBotControlRuleSet";
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Add path-based rate limiting
|
|
159
|
+
* Rate limit specific URL paths (e.g., login, API endpoints)
|
|
160
|
+
*/
|
|
161
|
+
static setPathRateLimit(webAcl: WAFv2WebACL, rule: RateLimitRule & {
|
|
162
|
+
paths: string[];
|
|
163
|
+
}): WAFv2WebACL;
|
|
164
|
+
/**
|
|
165
|
+
* Add header-based rate limiting
|
|
166
|
+
* Useful for API key or user-based rate limiting
|
|
167
|
+
*/
|
|
168
|
+
static setHeaderRateLimit(webAcl: WAFv2WebACL, rule: RateLimitRule & {
|
|
169
|
+
headerName: string;
|
|
170
|
+
headerValue?: string;
|
|
171
|
+
}): WAFv2WebACL;
|
|
172
|
+
/**
|
|
173
|
+
* Add login endpoint protection
|
|
174
|
+
* Combines rate limiting with common attack patterns
|
|
175
|
+
*/
|
|
176
|
+
static protectLoginEndpoint(webAcl: WAFv2WebACL, options: {
|
|
177
|
+
loginPaths: string[];
|
|
178
|
+
priority: number;
|
|
179
|
+
requestsPerMinute?: number;
|
|
180
|
+
}): WAFv2WebACL;
|
|
181
|
+
/**
|
|
182
|
+
* Add API rate limiting
|
|
183
|
+
* Apply stricter limits on API endpoints
|
|
184
|
+
*/
|
|
185
|
+
static protectApiEndpoints(webAcl: WAFv2WebACL, options: {
|
|
186
|
+
apiPaths: string[];
|
|
187
|
+
priority: number;
|
|
188
|
+
requestsPerMinute?: number;
|
|
189
|
+
}): WAFv2WebACL;
|
|
190
|
+
/**
|
|
191
|
+
* Create a comprehensive WAF with common protections
|
|
192
|
+
*/
|
|
193
|
+
static createProtectedFirewall(options: {
|
|
194
|
+
slug: string;
|
|
195
|
+
environment: EnvironmentType;
|
|
196
|
+
scope?: 'CLOUDFRONT' | 'REGIONAL';
|
|
197
|
+
enableBotControl?: boolean;
|
|
198
|
+
enableRateLimiting?: boolean;
|
|
199
|
+
rateLimitPerMinute?: number;
|
|
200
|
+
}): {
|
|
201
|
+
webAcl: WAFv2WebACL;
|
|
202
|
+
logicalId: string;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Common rate limit presets
|
|
206
|
+
*/
|
|
207
|
+
static readonly RateLimitPresets: {
|
|
208
|
+
/** Standard website: 2000 requests per minute per IP */
|
|
209
|
+
readonly STANDARD: 2000;
|
|
210
|
+
/** High-traffic API: 10000 requests per minute per IP */
|
|
211
|
+
readonly HIGH_TRAFFIC: 10000;
|
|
212
|
+
/** Aggressive protection: 100 requests per minute per IP */
|
|
213
|
+
readonly STRICT: 100;
|
|
214
|
+
/** Login protection: 10 requests per minute per IP */
|
|
215
|
+
readonly LOGIN: 10;
|
|
216
|
+
/** API endpoint: 100 requests per minute per IP */
|
|
217
|
+
readonly API: 100;
|
|
218
|
+
};
|
|
219
|
+
}
|