
                             S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r
  SSKJr  SS	KJr  SS	KJr  SS
KJr   " S S\R(                  5      rg)zCommand for listing images.    )absolute_import)division)unicode_literals)base_classes)lister)util)base)flags)
propertiesc                   4    \ rS rSrSr\S 5       rS rS rSr	g)List   a  List Google occurrences of PACKAGE_VULNERABILITY.

Lists occurrences with the "kind" field set to "PACKAGE_VULNERABILITY".

The default value of the `--filter` flag for this command is:

    vulnerabilityDetails.packageIssue.fixedLocation.version.kind != "MAXIMUM"

so that only vulnerabilities with a known fix are shown. Passing `--filter`
will override this so *all* PACKAGE_VULNERABILITY occurrences are shown, with
any additional provided filters applied.
c                    [         R                  " U 5        U R                  R                  S5        [        R
                  " SSS9[        l        [        R                  R                  U SS9  U R                  R                  S5        g )Na          table(
          name,
          noteName.basename():label=NOTE,
          vulnerabilityDetails.severity,
          vulnerabilityDetails.cvssScore,
          vulnerabilityDetails.packageIssue.affectedLocation.package.join(','):label=PACKAGES
        )Fz--image)requirednamecreate)operation_typezIvulnerabilityDetails.packageIssue.fixedLocation.version.kind != "MAXIMUM")
r   AddBaseListerArgsdisplay_info	AddFormatimage_flagsMakeDiskImageArgr   
_image_argAddArgument	AddFilter)parsers    2lib/surface/compute/images/vulnerabilities/list.pyArgs	List.Args,   st    
V$
!! #  "22Y(DOOOx@ !!	    c                 4   SS/nUR                   (       as  U R                  R                  UUR                  [        R
                  " UR                  5      S9nUR                  5       nUR                  SR                  U5      5        SR                  U5      $ )Nzkind = "PACKAGE_VULNERABILITY"zBhas_prefix(resource_url,"https://compute.googleapis.com/compute/"))scope_listerzhas_prefix(resource_url, "{}")z AND )imager   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerclientSelfLinkappendformatjoin)selfargsholderfilters	image_ref	image_urls         r   
_GetFilterList._GetFilterA   s    (LG
 zz//33



$::mm 4 i
 $$&inn5<<YGH<<  r    c                    [         R                  R                  R                  R	                  5       n[
        R                  " [        R                  R                  5      nU R                  X5      n[        R                  " X$SSS9$ )z Yields filtered vulnerabilities.N)
project_idresource_filteroccurrence_filterresource_urls)r   VALUEScoreprojectGetr   ComputeApiHolderr	   ReleaseTrackGAr3   containeranalysis_utilMakeOccurrenceRequest)r-   r.   r<   r/   r7   s        r   RunList.RunR   sg    $$,,002G**4+<+<+?+?@Food3O!77d4 4r     N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r3   rC   __static_attributes__rE   r    r   r   r      s%      (!"4r    r   N)rJ   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   (googlecloudsdk.api_lib.containeranalysisr   rA   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   r&   )googlecloudsdk.command_lib.compute.imagesr   googlecloudsdk.corer   ListCommandr   rE   r    r   <module>rU      s:    " &  ' 7 1 S ( E J *<44 <4r    