#2255 - CF - Implement FN::Transform and AWS::Include

This commit is contained in:
Bert Blommers 2020-03-18 13:02:07 +00:00
commit cbf0397953
5 changed files with 82 additions and 8 deletions

View file

@ -35,6 +35,17 @@ def bucket_name_from_url(url):
return None
# 'owi-common-cf', 'snippets/test.json' = bucket_and_name_from_url('s3://owi-common-cf/snippets/test.json')
def bucket_and_name_from_url(url):
prefix = "s3://"
if url.startswith(prefix):
bucket_name = url[len(prefix) : url.index("/", len(prefix))]
key = url[url.index("/", len(prefix)) + 1 :]
return bucket_name, key
else:
return None, None
REGION_URL_REGEX = re.compile(
r"^https?://(s3[-\.](?P<region1>.+)\.amazonaws\.com/(.+)|"
r"(.+)\.s3[-\.](?P<region2>.+)\.amazonaws\.com)/?"