Ë
    ?—Öj÷N  ã                   óè   — d dl Z d dlZd dlmZ d dlmZ d dlmZmZm	Z	m
Z
 d dlmZmZ ddlmZmZmZ ddlmZmZ dd	lmZ d
eeef   deeeef      fd„Zdeeef   deeef   fd„Z G d„ de	«      Zy)é    N)Údefaultdict)ÚAny)ÚTYPE_RESPONSEÚActionResultÚBaseResponseÚEmptyResult)Úcamelcase_to_underscoresÚensure_booleané   )ÚInvalidParameterValueÚSNSInvalidParameterÚSNSNotFoundError)Ú
SNSBackendÚsns_backends)Úis_e164ÚtagsÚreturnc                 óZ   — | j                  «       D ��cg c]
  \  }}||dœ‘Œ c}}S c c}}w )N)ÚKeyÚValue)Úitems)r   ÚkeyÚvalues      úO/var/www/photos/backend/venv/lib/python3.12/site-packages/moto/sns/responses.pyÚtransform_tagsr      s%   € Ø;?¿:¹:»<×H©Z¨S°%�C %Ó(ÓHÐHùÓHs   ”'Ú
attributesc           	      ó¨   — | j                  «       D ��ci c]1  \  }}|t        |t        «      rt        |«      j	                  «       n|“Œ3 c}}S c c}}w ©N)r   Ú
isinstanceÚboolÚstrÚlower)r   r   r   s      r   Útransform_attributesr#      sN   € ð
 %×*Ñ*Ó,÷áˆC�ð 	¤:¨e´TÔ#:ŒS�‹Z×ÑÔÀÑEóð ùó s   ”6Ac            	       ó´  ‡ — e Zd Z ej                  d«      Z ej                  d«      ZeeeeeeeedœZ	d2ˆ fd„Z
edefd„«       Zdeeef   fd„Zdeeef   fd„Zdeeef   fd	„Zd
eeef   deeef   fd„Zdefd„Zdefd„Zdefd„Zdefd„Zdefd„Zdefd„Zdefd„Zdefd„Zdefd„Zdefd„Zdefd„Z defd„Z!defd„Z"defd„Z#defd„Z$defd„Z%defd„Z&defd„Z'defd„Z(defd„Z)defd „Z*defd!„Z+defd"„Z,defd#„Z-defd$„Z.defd%„Z/defd&„Z0defd'„Z1defd(„Z2defd)„Z3defd*„Z4defd+„Z5defd,„Z6defd-„Z7e8d.ed/ed0ede9fd1„«       Z:ˆ xZ;S )3ÚSNSResponsez8^attributes\.entry\.(?P<index>\d+)\.(?P<type>key|value)$z^\+?\d+$)z(GetEndpointAttributesResponse.Attributesz3GetPlatformApplicationAttributesResponse.Attributesz#GetSMSAttributesResponse.Attributesz,GetSubscriptionAttributesResponse.Attributesz%GetTopicAttributesResponse.AttributeszHListEndpointsByPlatformApplicationResponse.Endpoints.Endpoint.AttributeszTListPlatformApplicationsResponse.PlatformApplications.PlatformApplication.Attributesz ListTagsForResourceResponse.Tagsr   c                 ó4   •— t         ‰| �  d¬«       d| _        y )NÚsns)Úservice_nameT)ÚsuperÚ__init__Úautomated_parameter_parsing)ÚselfÚ	__class__s    €r   r*   zSNSResponse.__init__+   s   ø€ Ü‰Ñ eÐÔ,Ø+/ˆÕ(ó    c                 óB   — t         | j                     | j                     S r   )r   Úcurrent_accountÚregion)r,   s    r   ÚbackendzSNSResponse.backend/   s   € ä˜D×0Ñ0Ñ1°$·+±+Ñ>Ð>r.   c                 ól   — | j                  di «      }g d¢}|D ]  }||v sŒt        ||   «      ||<   Œ |S )NÚ
Attributes)ÚContentBasedDeduplicationÚEnabledÚ	FifoTopicÚRawMessageDelivery)Ú
_get_paramr
   )r,   r   Úboolean_attributesÚ	attributes       r   Ú_get_attributeszSNSResponse._get_attributes3   sQ   € Ø—_‘_ \°2Ó6ˆ
