
                         v    S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSK
Jr  S	 rS
 rS rS rS rg)z@Arg parsing and other utilities for Essential Contacts commands.    )absolute_import)division)unicode_literalsN)
exceptions)	arg_utils)
propertiesc                 P    [        U 5      n[        U 5      nSR                  X!5      $ )zCReturns the full contact name from the args or raises an exception.z{}/contacts/{})GetContactId	GetParentformat)argscps      9lib/googlecloudsdk/command_lib/essential_contacts/util.pyGetContactNamer      s&    4!o!		 	 	&&    c                 D    [        U R                  5        U R                  $ N)_ValidateContact
CONTACT_ID)r   s    r   r
   r
   #   s    4??#	r   c                 j    [         R                  " SU 5      (       d  [        R                  " SU 5      eg )Nz^[0-9]+$contact)rematchr   InvalidArgumentException)
flag_values    r   r   r   (   s+    	*j	)	)

-
-i
DD 
*r   c                    S[        S U R                  U R                  U R                  4 5       5      :X  a7  [        R
                  R                  R                  R                  5       U l        SnU R                  (       a  SU R                  -  nU$ U R                  (       a  SU R                  -  nU$ SU R                  -  nU$ )zCReturns the parent resource from args or the active gcloud project.r   c              3   8   #    U  H  n[        U5      v   M     g 7fr   )bool).0xs     r   	<genexpr>GetParent.<locals>.<genexpr>/   s     NM!d1ggMs   Nzprojects/%sz
folders/%szorganizations/%s)sumprojectfolderorganizationr   VALUEScore	GetOrFail)r   parents     r   r   r   -   s    #Ndkk4;L;LMN
NN $$))11;;=DL&	\\T\\)F 
- {{DKK'F 
-  $"3"33F	-r   c                     U R                   (       d  / $ U R                    Vs/ s H  n[        R                  " UU5      PM     sn$ s  snf r   )notification_categoriesr   ChoiceToEnum)r   "notification_category_enum_messagecategory_choices      r   GetNotificationCategoriesr1   ?   sP    		%	%I "99
 :/ _?A9
  
s   !A)__doc__
__future__r   r   r   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.util.apisr   googlecloudsdk.corer   r   r
   r   r   r1    r   r   <module>r8      s:    G &  ' 	 . : *'
E
$r   