
    #                     L   d Z ddlmZ ddlmZ ddlmZ ddl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&                         G d de	j(                               Zee_        y)zCreate endpoint command.    )absolute_import)division)unicode_literalsN)ids_api)base)flags)labels_utilaF  
          Create an endpoint for the specified VPC network. Successful creation
          of an endpoint results in an endpoint in READY state. Check the
          progress of endpoint creation by using `gcloud alpha ids endpoints
          list`.

          For more examples, refer to the EXAMPLES section below.


        a{  
            To create an endpoint called `my-endpoint` for VPC network
            `my-net`, in zone `us-central1-a`, alerting on LOW threats or
            higher, run:

            $ {command} my-endpoint --network=my-net --zone=us-central1-a --project=my-project --severity=LOW

            To create an endpoint called `my-endpoint` for VPC network
            `my-net`, in zone `us-central1-a`, alerting on LOW threats or
            higher, excluding threat IDs 1000 and 2000, run:

            $ {command} my-endpoint --network=my-net --zone=us-central1-a --project=my-project --severity=LOW --threat-exceptions=1000,2000

    )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)CreatezCreate a Cloud IDS endpoint.c                    t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j
                  | d       t        j                  |        t        j                  | d       t        j                  j                  |        t        j                  j                  | d       t        j                  |        y )NF)required60mT)r   AddEndpointResourceAddNetworkArgAddDescriptionArgAddSeverityArgAddThreatExceptionsArgAddTrafficLogsArg
AddMaxWaitr   
ASYNC_FLAGAddToParser
SetDefaultr	   AddCreateLabelsFlags)parsers    #lib/surface/ids/endpoints/create.pyArgszCreate.Args>   s    	f%		F#	 	  %8	F#	VU#OO'OOvt,$$V,    c           
         t        j                  | j                               }|j                  j                  j                         }|j                  }|j                  }|j                  }|sg }|j                  }|j                  }t        j                  ||j                  j                  j                        }	|j                   }
t#        j$                  |j&                        }|j)                  |j+                         |j-                         j/                         ||||||	      }|
r|j1                  d      sd|_        |S |j5                  |j7                  |      dj3                  |j/                               |      S )N)seconds)nameparentnetworkseveritythreat_exceptionsdescriptionenable_traffic_logslabelsformatdefaultz'waiting for endpoint [{}] to be created)operation_refmessagemax_wait)r   ClientReleaseTrackCONCEPTSendpointParser$   r%   r&   r'   r(   r	   ParseCreateArgsmessagesEndpointLabelsValueasync_datetime	timedeltar.   CreateEndpointNameParentRelativeNameIsSpecifiedr*   WaitForOperationGetOperationRef)selfargsclientr2   r$   r%   r&   r'   r(   r)   is_asyncr.   	operations                r   Runz
Create.RunK   sZ   ^^D--/0F}}%%++-HllG}}H..""K22(()/)A)A)M)MOF{{H!!$--8H%%]]_ --/+/ & I  h'"",,Y79@@!!#%	 #  r   N)__name__
__module____qualname____doc__staticmethodr   rG    r   r   r   r   9   s     %
- 
-$r   r   )rK   
__future__r   r   r   r9   googlecloudsdk.api_lib.idsr   googlecloudsdk.callioper   googlecloudsdk.command_lib.idsr   $googlecloudsdk.command_lib.util.argsr	   DETAILED_HELPReleaseTracksr0   ALPHABETAGACreateCommandr   detailed_helprM   r   r   <module>rZ      s     &  '  . ( 0 <			< D%%++T->->-C-C%%((*4T 4*4n % r   