
                            S r SSK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
  \R                  R                  S\R                  R                  S\R                  R                  S0r\R                  R                  4S	 jr\R                  R                  4S
 jr\R                  R                  4S jr " S S5      rg)zAPI Wrapper lib for Cloud IDS.    N)
list_pager)apis)waiter)base)	resourcesv1c                 Z    [         R                  U 5      n[        R                  " SU5      $ Nids)_VERSION_MAPgetr   GetMessagesModulerelease_trackapi_versions     )lib/googlecloudsdk/api_lib/ids/ids_api.pyr   r   !   %      /+			{	33    c                 Z    [         R                  U 5      n[        R                  " SU5      $ r
   )r   r   r   GetClientInstancer   s     r   r   r   &   r   r   c                 Z    [         R                  U 5      n[        R                  " SU5      $ r
   )r   r   r   GetEffectiveApiEndpointr   s     r   r   r   +   s%      /+		%	%e[	99r   c                       \ rS rSrSrS rS r    SS jrS rS r	S	 r
SS
 jrS rS rS\R                  " SS94S jrS rS rSS jrSrg)Client0   zAPI client for IDS commands.c                 x   [        U5      U l        U R                  R                  U l        U R                  R                  U l        U R                  R                  U l        [        U5      U l	        [        R                  " 5       U l        U R                  R                  S[        R                  U5      5        g r
   )r   _clientprojects_locations_endpoints_endpoint_clientprojects_locations_operations_operations_clientprojects_locations_locations_clientr   messagesr   Registry_resource_parserRegisterApiByNamer   r   )selfr   s     r   __init__Client.__init__3   s    $]3DL LLEED"llHHD!\\<<D%m4DM%..0D++E,8,<,<],KMr   c                 |    U R                   R                  R                  R                  UR	                  5       5      $ )N)r$   EndpointSeverityValueValuesEnumlookup_by_nameupper)r(   severity_names     r   _ParseSeverityLevelClient._ParseSeverityLevel=   s1    ==!!99HH r   Nc	           	          U R                   R                  UUU R                  U5      UUUS9n	U R                   R                  XU	S9n
U R                  R                  U
5      $ )zCalls the CreateEndpoint API.)networkdescriptionseveritythreatExceptionstrafficLogslabels)
endpointIdparentendpoint)r$   r,   r1   *IdsProjectsLocationsEndpointsCreateRequestr   Create)r(   namer;   r4   r6   threat_exceptionsr5   enable_traffic_logsr9   r<   reqs              r   CreateEndpointClient.CreateEndpointA   sr     }}%%))(3*' & H --
B
B C ;C  '',,r   c                     U R                   R                  UUS9nU R                   R                  XSR                  U5      S9nU R                  R                  U5      $ )zCalls the UpdateEndpoint API.)r?   r7   ,)r?   r<   
updateMask)r$   r,   )IdsProjectsLocationsEndpointsPatchRequestjoinr   Patch)r(   r?   r@   update_maskr<   rB   s         r   UpdateEndpointClient.UpdateEndpointV   se    
 }}%%* & ,H --
A
A+1F B HC  &&s++r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zCalls the DeleteEndpoint API.r?   )r$   *IdsProjectsLocationsEndpointsDeleteRequestr   Deleter(   r?   rB   s      r   DeleteEndpointClient.DeleteEndpointb   s0    
--
B
B
B
MC  '',,r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zCalls the GetEndpoint API.rO   )r$   'IdsProjectsLocationsEndpointsGetRequestr   GetrR   s      r   DescribeEndpointClient.DescribeEndpointg   s0    
--
?
?T
?
JC  $$S))r   c           	      z    U R                   R                  XS9n[        R                  " U R                  UUUSSS9$ )zCalls the ListEndpoints API.)r;   filter	endpointspageSize
batch_sizelimitfieldbatch_size_attribute)r$   (IdsProjectsLocationsEndpointsListRequestr   YieldFromListr   )r(   r;   r`   	page_sizelist_filterrB   s         r   ListEndpointsClient.ListEndpointsl   sJ    
--
@
@ A +C##') )r   c                 p    U R                   R                  SU-   S9nU R                  R                  U5      $ )zCalls the ListLocations API.z	projects/rO   )r$   IdsProjectsLocationsListRequestr#   List)r(   projectrB   s      r   GetSupportedLocationsClient.GetSupportedLocationsx   s<    
--
7
7[8?>@
7 AC!!&&s++r   c                 N    U R                   R                  UR                  S5      $ )zKConverts an Operation to a Resource that can be used with `waiter.WaitFor`.z!ids.projects.locations.operations)r&   ParseRelativeNamer?   )r(   	operations     r   GetOperationRefClient.GetOperationRef~   s%      22;= =r   TiX  )secondsc                     U(       a,  [         R                  " U R                  U R                  5      nO [         R                  " U R                  5      n[         R
                  " XQX$R                  S-  S9$ )a  Waits for an operation to complete.

Polls the IDS Operation service until the operation completes, fails, or
  max_wait_seconds elapses.

Args:
  operation_ref:
    A Resource created by GetOperationRef describing the Operation.
  message:
    The message to display to the user while they wait.
  has_result:
    If True, the function will return the target of the
    operation (the IDS Endpoint) when it completes. If False, nothing will
    be returned (useful for Delete operations)
  max_wait:
    The time to wait for the operation to succeed before timing out.

Returns:
  if has_result = True, an Endpoint entity.
  Otherwise, None.
i  )max_wait_ms)r   CloudOperationPollerr   r!   CloudOperationPollerNoResourcesWaitForrt   )r(   operation_refmessage
has_resultmax_waitpollers         r   WaitForOperationClient.WaitForOperation   sd    4 **4+@+@+/+B+BDf 55d6M6MNf>>w4D4Dt4KM Mr   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zCalls the CancelOperation API.rO   )r$   +IdsProjectsLocationsOperationsCancelRequestr!   CancelrR   s      r   CancelOperationsClient.CancelOperations   s0    
--
C
C
C
NC""))#..r   c                 j    U R                   R                  US9nU R                  R                  U5      $ )zCalls the Operations API.rO   )r$   (IdsProjectsLocationsOperationsGetRequestr!   rW   rR   s      r   DescribeOperationClient.DescribeOperation   s0    
--
@
@d
@
KC""&&s++r   c           	      z    U R                   R                  XS9n[        R                  " U R                  UUUSSS9$ )zCalls the ListOperations API.)r?   r[   
operationsr]   r^   )r$   )IdsProjectsLocationsOperationsListRequestr   rd   r!   )r(   r?   r`   re   rf   rB   s         r   ListOperationsClient.ListOperations   sJ    
--
A
A B 'C##') )r   )r   r   r#   r!   r&   r$   )  FN)NNN)__name__
__module____qualname____firstlineno____doc__r)   r1   rC   rL   rS   rX   rg   rm   rr   datetime	timedeltar   r   r   r   __static_attributes__r   r   r   r   r   0   sj    $M (*!#). -*
,-
*

),= #' ( 2 23 ?	!MF/
,

)r   r   )r   r   apitools.base.pyr   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper   googlecloudsdk.corer   ReleaseTrackALPHABETAGAr   r   r   r   r   r   r   r   <module>r      s    %  ' , . ( ) 	TD$ %)$5$5$8$8 4
 %)$5$5$8$8 4
 +/*;*;*>*> :
J) J)r   