From f19db0fb646905fa9392fe33ca12197c84a7ba60 Mon Sep 17 00:00:00 2001 From: Melrick Mascarenhas Date: Sun, 3 Apr 2022 14:55:33 -0700 Subject: [PATCH 1/2] ARN fix for China regions. Issue #25 --- blueprints/python/api-gateway-authorizer-python.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blueprints/python/api-gateway-authorizer-python.py b/blueprints/python/api-gateway-authorizer-python.py index 1d79c32..0d212d2 100644 --- a/blueprints/python/api-gateway-authorizer-python.py +++ b/blueprints/python/api-gateway-authorizer-python.py @@ -133,7 +133,16 @@ def _addMethod(self, effect, verb, resource, conditions): if resource[:1] == "/": resource = resource[1:] - resourceArn = ("arn:aws:execute-api:" + + if re.search("cn", self.region): + resourceArn = ("arn:aws-cn:execute-api:" + + self.region + ":" + + self.awsAccountId + ":" + + self.restApiId + "/" + + self.stage + "/" + + verb + "/" + + resource) + else: + resourceArn = ("arn:aws:execute-api:" + self.region + ":" + self.awsAccountId + ":" + self.restApiId + "/" + From 552d541904a4a982a8489266c2cf184e19d377ee Mon Sep 17 00:00:00 2001 From: Melrick Mascarenhas Date: Sun, 3 Apr 2022 14:58:21 -0700 Subject: [PATCH 2/2] Added comments for CN region fix. Issue #25 --- blueprints/python/api-gateway-authorizer-python.py | 1 + 1 file changed, 1 insertion(+) diff --git a/blueprints/python/api-gateway-authorizer-python.py b/blueprints/python/api-gateway-authorizer-python.py index 0d212d2..1df870b 100644 --- a/blueprints/python/api-gateway-authorizer-python.py +++ b/blueprints/python/api-gateway-authorizer-python.py @@ -133,6 +133,7 @@ def _addMethod(self, effect, verb, resource, conditions): if resource[:1] == "/": resource = resource[1:] + """Added check for cn region in ARN and build the resourceARN accordingly.""" if re.search("cn", self.region): resourceArn = ("arn:aws-cn:execute-api:" + self.region + ":" +