@stacksjs/ts-cloud-aws-types 0.1.1

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/src/iam.ts ADDED
@@ -0,0 +1,142 @@
1
+ import type { CloudFormationResource } from './index'
2
+
3
+ export interface IAMRole extends CloudFormationResource {
4
+ Type: 'AWS::IAM::Role'
5
+ Properties: {
6
+ RoleName?: string
7
+ MaxSessionDuration?: number
8
+ AssumeRolePolicyDocument: {
9
+ Version: '2012-10-17'
10
+ Statement: Array<{
11
+ Effect: 'Allow' | 'Deny'
12
+ Principal: {
13
+ Service?: string | string[]
14
+ AWS?: string | string[]
15
+ Federated?: string | string[]
16
+ }
17
+ Action: string | string[]
18
+ Condition?: Record<string, unknown>
19
+ }>
20
+ }
21
+ ManagedPolicyArns?: string[]
22
+ Policies?: Array<{
23
+ PolicyName: string
24
+ PolicyDocument: {
25
+ Version: '2012-10-17'
26
+ Statement: Array<{
27
+ Effect: 'Allow' | 'Deny'
28
+ Action: string | string[]
29
+ Resource: string | string[]
30
+ }>
31
+ }
32
+ }>
33
+ Tags?: Array<{
34
+ Key: string
35
+ Value: string
36
+ }>
37
+ }
38
+ }
39
+
40
+ export interface IAMPolicy extends CloudFormationResource {
41
+ Type: 'AWS::IAM::Policy'
42
+ Properties: {
43
+ PolicyName: string
44
+ PolicyDocument: {
45
+ Version: '2012-10-17'
46
+ Statement: Array<{
47
+ Sid?: string
48
+ Effect: 'Allow' | 'Deny'
49
+ Action: string | string[]
50
+ Resource: string | string[]
51
+ Condition?: Record<string, unknown>
52
+ }>
53
+ }
54
+ Roles?: string[]
55
+ Users?: string[]
56
+ Groups?: string[]
57
+ }
58
+ }
59
+
60
+ export interface IAMUser extends CloudFormationResource {
61
+ Type: 'AWS::IAM::User'
62
+ Properties: {
63
+ UserName?: string
64
+ ManagedPolicyArns?: string[]
65
+ Groups?: string[]
66
+ Policies?: Array<{
67
+ PolicyName: string
68
+ PolicyDocument: {
69
+ Version: '2012-10-17'
70
+ Statement: Array<{
71
+ Effect: 'Allow' | 'Deny'
72
+ Action: string | string[]
73
+ Resource: string | string[]
74
+ }>
75
+ }
76
+ }>
77
+ Tags?: Array<{
78
+ Key: string
79
+ Value: string
80
+ }>
81
+ }
82
+ }
83
+
84
+ export interface IAMManagedPolicy extends CloudFormationResource {
85
+ Type: 'AWS::IAM::ManagedPolicy'
86
+ Properties: {
87
+ ManagedPolicyName?: string
88
+ Description?: string
89
+ Path?: string
90
+ PolicyDocument: {
91
+ Version: '2012-10-17'
92
+ Statement: Array<{
93
+ Sid?: string
94
+ Effect: 'Allow' | 'Deny'
95
+ Action: string | string[]
96
+ Resource: string | string[]
97
+ Condition?: Record<string, unknown>
98
+ }>
99
+ }
100
+ Roles?: Array<string | { Ref: string }>
101
+ Users?: Array<string | { Ref: string }>
102
+ Groups?: Array<string | { Ref: string }>
103
+ }
104
+ }
105
+
106
+ export interface IAMGroup extends CloudFormationResource {
107
+ Type: 'AWS::IAM::Group'
108
+ Properties: {
109
+ GroupName?: string
110
+ ManagedPolicyArns?: string[]
111
+ Policies?: Array<{
112
+ PolicyName: string
113
+ PolicyDocument: {
114
+ Version: '2012-10-17'
115
+ Statement: Array<{
116
+ Effect: 'Allow' | 'Deny'
117
+ Action: string | string[]
118
+ Resource: string | string[]
119
+ }>
120
+ }
121
+ }>
122
+ Path?: string
123
+ }
124
+ }
125
+
126
+ export interface IAMAccessKey extends CloudFormationResource {
127
+ Type: 'AWS::IAM::AccessKey'
128
+ Properties: {
129
+ UserName: string | { Ref: string }
130
+ Status?: 'Active' | 'Inactive'
131
+ Serial?: number
132
+ }
133
+ }
134
+
135
+ export interface IAMInstanceProfile extends CloudFormationResource {
136
+ Type: 'AWS::IAM::InstanceProfile'
137
+ Properties: {
138
+ InstanceProfileName?: string
139
+ Path?: string
140
+ Roles: Array<string | { Ref: string }>
141
+ }
142
+ }
package/src/index.ts ADDED
@@ -0,0 +1,328 @@
1
+ /**
2
+ * AWS CloudFormation Resource Type Definitions
3
+ * These types are lightweight definitions without AWS SDK dependencies
4
+ */
5
+
6
+ // CloudFormation Template Structure
7
+ export interface CloudFormationTemplate {
8
+ AWSTemplateFormatVersion?: '2010-09-09'
9
+ Description?: string
10
+ Parameters?: Record<string, CloudFormationParameter>
11
+ Mappings?: Record<string, unknown>
12
+ Conditions?: Record<string, unknown>
13
+ Resources: Record<string, CloudFormationResource>
14
+ Outputs?: Record<string, CloudFormationOutput>
15
+ }
16
+
17
+ export interface CloudFormationParameter {
18
+ Type: 'String' | 'Number' | 'List<Number>' | 'CommaDelimitedList'
19
+ Default?: unknown
20
+ Description?: string
21
+ AllowedValues?: unknown[]
22
+ AllowedPattern?: string
23
+ MinLength?: number
24
+ MaxLength?: number
25
+ MinValue?: number
26
+ MaxValue?: number
27
+ }
28
+
29
+ export interface CloudFormationResource {
30
+ Type: string
31
+ Properties?: Record<string, unknown>
32
+ DependsOn?: string | string[]
33
+ Condition?: string
34
+ DeletionPolicy?: 'Delete' | 'Retain' | 'Snapshot'
35
+ UpdateReplacePolicy?: 'Delete' | 'Retain' | 'Snapshot'
36
+ }
37
+
38
+ export interface CloudFormationOutput {
39
+ Description?: string
40
+ Value: unknown
41
+ Export?: {
42
+ Name: string
43
+ }
44
+ }
45
+
46
+ // CloudFormation Intrinsic Functions
47
+ export interface IntrinsicFunctions {
48
+ Ref: (logicalName: string) => { Ref: string }
49
+ GetAtt: (logicalName: string, attributeName: string) => { 'Fn::GetAtt': [string, string] }
50
+ Sub: (template: string, variables?: Record<string, unknown>) => { 'Fn::Sub': string | [string, Record<string, unknown>] }
51
+ Join: (delimiter: string, values: unknown[]) => { 'Fn::Join': [string, unknown[]] }
52
+ Select: (index: number, list: unknown[]) => { 'Fn::Select': [number, unknown[]] }
53
+ Split: (delimiter: string, source: string) => { 'Fn::Split': [string, string] }
54
+ GetAZs: (region?: string) => { 'Fn::GetAZs': string }
55
+ ImportValue: (name: string) => { 'Fn::ImportValue': string }
56
+ If: (condition: string, trueValue: unknown, falseValue: unknown) => { 'Fn::If': [string, unknown, unknown] }
57
+ }
58
+
59
+ // S3 Types
60
+ export interface S3Bucket extends CloudFormationResource {
61
+ Type: 'AWS::S3::Bucket'
62
+ Properties?: {
63
+ BucketName?: string
64
+ AccessControl?: 'Private' | 'PublicRead' | 'PublicReadWrite' | 'AuthenticatedRead'
65
+ BucketEncryption?: {
66
+ ServerSideEncryptionConfiguration: Array<{
67
+ ServerSideEncryptionByDefault: {
68
+ SSEAlgorithm: 'AES256' | 'aws:kms'
69
+ KMSMasterKeyID?: string
70
+ }
71
+ }>
72
+ }
73
+ VersioningConfiguration?: {
74
+ Status: 'Enabled' | 'Suspended'
75
+ }
76
+ WebsiteConfiguration?: {
77
+ IndexDocument?: string
78
+ ErrorDocument?: string
79
+ RedirectAllRequestsTo?: {
80
+ HostName: string
81
+ Protocol?: string
82
+ }
83
+ }
84
+ Tags?: Array<{
85
+ Key: string
86
+ Value: string
87
+ }>
88
+ LifecycleConfiguration?: {
89
+ Rules: Array<{
90
+ Id: string
91
+ Status: 'Enabled' | 'Disabled'
92
+ ExpirationInDays?: number
93
+ Transitions?: Array<{
94
+ TransitionInDays: number
95
+ StorageClass: string
96
+ }>
97
+ }>
98
+ }
99
+ PublicAccessBlockConfiguration?: {
100
+ BlockPublicAcls?: boolean
101
+ BlockPublicPolicy?: boolean
102
+ IgnorePublicAcls?: boolean
103
+ RestrictPublicBuckets?: boolean
104
+ }
105
+ CorsConfiguration?: {
106
+ CorsRules: Array<{
107
+ AllowedOrigins: string[]
108
+ AllowedMethods: string[]
109
+ AllowedHeaders?: string[]
110
+ MaxAge?: number
111
+ }>
112
+ }
113
+ NotificationConfiguration?: {
114
+ LambdaConfigurations?: Array<{
115
+ Event: string
116
+ Function: string
117
+ Filter?: {
118
+ S3Key?: {
119
+ Rules?: Array<{
120
+ Name: string
121
+ Value: string
122
+ }>
123
+ }
124
+ }
125
+ }>
126
+ }
127
+ }
128
+ }
129
+
130
+ export interface S3BucketPolicy extends CloudFormationResource {
131
+ Type: 'AWS::S3::BucketPolicy'
132
+ Properties: {
133
+ Bucket: string | { Ref: string }
134
+ PolicyDocument: {
135
+ Version: '2012-10-17'
136
+ Statement: Array<{
137
+ Sid?: string
138
+ Effect: 'Allow' | 'Deny'
139
+ Principal: unknown
140
+ Action: string | string[]
141
+ Resource: string | string[]
142
+ Condition?: unknown
143
+ }>
144
+ }
145
+ }
146
+ }
147
+
148
+ // CloudFront Cache Behavior Type
149
+ export interface CloudFrontCacheBehavior {
150
+ TargetOriginId: string
151
+ ViewerProtocolPolicy: 'allow-all' | 'https-only' | 'redirect-to-https'
152
+ AllowedMethods?: string[]
153
+ CachedMethods?: string[]
154
+ CachePolicyId?: string
155
+ Compress?: boolean
156
+ LambdaFunctionAssociations?: Array<{
157
+ EventType: 'origin-request' | 'origin-response' | 'viewer-request' | 'viewer-response'
158
+ LambdaFunctionARN: string
159
+ }>
160
+ // TTL settings
161
+ DefaultTTL?: number
162
+ MaxTTL?: number
163
+ MinTTL?: number
164
+ // Forwarded values (legacy, but still used)
165
+ ForwardedValues?: {
166
+ QueryString?: boolean
167
+ Headers?: string[]
168
+ Cookies?: {
169
+ Forward: string
170
+ WhitelistedNames?: string[]
171
+ }
172
+ }
173
+ // Path pattern for cache behaviors
174
+ PathPattern?: string
175
+ }
176
+
177
+ // CloudFront Origin Type
178
+ export interface CloudFrontOrigin {
179
+ Id: string
180
+ DomainName: string
181
+ OriginPath?: string
182
+ S3OriginConfig?: {
183
+ OriginAccessIdentity?: string
184
+ }
185
+ CustomOriginConfig?: {
186
+ HTTPPort?: number
187
+ HTTPSPort?: number
188
+ OriginProtocolPolicy: 'http-only' | 'https-only' | 'match-viewer'
189
+ OriginSSLProtocols?: string[]
190
+ OriginReadTimeout?: number
191
+ OriginKeepaliveTimeout?: number
192
+ }
193
+ OriginAccessControlId?: string
194
+ OriginCustomHeaders?: Array<{
195
+ HeaderName: string
196
+ HeaderValue: string
197
+ }>
198
+ }
199
+
200
+ // CloudFront Types
201
+ export interface CloudFrontDistribution extends CloudFormationResource {
202
+ Type: 'AWS::CloudFront::Distribution'
203
+ Properties: {
204
+ DistributionConfig: {
205
+ Enabled: boolean
206
+ Comment?: string
207
+ DefaultRootObject?: string
208
+ Origins: CloudFrontOrigin[]
209
+ DefaultCacheBehavior: CloudFrontCacheBehavior
210
+ CacheBehaviors?: CloudFrontCacheBehavior[]
211
+ PriceClass?: string
212
+ ViewerCertificate?: {
213
+ AcmCertificateArn?: string
214
+ CloudFrontDefaultCertificate?: boolean
215
+ MinimumProtocolVersion?: string
216
+ SslSupportMethod?: string
217
+ }
218
+ Aliases?: string[]
219
+ CustomErrorResponses?: Array<{
220
+ ErrorCode: number
221
+ ResponseCode?: number
222
+ ResponsePagePath?: string
223
+ }>
224
+ HttpVersion?: 'http1.1' | 'http2' | 'http2and3' | 'http3'
225
+ }
226
+ }
227
+ }
228
+
229
+ export interface CloudFrontOriginAccessControl extends CloudFormationResource {
230
+ Type: 'AWS::CloudFront::OriginAccessControl'
231
+ Properties: {
232
+ OriginAccessControlConfig: {
233
+ Name: string
234
+ Description?: string
235
+ OriginAccessControlOriginType: 's3' | 'mediastore'
236
+ SigningBehavior: 'always' | 'never' | 'no-override'
237
+ SigningProtocol: 'sigv4'
238
+ }
239
+ }
240
+ }
241
+
242
+ export interface CloudFrontFunction extends CloudFormationResource {
243
+ Type: 'AWS::CloudFront::Function'
244
+ Properties: {
245
+ Name: string
246
+ FunctionCode: string
247
+ FunctionConfig: {
248
+ Comment?: string
249
+ Runtime: 'cloudfront-js-1.0' | 'cloudfront-js-2.0'
250
+ KeyValueStoreAssociations?: Array<{
251
+ KeyValueStoreARN: string
252
+ }>
253
+ }
254
+ AutoPublish?: boolean
255
+ }
256
+ }
257
+
258
+ // Step Functions Types
259
+ export interface StepFunctionsStateMachine extends CloudFormationResource {
260
+ Type: 'AWS::StepFunctions::StateMachine'
261
+ Properties: {
262
+ StateMachineName?: string
263
+ StateMachineType?: 'STANDARD' | 'EXPRESS'
264
+ Definition?: Record<string, unknown>
265
+ DefinitionString?: string
266
+ DefinitionS3Location?: {
267
+ Bucket: string
268
+ Key: string
269
+ Version?: string
270
+ }
271
+ DefinitionSubstitutions?: Record<string, string>
272
+ RoleArn: string | { 'Fn::GetAtt': [string, string] } | { Ref: string }
273
+ LoggingConfiguration?: {
274
+ Destinations?: Array<{
275
+ CloudWatchLogsLogGroup?: {
276
+ LogGroupArn: string | { 'Fn::GetAtt': [string, string] }
277
+ }
278
+ }>
279
+ IncludeExecutionData?: boolean
280
+ Level?: 'ALL' | 'ERROR' | 'FATAL' | 'OFF'
281
+ }
282
+ TracingConfiguration?: {
283
+ Enabled?: boolean
284
+ }
285
+ Tags?: Array<{
286
+ Key: string
287
+ Value: string
288
+ }>
289
+ }
290
+ }
291
+
292
+ // Export all AWS CloudFormation resource types
293
+ export * from './route53'
294
+ export * from './ec2'
295
+ export * from './iam'
296
+ export * from './lambda'
297
+ export * from './ecs'
298
+ export * from './ecr'
299
+ export * from './alb'
300
+ export * from './rds'
301
+ export * from './dynamodb'
302
+ export * from './apigateway'
303
+ export * from './sns'
304
+ export * from './ses'
305
+ export * from './sqs'
306
+ export * from './eventbridge'
307
+ export * from './cloudwatch'
308
+ export * from './kms'
309
+ export * from './acm'
310
+ export * from './efs'
311
+ export * from './waf'
312
+ export * from './elasticache'
313
+ export * from './secrets-manager'
314
+ export * from './autoscaling'
315
+ export * from './ssm'
316
+ export * from './backup'
317
+ export * from './opensearch'
318
+ export * from './rds-proxy'
319
+ export * from './globalaccelerator'
320
+ export * from './appsync'
321
+ export * from './athena'
322
+ export * from './kinesis'
323
+ export * from './glue'
324
+ export * from './connect'
325
+ export * from './pinpoint'
326
+ export * from './common'
327
+ export * from './cognito'
328
+ export * from './codedeploy'