§
    >xÅjä  ã                   ó’  — d dl mZmZ d dlZd dlmZmZ d dlmZ d dl	m
Z
mZ d dlmZmZ d dlmZ d dlmZmZ d d	lmZ d d
lmZ d dlmZ  G d„ de¦  «        Zdededdfd„Z ej        de¬¦  «        	 	 	 ddej        deedz   ej        d¬¦  «        f         deedz   ej         dd¬¦  «        f         dedef
d„¦   «         Z!dS )é    )Ú	AnnotatedÚAnyN)Ú	BaseModelÚField)ÚRichToolkit)Ú	APIClientÚCustomDomain)ÚUserCommandÚget_user_command_context)Údomains_app)Ú_find_custom_domainÚ_select_custom_domain)Úrender_custom_domain_details)Úresolve_app_id_or_fail)ÚJsonOutputOptionc                   óV   — e Zd ZU eed<   eed<   dZee e	d¬¦  «        f         ed<   dS )ÚCustomDomainRestartOutputÚapp_idÚdomainT)ÚexcludeÚ
show_titleN)
Ú__name__Ú
__module__Ú__qualname__ÚstrÚ__annotations__r	   r   r   Úboolr   © ó    ú[C:\Projects\Historical\venv\Lib\site-packages\fastapi_cloud_cli/commands/domains/restart.pyr   r      sN   € € € € € € Ø€K€K�KØÐÐÑØ7;€J�	˜$  ¨dÐ 3Ñ 3Ô 3Ð3Ô4Ð;Ð;Ñ;Ð;Ð;r   r   ÚdataÚtoolkitÚreturnc                 óp  — | j         r)|                     d¦  «         |                     ¦   «          |                     d| j        j        › d�d¬¦  «         |                     ¦   «          t          | j        |¦  «         |                     ¦   «          |                     d| j        j        › d�¦  «         d S )Núcustom domainsz!Restarted verification for [bold]z[/bold]u   ðŸ�”)Úemojiz*[dim]hint: Run `fastapi cloud domains get z` to check progress.[/dim])r   Úprint_titleÚ
print_lineÚprintr   Únamer   )r!   r"   s     r    Ú$_render_custom_domain_restart_outputr+      sÚ   € ð „ð Ø×ÒÐ,Ñ-Ô-Ð-Ø×ÒÑÔÐà‡M‚MØE¨D¬KÔ,<ÐEÐEÐEØð ñ ô ð ð ×ÒÑÔÐÝ  ¤¨gÑ6Ô6Ð6Ø×ÒÑÔÐØ‡M‚Mð	8ØŒ;Ôð	8ð 	8ð 	8ñô ð ð ð r   Úrestart)ÚclsFÚctxr   z?Hostname or ID of the custom domain whose setup should restart.)Úhelpr   z--app-idz*ID of the app that owns the custom domain.Újson_outputc                 ó¢  — t          | ¦  «        j        }t          ||¬¦  «        }|du}|€#|j        dk    r|                     ddd¬¦  «         t          ¦   «         5 }|                     dd	¬
¦  «        5 }|                     |dd|¬¦  «        5  |                     |¬¦  «        j	        }ddd¦  «         n# 1 swxY w Y   ddd¦  «         n# 1 swxY w Y   |€ƒ| 
                    d¦  «         |                     ¦   «          d„ |D ¦   «         }	|	s%|                     dd¬¦  «         	 ddd¦  «         dS t          ||	d¬¦  «        }
|                     ¦   «          n.t          ||¦  «        }
|
€|                     dd|› d�d¬¦  «         |
€J ‚|                     dd	¬
¦  «        5 }|                     |dd|¬¦  «        5  |                     ||
j        ¬¦  «        }ddd¦  «         n# 1 swxY w Y   ddd¦  «         n# 1 swxY w Y   ddd¦  «         n# 1 swxY w Y   |                     t%          |||¬¦  «        t&          ¬¦  «         dS )z8
    Restart failed custom domain setup for an app.
    )r   NÚjsonÚmissing_required_inputzCustom domain is required.z&Pass DOMAIN to choose a custom domain.)ÚhintzFetching custom domainsT)ÚtitleÚ	transientz6Error fetching custom domains. Please try again later.zApp not found.)Údefault_messageÚnot_found_messager"   r%   c                 ó    — g | ]}|j         ¯	|‘ŒS r   )Úsetup_failed)Ú.0r   s     r    ú
