
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 dd	lmZ dd
lmZ ddlmZ dZdez   dj%                  e      dZdZe
j*                   e
j,                  e
j.                  j0                         G d de
j2                                      Ze
j*                   e
j,                  e
j.                  j6                  e
j.                  j8                         G d de
j2                                      Zej=                         e_        ej%                  eej@                        ej>                  d<   ej=                         e_        ej%                  eej@                        ej>                  d<   y)zCommand for listing instances.    )absolute_import)division)unicode_literals)base_classes)lister)utils)base)
completers)flags)	arg_utils	instanceszList Compute Engine zN          *{{command}}* displays all Compute Engine {0} in a project.
        )briefDESCRIPTIONa            To list all {0} in a project in table form, run:

            $ {{command}}

      To list the URIs of all {0} in a project, run:

            $ {{command}} --uri

      To list the IPv6 info of all {0} in a project, run:

            $ {{command}} --format="{1}"
    c                   &    e Zd ZdZed        Zd Zy)List.List Compute Engine virtual machine instances.c                    | j                   j                  t        j                         | j                   j	                  t        j
                  t        j                  d       | j                   j                  t        j                                t        j                  |        | j                   j                  t        j                         y )Nexternal_ipinternal_ip)display_info	AddFormatr   DEFAULT_LIST_FORMAT_WITH_IPV6AddTransformsTransformInstanceExternalIpTransformInstanceInternalIp
AddUriFuncr   MakeGetUriFuncr   AddZonalListerArgsAddCacheUpdaterr
   InstancesCompleterparsers    %lib/surface/compute/instances/list.pyArgsz	List.Args<   s    
!!%"E"EF
%%8888'  ""5#7#7#9:
f%
''
(E(EF    c                 L   t        j                  | j                               }|j                  }t	        j
                  ||j                        }t	        j                  ||j                  j                  |j                  j                        }t	        j                  ||      S )N)clientzonal_serviceaggregation_service)r   ComputeApiHolderReleaseTrackr(   r   ParseMultiScopeFlags	resourcesMultiScopeListerapitools_clientr   Invokeselfargsholderr(   request_datalist_implementations         r$   RunzList.RunG   s    **4+<+<+>?F]]F..tV5E5EFL 11,,66"22<<>
 ==':;;r&   N)__name__
__module____qualname____doc__staticmethodr%   r8    r&   r$   r   r   7   s      7G G<r&   r   c                   ,    e Zd ZdZed        Zd Zd Zy)ListBetar   c                    | j                   j                  t        j                         | j                   j	                  t        j
                  t        j                  d       | j                   j                  t        j                                t        j                  |        | j                   j                  t        j                         | j                  ddddt         j"                  d       y )Nr   z--viewzVOutput contains all configuration details of the instance, including partner metadata.zhDefault output view. Output contains all configuration details of the instance, except partner metadata.)FULLBASICz9Specifies the information that the output should contain.)choicestypehelp)r   r   r   r   r   r   r   r   r   r   r   r   r    r
   r!   add_argumentr   ChoiceToEnumNamer"   s    r$   r%   zListBeta.ArgsZ   s    
!!%"E"EF
%%8888'  ""5#7#7#9:
f%
''
(E(EF
0=	
 ''H  r&   c                 p    |dk(  r|j                   j                  S |dk(  r|j                   j                  S y )NrB   rC   )ViewValueValuesEnumrB   rC   )r3   viewrequest_messages      r$   _GetInstanceViewzListBeta._GetInstanceViewt   s7    v~00555	00666r&   c           	         t        j                  | j                               }|j                  }t	        j
                  ||j                        }t	        j                  ||j                  j                  |j                  j                  | j                  |j                  |j                  j                              }t	        j                  ||      S )N)r(   r)   r*   instance_view_flag)r   r+   r,   r(   r   r-   r.   r/   r0   r   rM   rK   messagesComputeInstancesListRequestr1   r2   s         r$   r8   zListBeta.Run{   s    **4+<+<+>?F]]F..tV5E5EFL 11,,66"22<<00IIvBB
	 ==':;;r&   N)r9   r:   r;   r<   r=   r%   rM   r8   r>   r&   r$   r@   r@   U   s#     7 2<r&   r@   EXAMPLESN)!r<   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r   googlecloudsdk.callioper	   "googlecloudsdk.command_lib.computer
   ,googlecloudsdk.command_lib.compute.instancesr   $googlecloudsdk.command_lib.util.apisr   RESOURCE_TYPEformatDETAILED_HELPEXAMPLE_FORMATUniverseCompatibleReleaseTracksr,   GAListCommandr   ALPHABETAr@   copydetailed_helpIPV6_INFO_LIST_FORMATr>   r&   r$   <module>rf      sf   % &  ' 7 1 0 ( 9 > : 	.	F=! D%%(()<4 < * <8 D%%++T->->-C-CD3<t 3< E 3<l #'') !/!6!65.."  :  '++- %3%:%:5..&  z "r&   