
                            S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  SS
KJr  SSS.r\R$                  R&                  \R$                  R(                  4rSr\R.                  \R0                  " \R$                  R&                  \R$                  R(                  \R$                  R2                  5       " S S\R4                  5      5       5       r\\l        g)zBCreate command to create a new resource of security profile group.    )absolute_import)division)unicode_literals)spg_api)base)	spg_flags)labels_util)
exceptions)logzN

          Create a new Security Profile Group with the given name.

        a  
          To create a Security Profile Group with the name `my-security-profile-group`, with a threat prevention profile using `--threat-prevention-profile` flag and optional description as `optional description`, run:

              $ {command} my-security-profile-group --organization=1234 --location=global --threat-prevention-profile=`organizations/1234/locations/global/securityProfiles/my-security-profile` --description='optional description'

        )DESCRIPTIONEXAMPLES))threat-prevention-profilecustom-mirroring-profile)r   custom-intercept-profile)url-filtering-profiler   )r   r   )r   r   c                   4    \ rS rSrSr\S 5       rS rS rSr	g)CreateProfileGroup7   z$Create a new Security Profile Group.c           	         [         R                  " XR                  5       5        [         R                  " U5        UR	                  SS9nU R                  5       [
        ;   a&  [         R                  " UU R                  5       SUSS9  [         R                  " UU R                  5       SUSS/S9  [         R                  " UU R                  5       S	USS9  [         R                  " UU R                  5       S
USS9  [        R                  " U5        [        R                  R                  U5        [        R                  R                  US5        g )NT)requiredr   F)groupr   r   zsecurity-profile)r   r   arg_aliasesr   r   )r   AddSecurityProfileGroupResourceReleaseTrackAddProfileGroupDescription	add_group_URL_FILTERING_SUPPORTEDAddSecurityProfileResourcer	   AddCreateLabelsFlagsr   
ASYNC_FLAGAddToParser
SetDefault)clsparserrequired_groups      >lib/surface/network_security/security_profile_groups/create.pyArgsCreateProfileGroup.Args>   s&   --f6F6F6HI((0%%t%4N
55**





! ((#'( ((" ((" $$V,OO'OOvu-    c                    [         R                  " U R                  5       5      nU R                  U5        UR                  R
                  R                  5       nUR                  R                  R                  5       n[        UR                  S5      (       a$  UR                  R                  R                  5       OS n[        UR                  S5      (       a$  UR                  R                  R                  5       OS n[        UR                  S5      (       a$  UR                  R                  R                  5       OS nUR                  nUR                  n	[        R                  " XR                   R"                  R$                  5      n
UR&                  S:w  a#  [(        R*                  " SUR&                  -  5      eUR-                  UR/                  5       UR1                  5       UR3                  5       R/                  5       UUb  UR/                  5       OS Ub  UR/                  5       OS Ub  UR/                  5       OS Ub  UR/                  5       OS U
S9	nU	(       a.  UR4                  n[6        R8                  R;                  SU5        U$ UR=                  UR?                  U5      SRA                  UR/                  5       5      S	S
9$ )Nurl_filtering_profilecustom_mirroring_profilecustom_intercept_profileglobalz0Only `global` location is supported, but got: %s)	security_profile_group_namesecurity_profile_group_idparentdescriptionthreat_prevention_profiler+   r,   r-   labelsz9Check for operation completion status using operation ID:z5Waiting for security-profile-group [{}] to be createdT)operation_refmessage
has_result)!r   Clientr   ValidateCompatibleProfilesCONCEPTSsecurity_profile_groupParser3   hasattrr+   r,   r-   r2   async_r	   ParseCreateArgsmessagesSecurityProfileGroupLabelsValuelocationsIdcore_exceptionsErrorCreateSecurityProfileGroupRelativeNameNameParentnamer   statusPrintWaitForOperationGetOperationsRefformat)selfargsclientr;   r3   r+   r,   r-   r2   is_asyncr4   responseoperation_ids                r&   RunCreateProfileGroup.Runf   s|   ^^D--/0F##D)!]]AAGGI $ G G M M O 4=="9:: 	++113  4=="<== 	..446  4=="<== 	..446  ""K{{H((oo22>>F ))X5!!
<"../ 
 00$:$G$G$I"8"="="?%,,.;;=$0 #<"H"H"J , 4@@B#/ ":!F!F!H#/ ":!F!F!H# 1 H* ]]l	jj
E
 o ""--h7GNN"//1
  #  r)   c                    SSSSS.nUR                   R                  R                  5       b  SUS'   [        UR                   S5      (       a*  UR                   R                  R                  5       b  SUS'   [        UR                   S5      (       a*  UR                   R
                  R                  5       b  SUS'   [        UR                   S	5      (       a*  UR                   R                  R                  5       b  SUS
'   [         HE  nX#S      (       d  M  X#S      (       d  M  [        R                  " SSR                  U5      -  5      e   g )NF)r   r   r   r   Tr   r+   r   r,   r   r-   r   r      zHOnly one of the following profiles can be specified at the same time: %sz, )r:   r3   r<   r=   r+   r,   r-   _INCOMPATIBLE_PAIRSrD   rE   join)rP   rQ   profilespairs       r&   r9   -CreateProfileGroup.ValidateCompatibleProfiles   s(   %*!&$)$)	H }}..446B.2h*+677MM//557C*.h&'9::MM2288:F-1h)*9::MM2288:F-1h)*#	q'		xQ00##iio
 	
 $r)    N)
__name__
__module____qualname____firstlineno____doc__classmethodr'   rV   r9   __static_attributes__r_   r)   r&   r   r   7   s&    
 -%. %.NER
r)   r   N)rd   
__future__r   r   r   ?googlecloudsdk.api_lib.network_security.security_profile_groupsr   googlecloudsdk.callioper   +googlecloudsdk.command_lib.network_securityr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   rD   r   _DETAILED_HELPr   ALPHABETAr   rZ   DefaultUniverseOnlyReleaseTracksGACreateCommandr   detailed_helpr_   r)   r&   <module>ru      s    I &  ' S ( A < = #
 	T..33   T..33T5F5F5I5IS
++ S
 S
l $2   r)   