ò
Ðð ,ò 	NˆIØ˜JÒ&Ü(6°zÀ)Ñ7LÓ(M�
˜9Ò%ð	Nð Ðr.   c                 ó^   — | j                  dg «      }|D �ci c]  }|d   |d   “Œ c}S c c}w )NÚTagsr   r   )r9   )r,   r   Útags      r   Ú	_get_tagszSNSResponse._get_tags@   s3   € Ø�‰˜v rÓ*ˆØ48Ö9¨S��E‘
˜C ™LÑ(Ò9Ð9ùÒ9s   —*c                 óH   — | j                  di «      }| j                  |«      S )NÚMessageAttributes)r9   Ú_transform_message_attributes)r,   Úmessage_attributess     r   Ú_parse_message_attributesz%SNSResponse._parse_message_attributesD   s&   € Ø!Ÿ_™_Ð-@À"ÓEÐØ×1Ñ1Ð2DÓEÐEr.   rD   c                 óö  — i }|j                  «       D ]«  \  }}|d   }|st        d|› d�«      ‚|j                  d«      }|d   dvrt        d|› d�«      ‚d }d|v r|d   }|d	k(  r7	 t        |«       n*d|v r&t        j                  |d   «      j                  «       }|dk(  rt        d|› d|d   › d�«      ‚||dœ||<   Œ­ |S # t        $ r, 	 t        |«       n# t        $ r t        d
|› d�«      ‚w xY wY ŒZw xY w)NÚDataTypezThe message attribute 'z1' must contain non-empty message attribute value.ú.r   )ÚStringÚBinaryÚNumberzj' has an invalid message attribute type, the set of supported type prefixes is Binary, Number, and String.ÚStringValuerK   zpAn error occurred (ParameterValueInvalid) when calling the Publish operation: Could not cast message attribute 'z' value to number.ÚBinaryValueÚ zM' must contain non-empty message attribute value for message attribute type 'z'.)ÚTyper   )	r   r   ÚsplitÚintÚ
ValueErrorÚfloatÚbase64Ú	b64encodeÚdecode)r,   rD   Útransformed_message_attributesÚnamer   Ú	data_typeÚdata_type_partsÚtransform_values           r   rC   z)SNSResponse._transform_message_attributesH   sˆ  € ð
 *,Ð&Ø-×3Ñ3Ó5ò 0	‰KˆD�%à˜jÑ)ˆIÙÜ+Ø-¨d¨VÐ3dÐeóð ð (Ÿo™o¨cÓ2ˆOØ˜qÑ!ð *ñ ô
 ,Ø-¨d¨Vð 42ð 2óð ð #ˆOØ Ñ%Ø"'¨Ñ"6�Ø Ò(ð
Ü˜OÕ,ð  %Ñ'Ü"(×"2Ñ"2°5¸Ñ3GÓ"H×"OÑ"OÓ"Q�Ø "Ò$Ü+Ø-¨d¨Vð 4à& q™\˜N¨"ð.óð ð "Ø(ñ4Ð*¨4Ò0ð[0	ðd .Ð-øô1 &ò ðÜ! /Õ2øÜ)ò Ü"7ð!EàEIÀFÐJ\ð!^ó#ð ðúñ 3ðús*   Á'CÃ	C8ÃCÃC8ÃC2Ã2C8Ã7C8c                 óÐ   — | j                  d«      }| j                  «       }| j                  «       }| j                  j	                  |||«      }d|j
                  i}t        |«      S )NÚNameÚTopicArn)r9   r<   r@   r2   Úcreate_topicÚarnr   )r,   rX   r   r   ÚtopicÚresults         r   r_   zSNSResponse.create_topic‚   s[   € Ø�‰˜vÓ&ˆØ×)Ñ)Ó+ˆ
