| 
									
										
										
										
											2014-08-27 11:17:06 -04:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							| 
									
										
										
										
											2017-09-26 00:21:07 +01:00
										 |  |  | import re | 
					
						
							| 
									
										
										
										
											2014-05-11 22:56:44 -04:00
										 |  |  | import uuid | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 08:44:26 -07:00
										 |  |  | E164_REGEX = re.compile(r"^\+?[1-9]\d{1,14}$") | 
					
						
							| 
									
										
										
										
											2017-09-26 00:21:07 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-11 22:56:44 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-31 16:01:07 -04: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-11 22:56:44 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def make_arn_for_subscription(topic_arn): | 
					
						
							|  |  |  |     subscription_id = uuid.uuid4() | 
					
						
							| 
									
										
										
										
											2014-05-11 23:07:05 -04:00
										 |  |  |     return "{0}:{1}".format(topic_arn, subscription_id) | 
					
						
							| 
									
										
										
										
											2017-09-26 00:21:07 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def is_e164(number): | 
					
						
							|  |  |  |     return E164_REGEX.match(number) is not None |