
                             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	\
R                  5      rS
 rS rS rS rg)z?Declarative Request Hooks for Cloud SCC's Notification Configs.    )absolute_import)division)unicode_literalsN)util)
exceptionsc                       \ rS rSrSrSrg)InvalidNotificationConfigError   z)Exception raised for errors in the input. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       Alib/googlecloudsdk/command_lib/scc/notifications/request_hooks.pyr	   r	      s    1r   r	   c                 x    A [         R                  " U5      n[        X5        [        U5      Ul        SUl        U$ )z@Generate a notification config using organization and config id.N)r   GetParentFromNamedArguments!_ValidateMutexOnConfigIdAndParent_GetNotificationConfigNamenamefilter)refargsreqparents       r   UpdateNotificationReqHookr      s7    	++D1&#D1'-#( $+	*r   c                    [         R                  " S5      n[         R                  " S5      nUR                  U R                  5      (       d+  UR                  U R                  5      (       d  [	        S5      eUR                  U R                  5      (       a  U R                  $ [
        R                  " U 5      S-   U R                  -   $ )z9Returns relative resource name for a notification config.zM(organizations|projects|folders)/.+/notificationConfigs/[a-zA-Z0-9-_]{1,128}$z[a-zA-Z0-9-_]{1,128}$zNotificationConfig must match either (organizations|projects|folders)/.+/notificationConfigs/[a-zA-Z0-9-_]{1,128})$ or [a-zA-Z0-9-_]{1,128}$.z/notificationConfigs/)recompilematchnotificationConfigIdr	   r   r   )r   resource_pattern
id_patterns      r   r   r   3   s    ZZU zz12*			

! 
!)3)9)9

#
#*% *%
(	!" "
 D5566$$$		)	)

%
&(,(A(A
B Br   c                 .    U R                  S5      nUS   $ )N/   )split)resource_nameparams_as_lists     r   _GetNotificationConfigIdr,   J   s     &&s+.		r   c                 ^    SU R                   ;   a  Ub  [        S5      egUc  [        S5      eg)zLValidates that only a full resource name or split arguments are provided.
  r'   NzOnly provide a full resource name (organizations/123/notificationConfigs/test-config) or an --(organization|folder|project) flag, not both.z{A corresponding parent by a --(organization|folder|project) flag must be provided if it is not included in notification ID.)r#   r	   )r   r   s     r   r   r   O   sS     	D%%%*BC C 
 ~
(	@A A r   )r   
__future__r   r   r   r    googlecloudsdk.command_lib.sccr   googlecloudsdk.corer   core_exceptionsErrorr	   r   r   r,   r   r   r   r   <module>r3      sE    F &  ' 	 / =2_%:%: 2(B.
Ar   