Ø�~‰~ÓˆØ—‘×)Ñ)¨$°
¸DÓAˆØ˜eŸi™iÐ(ˆÜ˜FÓ#Ð#r.   c                 ó‚   — | j                  d«      }| j                  j                  |¬«      \  }}||dœ}t        |«      S )NÚ	NextToken©Ú
next_token)ÚTopicsrd   )r9   r2   Úlist_topicsr   )r,   rf   Útopicsrb   s       r   rh   zSNSResponse.list_topicsŠ   sA   € Ø—_‘_ [Ó1ˆ
Ø!Ÿ\™\×5Ñ5ÀÐ5ÓLÑˆ�
Ø"°Ñ<ˆÜ˜FÓ#Ð#r.   c                 ón   — | j                  d«      }| j                  j                  |«       t        «       S )Nr^   )r9   r2   Údelete_topicr   )r,   Ú	topic_arns     r   rk   zSNSResponse.delete_topic�   s*   € Ø—O‘O JÓ/ˆ	Ø�‰×!Ñ! )Ô,Ü‹}Ðr.   c           
      óÎ  — | j                  d«      }| j                  j                  |«      }|j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  |j                  dœ	}|j                  r|j                  |d<   |j                  r|j                  |d<   |j                  |d<   d|i}t        |«      S )Nr^   )	ÚOwnerÚPolicyr^   ÚDisplayNameÚSubscriptionsPendingÚSubscriptionsConfirmedÚSubscriptionsDeletedÚDeliveryPolicyÚEffectiveDeliveryPolicyÚKmsMasterKeyIdr7   r5   r4   )r9   r2   Ú	get_topicÚ
account_idÚpolicyr`   Údisplay_nameÚsubscriptions_pendingÚsubscriptions_confimedÚsubscriptions_deletedÚdelivery_policyÚeffective_delivery_policyÚkms_master_key_idÚ
fifo_topicÚcontent_based_deduplicationr   )r,   rl   ra   r   rb   s        r   Úget_topic_attributesz SNSResponse.get_topic_attributes•   sÓ   € Ø—O‘O JÓ/ˆ	Ø—‘×&Ñ& yÓ1ˆà×%Ñ%Ø—l‘lØŸ	™	Ø ×-Ñ-Ø$)×$?Ñ$?Ø&+×&BÑ&BØ$)×$?Ñ$?Ø#×3Ñ3Ø',×'FÑ'Fñ

ˆ
ð ×"Ò"Ø+0×+BÑ+BˆJÐ'Ñ(Ø×ÒØ&+×&6Ñ&6ˆJ�{Ñ#Ø6;×6WÑ6WˆJÐ2Ñ3Ø 
Ð+ˆÜ˜FÓ#Ð#r.   c                 óì   — | j                  d«      }| j                  d«      }| j                  d«      }|dk(  rt        |«      }t        |«      }| j                  j	                  |||«       t        «       S )Nr^   ÚAttributeNameÚAttributeValuer5   )r9   r
   r	   r2   Úset_topic_attributer   )r,   rl   Úattribute_nameÚattribute_values       r   Úset_topic_attributesz SNSResponse.set_topic_attributes«   sh   € Ø—O‘O JÓ/ˆ	ØŸ™¨Ó9ˆØŸ/™/Ð*:Ó;ˆØÐ8Ò8Ü,¨_Ó=ˆOÜ1°.ÓAˆØ�‰×(Ñ(¨°NÀOÔTÜ‹}Ðr.   c                 óî  — | j                  d«      }| j                  d«      }| j                  d«      }| j                  «       }| j                  j                  |||«      }|�{d|v r8|j	                  d«      }| j                  j                  |j                  d|«       |j                  «       D ],  \  }}| j                  j                  |j                  ||«       Œ. d|j                  i}	t        |	«      S )Nr^   ÚEndpointÚProtocolÚFilterPolicyScopeÚSubscriptionArn)	r9   r<   r2   Ú	subscribeÚpopÚset_subscription_attributesr`   r   r   )
r,   rl   ÚendpointÚprotocolr   ÚsubscriptionÚfilter_policy_scopeÚ	attr_nameÚ
attr_valuerb   s
             r   r�   zSNSResponse.subscribeµ   sì   € Ø—O‘O JÓ/ˆ	Ø—?‘? :Ó.ˆØ—?‘? :Ó.ˆØ×)Ñ)Ó+ˆ
