moto/moto/sns/utils.py

19 lines
448 B
Python
Raw Normal View History

from __future__ import unicode_literals
2017-09-25 23:21:07 +00:00
import re
2014-05-12 02:56:44 +00:00
import uuid
2019-10-31 15:44:26 +00:00
E164_REGEX = re.compile(r"^\+?[1-9]\d{1,14}$")
2017-09-25 23:21:07 +00:00
2014-05-12 02:56:44 +00:00
def make_arn_for_topic(account_id, name, region_name):
return "arn:aws:sns:{0}:{1}:{2}".format(region_name, account_id, name)
2014-05-12 02:56:44 +00:00
def make_arn_for_subscription(topic_arn):
subscription_id = uuid.uuid4()
2014-05-12 03:07:05 +00:00
return "{0}:{1}".format(topic_arn, subscription_id)
2017-09-25 23:21:07 +00:00
def is_e164(number):
return E164_REGEX.match(number) is not None