
    "                        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 rS r\R$                  " \R&                  R(                  5      \R*                   " S S\R,                  5      5       5       r\R$                  " \R&                  R0                  5       " S S\5      5       r\R$                  " \R&                  R4                  5       " S S\5      5       rS rS rg)zList worker pools command.    )absolute_import)division)unicode_literals)cloudbuild_util)client_util)base)
exceptions)
properties)	resourcesc                     [        U [        5      (       a  U S   n [        R                  R	                  U R
                  SSS9nUR                  5       $ )Nwpz)cloudbuild.projects.locations.workerPoolsv1
collectionapi_version
isinstancedictr   REGISTRYParseRelativeNamenameSelfLinkresourcer   s     'lib/surface/builds/worker_pools/list.py_GetWorkerPoolURIr      sN    $~H++mm< , " 
    c                     [        U [        5      (       a  U S   n [        R                  R	                  U R
                  SSS9nUR                  5       $ )Nr   z1cloudbuild.projects.locations.workerPoolSecondGenv2r   r   r   s     r   _GetWorkerPoolSecondGenURIr    '   sN    $~H++mmD , " 
r   c                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
List1   0List all worker pools in a Google Cloud project.z{description}z          To fetch a list of worker pools running in region `us-central1`, run:

            $ {command} --region=us-central1
          )DESCRIPTIONEXAMPLESc                     U R                  SSS9  U R                  R                  S5        U R                  R                  [        5        g)Register flags for this command.

Args:
  parser: An argparse.ArgumentParser-like object. It is mocked out in order
    to capture some information, but behaves like an ArgumentParser.
--region)The Cloud region to list worker pools in.help
          table(
            name.segment(-1),
            createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            state
          )
        N)add_argumentdisplay_info	AddFormat
AddUriFuncr   parsers    r   Args	List.ArgsA   sO     8  : !! #  ""#45r   c                 x   UR                   nUR                  nU(       d2  [        R                  R                  R                   R                  5       n[        R                  R                  R                  R                  SS9n[        R                  R                  SUUS9n[        XSU R                  5       5      $ )This is what gets called when the user runs this command.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.

Returns:
  Some value that we want to have printed later.
Trequiredcloudbuild.projects.locationsr   
projectsIdlocationsId)region	page_sizer
   VALUESbuilds	GetOrFailcoreprojectGetr   r   Create_ListWorkerPoolFirstGenReleaseTrackselfargs	wp_regionwp_page_sizeparentparent_resources         r   RunList.RunV   s     I>>L##**11;;=i##++///>F  ((//2 0 O
 #t'8'8': r    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr4   rP   __static_attributes__rR   r   r   r"   r"   1   s1     9 		- 6 6(r   r"   c                   .    \ rS rSrSr\S 5       rS rSrg)ListBetar   r$   c                     U R                  SSS9  U R                  SS[        SS9  U R                  R                  S5        g	
r(   r)   r*   r+   --generation   zGeneration of the worker pool.)defaulttyper,   r-   Nr.   intr/   r0   r2   s    r   r4   ListBeta.Argsv   Y     8  : .	  1
 !! # r   c                    UR                   nUR                  nU(       d2  [        R                  R                  R                   R                  5       n[        R                  R                  R                  R                  SS9n[        R                  R                  SUUS9nUR                  S:X  a=  UR                  5       R                  [        5        [!        XSU R#                  5       5      $ UR                  S:X  a.  UR                  5       R                  [$        5        ['        U5      $ [(        R*                  " SS5      e	r7   Tr8   r:   r;   ra      r`   z=please use one of the following valid generation values: 1, 2r>   r?   r
   r@   rA   rB   rC   rD   rE   r   r   rF   
generationGetDisplayInfor1   r   rG   rH   r    _ListWorkerPoolSecondGenr	   InvalidArgumentExceptionrI   s         r   rP   ListBeta.Run   s    I>>L##**11;;=i##++///>F  ((//2 0 O
 !
&&'89$
):):)<  !
&&'AB%o66

-
-G r   rR   N	rS   rT   rU   rV   rW   rY   r4   rP   rZ   rR   r   r   r\   r\   r   s    8 0#r   r\   c                   .    \ rS rSrSr\S 5       rS rSrg)	ListAlpha   r$   c                     U R                  SSS9  U R                  SS[        SS9  U R                  R                  S5        g	r_   rd   r2   s    r   r4   ListAlpha.Args   rg   r   c                    UR                   nUR                  nU(       d2  [        R                  R                  R                   R                  5       n[        R                  R                  R                  R                  SS9n[        R                  R                  SUUS9nUR                  S:X  a=  UR                  5       R                  [        5        [!        XSU R#                  5       5      $ UR                  S:X  a.  UR                  5       R                  [$        5        ['        U5      $ [(        R*                  " SS5      eri   rk   rI   s         r   rP   ListAlpha.Run   s    I>>L##**11;;=i##++///>F  ((//2 0 O !
&&'89$
):):)<  !
&&'AB%o66

-
-G r   rR   Nrq   rR   r   r   rs   rs      s    8 0%r   rs   c                     [         R                  " 5       nUR                  nUR                  R	                  UR                  U R                  5       S95      R                  nU$ )zList Worker Pool Second Generation.

Args:
  parent_resource: The parent resource for Worker Pool Second Generation.

Returns:
  A list of Worker Pool Second Generation resources.
)rN   )cloudbuild_v2_utilGetClientInstanceMESSAGES_MODULE&projects_locations_workerPoolSecondGenr"   9CloudbuildProjectsLocationsWorkerPoolSecondGenListRequestRelativeNameworkerPoolSecondGen)rO   clientmessageswp_lists       r   rn   rn      se     //1&##( 99>>HH --/ I 122E2E 
 
.r   c                     [         R                  " U5      n[         R                  " U5      nUR                  R	                  UR                  U R                  5       US95      R                  nU$ )aK  List Worker Pool First Generation.

Args:
  parent_resource: The parent resource for Worker Pool First Generation.
  page_size: The number of elements to return in each page.
  release_track: The desired value of the enum
    googlecloudsdk.calliope.base.ReleaseTrack.

Returns:
  A list of Worker Pool First Generation resources.
)rN   pageSize)r   r{   GetMessagesModuleprojects_locations_workerPoolsr"   1CloudbuildProjectsLocationsWorkerPoolsListRequestr   workerPools)rO   r?   release_trackr   r   r   s         r   rG   rG     so     ,,];&..}=( 1166@@ --/) A  K	 
 
.r   N)rW   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   $googlecloudsdk.api_lib.cloudbuild.v2r   rz   googlecloudsdk.callioper   r	   googlecloudsdk.corer
   r   r   r    ReleaseTracksrH   GAUniverseCompatibleListCommandr"   BETAr\   ALPHArs   rn   rG   rR   r   r   <module>r      s    ! &  ' = R ( . * ) D%%(()<4 <  *<~ D%%**+?t ? ,?D D%%++,A A -AH(r   