à—|‘|×-Ñ-¨i¸À8ÓLˆàÐ!à" jÑ0Ø&0§n¡nÐ5HÓ&IÐ#Ø—‘×8Ñ8Ø ×$Ñ$Ð&9Ð;Nôð *4×)9Ñ)9Ó);ò Ñ%�	˜:Ø—‘×8Ñ8Ø ×$Ñ$ i°õðð
 $ \×%5Ñ%5Ð6ˆÜ˜FÓ#Ð#r.   c                 ón   — | j                  d«      }| j                  j                  |«       t        «       S )Nr�   )r9   r2   Úunsubscriber   )r,   Úsubscription_arns     r   rš   zSNSResponse.unsubscribeÍ   s-   € ØŸ?™?Ð+<Ó=ÐØ�‰× Ñ Ð!1Ô2Ü‹}Ðr.   c                 ó‚   — | j                  d«      }| j                  j                  |¬«      \  }}||dœ}t        |«      S )Nrd   re   ©ÚSubscriptionsrd   )r9   r2   Úlist_subscriptionsr   )r,   rf   Úsubscriptionsrb   s       r   rŸ   zSNSResponse.list_subscriptionsÒ   sI   € Ø—_‘_ [Ó1ˆ
Ø$(§L¡L×$CÑ$CØ!ð %Dó %
Ñ!ˆ�zð $1¸zÑJˆÜ˜FÓ#Ð#r.   c                 ó¦   — | j                  d«      }| j                  d«      }| j                  j                  ||¬«      \  }}||dœ}t        |«      S )Nr^   rd   re   r�   )r9   r2   Úlist_subscriptions_by_topicr   )r,   rl   rf   r    rb   s        r   r¢   z'SNSResponse.list_subscriptions_by_topicÚ   sY   € Ø—O‘O JÓ/ˆ	Ø—_‘_ [Ó1ˆ
Ø$(§L¡L×$LÑ$LØ *ð %Mó %
Ñ!ˆ�zð $1¸zÑJˆÜ˜FÓ#Ð#r.   c           
      ó$  — | j                  d«      }| j                  d«      }| j                  d«      }| j                  d«      }| j                  d«      }| j                  d«      }| j                  d«      }| j                  «       }d }	|�t        |«      st        d«      ‚|�|}	n|}	| j                  d	«      }
	 | j                  j                  |
