
                             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  \R"                   " S S\R$                  5      5       rg)z5Command to show fleets in an organization or project.    )absolute_import)division)unicode_literals)projects_api)client)base)util)log)
propertiesc                   4    \ rS rSrSr\S 5       rS rS rSr	g)List   a=  List fleets visible to the user in an organization.

This command can fail for the following reasons:
* The org or project specified does not exist.
* The user does not have access to the project specified.

## EXAMPLES

The following command lists fleets in organization `12345`:

  $ {command} --organization=12345
c                     [         R                  " SSS[         R                  S9nUR                  U 5        U R                  R                  [        R                  5        g )Nz--organizationORGANIZATION_IDzID (number) for the organization to list fleets from. If neither --organization nor --project are provided, defaults to the organization of the active project.)metavarhelpcategory)r   ArgumentCOMMONLY_USED_FLAGSAddToParserdisplay_info	AddFormatr	   LIST_FORMAT)parserorgflags     #lib/surface/container/fleet/list.pyArgs	List.Args-   sR     mm! ))+G 
!!$"2"23    c                    [         R                  " 5         [        R                  " U R	                  5       5      nUR
                  nUc2  [        R                  R                  R
                  R                  5       nUR                  nUc  UR
                  c  U R                  U5      nUb  UOUnUb  SOSn[        R                  R                  SR                  Xe5      5        UR!                  X45      $ )NorganizationprojectzListing fleets from {0} {1}:)r   EnableUserProjectQuotar   FleetClientReleaseTrackr"   r   VALUEScoreGetr!   GetOrgr
   statusPrintformat
ListFleets)selfargsfleetclientr"   orgparent
parenttypes          r   RunList.Run;   s    !$$T%6%6%89KllG!!&&..224g


C
{t||+KK cOSF#&?	JJJ3:::NO!!'//r   c                     [         R                  " US9nUR                   HG  nUR                  R                  nUR                  R
                  nUS:X  a   US:X  a   US:X  d  ME  Us  $    g )N)
project_idr"   folderr!   )crmGetAncestryancestor
resourceIdtypeid)r.   r"   ancestryresourceresource_typeresource_ids         r   r)   List.GetOrgJ   sf    '2H%%))..m''**k	)	#	(	"	.	( &r    N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r4   r)   __static_attributes__rD   r   r   r   r      s%     4 40r   r   N)rI   
__future__r   r   r   +googlecloudsdk.api_lib.cloudresourcemanagerr   r9   &googlecloudsdk.api_lib.container.fleetr   googlecloudsdk.callioper   *googlecloudsdk.command_lib.container.fleetr	   googlecloudsdk.corer
   r   DefaultUniverseOnlyListCommandr   rD   r   r   <module>rT      sL     < &  ' K 9 ( ; # * 64 6 6r   