1
1
from typing import Any , Dict , List , Optional , Union
2
2
3
- from samtranslator .model import PassThroughProperty , PropertyType , Resource
3
+ from samtranslator .model import GeneratedProperty , Resource
4
4
from samtranslator .model .intrinsics import fnGetAtt , ref
5
- from samtranslator .model .types import IS_DICT , IS_STR , any_type , is_type , list_of , one_of
6
5
from samtranslator .utils .types import Intrinsicable
7
6
8
7
9
8
class LambdaFunction (Resource ):
10
9
resource_type = "AWS::Lambda::Function"
11
10
property_types = {
12
- "Code" : PropertyType ( True , IS_DICT ),
13
- "PackageType" : PropertyType ( False , IS_STR ),
14
- "DeadLetterConfig" : PropertyType ( False , IS_DICT ),
15
- "Description" : PropertyType ( False , IS_STR ),
16
- "FunctionName" : PropertyType ( False , IS_STR ),
17
- "Handler" : PropertyType ( False , IS_STR ),
18
- "MemorySize" : PropertyType ( False , is_type ( int ) ),
19
- "Role" : PropertyType ( False , IS_STR ),
20
- "Runtime" : PropertyType ( False , IS_STR ),
21
- "Timeout" : PropertyType ( False , is_type ( int ) ),
22
- "VpcConfig" : PropertyType ( False , IS_DICT ),
23
- "Environment" : PropertyType ( False , IS_DICT ),
24
- "Tags" : PropertyType ( False , list_of ( IS_DICT ) ),
25
- "TracingConfig" : PropertyType ( False , IS_DICT ),
26
- "KmsKeyArn" : PropertyType ( False , one_of ( IS_DICT , IS_STR ) ),
27
- "Layers" : PropertyType ( False , list_of ( one_of ( IS_STR , IS_DICT )) ),
28
- "ReservedConcurrentExecutions" : PropertyType ( False , any_type () ),
29
- "FileSystemConfigs" : PropertyType ( False , list_of ( IS_DICT ) ),
30
- "CodeSigningConfigArn" : PropertyType ( False , IS_STR ),
31
- "ImageConfig" : PropertyType ( False , IS_DICT ),
32
- "Architectures" : PropertyType ( False , list_of ( one_of ( IS_STR , IS_DICT )) ),
33
- "SnapStart" : PropertyType ( False , IS_DICT ),
34
- "EphemeralStorage" : PropertyType ( False , IS_DICT ),
35
- "RuntimeManagementConfig" : PropertyType ( False , IS_DICT ),
11
+ "Code" : GeneratedProperty ( ),
12
+ "PackageType" : GeneratedProperty ( ),
13
+ "DeadLetterConfig" : GeneratedProperty ( ),
14
+ "Description" : GeneratedProperty ( ),
15
+ "FunctionName" : GeneratedProperty ( ),
16
+ "Handler" : GeneratedProperty ( ),
17
+ "MemorySize" : GeneratedProperty ( ),
18
+ "Role" : GeneratedProperty ( ),
19
+ "Runtime" : GeneratedProperty ( ),
20
+ "Timeout" : GeneratedProperty ( ),
21
+ "VpcConfig" : GeneratedProperty ( ),
22
+ "Environment" : GeneratedProperty ( ),
23
+ "Tags" : GeneratedProperty ( ),
24
+ "TracingConfig" : GeneratedProperty ( ),
25
+ "KmsKeyArn" : GeneratedProperty ( ),
26
+ "Layers" : GeneratedProperty ( ),
27
+ "ReservedConcurrentExecutions" : GeneratedProperty ( ),
28
+ "FileSystemConfigs" : GeneratedProperty ( ),
29
+ "CodeSigningConfigArn" : GeneratedProperty ( ),
30
+ "ImageConfig" : GeneratedProperty ( ),
31
+ "Architectures" : GeneratedProperty ( ),
32
+ "SnapStart" : GeneratedProperty ( ),
33
+ "EphemeralStorage" : GeneratedProperty ( ),
34
+ "RuntimeManagementConfig" : GeneratedProperty ( ),
36
35
}
37
36
38
37
Code : Dict [str , Any ]
@@ -66,10 +65,10 @@ class LambdaFunction(Resource):
66
65
class LambdaVersion (Resource ):
67
66
resource_type = "AWS::Lambda::Version"
68
67
property_types = {
69
- "CodeSha256" : PropertyType ( False , IS_STR ),
70
- "Description" : PropertyType ( False , IS_STR ),
71
- "FunctionName" : PropertyType ( True , one_of ( IS_STR , IS_DICT ) ),
72
- "RuntimeManagementConfig" : PropertyType ( False , IS_DICT ),
68
+ "CodeSha256" : GeneratedProperty ( ),
69
+ "Description" : GeneratedProperty ( ),
70
+ "FunctionName" : GeneratedProperty ( ),
71
+ "RuntimeManagementConfig" : GeneratedProperty ( ),
73
72
}
74
73
75
74
runtime_attrs = {
@@ -81,11 +80,11 @@ class LambdaVersion(Resource):
81
80
class LambdaAlias (Resource ):
82
81
resource_type = "AWS::Lambda::Alias"
83
82
property_types = {
84
- "Description" : PropertyType ( False , IS_STR ),
85
- "Name" : PropertyType ( False , IS_STR ),
86
- "FunctionName" : PropertyType ( True , one_of ( IS_STR , IS_DICT ) ),
87
- "FunctionVersion" : PropertyType ( True , one_of ( IS_STR , IS_DICT ) ),
88
- "ProvisionedConcurrencyConfig" : PropertyType ( False , IS_DICT ),
83
+ "Description" : GeneratedProperty ( ),
84
+ "Name" : GeneratedProperty ( ),
85
+ "FunctionName" : GeneratedProperty ( ),
86
+ "FunctionVersion" : GeneratedProperty ( ),
87
+ "ProvisionedConcurrencyConfig" : GeneratedProperty ( ),
89
88
}
90
89
91
90
runtime_attrs = {"arn" : lambda self : ref (self .logical_id )}
@@ -94,28 +93,28 @@ class LambdaAlias(Resource):
94
93
class LambdaEventSourceMapping (Resource ):
95
94
resource_type = "AWS::Lambda::EventSourceMapping"
96
95
property_types = {
97
- "BatchSize" : PropertyType ( False , is_type ( int ) ),
98
- "Enabled" : PropertyType ( False , is_type ( bool ) ),
99
- "EventSourceArn" : PropertyType ( False , IS_STR ),
100
- "FunctionName" : PropertyType ( True , IS_STR ),
101
- "MaximumBatchingWindowInSeconds" : PropertyType ( False , is_type ( int ) ),
102
- "MaximumRetryAttempts" : PropertyType ( False , is_type ( int ) ),
103
- "BisectBatchOnFunctionError" : PropertyType ( False , is_type ( bool ) ),
104
- "MaximumRecordAgeInSeconds" : PropertyType ( False , is_type ( int ) ),
105
- "DestinationConfig" : PropertyType ( False , IS_DICT ),
106
- "ParallelizationFactor" : PropertyType ( False , is_type ( int ) ),
107
- "StartingPosition" : PropertyType ( False , IS_STR ),
108
- "StartingPositionTimestamp" : PassThroughProperty ( False ),
109
- "Topics" : PropertyType ( False , is_type ( list ) ),
110
- "Queues" : PropertyType ( False , is_type ( list ) ),
111
- "SourceAccessConfigurations" : PropertyType ( False , is_type ( list ) ),
112
- "TumblingWindowInSeconds" : PropertyType ( False , is_type ( int ) ),
113
- "FunctionResponseTypes" : PropertyType ( False , is_type ( list ) ),
114
- "SelfManagedEventSource" : PropertyType ( False , IS_DICT ),
115
- "FilterCriteria" : PropertyType ( False , IS_DICT ),
116
- "AmazonManagedKafkaEventSourceConfig" : PropertyType ( False , IS_DICT ),
117
- "SelfManagedKafkaEventSourceConfig" : PropertyType ( False , IS_DICT ),
118
- "ScalingConfig" : PropertyType ( False , IS_DICT ),
96
+ "BatchSize" : GeneratedProperty ( ),
97
+ "Enabled" : GeneratedProperty ( ),
98
+ "EventSourceArn" : GeneratedProperty ( ),
99
+ "FunctionName" : GeneratedProperty ( ),
100
+ "MaximumBatchingWindowInSeconds" : GeneratedProperty ( ),
101
+ "MaximumRetryAttempts" : GeneratedProperty ( ),
102
+ "BisectBatchOnFunctionError" : GeneratedProperty ( ),
103
+ "MaximumRecordAgeInSeconds" : GeneratedProperty ( ),
104
+ "DestinationConfig" : GeneratedProperty ( ),
105
+ "ParallelizationFactor" : GeneratedProperty ( ),
106
+ "StartingPosition" : GeneratedProperty ( ),
107
+ "StartingPositionTimestamp" : GeneratedProperty ( ),
108
+ "Topics" : GeneratedProperty ( ),
109
+ "Queues" : GeneratedProperty ( ),
110
+ "SourceAccessConfigurations" : GeneratedProperty ( ),
111
+ "TumblingWindowInSeconds" : GeneratedProperty ( ),
112
+ "FunctionResponseTypes" : GeneratedProperty ( ),
113
+ "SelfManagedEventSource" : GeneratedProperty ( ),
114
+ "FilterCriteria" : GeneratedProperty ( ),
115
+ "AmazonManagedKafkaEventSourceConfig" : GeneratedProperty ( ),
116
+ "SelfManagedKafkaEventSourceConfig" : GeneratedProperty ( ),
117
+ "ScalingConfig" : GeneratedProperty ( ),
119
118
}
120
119
121
120
runtime_attrs = {"name" : lambda self : ref (self .logical_id )}
@@ -124,24 +123,24 @@ class LambdaEventSourceMapping(Resource):
124
123
class LambdaPermission (Resource ):
125
124
resource_type = "AWS::Lambda::Permission"
126
125
property_types = {
127
- "Action" : PropertyType ( True , IS_STR ),
128
- "FunctionName" : PropertyType ( True , IS_STR ),
129
- "Principal" : PropertyType ( True , IS_STR ),
130
- "SourceAccount" : PropertyType ( False , IS_STR ),
131
- "SourceArn" : PropertyType ( False , IS_STR ),
132
- "EventSourceToken" : PropertyType ( False , IS_STR ),
133
- "FunctionUrlAuthType" : PropertyType ( False , IS_STR ),
126
+ "Action" : GeneratedProperty ( ),
127
+ "FunctionName" : GeneratedProperty ( ),
128
+ "Principal" : GeneratedProperty ( ),
129
+ "SourceAccount" : GeneratedProperty ( ),
130
+ "SourceArn" : GeneratedProperty ( ),
131
+ "EventSourceToken" : GeneratedProperty ( ),
132
+ "FunctionUrlAuthType" : GeneratedProperty ( ),
134
133
}
135
134
136
135
137
136
class LambdaEventInvokeConfig (Resource ):
138
137
resource_type = "AWS::Lambda::EventInvokeConfig"
139
138
property_types = {
140
- "DestinationConfig" : PropertyType ( False , IS_DICT ),
141
- "FunctionName" : PropertyType ( True , IS_STR ),
142
- "MaximumEventAgeInSeconds" : PropertyType ( False , is_type ( int ) ),
143
- "MaximumRetryAttempts" : PropertyType ( False , is_type ( int ) ),
144
- "Qualifier" : PropertyType ( True , IS_STR ),
139
+ "DestinationConfig" : GeneratedProperty ( ),
140
+ "FunctionName" : GeneratedProperty ( ),
141
+ "MaximumEventAgeInSeconds" : GeneratedProperty ( ),
142
+ "MaximumRetryAttempts" : GeneratedProperty ( ),
143
+ "Qualifier" : GeneratedProperty ( ),
145
144
}
146
145
147
146
@@ -150,12 +149,12 @@ class LambdaLayerVersion(Resource):
150
149
151
150
resource_type = "AWS::Lambda::LayerVersion"
152
151
property_types = {
153
- "Content" : PropertyType ( True , IS_DICT ),
154
- "Description" : PropertyType ( False , IS_STR ),
155
- "LayerName" : PropertyType ( False , IS_STR ),
156
- "CompatibleArchitectures" : PropertyType ( False , list_of ( one_of ( IS_STR , IS_DICT )) ),
157
- "CompatibleRuntimes" : PropertyType ( False , list_of ( one_of ( IS_STR , IS_DICT )) ),
158
- "LicenseInfo" : PropertyType ( False , IS_STR ),
152
+ "Content" : GeneratedProperty ( ),
153
+ "Description" : GeneratedProperty ( ),
154
+ "LayerName" : GeneratedProperty ( ),
155
+ "CompatibleArchitectures" : GeneratedProperty ( ),
156
+ "CompatibleRuntimes" : GeneratedProperty ( ),
157
+ "LicenseInfo" : GeneratedProperty ( ),
159
158
}
160
159
161
160
Content : Dict [str , Any ]
@@ -171,7 +170,7 @@ class LambdaLayerVersion(Resource):
171
170
class LambdaUrl (Resource ):
172
171
resource_type = "AWS::Lambda::Url"
173
172
property_types = {
174
- "TargetFunctionArn" : PropertyType ( True , one_of ( IS_STR , IS_DICT ) ),
175
- "AuthType" : PropertyType ( True , IS_STR ),
176
- "Cors" : PropertyType ( False , IS_DICT ),
173
+ "TargetFunctionArn" : GeneratedProperty ( ),
174
+ "AuthType" : GeneratedProperty ( ),
175
+ "Cors" : GeneratedProperty ( ),
177
176
}
0 commit comments