
                             d Z ddlmZ ddlmZ dZdej                  fdZdej                  fdZ	deej                     fd	Z
d
 Zy)z+Util functions for Cloud Run v2 conditions.    )Sequence	conditionReadyr   c                 d    | j                   t        j                  j                  j                  k(  S N)statecondition_objects	ConditionStateCONDITION_SUCCEEDEDr   s    3lib/googlecloudsdk/command_lib/run/v2/conditions.pyIsConditionReadyr      s&    oo*44::NNN    c                 d    | j                   t        j                  j                  j                  k(  S r   )r	   r
   r   r   CONDITION_FAILEDr   s    r   IsConditionFailedr      s$    	-77==NN	NNr   
conditionsc                 @    | D ]  }|j                   t        k(  s|c S  y r   )type_ready_condition_type)r   r   s     r   _GetReadyConditionr   #   s$    i~~..  
r   c                 \    t        | d      r| j                  S t        | j                        S )a  Returns the terminal condition of a resource.

  Args:
    resource: A Cloud Run v2 resource to get the terminal condition of.

  Returns:
    A condition object representing the terminal condition of the resource, or
    None if the resource does not have a terminal condition.
  terminal_condition)hasattrr   r   r   )resources    r   GetTerminalConditionr   *   s4     
/	0 !! h112r   N)__doc__typingr   ;googlecloudsdk.generated_clients.gapic_clients.run_v2.typesr   r
   r   r   r   r   r   r    r   r   <module>r"      s]    2  f    1 ; ; O!2!<!< O8,=,G,G#H r   