
    P                     8   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"                  e	j$                  j&                  e	j$                  j(                         G d
 de	j*                                      Zy)zHCommand to bulk mute Security Command Center findings based on a filter.    )absolute_import)division)print_function)unicode_literals)securitycenter_client)base)flags)utilc                   2    e Zd ZdZddddZed        Zd Zy)BulkMutez=Bulk mute Security Command Center findings based on a filter.a  
      To bulk mute findings given organization ``123'' based on a filter on
      category that equals ``XSS_SCRIPTING'', run:

        $ {command} --organization=organizations/123
          --filter="category=\"XSS_SCRIPTING\""

      To bulk mute findings given folder ``123'' based on a filter on category
      that equals ``XSS_SCRIPTING'', run:

        $ {command} --folder=folders/123 --filter="category=\"XSS_SCRIPTING\""

      To bulk mute findings given project ``123'' based on a filter on category
      that equals ``XSS_SCRIPTING'', run:

        $ {command} --project=projects/123
          --filter="category=\"XSS_SCRIPTING\""

      To bulk mute findings given organization ``123'' based on a filter on
      category that equals ``XSS_SCRIPTING'' and `location=eu` run:

        $ {command} --organization=organizations/123
          --filter="category=\"XSS_SCRIPTING\"" --location=locations/eu
      z
      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                    | j                  dd      }|j                  dd       |j                  dd       |j                  dd	       | j                  d
dd       t        j                  ddddgd      j	                  |        t
        j                  j	                  |        t
        j                  j	                  |        y )NT)mutexrequiredz--organizationzl
        Organization where the findings reside. Formatted as
        ``organizations/123'' or just ``123''.)helpz--folderz`
        Folder where the findings reside. Formatted as ``folders/456'' or just
        ``456''.z	--projectzq
        Project (id or number) where the findings reside. Formatted as
        ``projects/789'' or just ``789''.z--filterz9Expression that identifies findings that should be muted.)r   r   z--mute-statemuted	undefinedz"Desired mute state of the finding.)defaultchoiceshelp_str)	add_groupadd_argumentr   ChoiceArgumentAddToParser	scc_flagsAPI_VERSION_FLAGLOCATION_FLAG)parserparent_groups     %lib/surface/scc/findings/bulk_mute.pyArgszBulkMute.ArgsC   s     ##$#>L2      -   H   	+&5	
 k&**62''/    c                    t        j                  |      }t        j                  |      }|j	                         }|j                  |j                  t        j                  |j                  |            |_
        t        j                  |      |_        d|_        |dk(  r%t        j                  ||j                        |_        t        j                  |      }|j                  j!                  |      S )N)filter	muteState v2)scc_utilGetVersionFromArgumentsr   GetMessages2SecuritycenterOrganizationsFindingsBulkMuteRequestBulkMuteFindingsRequestr%   r
   ConvertMuteStateInput
mute_statebulkMuteFindingsRequestValidateAndGetParentparent(ValidateLocationAndGetRegionalizedParent	GetClientorganizations_findingsr   )selfargsversionmessagesrequestclients         r!   RunzBulkMute.Runm   s    ..t4G$009HIIKG&.&F&F{{,,T__hG 'G 'G# ..t4GNDK$DD
gn #,,W5F((11'::r#   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr"   r<    r#   r!   r   r      s;     F J
0r9-B '0 '0R;r#   r   N)r@   
__future__r   r   r   r   googlecloudsdk.api_lib.sccr   googlecloudsdk.callioper   googlecloudsdk.command_lib.sccr	   r   r
   r)   'googlecloudsdk.command_lib.scc.findingsDefaultUniverseOnlyReleaseTracksReleaseTrackGAALPHACommandr   rC   r#   r!   <module>rO      s~    O &  % ' < ( = ; 8 D%%(($*;*;*A*AB`;t|| `; C `;r#   