
    &                        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S r\R"                  " \R$                  R&                  5      \R(                   " S S\R*                  5      5       5       r\R"                  " \R$                  R.                  \R$                  R0                  5       " S S\5      5       r\R4                  " S5      \l        SSSS.\l        g)zCommand for listing operations.    )absolute_import)division)unicode_literals)base_classes)lister)request_helper)utils)arg_parsers)base)
propertiesc                  f    [         R                  R                  R                  R	                  5       $ )N)r   VALUEScomputeallow_partial_errorGetBool     &lib/surface/compute/operations/list.py_AllowPartialErrorr      s#    				"	"	6	6	>	>	@@r   c                 \   U R                   R                  S5        U(       a  [        R                  " U SSSS9  g[        R                  " U 5        U R                  SSS[        R                  " 5       S9  U R                  SS	S
[        R                  " 5       S9  U R                  SSSSS9  g)z@Helper function for adding flags dependant on the release track.z      table(
        name,
        operationType:label=TYPE,
        targetLink.scope():label=TARGET,
        operation_http_status():label=HTTP_STATUS,
        status,
        insertTime:label=TIMESTAMP
      )T)zonalregionalglobal_z--zonesZONEzIf arguments are provided, only resources from the given zones are shown. If no arguments are provided all zonal operations are shown.)metavarhelptypez	--regionsREGIONzIf arguments are provided, only resources from the given regions are shown. If no arguments are provided all regional operations are shown.z--global
store_truez,If provided, all global resources are shown.F)actionr   defaultN)display_info	AddFormatr   AddMultiScopeListerFlagsAddBaseListerArgsadd_argumentr
   ArgList)parseris_gas     r   AddFlagsr*   "   s     !  
