
                         \   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 dd	lmZ dd
lmZ ddlmZ e	j&                   e	j(                  e	j*                  j,                  e	j*                  j.                         G d de	j0                                      Zy)z>Command to update a Cloud Security Command Center mute config.    )absolute_import)division)print_function)unicode_literals)securitycenter_client)base)flags)util)log)
propertiesc                   2    e Zd ZdZddddZed        Zd Zy)Updatez-Update a Security Command Center mute config.a  
        Update a mute config with ``ID=test-mute-config'' under
        ``organization=123'' with a filter on category that equals to
        XSS_SCRIPTING:

          $ {command} test-mute-config --organization=123
            --description="This is a test mute config"
            --filter="category=\"XSS_SCRIPTING\""

        Update a mute config with ``ID=test-mute-config'' under
        ``folder=456'' with a filter on category that equals to XSS_SCRIPTING:

          $ {command} test-mute-config --folder=456
            --description="This is a test mute config"
            --filter="category=\"XSS_SCRIPTING\""

        Update a mute config with ``ID=test-mute-config'' under
        ``project=789'' with a filter on category that equals to XSS_SCRIPTING:

          $ {command} test-mute-config --project=789
            --description="This is a test mute config"
            --filter="category=\"XSS_SCRIPTING\""

        Update a mute config with ``ID=test-mute-config'' under
        ``organization=123'' `location=eu`  with a filter on category that
        equals to XSS_SCRIPTING:

          $ {command} test-mute-config --organization=123
            --description="This is a test mute config"
            --filter="category=\"XSS_SCRIPTING\"" --location=euz
      This command uses the Security Command Center API. For more information,
      see [Security Command Center API.](https://cloud.google.com/security-command-center/docs/reference/rest))DESCRIPTIONEXAMPLESzAPI REFERENCEc                 ^   t        j                  |        t         j                  j                  |        t         j                  j                  |        t         j
                  j                  |        t         j                  j                  |        t        j                  j                  |        t        j                  j                  |        | j                  dd       | j                  j                  t        j                  j                  j                   j#                                y )Nz--update-maskz
        Optional: If left unspecified (default), an update-mask is automatically
        created using the flags specified in the command and only those values
        are updated.)help)r	   AddParentGroupMUTE_CONFIG_FLAGAddToParserDESCRIPTION_FLAGFILTER_FLAGEXPIRY_TIME_FLAG	scc_flagsAPI_VERSION_FLAGLOCATION_FLAGadd_argumentdisplay_info	AddFormatr   VALUEScoredefault_formatGet)parsers    %lib/surface/scc/muteconfigs/update.pyArgszUpdate.ArgsJ   s     
 	&&v.	&&v.	!!&)	&&v.**62''/
   !!*"3"3"8"8"G"G"K"K"MN    c                    t        j                  ||j                        }t        j                  |      }|j                         }t        j                  |      }|dk(  r.|j                  |j                  |j                  |      |_        n-|j                  |j                  |j                  |      |_        |j                  sg }|j                  d      r|j!                  d       |j                  d      r|j!                  d       |j                  d      r|j!                  d       dj#                  |      |_        n|j                  |_        t        j&                  |||      }t        j(                  |j$                        |_        d|_
        t        j*                  |      }|j,                  j/                  |      }t0        j2                  j5                  d	       |S )
Nv2)descriptionfilter
expiryTimer)   r*   zexpiry-timeexpiry_time, zUpdated.)scc_utilGetVersionFromArgumentsmute_configr   GetMessages2SecuritycenterOrganizationsMuteConfigsPatchRequestr
   ValidateAndGetExpiryTime%GoogleCloudSecuritycenterV2MuteConfigr)   r*   %googleCloudSecuritycenterV2MuteConfig%GoogleCloudSecuritycenterV1MuteConfig%googleCloudSecuritycenterV1MuteConfigupdate_maskIsKnownAndSpecifiedappendjoin
updateMaskGenerateMuteConfigNameCleanUpUserMaskInput	GetClientorganizations_muteConfigsPatchr   statusPrint)	selfargsversionmessagesrequestr,   computed_update_maskclientresponses	            r$   Runz
Update.Run]   s   ..tT5E5EFG$009HIIKG//5K$

8
8**[[$ 9  3 
8
8**[[$ 9  3 		!	!-	0##M2		!	!(	+##H-		!	!-	0##M288$89g++g ))$AG!66w7I7IJGDK",,W5F//55g>HJJZ Or&   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr%   rM    r&   r$   r   r       s=     6 EE<rA#-J O O$-r&   r   N)rQ   
__future__r   r   r   r   googlecloudsdk.api_lib.sccr   googlecloudsdk.callioper   googlecloudsdk.command_lib.sccr	   r   r
   r/   *googlecloudsdk.command_lib.scc.muteconfigsgooglecloudsdk.corer   r   DefaultUniverseOnlyReleaseTracksReleaseTrackGAALPHAUpdateCommandr   rT   r&   r$   <module>ra      s    E &  % ' < ( = ; < ; # * D%%(($*;*;*A*ABhT h C hr&   