ó
    €Ïr  ã                   óD   • S r SrSrSrS rS rS rS rS rS	 r	S
 r
S rg)zECommon command-agnostic utility functions for entraid-certs commands.ÚActiveÚNextÚPreviousc                 ó|   • U R                   R                  UR                  UR                  UR                  S95      $ )z?Calls the list entraid certs endpoint and returns the response.)ÚprojectÚinstance)Ú	instancesÚListEntraIdCertificatesÚ*SqlInstancesListEntraIdCertificatesRequestr   r   )Ú
sql_clientÚsql_messagesÚinstance_refs      Ú3lib/googlecloudsdk/api_lib/sql/ssl/entraid_certs.pyr	   r	      s?   € à	×	Ñ	×	5Ñ	5Ø×=Ñ=Ø×&Ñ&°×1FÑ1Fð >ð ó
ð ó    c                 óN   • [        U 5      nUR                  [        5      [        4$ )z"Returns the current Entra ID Cert.)ÚGetEntraIdCertificateTypeDictÚgetÚACTIVE_CERT_LABEL©Úlist_entraid_certs_responseÚentraid_cert_typess     r   Ú_GetCurrentEntraIdCertificater   "   s*   € ä4Ø!óÐð ×
 Ñ
 Ô!2Ó
3Ô5FÐ	GÐGr   c                 ó0   • [        XU5      n[        U5      $ )zReturns the next Entra ID Cert.)r	   Ú*_GetNextEntraIdCertificateFromListResponse©r   r   r   r   s       r   ÚGetNextEntraIdCertificater   *   s    € ä 7Ø ó!Ðô 
4Ð4OÓ	PÐPr   c                 óN   • [        U 5      nUR                  [        5      [        4$ ©N)r   r   ÚNEXT_CERT_LABELr   s     r   r   r   2   s(   € Ü4Ø!óÐð ×
 Ñ
 ¤Ó
1´?Ð	CÐCr   c                 ó0   • [        XU5      n[        U5      $ )zÕReturns the previous Entra ID Cert.

Args:
  sql_client: Sql client.
  sql_messages: Sql messages.
  instance_ref: Instance reference.

Returns:
  A tuple of the previous Entra ID Cert and the status of the cert.
)r	   Ú_GetPreviousEntraIdCertificater   s       r   ÚGetPreviousEntraIdCertificater!   9   s"   € ô !8Ø ó!Ðô 
(Ð(CÓ	DÐDr   c                 óN   • [        U 5      nUR                  [        5      [        4$ r   )r   r   ÚPREVIOUS_CERT_LABELr   s     r   r    r    J   s*   € Ü4Ø!óÐð ×
 Ñ
 Ô!4Ó
5Ô7JÐ	KÐKr   c                 óx   • [        XU5      n[        UR                  5      S:X  a  [        U5      $ [	        U5      $ )a$  Returns the added Entra ID Cert.

If this is the first cert, that cert will be Active. Subsequent certs will be
Next.

Args:
  sql_client: Sql client.
  sql_messages: Sql messages.
  instance_ref: Instance reference.

Returns:
  A tuple of the added Entra ID Cert and the status of the cert.
é   )r	   ÚlenÚcertsr   r   r   s       r   ÚGetAddedEntraIdCertificater(   Q   sF   € ô !8Ø ó!Ðô 	Ð	$×	*Ñ	*Ó+¨qÓ0Ü(Ð)DÓEÐEä5Ø#óð r   c                 óÔ  • 0 nU R                   nU R                  nSnU H  nUR                  U:X  d  M  Un  O   U(       d  U$ XA[        '   U Vs/ s H  oUR                  U:w  d  M  UPM     nn[	        U5      S:X  a4  US   nUR
                  UR
                  :”  a
  Xq[        '   U$ Xq[        '    U$ [	        U5      S:”  a#  [        US S9nUS   U[        '   US   U[        '   U$ s  snf )aD  Gets a dictionary mapping Entra ID Cert types to certs.

The keys to the dictionary returned will be some combination of 'Current',
'Next', and 'Previous'.

Args:
  list_entraid_certs_response: InstancesListEntraIdCertificatesResponse
    instance.

Returns:
  A dictionary mapping Entra ID Cert types to SslCert instances.
Nr%   é    c                 ó   • U R                   $ r   )Ú
createTime)Úcerts    r   Ú<lambda>Ú/GetEntraIdCertificateTypeDict.<locals>.<lambda>“   s   € ¸T¿_º_r   )Úkeyéÿÿÿÿ)	ÚactiveVersionr'   Úsha1Fingerprintr   r&   r,   r   r#   Úsorted)r   r   Ú	active_idr'   Úactive_certr-   Úinactive_certsÚinactive_certs           r   r   r   j   s  € ð Ðà)×7Ñ7€)ð &×
+Ñ
+€%Ø€+Û€dØ×Ñ˜yÕ(Ø€kÙñ ö 
àÐØ*5Ô&Ñ'ñ &+ÓP¢U˜T×.BÑ.BÀiÑ.O—D¡U€.ÐPÜˆÓ˜AÓØ" 1Ñ%€MØ×Ñ +×"8Ñ"8Ó8à,9œÑ)ð 
Ðð 1>Ô,Ò-ð 
Ðô ˆ>Ó˜QÓä˜NÑ0LÑM€NØ.<¸QÑ.?ÐÔ*Ñ+Ø*8¸Ñ*<Ð”Ñ'à	Ðùò Qs   ÁC%Á&C%N)Ú__doc__r   r   r#   r	   r   r   r   r!   r    r(   r   © r   r   Ú<module>r;      sK   ðñ  Lð Ð Ø€Ø Ð òòHòQòDòEò"Lòó2-r   