##dT49 V$
&   "  $ &   "  $ ;	  r   c                   4    \ rS rSrSr\S 5       rS rS rSr	g)ListG   List Compute Engine operations.c                     [        U S5        g )NTr*   r(   s    r   Args	List.ArgsL   s    VTr   c                 |    UR                   SL =(       a&    UR                  SL =(       a    [        US5      (       + nU$ )z:Determine if the user provided any flags indicating scope.Nglobal)zonesregionsgetattr)selfargsno_compute_argss      r   NoArgumentsList.NoArgumentsP   s;    zzT) 3dlld.B 3"422 r   c                    [         R                  " U R                  5       5      nUR                  nU R	                  U5      n/ n[
        R                  " UUR                  5      nU(       a  UR                  UR                  R                  SUR                  R                  R                  S5      " UR                  UR                  S[        UR                  5      S   R                   S945        GO@[#        US5      (       a  UR                  UR                  R                  SUR                  R                  R                  S5      " UR                  UR                  [        UR                  5      S   R                   S945        UR$                  Gb  UR$                  =(       d    /  Vs/ s HZ  nUR                  R'                  US	[(        R*                  R,                  R                   R.                  0S
S9R1                  5       PM\     nn/ n	U=(       d    [
        R2                  " UR                  R$                  [(        R*                  R,                  R                   R/                  5       SUR                  R4                  UR6                  U	S9 V
s/ s H  oR8                  PM     sn
nU	(       a  [:        R<                  " U	S5        U H  nUR                  UR                  R>                  SUR                  R>                  R                  S5      " UR                  UR                  U[        UR                  5      S   R                   S945        M     UR@                  Gb  UR@                  =(       d    /  Vs/ s HZ  nUR                  R'                  US	[(        R*                  R,                  R                   R.                  0SS9R1                  5       PM\     nn/ n	U=(       d    [
        R2                  " UR                  R@                  [(        R*                  R,                  R                   R/                  5       SUR                  R4                  UR6                  U	S9 V
s/ s H  oR8                  PM     sn
nU	(       a  [:        R<                  " U	S5        U H  nUR                  UR                  RB                  SUR                  RB                  R                  S5      " UR                  UR                  U[        UR                  5      S   R                   S945        M     / n	[        [D        RF                  " UUR                  R4                  UR6                  U	S95      nU	(       a=  [I        5       (       a  [:        RJ                  " U	5        U$ [:        R<                  " U	5        U$ s  snf s  sn
f s  snf s  sn
f )z0Yields zonal, regional, and/or global resources.AggregatedListTr   )filter
maxResultsreturnPartialSuccessprojectr5   r,   )r@   rA   rC   NrC   zcompute.regions)params
collection)servicerC   filter_exprhttp	batch_urlerrorszMUnable to fetch a list of regions. Specifying [--regions] may fix this issue:)r@   rA   regionrC   zcompute.zoneszIUnable to fetch a list of zones. Specifying [--zones] may fix this issue:)r@   rA   zonerC   )requestsrH   rI   rJ   )&r   ComputeApiHolderReleaseTrackclientr<   r   ParseNamesAndRegexpFlags	resourcesappendapitools_clientglobalOperationsGetRequestTyper@   max_resultslist	scope_setrC   r8   r7   Parser   r   core	GetOrFailNameGetGlobalResourcesrH   rI   namer	   RaiseToolExceptionregionOperationsr6   zoneOperationsr   ListJsonr   WarnIfPartialRequestFail)r9   r:   compute_holdercompute_clientno_scope_flagsrM   request_datarK   args_region_namesrJ   resregion_namesregion_namerL   args_zone_names
zone_names	zone_nameresultss                     r   RunList.RunV   s9   !2243D3D3FGN#**N %%d+NH2243A3K3KML
 oo))::<L))::II!&--*66(, 6 67:BBDEF 
x	 	 ++<<f++<<KK(// , 8 8!,"8"89!<DD	FG	H 
	! ,,,",.
 -	 $$**!:#4#4#9#9#A#A#K#KL, + . /3df5 - 	 .   f6O6O&66>>"))..66@@B #3388(227 "  7s(( 7 "  	 

"
" ! (K
//-->>-->>MM*11".":":)#L$:$:;A>FFHIJ ( 
	 

(b(* ) $$**z0055==GG + + ,
 -1DF3 ) 	 *   F4M4M&66<<"))..66@@B #3388(225    5S 5    	 

"
" ! $I
//--<<f--<<KK*11".":":%#L$:$:;A>FFHIJ $ F//44$..		G 			&&v. N 	  (N[." ,*  s   /A!V:V?A!W/W	r   N)
__name__
__module____qualname____firstlineno____doc__staticmethodr2   r<   rq   __static_attributes__r   r   r   r,   r,   G   s$     ( nr   r,   c                   (    \ rS rSrSr\S 5       rSrg)ListBeta   r.   c                     [        U S5        g )NFr0   r1   s    r   r2   ListBeta.Args   s    VUr   r   N)rs   rt   ru   rv   rw   rx   r2   ry   r   r   r   r{   r{      s    ' r   r{   
operationszList Compute Engine operationsa  
        *{command}* displays all Compute Engine operations in a
        project.

        By default, all global, regional, and zonal operations are listed. The
        results can be narrowed by providing combinations of the --zones,
        --regions, and --global flags.

        Note: *{command}* displays operations fewer than 14 days old, up to a
        maximum of 5000.
        a  
        To list all operations in a project in table form, run:

          $ {command}

        To list the URIs of all operations in a project, run:

          $ {command} --uri

        To list all operations in zones us-central1-b and
        europe-west1-d, run:

           $ {command} --zones=us-central1-b,europe-west1-d

        To list all global operations in a project, run:

           $ {command} --global

        To list all regional operations in a project, run:

           $ {command} --regions=""

        To list all operations with names prefixed with `operation`, run:

           $ {command} --filter="name:operation"

        To list all operations in the us-central1 and europe-west1
        regions and all operations in the us-central1-a zone, run:

           $ {command} --zones=us-central1-a --regions=us-central1,europe-west1

        To list all operations with a specified target, filter on the targetLink
        field (run `{command} --format=json` to see a full, well-structured list
        of available fields). Additionally, use `scope()` which extracts the
        last part of the URL to get the required target information, and run:

           $ {command} --filter="targetLink.scope():default-12345abc"
        )briefDESCRIPTIONEXAMPLESN)rw   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r   r	   googlecloudsdk.callioper
   r   googlecloudsdk.corer   r   r*   ReleaseTracksrO   GAUniverseCompatibleListCommandr,   ALPHABETAr{   GetGlobalRegionalListerHelpdetailed_helpr   r   r   <module>r      s    & &  ' 7 1 9 0 / ( *A"J D%%((){4 {  *{| D%%++T->->-C-CDt  E "==lK -
%3 r   