
                         |    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j                  fdZ
dededej                  d	ej                  j                  d
edej                  fdZdededej                  d	ej                  j                  dedej                  fdZdede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)SHACustomModuleClientzQClient for SHA custom module interaction with the Security Center Management API.c                 N    t        j                  dd      j                  | _        y Nsecuritycentermanagementv1)r   GetClientInstance7projects_locations_securityHealthAnalyticsCustomModules_clientselfs    4lib/googlecloudsdk/api_lib/scc/manage/sha/clients.py__init__zSHACustomModuleClient.__init__   s$     ))"D== 	L    namereturnc                 d    t        j                  |      }| j                  j                  |      S )zGet a SHA custom module.r   )messagesWSecuritycentermanagementProjectsLocationsSecurityHealthAnalyticsCustomModulesGetRequestr   Getr   r   reqs      r   r   zSHACustomModuleClient.Get#   s.     
j
jC <<C  r   c                     t        j                  ||      }t        j                  ||      }| j                  j	                  |      S )zSimulate a SHA custom module.)customConfigresource)parent2simulateSecurityHealthAnalyticsCustomModuleRequest)r   2SimulateSecurityHealthAnalyticsCustomModuleRequest\SecuritycentermanagementProjectsLocationsSecurityHealthAnalyticsCustomModulesSimulateRequestr   Simulate)r   r#   custom_configr"   sim_reqr   s         r   r'   zSHACustomModuleClient.Simulate+   sH    
 II"XG 
o
o;BC <<  %%r   validate_onlyr(   enablement_stateupdate_maskc                 4   t        j                  |||      }t        j                  ||t        j                  |      |      }| j
                  j                  |      }|r!t        j                  j                  d       |S t        j                  |       |S )zUpdate a SHA custom module.)r!   enablementStater   )#securityHealthAnalyticsCustomModuler   
updateMaskvalidateOnlyRequest is valid.)r   #SecurityHealthAnalyticsCustomModuleYSecuritycentermanagementProjectsLocationsSecurityHealthAnalyticsCustomModulesPatchRequestscc_utilCleanUpUserMaskInputr   Patchr   statusPrintUpdatedResource)	r   r   r*   r(   r+   r,   'security_health_analytics_custom_moduler   responses	            r   UpdatezSHACustomModuleClient.Update9   s     	44&,	
 , 
l
l,S00="	C ||!!#&H	jj*+oOr   r#   display_namec                    t        j                  |||      }t        j                  |||      }| j                  j	                  |      }|r!t
        j                  j                  d       |S t        j                  |       |S )zCreate an SHA custom module.)r!   r.   displayName)r/   r#   r1   r2   )	r   r3   ZSecuritycentermanagementProjectsLocationsSecurityHealthAnalyticsCustomModulesCreateRequestr   Creater   r8   r9   CreatedResource)	r   r#   r*   r(   r+   r>   r;   r   r<   s	            r   rB   zSHACustomModuleClient.CreateX   s     	44&,$	
 , 
m
m,S"C
 ||""3'H	jj*+o%Or   c                     t        j                  ||      }| j                  j                  |      }|r!t        j
                  j                  d       |S t	        j                  |       |S )zDelete a SHA custom module.)r   r1   r2   )r   ZSecuritycentermanagementProjectsLocationsSecurityHealthAnalyticsCustomModulesDeleteRequestr   Deleter   r8   r9   DeletedResource)r   r   r*   r   r<   s        r   rF   zSHACustomModuleClient.Deletev   s]     
m
mC ||""3'H	jj*+oOr   	page_sizelimitNc                 z    t        j                  ||      }t        j                  | j                  ||d|d      S )z(List the details of a SHA custom module.pageSizer#   $securityHealthAnalyticsCustomModulesrL   requestrI   field
batch_sizebatch_size_attribute)r   XSecuritycentermanagementProjectsLocationsSecurityHealthAnalyticsCustomModulesListRequestr   YieldFromListr   r   rH   r#   rI   r   s        r   ListzSHACustomModuleClient.List   sD     
k
k6C ##4' r   c           	      |    t        j                  ||      }t        j                  | j                  d||d|d      S )zCList the details of the resident and descendant SHA custom modules.rK   ListDescendantrM   rL   )methodrO   rI   rP   rQ   rR   )r   bSecuritycentermanagementProjectsLocationsSecurityHealthAnalyticsCustomModulesListDescendantRequestr   rT   r   rU   s        r   rX   z$SHACustomModuleClient.ListDescendant   sG     
u
u6C ##4' r   )__name__
__module____qualname____doc__r   strr   r3   r   3SimulateSecurityHealthAnalyticsCustomModuleResponser'   boolCustomConfigEnablementStateValueValuesEnumr=   rB   rF   intr   0ListSecurityHealthAnalyticsCustomModulesResponserV   :ListDescendantSecurityHealthAnalyticsCustomModulesResponserX    r   r   r
   r
      s   Y>!c !hJJ !&CC&  **	
 !DDcc  33>  **	
 !DDcc  33< T $'0322
??A*$'0322
IIK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	)EffectiveSHACustomModuleClientz[Client for SHA effective custom module interaction with the Security Center Management API.c                 N    t        j                  dd      j                  | _        y r   )r   r   @projects_locations_effectiveSecurityHealthAnalyticsCustomModulesr   r   s    r   r   z'EffectiveSHACustomModuleClient.__init__   s"    ))"DFF 	Lr   r   r   c                 d    t        j                  |      }| j                  j                  |      S )z"Get a SHA effective custom module.r   )r   `SecuritycentermanagementProjectsLocationsEffectiveSecurityHealthAnalyticsCustomModulesGetRequestr   r   r   s      r   r   z"EffectiveSHACustomModuleClient.Get   s.     
s
sC <<C  r   rH   r#   rI   Nc                 z    t        j                  ||      }t        j                  | j                  ||d|d      S )zMList the details of the resident and descendant SHA effective custom modules.rK   -effectiveSecurityHealthAnalyticsCustomModulesrL   rN   )r   aSecuritycentermanagementProjectsLocationsEffectiveSecurityHealthAnalyticsCustomModulesListRequestr   rT   r   rU   s        r   rV   z#EffectiveSHACustomModuleClient.List   sD     
t
t6C ##=' r   )r[   r\   r]   r^   r   r_   r   ,EffectiveSecurityHealthAnalyticsCustomModuler   rd   r   9ListEffectiveSecurityHealthAnalyticsCustomModulesResponserV   rg   r   r   ri   ri      sk    cG
!! MM!$'03;;
HHJr   ri   N)r^   typingr   apitools.base.pyr   googlecloudsdk.api_lib.utilr   googlecloudsdk.command_lib.sccr   r5   googlecloudsdk.corer   Agooglecloudsdk.generated_clients.apis.securitycentermanagement.v1r   r   objectr
   ri   rg   r   r   <module>rz      s7    >  ' , ; # ~SF Sl$V $r   