
    
                         S r SSKJr   " S S\R                  5      r " S S\5      rS r " S S	\R                  5      r " S
 S\5      r	S r
g)zFCode that's shared between multiple router route policies subcommands.    )
exceptionsc                       \ rS rSrSrSrg)RoutePolicyError   zFError superclass for all router route policies surface-related errors. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       Dlib/googlecloudsdk/command_lib/compute/routers/route_policy_utils.pyr   r      s    Nr   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )PolicyTermNotFoundError   z-Error raised when a policy term is not found.c                 J   > SR                  US9n[        [        U ]  U5        g )Nz(Policy term [{term_priority}] not found.)term_priority)formatsuperr   __init__)selfr   msg	__class__s      r   r    PolicyTermNotFoundError.__init__   s-    
4
;
;# < C 

!41#6r   r   r	   r
   r   r   r   r   r   __classcell__r   s   @r   r   r      s    57 7r   r   c                 f    U R                    H  nUR                  U:X  d  M  Us  $    [        U5      e)a9  Searches for and returns a term in the route policy resource.

Args:
  resource: The route policy resource to find term for.
  term_priority: The priority of the term to find.

Returns:
  The term with the given priority, if found.

Raises:
  PolicyTermNotFoundError: If no term with the given priority is found.
)termspriorityr   )resourcer   terms      r   FindPolicyTermOrRaiser%   "   s0     nnd}}%k  	 ..r   c                       \ rS rSrSrSrg)NamedSetError5   zAError superclass for all router named set surface-related errors.r   Nr   r   r   r   r'   r'   5   s    Ir   r'   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )NamedSetElementNotFoundError9   z3Error raised when a named set element is not found.c                 J   > SR                  US9n[        [        U ]  U5        g )Nz&Named set element {element} not found.)element)r   r   r*   r   )r   r-   r   r   s      r   r   %NamedSetElementNotFoundError.__init__<   s&    
2
9
9'
9
JC	
&6s;r   r   r   r   s   @r   r*   r*   9   s    ;< <r   r*   c                 f    U R                    H  nUR                  U:X  d  M  Us  $    [        U5      e)aZ  Searches for and returns an element in the named set resource.

Args:
  resource: The named set resource to find element for.
  element_cel: The CEL expression of the element to find.

Returns:
  The element with the given CEL expression, if found.

Raises:
  NamedSetElementNotFoundError: If no element with the given CEL expression is
  found.
)elements
expressionr*   )r#   element_celr-   s      r   FindNamedSetElementOrRiser3   A   s4     ""g[(n # 	%[11r   N)r   googlecloudsdk.corer   core_exceptionsErrorr   r   r%   r'   r*   r3   r   r   r   <module>r7      sY    M =O,, O7. 7/&JO)) J<= <2r   