|	||||||¬
«      }d|i}t        |«      S # t        $ r}t        t        |«      «      ‚d }~ww xY w)NÚ	TargetArnr^   ÚPhoneNumberÚSubjectÚMessageGroupIdÚMessageDeduplicationIdÚMessageStructurez*Phone number does not meet the E164 formatÚMessage)r`   Úphone_numberÚsubjectrD   Úgroup_idÚdeduplication_idÚmessage_structureÚ	MessageId)	r9   rE   r   r   r2   ÚpublishrR   r!   r   )r,   Ú
target_arnrl   r«   r¬   Úmessage_group_idÚmessage_deduplication_idr¯   rD   r`   ÚmessageÚ
message_idÚerrrb   s                 r   r±   zSNSResponse.publishã   s$  € Ø—_‘_ [Ó1ˆ
Ø—O‘O JÓ/ˆ	Ø—‘ }Ó5ˆØ—/‘/ )Ó,ˆØŸ?™?Ð+;Ó<ÐØ#'§?¡?Ð3KÓ#LÐ Ø ŸO™OÐ,>Ó?Ðà!×;Ñ;Ó=ÐàˆØÐ#ä˜<Ô(Ü)Ð*VÓWÐWØÐ#Ø‰CàˆCà—/‘/ )Ó,ˆð	0ØŸ™×-Ñ-ØØØ)ØØ#5Ø)Ø!9Ø"3ð .ó 	ˆJð ˜zÐ*ˆÜ˜FÓ#Ð#øô	 ò 	0Ü%¤c¨#£hÓ/Ð/ûð	0ús   Â;#C- Ã-	DÃ6D
Ä
Dc                 óî   — | j                  d«      }| j                  dg «      }|D ]  }d|v sŒ| j                  |d   «      |d<   Œ  | j                  j                  ||¬«      \  }}||dœ}t	        |«      S )Nr^   ÚPublishBatchRequestEntriesrB   )rl   Úpublish_batch_request_entries)Ú
SuccessfulÚFailed)r9   rC   r2   Úpublish_batchr   )r,   rl   rº   ÚentryÚ
successfulÚfailedrb   s          r   r½   zSNSResponse.publish_batch  s™   € Ø—O‘O JÓ/ˆ	Ø(,¯©Ø(¨"ó)
Ð%ð 3ò 	ˆEØ" eÒ+à-1×-OÑ-OØÐ-Ñ.ó.�Ð)Ò*ð	ð "Ÿ\™\×7Ñ7ØØ*Gð 8ó 
Ñˆ
�Fð !+°fÑ=ˆÜ˜FÓ#Ð#r.   c                 óÒ   — | j                  d«      }| j                  d«      }| j                  «       }| j                  j                  |||«      }d|j                  i}t        |«      S )Nr]   ÚPlatformÚPlatformApplicationArn)r9   r<   r2   Úcreate_platform_applicationr`   r   )r,   rX   Úplatformr   Úplatform_applicationrb   s         r   rÄ   z'SNSResponse.create_platform_application  sf   € Ø�‰˜vÓ&ˆØ—?‘? :Ó.ˆØ×)Ñ)Ó+ˆ
Ø#Ÿ|™|×GÑGØ�(˜Jó 
Ðð +Ð,@×,DÑ,DÐEˆÜ˜FÓ#Ð#r.   c                 óx   — | j                  d«      }| j                  j                  |«      }d|i}t        |«      S )NrÃ   r4   )r9   r2   Ú#get_platform_application_attributesr   ©r,   r`   r   rb   s       r   rÈ   z/SNSResponse.get_platform_application_attributes'  s:   € Ø�o‰oÐ6Ó7ˆØ—\‘\×EÑEÀcÓJˆ
Ø 
Ð+ˆÜ˜FÓ#Ð#r.   c                 ó�   — | j                  d«      }| j                  «       }| j                  j                  ||«       t	        «       S ©NrÃ   )r9   r<   r2   Ú#set_platform_application_attributesr   ©r,   r`   r   s      r   rÌ   z/SNSResponse.set_platform_application_attributes-  s;   € Ø�o‰oÐ6Ó7ˆØ×)Ñ)Ó+ˆ
à�‰×8Ñ8¸¸jÔIÜ‹}Ðr.   c                 óT   — | j                   j                  «       }d|i}t        |«      S )NÚPlatformApplications)r2   Úlist_platform_applicationsr   )r,   Úapplicationsrb   s      r   rÐ   z&SNSResponse.list_platform_applications4  s)   € Ø—|‘|×>Ñ>Ó@ˆØ(¨,Ð7ˆÜ˜FÓ#Ð#r.   c                 ón   — | j                  d«      }| j                  j                  |«       t        «       S rË   )r9   r2   Údelete_platform_applicationr   )r,   Úplatform_arns     r   rÓ   z'SNSResponse.delete_platform_application9  s+   € Ø—‘Ð'?Ó@ˆØ�‰×0Ñ0°Ô>Ü‹}Ðr.   c                 ó,  — | j                  d«      }| j                  j                  |«      }| j                  d«      }| j                  d«      }| j                  «       }| j                  j	                  ||||«      }d|j
                  i}t        |«      S )NrÃ   ÚCustomUserDataÚTokenÚEndpointArn)r9   r2   Úget_applicationr<   Úcreate_platform_endpointr`   r   )r,   Úapplication_arnÚapplicationÚcustom_user_dataÚtokenr   Úplatform_endpointrb   s           r   rÚ   z$SNSResponse.create_platform_endpoint>  sŽ   € ØŸ/™/Ð*BÓCˆØ—l‘l×2Ñ2°?ÓCˆØŸ?™?Ð+;Ó<ÐØ—‘ Ó(ˆØ×)Ñ)Ó+ˆ
Ø ŸL™L×AÑAØÐ)¨5°*ó
Ðð  Ð!2×!6Ñ!6Ð7ˆÜ˜FÓ#Ð#r.   c                 ó®   — | j                  d«      }| j                  j                  |«       | j                  j                  |«      }d|i}t	        |«      S )NrÃ   Ú	Endpoints)r9   r2   rÙ   Ú&list_endpoints_by_platform_applicationr   )r,   rÛ   Ú	endpointsrb   s       r   râ   z2SNSResponse.list_endpoints_by_platform_applicationJ  sL   € ØŸ/™/Ð*BÓCˆØ�‰×$Ñ$ _Ô5Ø—L‘L×GÑGÈÓXˆ	Ø˜yÐ)ˆÜ˜FÓ#Ð#r.   c                 óx   — | j                  d«      }| j                  j                  |«      }d|i}t        |«      S )NrØ   r4   )r9   r2   Úget_endpoint_attributesr   rÉ   s       r   rå   z#SNSResponse.get_endpoint_attributesQ  s9   € Ø�o‰o˜mÓ,ˆØ—\‘\×9Ñ9¸#Ó>ˆ
Ø 
Ð+ˆÜ˜FÓ#Ð#r.   c                 ó�   — | j                  d«      }| j                  «       }| j                  j                  ||«       t	        «       S ©NrØ   )r9   r<   r2   Úset_endpoint_attributesr   rÍ   s      r   rè   z#SNSResponse.set_endpoint_attributesW  s:   € Ø�o‰o˜mÓ,ˆØ×)Ñ)Ó+ˆ
Ø�‰×,Ñ,¨S°*Ô=Ü‹}Ðr.   c                 ón   — | j                  d«      }| j                  j                  |«       t        «       S rç   )r9   r2   Údelete_endpointr   )r,   r`   s     r   rê   zSNSResponse.delete_endpoint]  s*   € Ø�o‰o˜mÓ,ˆØ�‰×$Ñ$ SÔ)Ü‹}Ðr.   c                 óx   — | j                  d«      }| j                  j                  |«      }d|i}t        |«      S )Nr�   r4   )r9   r2   Úget_subscription_attributesr   rÉ   s       r   rì   z'SNSResponse.get_subscription_attributesb  s:   € Ø�o‰oÐ/Ó0ˆØ—\‘\×=Ñ=¸cÓBˆ
Ø 
Ð+ˆÜ˜FÓ#Ð#r.   c                 óÖ   — | j                  d«      }| j                  d«      }| j                  d«      }|dk(  rt        |«      }| j                  j                  |||«       t	        «       S )Nr�   r…   r†   r8   )r9   r
   r2   r’   r   )r,   r`   r—   r˜   s       r   r’   z'SNSResponse.set_subscription_attributesh  s_   € Ø�o‰oÐ/Ó0ˆØ—O‘O OÓ4ˆ	Ø—_‘_Ð%5Ó6ˆ
ØÐ,Ò,Ü'¨
Ó3ˆJØ�‰×0Ñ0°°iÀÔLÜ‹}Ðr.   c                 ó”  — t        t        «      }| j                  j                  «       D ]L  \  }}| j                  j                  |«      }|€Œ$|d   ||j                  d«         |j                  d«      <   ŒN i }|j                  «       D ]  }d|v sŒd|v sŒ|d   ||d   <   Œ | j                  j                  |«       t        «       S )Nr   ÚindexÚtyper   r   )r   ÚdictÚquerystringr   ÚSMS_ATTR_REGEXÚmatchÚgroupÚvaluesr2   Úset_sms_attributesr   )r,   Ú	temp_dictr   r   rô   rb   Úitems          r   r÷   zSNSResponse.set_sms_attributesq  sÍ   € ô
 %0´Ó$5ˆ	Ø×*Ñ*×0Ñ0Ó2ò 	P‰JˆC�Ø×'Ñ'×-Ñ-¨cÓ2ˆEØÑ ØGLÈQÁx�	˜%Ÿ+™+ gÓ.Ñ/°·±¸FÓ0CÒDð	Pð ˆØ×$Ñ$Ó&ò 	4ˆDØ˜Š} ¨D¢Ø&*¨7¡m��t˜E‘{Ò#ð	4ð 	�‰×'Ñ'¨Ô/ä‹}Ðr.   c                 óú   — t        «       }| j                  j                  «       D ]+  \  }}|j                  d«      sŒ|j	                  |d   «       Œ- | j
                  j                  |«      }d|i}t        |«      S )Nzattributes.member.1r   r   )Úsetrò   r   Ú
startswithÚaddr2   Úget_sms_attributesr   )r,   Úfilter_listr   r   r   rb   s         r   rþ   zSNSResponse.get_sms_attributes‰  ss   € Ü“eˆØ×*Ñ*×0Ñ0Ó2ò 	*‰JˆC�Ø�~‰~Ð3Õ4Ø—‘  a¡Õ)ð	*ð —\‘\×4Ñ4°[ÓAˆ
Ø 
Ð+ˆÜ˜FÓ#Ð#r.   c                 óÄ   — | j                  d«      }| j                  j                  |«      €t        d«      ‚| j                  j                  |«      }d|i}t        |«      S )NÚphoneNumberzBInvalid parameter: PhoneNumber Reason: input incorrectly formattedÚ
isOptedOut)r9   ÚOPT_OUT_PHONE_NUMBER_REGEXrô   r   r2   Ú"check_if_phone_number_is_opted_outr   )r,   ÚnumberÚxrb   s       r   r  z.SNSResponse.check_if_phone_number_is_opted_out’  sd   € ð —‘ Ó/ˆØ×*Ñ*×0Ñ0°Ó8Ð@Ü%ØTóð ð �L‰L×;Ñ;¸FÓCˆØ Ð"ˆÜ˜FÓ#Ð#r.   c                 óT   — | j                   j                  «       }d|i}t        |«      S )NÚphoneNumbers)r2   Úlist_phone_numbers_opted_outr   )r,   Únumbersrb   s      r   r	  z(SNSResponse.list_phone_numbers_opted_outŸ  s)   € Ø—,‘,×;Ñ;Ó=ˆØ  'Ð*ˆÜ˜FÓ#Ð#r.   c                 ón   — | j                  d«      }| j                  j                  |«       t        «       S )Nr  )r9   r2   Úopt_in_phone_numberr   )r,   r  s     r   r  zSNSResponse.opt_in_phone_number¤  s*   € Ø—‘ Ó/ˆØ�‰×(Ñ(¨Ô0Ü‹}Ðr.   c                 óö   — | j                  d«      }| j                  d«      }| j                  dg «      }| j                  dg «      }| j                  j                  | j                  ||||¬«       t	        «       S )Nr^   ÚLabelÚAWSAccountIdÚ
ActionName)Úregion_namerl   ÚlabelÚaws_account_idsÚaction_names)r9   r2   Úadd_permissionr1   r   )r,   rl   r  r  r  s        r   r  zSNSResponse.add_permission©  sr   € Ø—O‘O JÓ/ˆ	Ø—‘ Ó(ˆØŸ/™/¨.¸"Ó=ˆØ—‘ |°RÓ8ˆØ�‰×#Ñ#ØŸ™ØØØ+Ø%ð 	$ô 	
ô ‹}Ðr.   c                 ó’   — | j                  d«      }| j                  d«      }| j                  j                  ||«       t        «       S )Nr^   r  )r9   r2   Úremove_permissionr   )r,   rl   r  s      r   r  zSNSResponse.remove_permission·  s:   € Ø—O‘O JÓ/ˆ	Ø—‘ Ó(ˆØ�‰×&Ñ& y°%Ô8Ü‹}Ðr.   c                 óŽ   — | j                  d«      }|| j                  j                  vrt        d«      ‚d|› d�i}t	        |«      S )Nr^   zTopic does not existr�   z%:68762e72-e9b1-410a-8b3b-903da69ee1d5)r9   r2   ri   r   r   )r,   r`   rb   s      r   Úconfirm_subscriptionz SNSResponse.confirm_subscription½  sM   € Ø�o‰o˜jÓ)ˆà�d—l‘l×)Ñ)Ñ)Ü"Ð#9Ó:Ð:ð" $¨ uÐ,QÐ%RÐSˆÜ˜FÓ#Ð#r.   c                 óx   — | j                  d«      }| j                  j                  |«      }d|i}t        |«      S )NÚResourceArnr>   )r9   r2   Úlist_tags_for_resourcer   )r,   r`   r   rb   s       r   r  z"SNSResponse.list_tags_for_resourceÕ  s8   € Ø�o‰o˜mÓ,ˆØ�|‰|×2Ñ2°3Ó7ˆØ˜$�ˆÜ˜FÓ#Ð#r.   c                 ó�   — | j                  d«      }| j                  «       }| j                  j                  ||«       t	        «       S )Nr  )r9   r@   r2   Útag_resourcer   )r,   r`   r   s      r   r  zSNSResponse.tag_resourceÛ  s8   € Ø�o‰o˜mÓ,ˆØ�~‰~ÓˆØ�‰×!Ñ! # tÔ,Ü‹}Ðr.   c                 ó”   — | j                  d«      }| j                  dg «      }| j                  j                  ||«       t        «       S )Nr  ÚTagKeys)r9   r2   Úuntag_resourcer   )r,   r`   Útag_keyss      r   r!  zSNSResponse.untag_resourceá  s<   € Ø�o‰o˜mÓ,ˆØ—?‘? 9¨bÓ1ˆØ�‰×#Ñ# C¨Ô2Ü‹}Ðr.   ÚrequestÚfull_urlÚheadersc                 óª   — t        «       }d|_        |j                  | «       |j                  d«      d   }|j                  j
                  |   }di |fS )NFú/éÿÿÿÿéÈ   )r%   r+   Úsetup_classrP   r2   Ú_message_public_keys)r#  r$  r%  r'   Úkey_namer   s         r   Ú	serve_pemzSNSResponse.serve_pemç  sP   € ä‹mˆØ*/ˆÔ'Ø�‰˜Ô Ø—>‘> #Ó& rÑ*ˆØ�k‰k×.Ñ.¨xÑ8ˆØ�B˜ˆ|Ðr.   )r   N)<Ú__name__Ú
