
                         h   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 r\R$                  \R&                  " \R(                  R*                  \R(                  R,                  5      \R.                   " S S\R0                  5      5       5       5       rg)zList PipelineRuns and TaskRuns.    )absolute_import)division)unicode_literals)
exceptions)
list_pager)client_util)base)	run_flags)
properties)	resourcesc                     [         R                  R                  U R                  S[        R
                  S9nUR                  5       $ )Nz%cloudbuild.projects.locations.results)
collectionapi_version)r   REGISTRYParseRelativeNamenamer   GA_API_VERSIONSelfLink)resourceresults     lib/surface/builds/runs/list.py_GetResultURIr      s?    //mm8,, 0 .& 
	    c                   .    \ rS rSrSr\S 5       rS rSrg)List&   z4List all Cloud Build runs in a Google Cloud project.c                     U R                   R                  [        5        [        R                  " U S5        [
        R                  R                  U S5        U R                   R                  S5        g )NF2   a  
        table(
            recordSummaries[0].recordData.name.segment(5).yesno(no="-"):label=ID,
            name.segment(3):label=REGION,
            recordSummaries[0].createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            result_duration(undefined='-').slice(2:).join("").yesno(no="-"):label=DURATION,
            recordSummaries[0].recordData.workflow.segment(5).yesno(no="-"):label=WORKFLOW,
            result_status():label=STATUS
        )
    )	display_info
AddUriFuncr   r
   AddsRegionResourceArgr	   
LIMIT_FLAG
SetDefault	AddFormat)parsers    r   Args	List.Args,   sS    
""=1##FE2OOvr*
!!		r   c           
   #     #    [         R                  " 5       n[         R                  " 5       nUR                  R                  R                  5       nU(       a  UR                  5       /nOUR                  =(       d2    [        R                  R                  R                  R                  5       n[         R                  " U5      n[        UR                   Vs/ s H  oR                  PM     sn5      nUR                   n	/ n
U H_  n ["        R$                  " UR&                  UR)                  XR*                  S9SUR,                  SU	S9nU H  nUv   U	c  M  U	S-  n	M     Ma     U
(       a%  [.        R4                  " SR7                  U
5      5      egs  snf ! [.        R0                   a    U
R3                  U5         M  f = f7f)z9This is what gets called when the user runs this command.)parentfilterresultspageSize)field
batch_sizebatch_size_attributelimitN   zUnable to fetch data from: {})r   GetClientInstanceGetMessagesModuleCONCEPTSregionParseRelativeNameprojectr   VALUEScore	GetOrFailListLocationssorted	locationsr   r0   r   YieldFromListprojects_locations_results-CloudbuildProjectsLocationsResultsListRequestr*   	page_sizer   	HttpErrorappendErrorformat)selfargsclientmessages
region_refparentsr8   responselocationtotal_limitparent_errorspr+   rs                 r   RunList.Run>   s    **,F,,.H%%++-J((*+g J
 1 1 6 6 > > H H Jg**73hh6H6HI6H(6HIJg **KM  **--BB C .~~!+ A'$1K  " 
)
0
0
?A A 3 J, !!  Q s=   CGF-GAF	F#6G%G>GGG N)	__name__
__module____qualname____firstlineno____doc__staticmethodr&   rS   __static_attributes__rU   r   r   r   r   &   s     = "'Ar   r   N)rZ   
__future__r   r   r   apitools.base.pyr   r   $googlecloudsdk.api_lib.cloudbuild.v2r   googlecloudsdk.callioper	   %googlecloudsdk.command_lib.cloudbuildr
   googlecloudsdk.corer   r   r   HiddenReleaseTracksReleaseTrackALPHABETAUniverseCompatibleListCommandr   rU   r   r   <module>rj      s    & &  ' ' ' < ( ; * ) D%%++T->->-C-CD<A4 <A  E <Ar   