@ts-cloud/core 0.2.3 → 0.2.5
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,148 @@
|
|
|
1
|
+
import type { EC2EIP, EC2FlowLog, EC2InternetGateway, EC2NatGateway, EC2Route, EC2RouteTable, EC2Subnet, EC2SubnetRouteTableAssociation, EC2VPC, EC2VPCGatewayAttachment } from '@ts-cloud/aws-types';
|
|
2
|
+
import type { EnvironmentType } from '../types';
|
|
3
|
+
export interface VpcOptions {
|
|
4
|
+
slug: string;
|
|
5
|
+
environment: EnvironmentType;
|
|
6
|
+
cidr?: string;
|
|
7
|
+
enableDnsHostnames?: boolean;
|
|
8
|
+
enableDnsSupport?: boolean;
|
|
9
|
+
zones?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SubnetOptions {
|
|
12
|
+
slug: string;
|
|
13
|
+
environment: EnvironmentType;
|
|
14
|
+
vpcId: string;
|
|
15
|
+
type: 'public' | 'private' | 'isolated';
|
|
16
|
+
cidr: string;
|
|
17
|
+
availabilityZone: string;
|
|
18
|
+
mapPublicIp?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface NatGatewayOptions {
|
|
21
|
+
slug: string;
|
|
22
|
+
environment: EnvironmentType;
|
|
23
|
+
subnetId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface FlowLogOptions {
|
|
26
|
+
slug: string;
|
|
27
|
+
environment: EnvironmentType;
|
|
28
|
+
resourceId: string;
|
|
29
|
+
resourceType: 'VPC' | 'Subnet';
|
|
30
|
+
trafficType?: 'ACCEPT' | 'REJECT' | 'ALL';
|
|
31
|
+
logGroupName?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Network Module - VPC, Subnets, NAT, Internet Gateway
|
|
35
|
+
* Provides clean API for creating and configuring networking resources
|
|
36
|
+
*/
|
|
37
|
+
export declare class Network {
|
|
38
|
+
/**
|
|
39
|
+
* Create a VPC with optional multi-AZ configuration
|
|
40
|
+
*/
|
|
41
|
+
static createVpc(options: VpcOptions): {
|
|
42
|
+
vpc: EC2VPC;
|
|
43
|
+
logicalId: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Create a subnet in a VPC
|
|
47
|
+
*/
|
|
48
|
+
static createSubnet(options: SubnetOptions): {
|
|
49
|
+
subnet: EC2Subnet;
|
|
50
|
+
logicalId: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Create Internet Gateway
|
|
54
|
+
*/
|
|
55
|
+
static createInternetGateway(slug: string, environment: EnvironmentType): {
|
|
56
|
+
internetGateway: EC2InternetGateway;
|
|
57
|
+
logicalId: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Attach Internet Gateway to VPC
|
|
61
|
+
*/
|
|
62
|
+
static attachInternetGateway(vpcLogicalId: string, igwLogicalId: string): {
|
|
63
|
+
attachment: EC2VPCGatewayAttachment;
|
|
64
|
+
logicalId: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Create Elastic IP for NAT Gateway
|
|
68
|
+
*/
|
|
69
|
+
static createEip(slug: string, environment: EnvironmentType): {
|
|
70
|
+
eip: EC2EIP;
|
|
71
|
+
logicalId: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Create NAT Gateway (with cost warning in comments)
|
|
75
|
+
*/
|
|
76
|
+
static createNatGateway(options: NatGatewayOptions, eipLogicalId: string): {
|
|
77
|
+
natGateway: EC2NatGateway;
|
|
78
|
+
logicalId: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Create Route Table
|
|
82
|
+
*/
|
|
83
|
+
static createRouteTable(slug: string, environment: EnvironmentType, vpcLogicalId: string, type: 'public' | 'private'): {
|
|
84
|
+
routeTable: EC2RouteTable;
|
|
85
|
+
logicalId: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Create Route (e.g., for Internet Gateway or NAT Gateway)
|
|
89
|
+
*/
|
|
90
|
+
static createRoute(routeTableLogicalId: string, destination: string, target: {
|
|
91
|
+
type: 'igw' | 'nat' | 'instance';
|
|
92
|
+
logicalId: string;
|
|
93
|
+
}): {
|
|
94
|
+
route: EC2Route;
|
|
95
|
+
logicalId: string;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Associate Subnet with Route Table
|
|
99
|
+
*/
|
|
100
|
+
static associateSubnetWithRouteTable(subnetLogicalId: string, routeTableLogicalId: string): {
|
|
101
|
+
association: EC2SubnetRouteTableAssociation;
|
|
102
|
+
logicalId: string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Enable VPC Flow Logs
|
|
106
|
+
*/
|
|
107
|
+
static enableFlowLogs(options: FlowLogOptions): {
|
|
108
|
+
flowLog: EC2FlowLog;
|
|
109
|
+
logicalId: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Calculate subnet CIDRs for a VPC
|
|
113
|
+
* Splits a VPC CIDR into smaller subnets
|
|
114
|
+
*/
|
|
115
|
+
static calculateSubnetCidrs(vpcCidr: string, zones: number, subnetsPerZone?: number): string[];
|
|
116
|
+
/**
|
|
117
|
+
* Get available availability zones for a region
|
|
118
|
+
* Returns zone suffixes (a, b, c, etc.)
|
|
119
|
+
*/
|
|
120
|
+
static getAvailabilityZones(region: string, count: number): string[];
|
|
121
|
+
/**
|
|
122
|
+
* Create a complete multi-AZ network setup with optional NAT Gateway
|
|
123
|
+
* This creates VPC, public/private subnets, IGW, and optionally NAT
|
|
124
|
+
*/
|
|
125
|
+
static createMultiAzNetwork(options: {
|
|
126
|
+
slug: string;
|
|
127
|
+
environment: EnvironmentType;
|
|
128
|
+
region: string;
|
|
129
|
+
cidr?: string;
|
|
130
|
+
zones?: number;
|
|
131
|
+
enableNatGateway?: boolean;
|
|
132
|
+
singleNatGateway?: boolean;
|
|
133
|
+
enableFlowLogs?: boolean;
|
|
134
|
+
}): {
|
|
135
|
+
resources: Record<string, any>;
|
|
136
|
+
outputs: {
|
|
137
|
+
vpcId: string;
|
|
138
|
+
publicSubnetIds: string[];
|
|
139
|
+
privateSubnetIds: string[];
|
|
140
|
+
natGatewayIds?: string[];
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* NAT Gateway cost warning
|
|
145
|
+
* NAT Gateways cost ~$32/month plus data transfer charges
|
|
146
|
+
*/
|
|
147
|
+
static readonly NatGatewayCostWarning = "\n\u26A0\uFE0F NAT Gateway Cost Warning:\n- Each NAT Gateway costs approximately $32-45/month (hourly charges)\n- Data processing charges: $0.045/GB processed\n- For development environments, consider:\n - Using a single NAT Gateway (singleNatGateway: true)\n - Using NAT Instances instead (cheaper but requires management)\n - Disabling NAT entirely for isolated private subnets\n";
|
|
148
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Systems Manager Parameter Store Module
|
|
3
|
+
* Clean API for AWS SSM Parameter Store
|
|
4
|
+
*/
|
|
5
|
+
import type { SSMParameter } from '@ts-cloud/aws-types';
|
|
6
|
+
export interface ParameterOptions {
|
|
7
|
+
slug: string;
|
|
8
|
+
environment: string;
|
|
9
|
+
parameterName?: string;
|
|
10
|
+
value: string;
|
|
11
|
+
type?: 'String' | 'StringList' | 'SecureString';
|
|
12
|
+
description?: string;
|
|
13
|
+
tier?: 'Standard' | 'Advanced' | 'Intelligent-Tiering';
|
|
14
|
+
tags?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parameter Store Module
|
|
18
|
+
*/
|
|
19
|
+
export declare class ParameterStore {
|
|
20
|
+
/**
|
|
21
|
+
* Create a parameter
|
|
22
|
+
*/
|
|
23
|
+
static createParameter(options: ParameterOptions): {
|
|
24
|
+
parameter: SSMParameter;
|
|
25
|
+
logicalId: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Create a string parameter
|
|
29
|
+
*/
|
|
30
|
+
static createString(slug: string, environment: string, name: string, value: string, description?: string): {
|
|
31
|
+
parameter: SSMParameter;
|
|
32
|
+
logicalId: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Create a secure string parameter (encrypted)
|
|
36
|
+
*/
|
|
37
|
+
static createSecureString(slug: string, environment: string, name: string, value: string, description?: string): {
|
|
38
|
+
parameter: SSMParameter;
|
|
39
|
+
logicalId: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Create a string list parameter (comma-separated)
|
|
43
|
+
*/
|
|
44
|
+
static createStringList(slug: string, environment: string, name: string, values: string[], description?: string): {
|
|
45
|
+
parameter: SSMParameter;
|
|
46
|
+
logicalId: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Common parameter patterns
|
|
50
|
+
*/
|
|
51
|
+
static readonly Parameters: {
|
|
52
|
+
/**
|
|
53
|
+
* Database connection string
|
|
54
|
+
*/
|
|
55
|
+
databaseUrl: (slug: string, environment: string, url: string) => {
|
|
56
|
+
parameter: SSMParameter;
|
|
57
|
+
logicalId: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* API endpoint
|
|
61
|
+
*/
|
|
62
|
+
apiEndpoint: (slug: string, environment: string, endpoint: string) => {
|
|
63
|
+
parameter: SSMParameter;
|
|
64
|
+
logicalId: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Application version
|
|
68
|
+
*/
|
|
69
|
+
appVersion: (slug: string, environment: string, version: string) => {
|
|
70
|
+
parameter: SSMParameter;
|
|
71
|
+
logicalId: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Feature flags (comma-separated list)
|
|
75
|
+
*/
|
|
76
|
+
featureFlags: (slug: string, environment: string, flags: string[]) => {
|
|
77
|
+
parameter: SSMParameter;
|
|
78
|
+
logicalId: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Third-party API key (secure)
|
|
82
|
+
*/
|
|
83
|
+
apiKey: (slug: string, environment: string, serviceName: string, key: string) => {
|
|
84
|
+
parameter: SSMParameter;
|
|
85
|
+
logicalId: string;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* OAuth credentials
|
|
89
|
+
*/
|
|
90
|
+
oauthCredentials: (slug: string, environment: string, clientId: string, clientSecret: string) => {
|
|
91
|
+
clientId: {
|
|
92
|
+
parameter: SSMParameter;
|
|
93
|
+
logicalId: string;
|
|
94
|
+
};
|
|
95
|
+
clientSecret: {
|
|
96
|
+
parameter: SSMParameter;
|
|
97
|
+
logicalId: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* SMTP credentials
|
|
102
|
+
*/
|
|
103
|
+
smtpCredentials: (slug: string, environment: string, username: string, password: string, host: string, port: number) => {
|
|
104
|
+
username: {
|
|
105
|
+
parameter: SSMParameter;
|
|
106
|
+
logicalId: string;
|
|
107
|
+
};
|
|
108
|
+
password: {
|
|
109
|
+
parameter: SSMParameter;
|
|
110
|
+
logicalId: string;
|
|
111
|
+
};
|
|
112
|
+
host: {
|
|
113
|
+
parameter: SSMParameter;
|
|
114
|
+
logicalId: string;
|
|
115
|
+
};
|
|
116
|
+
port: {
|
|
117
|
+
parameter: SSMParameter;
|
|
118
|
+
logicalId: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Redis connection
|
|
123
|
+
*/
|
|
124
|
+
redisUrl: (slug: string, environment: string, url: string) => {
|
|
125
|
+
parameter: SSMParameter;
|
|
126
|
+
logicalId: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* S3 bucket name
|
|
130
|
+
*/
|
|
131
|
+
s3Bucket: (slug: string, environment: string, bucketName: string) => {
|
|
132
|
+
parameter: SSMParameter;
|
|
133
|
+
logicalId: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* CloudFront distribution ID
|
|
137
|
+
*/
|
|
138
|
+
cloudFrontDistribution: (slug: string, environment: string, distributionId: string) => {
|
|
139
|
+
parameter: SSMParameter;
|
|
140
|
+
logicalId: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type { IAMAccessKey, IAMGroup, IAMInstanceProfile, IAMManagedPolicy, IAMRole, IAMUser } from '@ts-cloud/aws-types';
|
|
2
|
+
import type { EnvironmentType } from '../types';
|
|
3
|
+
export interface PolicyStatement {
|
|
4
|
+
sid?: string;
|
|
5
|
+
effect?: 'Allow' | 'Deny';
|
|
6
|
+
actions: string | string[];
|
|
7
|
+
resources: string | string[];
|
|
8
|
+
conditions?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface UserOptions {
|
|
11
|
+
slug: string;
|
|
12
|
+
environment: EnvironmentType;
|
|
13
|
+
userName?: string;
|
|
14
|
+
groups?: string[];
|
|
15
|
+
managedPolicyArns?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface RoleOptions {
|
|
18
|
+
slug: string;
|
|
19
|
+
environment: EnvironmentType;
|
|
20
|
+
roleName?: string;
|
|
21
|
+
servicePrincipal?: string | string[];
|
|
22
|
+
awsPrincipal?: string | string[];
|
|
23
|
+
managedPolicyArns?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface GroupOptions {
|
|
26
|
+
slug: string;
|
|
27
|
+
environment: EnvironmentType;
|
|
28
|
+
groupName?: string;
|
|
29
|
+
managedPolicyArns?: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface ManagedPolicyOptions {
|
|
32
|
+
slug: string;
|
|
33
|
+
environment: EnvironmentType;
|
|
34
|
+
policyName?: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
statements: PolicyStatement[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Permissions Module - IAM (Identity and Access Management)
|
|
40
|
+
* Provides clean API for creating users, roles, policies, and groups
|
|
41
|
+
*/
|
|
42
|
+
export declare class Permissions {
|
|
43
|
+
/**
|
|
44
|
+
* Create an IAM user
|
|
45
|
+
*/
|
|
46
|
+
static createUser(options: UserOptions): {
|
|
47
|
+
user: IAMUser;
|
|
48
|
+
logicalId: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Create an IAM role
|
|
52
|
+
*/
|
|
53
|
+
static createRole(options: RoleOptions): {
|
|
54
|
+
role: IAMRole;
|
|
55
|
+
logicalId: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Create an IAM group
|
|
59
|
+
*/
|
|
60
|
+
static createGroup(options: GroupOptions): {
|
|
61
|
+
group: IAMGroup;
|
|
62
|
+
logicalId: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Create a managed policy
|
|
66
|
+
*/
|
|
67
|
+
static createPolicy(options: ManagedPolicyOptions): {
|
|
68
|
+
policy: IAMManagedPolicy;
|
|
69
|
+
logicalId: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Attach a policy to a role
|
|
73
|
+
*/
|
|
74
|
+
static attachPolicyToRole(role: IAMRole, policyArn: string): IAMRole;
|
|
75
|
+
/**
|
|
76
|
+
* Attach a policy to a user
|
|
77
|
+
*/
|
|
78
|
+
static attachPolicyToUser(user: IAMUser, policyArn: string): IAMUser;
|
|
79
|
+
/**
|
|
80
|
+
* Attach a policy to a group
|
|
81
|
+
*/
|
|
82
|
+
static attachPolicyToGroup(group: IAMGroup, policyArn: string): IAMGroup;
|
|
83
|
+
/**
|
|
84
|
+
* Add inline policy to a role
|
|
85
|
+
*/
|
|
86
|
+
static addInlinePolicyToRole(role: IAMRole, policyName: string, statements: PolicyStatement[]): IAMRole;
|
|
87
|
+
/**
|
|
88
|
+
* Add inline policy to a user
|
|
89
|
+
*/
|
|
90
|
+
static addInlinePolicyToUser(user: IAMUser, policyName: string, statements: PolicyStatement[]): IAMUser;
|
|
91
|
+
/**
|
|
92
|
+
* Create an access key for programmatic access
|
|
93
|
+
*/
|
|
94
|
+
static createAccessKey(userLogicalId: string, options: {
|
|
95
|
+
slug: string;
|
|
96
|
+
environment: EnvironmentType;
|
|
97
|
+
status?: 'Active' | 'Inactive';
|
|
98
|
+
}): {
|
|
99
|
+
accessKey: IAMAccessKey;
|
|
100
|
+
logicalId: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Create an instance profile for EC2
|
|
104
|
+
*/
|
|
105
|
+
static createInstanceProfile(roleLogicalId: string, options: {
|
|
106
|
+
slug: string;
|
|
107
|
+
environment: EnvironmentType;
|
|
108
|
+
profileName?: string;
|
|
109
|
+
}): {
|
|
110
|
+
instanceProfile: IAMInstanceProfile;
|
|
111
|
+
logicalId: string;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* AWS Managed Policies (common)
|
|
115
|
+
*/
|
|
116
|
+
static readonly ManagedPolicies: {
|
|
117
|
+
readonly AdministratorAccess: "arn:aws:iam::aws:policy/AdministratorAccess";
|
|
118
|
+
readonly PowerUserAccess: "arn:aws:iam::aws:policy/PowerUserAccess";
|
|
119
|
+
readonly ReadOnlyAccess: "arn:aws:iam::aws:policy/ReadOnlyAccess";
|
|
120
|
+
readonly S3FullAccess: "arn:aws:iam::aws:policy/AmazonS3FullAccess";
|
|
121
|
+
readonly S3ReadOnlyAccess: "arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess";
|
|
122
|
+
readonly DynamoDBFullAccess: "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess";
|
|
123
|
+
readonly DynamoDBReadOnlyAccess: "arn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess";
|
|
124
|
+
readonly RDSFullAccess: "arn:aws:iam::aws:policy/AmazonRDSFullAccess";
|
|
125
|
+
readonly RDSReadOnlyAccess: "arn:aws:iam::aws:policy/AmazonRDSReadOnlyAccess";
|
|
126
|
+
readonly LambdaFullAccess: "arn:aws:iam::aws:policy/AWSLambda_FullAccess";
|
|
127
|
+
readonly LambdaReadOnlyAccess: "arn:aws:iam::aws:policy/AWSLambda_ReadOnlyAccess";
|
|
128
|
+
readonly LambdaBasicExecutionRole: "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole";
|
|
129
|
+
readonly LambdaVPCAccessExecutionRole: "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole";
|
|
130
|
+
readonly EC2FullAccess: "arn:aws:iam::aws:policy/AmazonEC2FullAccess";
|
|
131
|
+
readonly EC2ReadOnlyAccess: "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess";
|
|
132
|
+
readonly EC2ContainerRegistryReadOnly: "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly";
|
|
133
|
+
readonly EC2ContainerRegistryPowerUser: "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser";
|
|
134
|
+
readonly ECSTaskExecutionRole: "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy";
|
|
135
|
+
readonly ECSFullAccess: "arn:aws:iam::aws:policy/AmazonECS_FullAccess";
|
|
136
|
+
readonly CloudWatchFullAccess: "arn:aws:iam::aws:policy/CloudWatchFullAccess";
|
|
137
|
+
readonly CloudWatchLogsFullAccess: "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess";
|
|
138
|
+
readonly SESFullAccess: "arn:aws:iam::aws:policy/AmazonSESFullAccess";
|
|
139
|
+
readonly SNSFullAccess: "arn:aws:iam::aws:policy/AmazonSNSFullAccess";
|
|
140
|
+
readonly SQSFullAccess: "arn:aws:iam::aws:policy/AmazonSQSFullAccess";
|
|
141
|
+
readonly SecretsManagerReadWrite: "arn:aws:iam::aws:policy/SecretsManagerReadWrite";
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Common service principals
|
|
145
|
+
*/
|
|
146
|
+
static readonly ServicePrincipals: {
|
|
147
|
+
readonly Lambda: "lambda.amazonaws.com";
|
|
148
|
+
readonly EC2: "ec2.amazonaws.com";
|
|
149
|
+
readonly ECS: "ecs.amazonaws.com";
|
|
150
|
+
readonly ECSTaskExecution: "ecs-tasks.amazonaws.com";
|
|
151
|
+
readonly APIGateway: "apigateway.amazonaws.com";
|
|
152
|
+
readonly Events: "events.amazonaws.com";
|
|
153
|
+
readonly States: "states.amazonaws.com";
|
|
154
|
+
readonly CodeBuild: "codebuild.amazonaws.com";
|
|
155
|
+
readonly CodeDeploy: "codedeploy.amazonaws.com";
|
|
156
|
+
readonly CloudFormation: "cloudformation.amazonaws.com";
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Create a CI/CD user with deployment permissions
|
|
160
|
+
*/
|
|
161
|
+
static createCiCdUser(options: {
|
|
162
|
+
slug: string;
|
|
163
|
+
environment: EnvironmentType;
|
|
164
|
+
permissions: {
|
|
165
|
+
s3Buckets?: string[];
|
|
166
|
+
cloudFrontDistributions?: string[];
|
|
167
|
+
ecrRepositories?: string[];
|
|
168
|
+
ecsServices?: string[];
|
|
169
|
+
cloudFormationStacks?: string[];
|
|
170
|
+
lambdaFunctions?: string[];
|
|
171
|
+
secretsManagerSecrets?: string[];
|
|
172
|
+
};
|
|
173
|
+
createAccessKey?: boolean;
|
|
174
|
+
}): {
|
|
175
|
+
user: IAMUser;
|
|
176
|
+
accessKey?: IAMAccessKey;
|
|
177
|
+
policy: IAMManagedPolicy;
|
|
178
|
+
userLogicalId: string;
|
|
179
|
+
accessKeyLogicalId?: string;
|
|
180
|
+
policyLogicalId: string;
|
|
181
|
+
resources: Record<string, any>;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Create a cross-account access role
|
|
185
|
+
*/
|
|
186
|
+
static createCrossAccountRole(options: {
|
|
187
|
+
slug: string;
|
|
188
|
+
environment: EnvironmentType;
|
|
189
|
+
trustedAccountIds: string[];
|
|
190
|
+
externalId?: string;
|
|
191
|
+
permissions: PolicyStatement[];
|
|
192
|
+
maxSessionDuration?: number;
|
|
193
|
+
}): {
|
|
194
|
+
role: IAMRole;
|
|
195
|
+
policy: IAMManagedPolicy;
|
|
196
|
+
roleLogicalId: string;
|
|
197
|
+
policyLogicalId: string;
|
|
198
|
+
resources: Record<string, any>;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Create a CLI access user with minimal permissions
|
|
202
|
+
*/
|
|
203
|
+
static createCliUser(options: {
|
|
204
|
+
slug: string;
|
|
205
|
+
environment: EnvironmentType;
|
|
206
|
+
permissions?: 'readonly' | 'deploy' | 'admin';
|
|
207
|
+
}): {
|
|
208
|
+
user: IAMUser;
|
|
209
|
+
accessKey: IAMAccessKey;
|
|
210
|
+
policy?: IAMManagedPolicy;
|
|
211
|
+
userLogicalId: string;
|
|
212
|
+
accessKeyLogicalId: string;
|
|
213
|
+
policyLogicalId?: string;
|
|
214
|
+
resources: Record<string, any>;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Common CI/CD policy templates
|
|
218
|
+
*/
|
|
219
|
+
static readonly CiCdPolicies: {
|
|
220
|
+
/**
|
|
221
|
+
* S3 static site deployment policy
|
|
222
|
+
*/
|
|
223
|
+
s3Deployment: (bucketArns: string[]) => PolicyStatement[];
|
|
224
|
+
/**
|
|
225
|
+
* CloudFront invalidation policy
|
|
226
|
+
*/
|
|
227
|
+
cloudFrontInvalidation: (distributionArns: string[]) => PolicyStatement[];
|
|
228
|
+
/**
|
|
229
|
+
* ECS deployment policy
|
|
230
|
+
*/
|
|
231
|
+
ecsDeployment: () => PolicyStatement[];
|
|
232
|
+
/**
|
|
233
|
+
* ECR push policy
|
|
234
|
+
*/
|
|
235
|
+
ecrPush: (repositoryArns: string[]) => PolicyStatement[];
|
|
236
|
+
/**
|
|
237
|
+
* Lambda deployment policy
|
|
238
|
+
*/
|
|
239
|
+
lambdaDeployment: (functionArns: string[]) => PolicyStatement[];
|
|
240
|
+
/**
|
|
241
|
+
* CloudFormation deployment policy
|
|
242
|
+
*/
|
|
243
|
+
cloudFormationDeployment: (stackArns: string[]) => PolicyStatement[];
|
|
244
|
+
};
|
|
245
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phone/Voice Module for CloudFormation
|
|
3
|
+
*
|
|
4
|
+
* Provides CloudFormation resources for Amazon Connect phone infrastructure
|
|
5
|
+
*/
|
|
6
|
+
export interface PhoneConfig {
|
|
7
|
+
slug: string;
|
|
8
|
+
environment: string;
|
|
9
|
+
instanceAlias: string;
|
|
10
|
+
inboundCallsEnabled?: boolean;
|
|
11
|
+
outboundCallsEnabled?: boolean;
|
|
12
|
+
voicemailEnabled?: boolean;
|
|
13
|
+
transcriptionEnabled?: boolean;
|
|
14
|
+
notificationTopicArn?: string;
|
|
15
|
+
webhookUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class Phone {
|
|
18
|
+
/**
|
|
19
|
+
* Lambda code for phone handlers
|
|
20
|
+
*/
|
|
21
|
+
static LambdaCode: {
|
|
22
|
+
incomingCall: string;
|
|
23
|
+
voicemail: string;
|
|
24
|
+
missedCall: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Create Amazon Connect instance CloudFormation resource
|
|
28
|
+
*/
|
|
29
|
+
static createConnectInstance(config: PhoneConfig): Record<string, any>;
|
|
30
|
+
/**
|
|
31
|
+
* Create hours of operation resource
|
|
32
|
+
*/
|
|
33
|
+
static createHoursOfOperation(config: {
|
|
34
|
+
slug: string;
|
|
35
|
+
instanceArn: string;
|
|
36
|
+
name: string;
|
|
37
|
+
timezone: string;
|
|
38
|
+
schedule: Array<{
|
|
39
|
+
day: string;
|
|
40
|
+
startHour: number;
|
|
41
|
+
startMinute: number;
|
|
42
|
+
endHour: number;
|
|
43
|
+
endMinute: number;
|
|
44
|
+
}>;
|
|
45
|
+
}): Record<string, any>;
|
|
46
|
+
/**
|
|
47
|
+
* Create queue resource
|
|
48
|
+
*/
|
|
49
|
+
static createQueue(config: {
|
|
50
|
+
slug: string;
|
|
51
|
+
instanceArn: string;
|
|
52
|
+
name: string;
|
|
53
|
+
hoursOfOperationArn: string;
|
|
54
|
+
maxContacts?: number;
|
|
55
|
+
}): Record<string, any>;
|
|
56
|
+
/**
|
|
57
|
+
* Create contact flow resource
|
|
58
|
+
*/
|
|
59
|
+
static createContactFlow(config: {
|
|
60
|
+
slug: string;
|
|
61
|
+
instanceArn: string;
|
|
62
|
+
name: string;
|
|
63
|
+
type: 'CONTACT_FLOW' | 'CUSTOMER_QUEUE' | 'CUSTOMER_HOLD' | 'CUSTOMER_WHISPER' | 'AGENT_HOLD' | 'AGENT_WHISPER' | 'OUTBOUND_WHISPER' | 'AGENT_TRANSFER' | 'QUEUE_TRANSFER';
|
|
64
|
+
content: string;
|
|
65
|
+
}): Record<string, any>;
|
|
66
|
+
/**
|
|
67
|
+
* Create basic IVR contact flow content
|
|
68
|
+
*/
|
|
69
|
+
static createBasicIvrFlow(config: {
|
|
70
|
+
greeting: string;
|
|
71
|
+
queueArn: string;
|
|
72
|
+
voicemailLambdaArn?: string;
|
|
73
|
+
}): string;
|
|
74
|
+
/**
|
|
75
|
+
* Create Lambda role for phone handlers
|
|
76
|
+
*/
|
|
77
|
+
static createPhoneLambdaRole(config: {
|
|
78
|
+
slug: string;
|
|
79
|
+
}): Record<string, any>;
|
|
80
|
+
/**
|
|
81
|
+
* Create incoming call Lambda function
|
|
82
|
+
*/
|
|
83
|
+
static createIncomingCallLambda(config: {
|
|
84
|
+
slug: string;
|
|
85
|
+
roleArn: string;
|
|
86
|
+
notificationTopicArn?: string;
|
|
87
|
+
callLogTable?: string;
|
|
88
|
+
webhookUrl?: string;
|
|
89
|
+
}): Record<string, any>;
|
|
90
|
+
/**
|
|
91
|
+
* Create voicemail Lambda function
|
|
92
|
+
*/
|
|
93
|
+
static createVoicemailLambda(config: {
|
|
94
|
+
slug: string;
|
|
95
|
+
roleArn: string;
|
|
96
|
+
voicemailBucket: string;
|
|
97
|
+
notificationTopicArn?: string;
|
|
98
|
+
callLogTable?: string;
|
|
99
|
+
transcriptionEnabled?: boolean;
|
|
100
|
+
}): Record<string, any>;
|
|
101
|
+
/**
|
|
102
|
+
* Create missed call Lambda function
|
|
103
|
+
*/
|
|
104
|
+
static createMissedCallLambda(config: {
|
|
105
|
+
slug: string;
|
|
106
|
+
roleArn: string;
|
|
107
|
+
notificationTopicArn?: string;
|
|
108
|
+
callLogTable?: string;
|
|
109
|
+
webhookUrl?: string;
|
|
110
|
+
}): Record<string, any>;
|
|
111
|
+
/**
|
|
112
|
+
* Create call log DynamoDB table
|
|
113
|
+
*/
|
|
114
|
+
static createCallLogTable(config: {
|
|
115
|
+
slug: string;
|
|
116
|
+
}): Record<string, any>;
|
|
117
|
+
/**
|
|
118
|
+
* Create complete phone setup
|
|
119
|
+
*/
|
|
120
|
+
static createCompleteSetup(config: PhoneConfig): {
|
|
121
|
+
resources: Record<string, any>;
|
|
122
|
+
outputs: Record<string, any>;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export default Phone;
|