
                         z   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ dd	lmZ dd
lmZ dddZ ej$                  ej&                  j(                  ej&                  j*                  ej&                  j,                        ej.                   G d dej0                                      Zee_        y)zECreate command to create a new resource of threat prevention profile.    )absolute_import)division)unicode_literals)tpp_api)base)sp_flags)labels_util)
exceptions)logzH

          Create a new Security Profile with the given name.

        z
          To create a Security Profile with the name `my-security-profile` and an optional description as `New Security Profile`, run:

              $ {command} my-security-profile --description="New Security Profile"

        )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)CreateProfilez'Create a new Threat Prevention Profile.c                    t        j                  || j                                t        j                  |       t        j
                  j                  |       t        j
                  j                  |d       t        j                  |       y )NF)
r   AddSecurityProfileResourceReleaseTrackAddProfileDescriptionr   
ASYNC_FLAGAddToParser
SetDefaultr	   AddCreateLabelsFlags)clsparsers     Jlib/surface/network_security/security_profiles/threat_prevention/create.pyArgszCreateProfile.Args2   s]    ''0@0@0BC""6*OO'OOvu-$$V,    c                 6   t        j                  | j                               }|j                  j                  j                         }|j                  }t        j                  ||j                  j                  j                        }|j                  }|j                  d      sd|_        |j                  dk7  r"t        j                   d|j                  z        |j#                  |j%                         |j'                         |j)                         j%                         ||      }|r.|j*                  }t,        j.                  j1                  d|       |S |j3                  |j5                  |      dj7                  |j%                               d	      S )
Ndescriptionz*Security Profile of type Threat Preventionglobalz0Only `global` location is supported, but got: %s)namesp_idparentr   labelsz9Check for operation completion status using operation ID:z/Waiting for security-profile [{}] to be createdT)operation_refmessage
has_result)r   Clientr   CONCEPTSsecurity_profileParser   r	   ParseCreateArgsmessagesSecurityProfileLabelsValueasync_IsSpecifiedlocationcore_exceptionsErrorCreateThreatPreventionProfileRelativeNameNameParentr    r   statusPrintWaitForOperationGetOperationsRefformat)	selfargsclientr)   r   r#   is_asyncresponseoperation_ids	            r   RunzCreateProfile.Run:   sl   ^^D--/0F}}55;;=""K((foo--99F {{HM*Ed}} !!
<t}}
L  33**,##%&&(557 4 H ]]l	jj
E
 o ""--h7AHH))+
  #  r   N)__name__
__module____qualname____doc__classmethodr   rC    r   r   r   r   +   s    
 0- -)r   r   N)rG   
__future__r   r   r   9googlecloudsdk.api_lib.network_security.security_profilesr   googlecloudsdk.callioper   +googlecloudsdk.command_lib.network_securityr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   r2   r   DETAILED_HELPReleaseTracksr   ALPHABETAGADefaultUniverseOnlyCreateCommandr   detailed_helprI   r   r   <module>rX      s    L &  ' M ( @ < = #
 T..33T5F5F5I5I 4D&& 4 4n , r   