<listcomp>z"restart_domain.<locals>.<listcomp>c   s    € ÐRÐRÐR¨¸fÔ>QÐR˜fÐRÐRÐRr   zNo failed custom domains found.F)Úbulletz$Select the custom domain to restart:)ÚpromptÚ	not_foundzCustom domain z not found.zARun `fastapi cloud domains list` to see available custom domains.zRestarting custom domain setupz=Error restarting custom domain setup. Please try again later.zCustom domain not found.)r   Ú	domain_id)r   r   r   )Úrender_output)r   r"   r   ÚmodeÚfailr   ÚprogressÚhandle_http_errorsÚget_custom_domainsr!   r'   r(   r)   r   r   Úrestart_custom_domain_setupÚidÚsuccessr   r+   )r.   r   r   r0   r"   Údomain_was_providedÚclientrD   ÚdomainsÚfailed_domainsÚselected_domainÚrestarted_domains               r    Úrestart_domainrP   .   si  € õ* ' sÑ+Ô+Ô3€GÝ# G°FÐ;Ñ;Ô;€FØ ¨Ð,Ðà€~˜'œ,¨&Ò0Ð0Ø�ŠØ$Ø(Ø9ð 	ñ 	
ô 	
ð 	
õ 
‰Œð ?˜à×ÒØ/Øð ñ ô ð	Dð Ø×%Ò%ØàLà"2Øð &ñ ô ð	Dð 	Dð ×/Ò/°vÐ/Ñ>Ô>ÔCˆGð	Dð 	Dð 	Dñ 	Dô 	Dð 	Dð 	Dð 	Dð 	Dð 	Dð 	Døøøð 	Dð 	Dð 	Dð 	Dð 	Dð 	Dð 	Dñ 	Dô 	Dð 	Dð 	Dð 	Dð 	Dð 	Dð 	Døøøð 	Dð 	Dð 	Dð 	Dð" ˆ>Ø×ÒÐ 0Ñ1Ô1Ð1Ø×ÒÑ Ô Ð ØRÐR°7ÐRÑRÔRˆNà!ð Ø—’Ð?È�ÑNÔNÐNØð3?ð ?ð ?ñ ?ô ?ð ?ð ?ð ?õ6 4ØØØ=ðñ ô ˆOð
 ×ÒÑ Ô Ð Ð å1°'¸6ÑBÔBˆOØÐ&Ø—’ØØ8 VÐ8Ð8Ð8ð*ð	 ñ ô ð ð Ð*Ð*Ð*à×ÒØ6Øð ñ ô ð	ð Ø×%Ò%ØàSà"<Øð &ñ ô ð	ð 	ð  &×AÒAØØ)Ô,ð  Bñ  ô  Ðð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð]?ð ?ð ?ñ ?ô ?ð ?ð ?ð ?ð ?ð ?ð ?øøøð ?ð ?ð ?ð ?ðB ‡O‚OÝ!ØØ#Ø*ð	
ñ 	
ô 	
õ
 ;ð ñ ô ð ð ð sª   ÁHÁ5CÂB7Â+CÂ7B;Â;CÂ>B;Â?CÃHÃC	ÃHÃC	ÃAHÄ7A0HÆ'HÇG*ÇHÇ*G.Ç.HÇ1G.Ç2HÇ5HÈH	ÈHÈH	È	HÈHÈH)NNF)"Útypingr   r   ÚtyperÚpydanticr   r   Úrich_toolkitr   Úfastapi_cloud_cli.apir   r	   Ú fastapi_cloud_cli.commands._authr
   r   Ú'fastapi_cloud_cli.commands.domains._appr   Ú*fastapi_cloud_cli.commands.domains._sharedr   r   Ú,fastapi_cloud_cli.commands.domains.renderingr   Úfastapi_cloud_cli.utils.appsr   Ú!fastapi_cloud_cli.utils.executionr   r   r+   ÚcommandÚContextr   ÚArgumentÚOptionrP   r   r   r    ú<module>r`      s-  ðØ !Ð !Ð !Ð !Ð !Ð !Ð !Ð !à €€€Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø $Ð $Ð $Ð $Ð $Ð $à 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø RÐ RÐ RÐ RÐ RÐ RÐ RÐ RØ ?Ð ?Ð ?Ð ?Ð ?Ð ?ðð ð ð ð ð ð ð ð VÐ UÐ UÐ UÐ UÐ UØ ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø >Ð >Ð >Ð >Ð >Ð >ð<ð <ð <ð <ð < 	ñ <ô <ð <ðØ
#ðàðð 
ðð ð ð ð* €Ô�Y KÐ0Ñ0Ô0ð 	ð 	Ø$)ðgð gØ	ŒðgàØˆd‰
ØˆŒØRð	
ñ 	
ô 	
ð	ôðgð Øˆd‰
ØˆŒØØ=ð	
ñ 	
ô 	
ð	ôðgð "ðgð  	ð!gð gð gñ 1Ô0ðgð gð gr   