
                         |    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  G d d	e      Z G d
 de      Zy)z7Useful commands for interacting with the Cloud SCC API.    )	Generator)
list_pager)apis)util)log)$securitycentermanagement_v1_messagesc                      e Zd ZdZd Zdedej                  fdZdedededej                  fd	Z
ded
efdZded
ededej                  fdZded
edej                  j                  dej                  j                  dededej                  fdZdedededeej                  dej&                  f   fdZdedededeej                  dej&                  f   fdZy)ETDCustomModuleClientzQClient for ETD custom module interaction with the Security Center Management API.c                 N    t        j                  dd      j                  | _        y Nsecuritycentermanagementv1)r   GetClientInstance4projects_locations_eventThreatDetectionCustomModules_clientselfs    4lib/googlecloudsdk/api_lib/scc/manage/etd/clients.py__init__zETDCustomModuleClient.__init__   s$     ))"D:: 	L    namereturnc                 d    t        j                  |      }| j                  j                  |      S )zGet a ETD custom module.r   )messagesTSecuritycentermanagementProjectsLocationsEventThreatDetectionCustomModulesGetRequestr   Getr   r   reqs      r   r   zETDCustomModuleClient.Get#   s.     
g
gC <<C  r   parentcustom_config_jsonmodule_typec                 .   t        j                  ||      }t        j                  ||      }| j                  j	                  |      }|j
                  s t        j                  j                  d       yt        j                  j                  |       |S )zValidate a ETD module.)rawTexttype)r    /validateEventThreatDetectionCustomModuleRequestzModule is valid.N)	r   /ValidateEventThreatDetectionCustomModuleRequestYSecuritycentermanagementProjectsLocationsEventThreatDetectionCustomModulesValidateRequestr   Validateerrorsr   statusPrint)r   r    r!   r"   validate_requestr   responses          r   r)   zETDCustomModuleClient.Validate+   s}    
  OO"
 
l
l8HC
 ||$$S)H??	jj)*	jjx or   validate_onlyc                     t        j                  ||      }| j                  j                  |      }|r!t        j
                  j                  d       |S t	        j                  |       |S )zDelete a ETD custom module.)r   validateOnlyRequest is valid.)r   WSecuritycentermanagementProjectsLocationsEventThreatDetectionCustomModulesDeleteRequestr   Deleter   r+   r,   DeletedResource)r   r   r/   r   r.   s        r   r4   zETDCustomModuleClient.DeleteB   s]     
j
jC ||""3'H	jj*+oOr   update_maskc                 4   t        j                  |||      }t        j                  ||t        j                  |      |      }| j
                  j                  |      }|r!t        j                  j                  d       |S t        j                  |       |S )zUpdate an ETD custom module.)configenablementStater   ) eventThreatDetectionCustomModuler   
updateMaskr1   r2   )r    EventThreatDetectionCustomModuleVSecuritycentermanagementProjectsLocationsEventThreatDetectionCustomModulesPatchRequestscc_utilCleanUpUserMaskInputr   Patchr   r+   r,   UpdatedResource)	r   r   r/   custom_configenablement_stater6   $event_threat_detection_custom_moduler   r.   s	            r   UpdatezETDCustomModuleClient.UpdateO   s     	11 ,	
 ) 
i
i)M00="	C ||!!#&H	jj*+oOr   rB   rC   display_namec                    t        j                  ||||      }t        j                  |||      }| j                  j	                  |      }	|r!t
        j                  j                  d       |	S t        j                  |       |	S )zCreate an ETD custom module.)r8   r9   displayNamer%   )r:   r    r1   r2   )	r   r<   WSecuritycentermanagementProjectsLocationsEventThreatDetectionCustomModulesCreateRequestr   Creater   r+   r,   CreatedResource)
r   r    r/   rB   rC   r"   rF   rD   r   r.   s
             r   rJ   zETDCustomModuleClient.Createn   s     	11 ,$		
 ) 
j
j)M"C ||""3'H	jj*+o%Or   	page_sizelimitNc                 z    t        j                  ||      }t        j                  | j                  ||d|d      S )zMList details of resident and inherited Event Threat Detection Custom Modules.pageSizer    !eventThreatDetectionCustomModulesrP   requestrM   field
batch_sizebatch_size_attribute)r   USecuritycentermanagementProjectsLocationsEventThreatDetectionCustomModulesListRequestr   YieldFromListr   r   rL   r    rM   r   s        r   ListzETDCustomModuleClient.List   sD     
h
h6C ##1' r   c           	      |    t        j                  ||      }t        j                  | j                  d||d|d      S )zCList the details of the resident and descendant ETD custom modules.rO   ListDescendantrQ   rP   )methodrS   rM   rT   rU   rV   )r   _SecuritycentermanagementProjectsLocationsEventThreatDetectionCustomModulesListDescendantRequestr   rX   r   rY   s        r   r\   z$ETDCustomModuleClient.ListDescendant   sG     
r
r6C ##1' r   )__name__
__module____qualname____doc__r   strr   r<   r   0ValidateEventThreatDetectionCustomModuleResponser)   boolr4   rE   ConfigValueEnablementStateValueValuesEnumrJ   intr   -ListEventThreatDetectionCustomModulesResponserZ   r\    r   r   r
   r
      s   Y;!c !hGG !-0?B@@. T    00>  >>JJ	
 !AA``   00B$'03//
<<>*$'03//
<<>r   r
   c                       e Zd ZdZd Zdedej                  fdZde	dede	de
ej                  d	ej                  f   fd
Zy	)EffectiveETDCustomModuleClientz[Client for effective ETD custom module interaction with the Security Center Management API.c                 N    t        j                  dd      j                  | _        y r   )r   r   =projects_locations_effectiveEventThreatDetectionCustomModulesr   r   s    r   r   z'EffectiveETDCustomModuleClient.__init__   s"    ))"DCC 	Lr   r   r   c                 d    t        j                  |      }| j                  j                  |      S )z"Get a ETD effective custom module.r   )r   ]SecuritycentermanagementProjectsLocationsEffectiveEventThreatDetectionCustomModulesGetRequestr   r   r   s      r   r   z"EffectiveETDCustomModuleClient.Get   s.     
p
pC <<C  r   rL   r    rM   Nc                 z    t        j                  ||      }t        j                  | j                  ||d|d      S )zMList the details of the resident and descendant ETD effective custom modules.rO   *effectiveEventThreatDetectionCustomModulesrP   rR   )r   ^SecuritycentermanagementProjectsLocationsEffectiveEventThreatDetectionCustomModulesListRequestr   rX   r   rY   s        r   rZ   z#EffectiveETDCustomModuleClient.List   sD     
q
q6C ##:' r   )r_   r`   ra   rb   r   rc   r   )EffectiveEventThreatDetectionCustomModuler   rh   r   6ListEffectiveEventThreatDetectionCustomModulesResponserZ   rj   r   r   rl   rl      sk    cD
!!"LL!$'0388
EEGr   rl   N)rb   typingr   apitools.base.pyr   googlecloudsdk.api_lib.utilr   googlecloudsdk.command_lib.sccr   r>   googlecloudsdk.corer   Agooglecloudsdk.generated_clients.apis.securitycentermanagement.v1r   r   objectr
   rl   rj   r   r   <module>r}      s7    >  ' , ; # ~_F _D$V $r   