
                         P    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 Z	d Z
y	)
z7Tunnel TCP traffic over Cloud IAP WebSocket connection.    )absolute_import)division)unicode_literals)
iap_tunnel)logc                 ,    | j                  ddd       y )Nz--tunnel-through-iap
store_truez      Tunnel the ssh connection through Identity-Aware Proxy for TCP forwarding.

      To learn more, see the
      [IAP for TCP forwarding documentation](https://cloud.google.com/iap/docs/tcp-forwarding-overview).
      )actionhelp)add_argument)parsers    0lib/googlecloudsdk/command_lib/app/iap_tunnel.pyAddSshTunnelArgsr      s     
  	    c                 :   t        | d      sy|j                  j                  j                  }| j	                  d      rL| j
                  s t        j                  j                  d       yt        j                  j                  d       nB|j                  j                  |j                  ur t        j                  j                  d       yt        j                         }|j                  |_        ||_        |j"                  |_        |j&                  |_        |S )a  Construct an SshTunnelArgs from command line args and values.

  Args:
    args: The parsed commandline arguments. May or may not have had
      AddSshTunnelArgs called.
    api_client: An appengine_api_client.AppEngineApiClient.
    track: ReleaseTrack, The currently running release track.
    project: str, the project id (string with dashes).
    version: The target version reference object.
    instance: The target instance reference object.

  Returns:
    SshTunnelArgs or None if IAP Tunnel is disabled.
  tunnel_through_iapNzPIAP tunnel is disabled; ssh/scp operations that require IAP tunneling will fail.zRIAP tunnel is enabled; ssh/scp operations that require IAP tunneling will succeed.z@External IP address was found while IAP tunneling not specified;)hasattrmessagesNetworkInstanceIpModeValueValuesEnumIsSpecifiedr   r   statusPrintnetworkinstanceIpModeINTERNALr   SshTunnelArgsprefixtrackproject
vmZoneNamezoneidinstance)args
api_clientr   r    versionr$   instance_ip_mode_enumress           r   CreateSshTunnelArgsr*   &   s      
+	, !!?? 
 
*+""	jj&  
jj) %%-B-K-KK	jj
L   "#ll#)#+  #(#,	*r   N)__doc__
__future__r   r   r   "googlecloudsdk.command_lib.computer   googlecloudsdk.corer   r   r*    r   r   <module>r0      s#    > &  ' 9 #
5r   