
                             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\R&                  5      rg)z-Command for listing instance vulnerabilities.    )absolute_import)division)unicode_literals)base_classes)util)base)
completers)flags)
propertiesc            
       t    \ rS rSrSr\R                  " SS\R                  SSSSS	9r	\
S
 5       rS rS rSrg)List   zwList vulnerability occurrences for instances.

Lists occurrences with the "kind" field set to "PACKAGE_VULNERABILITY".
instancez
--instanceFzcompute.instancesz5The name of the instance to show vulnerabilities for.z5If not specified, it will be set to the same as zone.)resource_namename	completerrequiredzonal_collection
short_helpzone_explanationc                 x    [         R                  R                  U 5        U R                  R	                  S5        g )Na^          table(
          name.basename(),
          resource_url.basename():label=INSTANCE,
          resource_url.scope().split('/').slice(0).join(''):label=ZONE,
          noteName.basename():label=NOTE,
          vulnerabilityDetails.severity,
          vulnerabilityDetails.packageIssue.affectedLocation.package.join(','):label=PACKAGES
        ))r   _INSTANCE_ARGAddArgumentdisplay_info	AddFormat)parsers    5lib/surface/compute/instances/vulnerabilities/list.pyArgs	List.Args,   s/    ""6*
!! #     c                 z   S/nSR                  U5      nUR                  (       af  [        R                  R	                  UUR
                  [        R                  " UR                  5      S9nSR                  UR                  5       5      nUR                  SR                  U5      5        SR                  U5      $ )Nzkind = "PACKAGE_VULNERABILITY"z5https://www.googleapis.com/compute/projects/{}/zones/)scope_listerz%https://www.googleapis.com/compute/{}zhas_prefix(resource_url, "{}")z AND )formatr   r   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerclientRelativeNameappendjoin)selfprojectargsholderfiltersprefixinsts          r   
_GetFilterList._GetFilter:   s    (G EKKF}}11



$::6==I 2 d
 7==



f NN3::6BC<<  r    c                    [         R                  R                  R                  R	                  5       n[
        R                  " [        R                  R                  5      nU R                  X!U5      n[        R                  " UUSSS9$ )z Yields filtered vulnerabilities.N)
project_idresource_filteroccurrence_filterresource_urls)r   VALUEScorer-   Getr   ComputeApiHolderr   ReleaseTrackALPHAr3   containeranalysis_utilMakeOccurrenceRequest)r,   r.   r-   r/   r7   s        r   RunList.RunN   sm    $$,,002G**4+<+<+B+BCFoogV<O!77'	 r     N)__name__
__module____qualname____firstlineno____doc__r&   ResourceArgumentcompute_completersInstancesCompleterr   staticmethodr   r3   rB   __static_attributes__rD   r    r   r   r      sS    
  00"55*HNP-  !(
r    r   N)rI   
__future__r   r   r   googlecloudsdk.api_lib.computer   (googlecloudsdk.api_lib.containeranalysisr   r@   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   rK   r
   r&   googlecloudsdk.corer   ListCommandr   rD   r    r   <module>rV      s7    4 &  ' 7 S ( O E *;4 ;r    