
                         f    S r SSKJr  SSKJr  SSKrSrSr\R                  q	S r
S rS	 rS
 rS rg)z*Utilities for `gcloud app firewall-rules`.    )
exceptions)	resourcesNizS
  table(
    priority:sort=1,
    action,
    source_range,
    description
  )
  c                      [         R                  R                  SU 5        [
        $ ! [         R                   a<    [         R                  R	                  5       q[
        R                  SU 5         [
        $ f = f)N	appengine)r   REGISTRYGetCollectionInfoInvalidCollectionExceptionCloneregistryRegisterApiByName)versions    9lib/googlecloudsdk/command_lib/app/firewall_rules_util.pyGetRegistryr   %   sd    5((g> 
/ 
	-	- 5!!'')H{G4	/5s    ( AA87A8c                     [        U R                  5       5      R                  [        R                  " [        U5      5      SU R                  0SS9nU$ )zCreates a resource path given a firewall rule priority.

Args:
  client: AppengineFirewallApiClient, the API client for this release track.
  priority: str, the priority of the rule.

Returns:
  The resource for the rule.

appsIdz$appengine.apps.firewall.ingressRules)params
collection)r   
ApiVersionParsesix	text_typeParsePriorityproject)clientpriorityress      r   ParseFirewallRuler   /   sN     	F%%'(..	mmM(+,'7 	/ 	9# 
*    c                     U S:X  a  [         n  [        U 5      nUS::  d
  U[         :  a*  [        R                  " SSR	                  [         5      5      eU$ ! [
         a    [        R                  " SS5      ef = f)z"Converts a priority to an integer.defaultr   r   z-Priority must be between 1 and {0} inclusive.z1Priority should be an integer value or `default`.)DEFAULT_RULE_PRIORITYintr   InvalidArgumentExceptionformat
ValueError)r   priority_ints     r   r   r   A   s    $H	Ix=LqL+@@//
ELL#%& & 	 I

-
-GI IIs   AA "A7c                 d    U(       d  gU R                   R                  UR                  5       5      $ )aA  Converts an action string to the corresponding enum value.

Options are: 'allow' or 'deny', otherwise None will be returned.

Args:
  messages: apitools.base.protorpclite.messages, the proto messages class for
    this API version for firewall.
  action: str, the action as a string
Returns:
  ActionValueValuesEnum type
N)FirewallRuleActionValueValuesEnumupper)messagesactions     r   ParseActionr-   R   s'     
				4	4V\\^	DDr   c                  4    [         R                  " / SQS5      e)N)z--actionz--source-rangez--descriptionzCPlease specify at least one attribute to the firewall-rules update.)r   MinimumArgumentException r   r   RaiseMinArgumentr1   c   s    ++ -J	L Lr   )__doc__googlecloudsdk.callioper   googlecloudsdk.corer   r   r!   LIST_FORMATr   r   r   r   r   r-   r1   r0   r   r   <module>r6      sM    1 / ) 
 "  $I"E"Lr   