
    
                     \    S r SSKJr  SSKJr  SSKJr   " S S\R                  5      r	S r
g)	z<Wrapper around serverless_operations CancelFoo for surfaces.    )waiter)
exceptions)progress_trackerc                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
CancellationPoller   z%Polls for cancellation of a resource.c                     Xl         SU l        g)z%Supply getter as the resource getter.N_getter_ret)selfgetters     2lib/googlecloudsdk/command_lib/run/cancellation.py__init__CancellationPoller.__init__   s    LDI    c                 L    US L =(       d    UR                   R                  5       $ N)
conditions
IsTerminalr   objs     r   IsDoneCancellationPoller.IsDone   s    $;5#..3355r   c                 F    U R                  U5      U l        U R                  $ r   r
   )r   refs     r   PollCancellationPoller.Poll"   s    S!DI99r   c                     U R                   (       aH  U R                   R                  (       a-  U R                   R                  R                  5       =(       d    S$ g)N )r   r   DescriptiveMessage)r   s    r   
GetMessageCancellationPoller.GetMessage&   s6    yyTYY))YY!!446<"<r   c                     U$ r    r   s     r   	GetResultCancellationPoller.GetResult+   s    Jr   r
   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r"   r&   __static_attributes__r%   r   r   r   r      s    -
6
r   r   c                    U(       a	  U" U 5        g[        U5      n[        R                  " SR                  U R	                  5       5      UR
                  S9   U" U 5        [        R                  " X@5      nU(       d3  [        R                  " SR                  U R	                  5       5      5      eUR                  R                  5       (       a3  [        R                  " SR                  U R	                  5       5      5      eUR                  R                  5       S:w  a  UR                  5       (       aB  [        R                  " SR                  U R	                  5       UR                  5       5      5      e[        R                  " SR                  U R	                  5       5      5      e SSS5        g! , (       d  f       g= f)zFCancels a resource for a surface, including a pretty progress tracker.NzCancelling [{}])messagedetail_message_callbackzFailed to cancel [{}].z=[{}] has completed successfully before it could be cancelled.	CancelledzFailed to cancel [{}]: {})r   r   ProgressTrackerformatNamer"   r   PollUntilDoneserverless_exceptionsCancellationFailedErrorr   IsReadyTerminalConditionReason)r   r   	cancellerasync_pollerress         r   Cancelr>   /   sX   cN
f%&''&&sxxz2$// cN


v
+C!99
"
)
)#((*
5  ~~!99
I6#((*  ~~--/;>					#;;'..sxxz6;L;L;NO
 	
 $;;$++CHHJ7
 	
 ?  s   EF55
GN)r,   googlecloudsdk.api_lib.utilr   googlecloudsdk.command_lib.runr   r6   googlecloudsdk.core.consoler   OperationPollerr   r>   r%   r   r   <module>rC      s-    C / N 8// 0
r   