
    ,                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSK	Jr  SSKJr  SS	KJr  \R                   \R"                  " \R$                  R&                  5       " S
 S\R(                  5      5       5       r\R"                  " \R$                  R,                  5       " S S\5      5       r\R"                  " \R$                  R0                  5       " S S\5      5       rg)zMDetach GCF 2nd gen function from GCF and make it a native Cloud Run function.    )client)
exceptions)util)base)flags)run_util)log)
console_ioc                   4    \ rS rSrSr\S 5       rS rS rSr	g)Detach   kDetach a Cloud Functions v2 function from its existing environment and make it a native Cloud Run function.c                 .    [         R                  " U SS9  g )Nz6The name of the Cloud Functions v2 function to detach.)help_text_override)r   AddFunctionResourceArg)parsers    lib/surface/functions/detach.pyArgsDetach.Args    s    	  D    c                 z   [         R                  " U R                  5       5      nUR                  R                  R                  5       nUR                  5       nSU S3n[        R                  " 5       (       a  [        R                  " USSS9  UR                  U5      nU(       d%  [        R                  " SR                  U5      5      eUR                  U5      nSn[        R                   " UR"                  UR$                  Xx5        [&        R(                  " U5      n	U R+                  XIR,                  5        g )Nz-WARNING: This command detaches your function z from the Cloud Functions API (cloudfunctions.googleapis.com). Detached functions continue to serve traffic, and retain the `cloudfunctions.net` URL. You can only manage your detached functions using the Cloud Run Admin API or the `gcloud run <command>`. T)defaultcancel_on_nozFunction [{}] does not exist.zRDetaching function from Google Cloud Functions API (cloudfunctions.googleapis.com))	client_v2FunctionsClientReleaseTrackCONCEPTSnameParseRelativeNamer
   	CanPromptPromptContinueGetFunctionr   FunctionsErrorformatDetachFunctionapi_utilWaitForOperationr   messagesr   
GetService_PrintSuccessMessageurls)
selfargsr   function_reffunction_namemessagefunction	operationdescriptionservices
             r   Run
Detach.Run)   s   &&t'8'8':;F==%%++-L --/M 8 G 	  DI!!-0H%%
)
0
0
?  %%m4I	+  v	
 !!(+Gm\\:r   c                    [         R                  R                  5         [         R                  R                  SU S35        U H%  n[         R                  R                  SU 35        M'     [         R                  R                  S5        g )Nz	Function zh has been detached successfully! Your function will continue to be available at the following endpoints:z* zAny existing event triggers associated with your function will continue to work and can be managed through Eventarc API.
Reminder, your function can now be managed through the Cloud Run API. )r	   statusPrint)r-   r0   r,   urls       r   r+   Detach._PrintSuccessMessageL   ss    JJJJ
M? #N 	N 	jjC5z" JJ	Qr    N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r6   r+   __static_attributes__r=   r   r   r   r      s%     t !;Fr   r   c                       \ rS rSrSrSrg)
DetachBeta[   r   r=   Nr>   r?   r@   rA   rB   rD   r=   r   r   rF   rF   [       sr   rF   c                       \ rS rSrSrSrg)DetachAlpha`   r   r=   NrH   r=   r   r   rK   rK   `   rI   r   rK   N)rB   #googlecloudsdk.api_lib.functions.v2r   r   r   r   r'   googlecloudsdk.callioper   $googlecloudsdk.command_lib.functionsr   r   googlecloudsdk.corer	   googlecloudsdk.core.consoler
   DefaultUniverseOnlyReleaseTracksr   GACommandr   BETArF   ALPHArK   r=   r   r   <module>rX      s    T C : @ ( 6 9 # 2 D%%(();T\\ ; * ;| D%%**+t t ,t D%%++,t* t -tr   