__module__Ú__qualname__ÚreÚcompileró   r  r#   r   Ú RESPONSE_KEY_PATH_TO_TRANSFORMERr*   Úpropertyr   r2   rñ   r!   r   r<   r@   rE   rC   r   r_   rh   rk   rƒ   rŠ   r�   rš   rŸ   r¢   r±   r½   rÄ   rÈ   rÌ   rÐ   rÓ   rÚ   râ   rå   rè   rê   rì   r’   r÷   rþ   r  r	  r  r  r  r  r  r  r!  Ústaticmethodr   r-  Ú__classcell__)r-   s   @r   r%   r%      s—  ø„ Ø�R—Z‘ZØCó€Nð ", §¡¨KÓ!8Ðà4HØ?SØ/CØ8LØ1EØThØ`tØ,:ñ	(Ð$õ0ð ð?˜ò ?ó ð?ð  c¨3 h¡ó ð:˜4  S ™>ó :ðF¨4°°S°©>ó Fð8.Ø"& s¨C x¡.ð8.à	ˆc�3ˆh‰ó8.ðt$˜ló $ð$˜\ó $ð˜ló ð
$ ló $ð, ló ð$˜<ó $ð0˜\ó ð
$ Ló $ð$¨\ó $ð&$˜ó &$ðP$˜|ó $ð$$¨\ó $ð$°\ó $ð°\ó ð$¨Ló $ð
¨\ó ð

$¨,ó 
$ð$¸ó $ð$¨ó $ð¨ó ð ó ð
$¨\ó $ð¨\ó ð Ló ð0$ Ló $ð$à	ó$ð$¨ló $ð
 \ó ð
 ó ð <ó ð$ ló $ð0$¨ó $ð˜ló ð ó ð ð˜3ð ¨#ð ¸ð Àò ó ôr.   r%   )rT   r1  Úcollectionsr   Útypingr   Úmoto.core.responsesr   r   r   r   Úmoto.core.utilsr	   r
   Ú
exceptionsr   r   r   Úmodelsr   r   Úutilsr   rñ   r!   Úlistr   r#   r%   © r.   r   ú<module>r@     s‚   ðÛ Û 	Ý #Ý ç VÓ Vß Dç TÑ Tß ,Ý ðI˜˜c 3˜h™ð I¨D°°c¸3°h±Ñ,@ó Ið T¨#¨s¨(¡^ð ¸¸SÀ#¸X¹ó ôS�,õ Sr.   