ó
    €Ï  ã                   óˆ   • S r SSKJr  SSKJr  SSKJr  SSKJr   " S S\5      r " S S	\5      r	S
 r
S rS rS rS rS rg)z5PSC Connection utilities for `gcloud redis clusters`.é    )Úabsolute_import)Údivision)Úunicode_literals)Úutilc                   ó   • \ rS rSrSrSrg)ÚErroré   zExceptions for this module.© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r
   ó    Ú7lib/googlecloudsdk/command_lib/redis/psc_update_util.pyr   r      s   † Ü#r   r   c                   ó   • \ rS rSrSrSrg)ÚInvalidInputErroré   z)Error for parsing cluster endpoint input.r
   Nr   r
   r   r   r   r      s   † Ü1r   r   c                 óª   • [         R                  " U 5      n[         R                  " U 5      nUR                  R	                  UR                  US95      $ )N)Úname)r   ÚGetClientForResourceÚGetMessagesForResourceÚprojects_locations_clustersÚGetÚ(RedisProjectsLocationsClustersGetRequest)Úcluster_refÚcluster_nameÚclientÚmessagess       r   Ú_GetClusterr"       sL   € Ü×$Ò$ [Ó1€&Ü×(Ò(¨Ó5€(Ø	×	+Ñ	+×	/Ñ	/Ø×7Ñ7¸\Ð7ÐJó
ð r   c                 óL   • [        U R                  5      S:w  a  [        S5      eg )Né   z;Each cluster endpoint should have two connections in a pair)ÚlenÚconnectionsr   )Úcluster_endpoints    r   Ú_ValidateConnectionLengthr(   (   s-   € ÜÐ	×	%Ñ	%Ó&¨!Ó+Ü
ØEóGð Gð ,r   c                 óÔ   • [        XR                  5      nUR                  nUR                   H  n[	        U5        UR                  U5        M!     XBR                  l        SUl        U$ )z4Hook to update cluster endpoint for a redis cluster.Úcluster_endpoints)r"   r   ÚclusterEndpointsr'   r(   ÚappendÚclusterÚ
updateMask)r   ÚargsÚpatch_requestr-   Úall_cluster_endpointsr'   s         r   ÚUpdateClusterEndpointsr2   .   sd   € ä˜×%7Ñ%7Ó8€'Ø!×2Ñ2Ðà×/Ô/ÐÜÐ.Ô/Ø× Ñ Ð!1Ö2ñ 0ð ,A×ÑÔ(Ø0€-ÔØ	Ðr   c                 ó:   • [        S U R                   5       5      $ )Nc              3   ól   #   • U  H*  nUR                   c  M  UR                   R                  v •  M,     g 7f©N)ÚpscConnectionÚpscConnectionId)Ú.0Ú
connections     r   Ú	<genexpr>Ú$_ExtractAllPSCIDs.<locals>.<genexpr>=   s.   é € ð â,ˆ*Ø	×	!Ñ	!ó /€j×Ñ×.Ö.Ú,ùs   ‚4—4)Úsetr&   )Úendpoints    r   Ú_ExtractAllPSCIDsr>   <   s"   € Ü	ñ à ×,Ò,óó 
ð r   c                 óD   ^• [        U 5      m[        U4S jU 5       5      $ )Nc              3   ó@   >#   • U  H  n[        U5      T:H  v •  M     g 7fr5   )r>   )r8   Úto_be_removedÚexisting_idss     €r   r:   Ú'_IsInToBeRemovedList.<locals>.<genexpr>F   s"   øé € ð â-ˆ-ô ˜Ó&¨,Ö6Ú-ùs   ƒ)r>   Úany)r=   Úto_be_removed_listrB   s     @r   Ú_IsInToBeRemovedListrF   D   s'   ø€ Ü" 8Ó,€,Ü	ô á-óó 
ð r   c                 ó"  • [        XR                  5      nUR                  nUR                   H  n[	        U5        M     / nU H0  n[        XqR                  5      (       a  M  UR                  U5        M2     XbR                  l        SUl        U$ )z7Hook to remove a cluster endpoint from a redis cluster.r*   )	r"   r   r+   r'   r(   rF   r,   r-   r.   )r   r/   r0   r-   r1   r'   Únew_cluster_endpointsÚexisting_endpoints           r   ÚRemoveClusterEndpointsrJ   L   s‰   € ä˜×%7Ñ%7Ó8€'Ø!×2Ñ2Ðà×/Ô/ÐÜÐ.Ö/ñ 0ð ÐÛ0ÐÜÐ 1×3HÑ3H×IÓIØ×"Ñ"Ð#4Ö5ñ 1ð ,A×ÑÔ(Ø0€-ÔØ	Ðr   N)r   Ú
__future__r   r   r   Ú googlecloudsdk.command_lib.redisr   Ú	Exceptionr   r   r"   r(   r2   r>   rF   rJ   r
   r   r   Ú<module>rN      sM   ðñ <å &Ý Ý 'å 1ô$ˆIô $ô2˜ô 2òòGòòòór   