
    S                        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  ej                  ej                   j"                  ej                   j$                         G d dej&                               Zy)z&Command to update a ETD custom module.    )absolute_import)division)unicode_literals)clients)base)	constants)flags)parsing)
console_ioc                   &    e Zd ZdZed        Zd Zy)Updatea6  Update an Event Threat Detection custom module.

  ## EXAMPLES

  To update an Event Threat Detection custom module with ID 123456 for
  organization 123, run:

      $ {command} 123456
          --organization=organizations/123 --enablement-state="ENABLED"
          --custom-config-file=custom_config.json
  c                    t        j                  t        j                  j                        j                  |        t        j                  d      j                  |        t        j                  d      j                  |        t        j                  dt        j                  j                  d      j                  |        y )Nmodule_typeF)requiredTJSON)r   r   	file_type)	r	   CreateModuleIdOrNameArgr   CustomModuleTypeETDAddToParserCreateParentFlagCreateValidateOnlyFlagCreateUpdateFlags)parsers    3lib/surface/scc/manage/custom_modules/etd/update.pyArgszUpdate.Args+   s    	!!..22k&	E*66v>	  %0<<VD	..22 k&    c                    t        j                  |t        j                  j                        }|j
                  }t        j                  |j                        }t        j                  |j                  t        j                  j                        }t        j                  |      }|s&t        j                  dj                  |      d       t        j                         }|j!                  |||||      S )Nr   zMAre you sure you want to update the Event Threat Detection custom module {}?
T)messagecancel_on_no)namevalidate_onlycustom_configenablement_stateupdate_mask)r
   GetModuleNameFromArgsr   r   r   r#   GetConfigValueFromArgscustom_config_fileGetEnablementStateFromArgsr%   CreateUpdateMaskFromArgsr   PromptContinueformatr   ETDCustomModuleClientr   )selfargsr"   r#   r$   r%   r&   clients           r   Runz
Update.Run8   s    (()4488D &&M2243J3JKM999+E+E+I+I 2248K%%+VD\ **,F==##)   r   N)__name__
__module____qualname____doc__staticmethodr   r2    r   r   r   r      s     
 
 
r   r   N)r6   
__future__r   r   r   %googlecloudsdk.api_lib.scc.manage.etdr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.scc.manager   r	   r
   googlecloudsdk.core.consoler   ReleaseTracksReleaseTrackGAALPHACommandr   r8   r   r   <module>rC      sl    - &  ' 9 ( ; 7 9 2 D%%(($*;*;*A*AB6T\\ 6 C6r   