Skip to content

Commit 319d4fd

Browse files
authored
Merge pull request #236 from adanaja/morosi-fix2
Fix InvokeFunction permission for ANY method
2 parents 09835af + cc6365c commit 319d4fd

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

src/e3/aws/troposphere/apigateway/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ def _declare_method(
963963
f"${{api}}/{config.name}/${{method}}/{resource_path}",
964964
dict_values={
965965
"api": self.ref,
966-
"method": method.method,
966+
"method": "*" if method.method == "ANY" else method.method,
967967
},
968968
),
969969
)

tests/tests_e3_aws/troposphere/apigateway/apigateway_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def test_rest_api_nested_resources(stack: Stack, lambda_fun: PyFunction) -> None
736736
# Specific lambda for this resource
737737
lambda_arn=products_lambda.ref,
738738
method_list=[Method("ANY")],
739-
resource_list=[Resource(path="abcd", method_list=[Method("ANY")])],
739+
resource_list=[Resource(path="abcd", method_list=[Method("GET")])],
740740
),
741741
],
742742
)

tests/tests_e3_aws/troposphere/apigateway/apigatewayv1_test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
"api": {
131131
"Ref": "Testapi"
132132
},
133-
"method": "ANY"
133+
"method": "*"
134134
}
135135
]
136136
}

tests/tests_e3_aws/troposphere/apigateway/apigatewayv1_test_custom_domain.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
"api": {
160160
"Ref": "Testapi"
161161
},
162-
"method": "ANY"
162+
"method": "*"
163163
}
164164
]
165165
}

tests/tests_e3_aws/troposphere/apigateway/apigatewayv1_test_custom_domain_stages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
"api": {
206206
"Ref": "Testapi"
207207
},
208-
"method": "ANY"
208+
"method": "*"
209209
}
210210
]
211211
}
@@ -226,7 +226,7 @@
226226
"api": {
227227
"Ref": "Testapi"
228228
},
229-
"method": "ANY"
229+
"method": "*"
230230
}
231231
]
232232
}

tests/tests_e3_aws/troposphere/apigateway/apigatewayv1_test_lambda_alias.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"api": {
171171
"Ref": "Testapi"
172172
},
173-
"method": "ANY"
173+
"method": "*"
174174
}
175175
]
176176
}
@@ -191,7 +191,7 @@
191191
"api": {
192192
"Ref": "Testapi"
193193
},
194-
"method": "ANY"
194+
"method": "*"
195195
}
196196
]
197197
}

tests/tests_e3_aws/troposphere/apigateway/apigatewayv1_test_nested_resources.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"DependsOn": [
8585
"TestapiAccountsANYMethod",
8686
"TestapiProductsANYMethod",
87-
"TestapiProductsAbcdANYMethod"
87+
"TestapiProductsAbcdGETMethod"
8888
]
8989
},
9090
"TestapiDefaultStage": {
@@ -178,13 +178,13 @@
178178
},
179179
"Type": "AWS::ApiGateway::Method"
180180
},
181-
"TestapiProductsAbcdANYMethod": {
181+
"TestapiProductsAbcdGETMethod": {
182182
"Properties": {
183183
"RestApiId": {
184184
"Ref": "Testapi"
185185
},
186186
"AuthorizationType": "NONE",
187-
"HttpMethod": "ANY",
187+
"HttpMethod": "GET",
188188
"Integration": {
189189
"CacheKeyParameters": [],
190190
"CacheNamespace": "none",
@@ -222,7 +222,7 @@
222222
"api": {
223223
"Ref": "Testapi"
224224
},
225-
"method": "ANY"
225+
"method": "*"
226226
}
227227
]
228228
}
@@ -243,14 +243,14 @@
243243
"api": {
244244
"Ref": "Testapi"
245245
},
246-
"method": "ANY"
246+
"method": "*"
247247
}
248248
]
249249
}
250250
},
251251
"Type": "AWS::Lambda::Permission"
252252
},
253-
"TestapiProductsAbcdANYDefaultLambdaPermission": {
253+
"TestapiProductsAbcdGETDefaultLambdaPermission": {
254254
"Properties": {
255255
"Action": "lambda:InvokeFunction",
256256
"FunctionName": {
@@ -264,7 +264,7 @@
264264
"api": {
265265
"Ref": "Testapi"
266266
},
267-
"method": "ANY"
267+
"method": "GET"
268268
}
269269
]
270270
}

tests/tests_e3_aws/troposphere/apigateway/apigatewayv1_test_stages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
"api": {
177177
"Ref": "Testapi"
178178
},
179-
"method": "ANY"
179+
"method": "*"
180180
}
181181
]
182182
}
@@ -197,7 +197,7 @@
197197
"api": {
198198
"Ref": "Testapi"
199199
},
200-
"method": "ANY"
200+
"method": "*"
201201
}
202202
]
203203
}

0 commit comments

Comments
 (0)