
                         d   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ddZy)z>Command to Create 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)Createz-Create a Security Command Center mute config.a  
        To create a mute config ``test-mute-config'' given organization ``123''
        with a filter on category that equals to ``XSS_SCRIPTING'', run:

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

        To create a mute config ``test-mute-config'' given folder ``456'' with a
        filter on category that equals to ``XSS_SCRIPTING'', run:

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

        To create a mute config ``test-mute-config'' given project ``789'' with a
        filter on category that equals to ``XSS_SCRIPTING'', run:

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

        To create a mute config ``test-mute-config'' given organization ``123'',
        `location=eu` with a filter on category that equals to ``XSS_SCRIPTING'',
        run:

          $ {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                 v   t         j                  j                  |        t        j                  |        t         j                  j                  |        t         j
                  j                  |        t         j                  j                  |        t         j                  j                  |        t        j                  j                  |        t        j                  j                  |        | j                  j                  t        j                  j                  j                   j#                                y )N)r	   MUTE_CONFIG_FLAGAddToParserAddParentGroupDESCRIPTION_FLAGFILTER_FLAG	TYPE_FLAGEXPIRY_TIME_FLAG	scc_flagsAPI_VERSION_FLAGLOCATION_FLAGdisplay_info	AddFormatr   VALUEScoredefault_formatGet)parsers    %lib/surface/scc/muteconfigs/create.pyArgszCreate.ArgsI   s     
&&v.	 	&&v.	!!&)	OO'	&&v.**62''/
!!*"3"3"8"8"G"G"K"K"MN    c                 b   t        j                  ||j                        }t        j                  |      }|j                         }t        j                  ||      }t        j                  |      }|dk(  r/|j                  |j                  |j                  ||      |_        n.|j                  |j                  |j                  ||      |_        t        |||      }t        j                   |      }|j"                  j%                  |      }t&        j(                  j+                  d       |S )Nv2)filterdescriptiontype
expiryTimezCreated.)scc_utilGetVersionFromArgumentsmute_configr   GetMessages3SecuritycenterOrganizationsMuteConfigsCreateRequestr
   ValidateAndGetTypeValidateAndGetExpiryTime%GoogleCloudSecuritycenterV2MuteConfigr(   r)   %googleCloudSecuritycenterV2MuteConfig%GoogleCloudSecuritycenterV1MuteConfig%googleCloudSecuritycenterV1MuteConfig_GenerateMuteConfig	GetClientorganizations_muteConfigsr   r   statusPrint)	selfargsversionmessagesrequestmute_config_typeexpiry_timeclientresponses	            r#   Runz
Create.RunV   s   ..tT5E5EFG$009HJJLG..tW=//5K$

8
8[[**#$	 9  3 
8
8[[**#$	 9  3 "$9G",,W5F//66w?HJJZ Or%   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr$   rE    r%   r#   r   r       s<     6 EE:r?"-H 
O 
Or%   r   c                    t        j                  |       |_        |j                  E|dk(  r%t        j                  | |j                        |_        t        j                  |       |_        nft        j                  | |      | _        t        j                  | |      }t        j                  |      |_        t        j                  ||      |_        d| _        |S )z+Updates parent and Generates a mute config.r'    )r
   ValidateAndGetParentparent ValidateAndGetRegionalizedParentValidateAndGetMuteConfigIdmuteConfigIdr,   ValidateAndGetLocationlocation(ValidateAndGetMuteConfigFullResourceName#GetMuteConfigIdFromFullResourceNameGetParentFromFullResourceNamer(   )r=   reqr>   r.   s       r#   r7   r7   w   s    ((.#*ZZ$88szzJcj66t<C33D'BDM??gK ??LC33KICJ$+	*r%   N)v1)rI   
__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CreateCommandr   r7   rL   r%   r#   <module>rg      s    E &  % ' < ( = ; < ; # * D%%(($*;*;*A*ABRT R C Rjr%   