
    #                     F   S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSK
Jr  \	R                  " \	R                  R                  \	R                  R                   \	R                  R"                  5      \	R$                   " S	 S
\	R&                  5      5       5       rg)z.Command for SSHing into a started workstation.    )absolute_import)division)unicode_literalsN)workstations)base)flagsc                   4    \ rS rSrSr\S 5       rS rS rSr	g)Start   a0  SSH into a running workstation.

SSH into a running workstation.

Note that arguments for the `NO_PROXY` environment variable must be FQDNs.

## EXAMPLES

  To ssh into a running workstation, run:

    $ {command} WORKSTATION

  To specify the workstation port, run:

    $ {command} WORKSTATION --port=22

  To ssh into a running workstation with a username, run:

    $ {command} WORKSTATION --user=my-user

  To run a command on the workstation, such as getting a snapshot of the
  guest's process tree, run:
    $ {command} WORKSTATION --command="ps -ejH"
c                     [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        [         R                  " U 5        [         R
                  " U 5        g )N)workstations_flagsAddWorkstationResourceArgAddPortFieldAddLocalHostPortFieldAddCommandFieldAddSshArgsAndUserField)parsers    lib/surface/workstations/ssh.pyArgs
Start.Args:   sH    008##F+,,V4&&v.--f5    c                     g)NzSworkstations.projects.locations.workstationClusters.workstationConfigs.workstations )selfs    r   
CollectionStart.CollectionB   s    `r   c                    UR                   Ul        [        R                  " U R	                  5       5      nUR
                  R                  R                  5         UR                  R                  5         SUl
        [        R                  " UR                  US4S9nSUl        UR                  5         UR                  R!                  5         UR                  (       a  UR#                  U5        g g )NFT)targetargs)portworkstation_portr   WorkstationsReleaseTrackCONCEPTSworkstationParsethreading_eventcleartcp_tunnel_open	threadingThreadStartTcpTunneldaemonstartwaitSsh)r   r   clientts       r   Run	Start.RunE   s     IID&&t'8'8':;F
 	MM##%
  ""F 5 5T4LIAAHGGI
!jj r   r   N)
__name__
__module____qualname____firstlineno____doc__staticmethodr   r   r3   __static_attributes__r   r   r   r
   r
      s&    
2 6 6ar   r
   )r9   
__future__r   r   r   r*   #googlecloudsdk.api_lib.workstationsr   googlecloudsdk.callioper   'googlecloudsdk.command_lib.workstationsr   r   ReleaseTracksr#   GABETAALPHADefaultUniverseOnlyCommandr
   r   r   r   <module>rF      s    5 &  '  < ( O $++00$2C2C2I2I 9DLL 9 9r   