
                             S r SSKJr  SSKJr  SSKJr  SSK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  \R*                   " S S\R,                  5      5       rg)z5The List command for Binary Authorization signatures.    )absolute_import)division)unicode_literalsN)apis)	attestors)containeranalysis)containeranalysis_apis)util)base)flags)	resourcesc                   :    \ rS rSrSr\S 5       rS rS rS r	Sr
g)	List"   a1  List Binary Authorization attestations.

This command lists Binary Authorization attestations for your
project.  Command line flags specify which attestor and artifact to
list the attestations for. If no attestor is specified, this lists
all attestations in the project, which requires the
`containeranalysis.occurrences.get` permission. If no artifact is
specified, then this lists all URLs with associated occurrences.

## EXAMPLES

List the Occurrence messages for all attestations bound to the passed
attestor:

    $ {command} \
        --attestor=projects/foo/attestor/bar

List the Occurrence messages for all attestations for the passed artifact-url
bound to the passed attestor:

    $ {command} \
        --attestor=projects/foo/attestors/bar \
        --artifact-url='gcr.io/foo/example-image@sha256:abcd'
c                     [         R                  " USS9  [         R                  " U[         R                  " SSSS[        R
                  " S5      S95        g )NF)requiredattestorz              The Attestor whose Container Analysis Note will be queried
              for attestations. Note that the caller must have the
              `containeranalysis.notes.listOccurrences` permission on the note
              being queried.)	base_namer   
positionaluse_global_project_flag
group_help)r   AddArtifactUrlFlagAddConceptsGetAttestorPresentationSpectextwrapdedent)clsparsers     3lib/surface/container/binauthz/attestations/list.pyArgs	List.Args=   sN    	Ve4	)) $) (  !
	
    c                     S nUR                   (       a   [        R                  " UR                   5      nUR                  (       a  U R	                  X5      $ U R                  X5      $ )N)artifact_urlbinauthz_command_utilGetImageDigestr   ListInAttestorListInProject)selfargsartifact_digests      r   RunList.RunP   sO    O-<<T=N=NOo}}  77d44r"   c                    [         R                  " [        R                  " U R	                  5       5      5      n[
        R                  " [        R                  " U R	                  5       5      5      nUR                  R                  R                  5       nUR                  U5      n[        R                  R                  SUR                  U5      R                  0 5      nUR!                  UUUR"                  UR$                  S9$ )Nz containeranalysis.projects.notes)note_refr+   	page_sizelimit)r   Clientr   GetApiVersionReleaseTrackr   ca_apisCONCEPTSr   ParseGetr   REGISTRYParseResourceIdGetNoteAttrnoteReferenceYieldAttestationsr0   r1   )r)   r*   r+   attestors_clientdrydock_clientattestor_refr   r/   s           r   r'   List.ListInAttestorY   s     ''(:(:4;L;L;N(OP&--d//12N ==))//1L##L1H!!11*$$X.<<
H ++'..jj	 ,  r"   c                     [         R                  " [        R                  " U R	                  5       5      5      nUR                  S [        R                  " 5       UUR                  UR                  S9$ )N)r/   project_refr+   r0   r1   )
r   r2   r5   r3   r4   r=   binauthz_api_utilGetProjectRefr0   r1   )r)   r*   r+   r?   s       r   r(   List.ListInProjectn   sc    &--d//12N ++%335'..jj ,  r"    N)__name__
__module____qualname____firstlineno____doc__classmethodr    r,   r'   r(   __static_attributes__rG   r"   r   r   r   "   s*    2  $5*r"   r   )rL   
__future__r   r   r   r   )googlecloudsdk.api_lib.container.binauthzr   r   r   r	   r5   r
   rD   googlecloudsdk.callioper   -googlecloudsdk.command_lib.container.binauthzr   r%   googlecloudsdk.corer   DefaultUniverseOnlyListCommandr   rG   r"   r   <module>rV      s[    < &  '  : ? G W O ( ? W ) V4 V Vr"   