Added in publish by phone number

This commit is contained in:
Terry Cain 2017-09-26 00:21:07 +01:00
commit 56c65bc67c
No known key found for this signature in database
GPG key ID: 14D90844E4E9B9F3
5 changed files with 121 additions and 1 deletions

View file

@ -1,6 +1,9 @@
from __future__ import unicode_literals
import re
import uuid
E164_REGEX = re.compile(r'^\+?[1-9]\d{1,14}$')
def make_arn_for_topic(account_id, name, region_name):
return "arn:aws:sns:{0}:{1}:{2}".format(region_name, account_id, name)
@ -9,3 +12,7 @@ def make_arn_for_topic(account_id, name, region_name):
def make_arn_for_subscription(topic_arn):
subscription_id = uuid.uuid4()
return "{0}:{1}".format(topic_arn, subscription_id)
def is_e164(number):
return E164_REGEX.match(number) is not None