| :py:mod:`airflow.providers.ssh.hooks.ssh` |
| ========================================= |
| |
| .. py:module:: airflow.providers.ssh.hooks.ssh |
| |
| .. autoapi-nested-parse:: |
| |
| Hook for SSH connections. |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.ssh.hooks.ssh.SSHHook |
| |
| |
| |
| |
| Attributes |
| ~~~~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.ssh.hooks.ssh.TIMEOUT_DEFAULT |
| |
| |
| .. py:data:: TIMEOUT_DEFAULT |
| :annotation: = 10 |
| |
| |
| |
| .. py:class:: SSHHook(ssh_conn_id = None, remote_host = '', username = None, password = None, key_file = None, port = None, timeout = None, conn_timeout = None, keepalive_interval = 30, banner_timeout = 30.0) |
| |
| Bases: :py:obj:`airflow.hooks.base.BaseHook` |
| |
| Hook for ssh remote execution using Paramiko. |
| ref: https://github.com/paramiko/paramiko |
| This hook also lets you create ssh tunnel and serve as basis for SFTP file transfer |
| |
| :param ssh_conn_id: :ref:`ssh connection id<howto/connection:ssh>` from airflow |
| Connections from where all the required parameters can be fetched like |
| username, password or key_file. Thought the priority is given to the |
| param passed during init |
| :param remote_host: remote host to connect |
| :param username: username to connect to the remote_host |
| :param password: password of the username to connect to the remote_host |
| :param key_file: path to key file to use to connect to the remote_host |
| :param port: port of remote host to connect (Default is paramiko SSH_PORT) |
| :param conn_timeout: timeout (in seconds) for the attempt to connect to the remote_host. |
| The default is 10 seconds. If provided, it will replace the `conn_timeout` which was |
| predefined in the connection of `ssh_conn_id`. |
| :param timeout: (Deprecated). timeout for the attempt to connect to the remote_host. |
| Use conn_timeout instead. |
| :param keepalive_interval: send a keepalive packet to remote host every |
| keepalive_interval seconds |
| :param banner_timeout: timeout to wait for banner from the server in seconds |
| |
| .. py:attribute:: conn_name_attr |
| :annotation: = ssh_conn_id |
| |
| |
| |
| .. py:attribute:: default_conn_name |
| :annotation: = ssh_default |
| |
| |
| |
| .. py:attribute:: conn_type |
| :annotation: = ssh |
| |
| |
| |
| .. py:attribute:: hook_name |
| :annotation: = SSH |
| |
| |
| |
| .. py:method:: get_ui_field_behaviour() |
| :staticmethod: |
| |
| Returns custom field behaviour |
| |
| |
| .. py:method:: host_proxy(self) |
| |
| |
| .. py:method:: get_conn(self) |
| |
| Opens a ssh connection to the remote host. |
| |
| :rtype: paramiko.client.SSHClient |
| |
| |
| .. py:method:: __enter__(self) |
| |
| |
| .. py:method:: __exit__(self, exc_type, exc_val, exc_tb) |
| |
| |
| .. py:method:: get_tunnel(self, remote_port, remote_host = 'localhost', local_port = None) |
| |
| Creates a tunnel between two hosts. Like ssh -L <LOCAL_PORT>:host:<REMOTE_PORT>. |
| |
| :param remote_port: The remote port to create a tunnel to |
| :param remote_host: The remote host to create a tunnel to (default localhost) |
| :param local_port: The local port to attach the tunnel to |
| |
| :return: sshtunnel.SSHTunnelForwarder object |
| |
| |
| .. py:method:: create_tunnel(self, local_port, remote_port, remote_host = 'localhost') |
| |
| Creates tunnel for SSH connection [Deprecated]. |
| |
| :param local_port: local port number |
| :param remote_port: remote port number |
| :param remote_host: remote host |
| :return: |
| |
| |
| .. py:method:: exec_ssh_client_command(self, ssh_client, command, get_pty, environment, timeout) |
| |
| |
| |