airflow.providers.google.cloud.hooks.compute_ssh

Module Contents

class airflow.providers.google.cloud.hooks.compute_ssh._GCloudAuthorizedSSHClient(google_hook, *args, **kwargs)[source]

Bases: paramiko.SSHClient

SSH Client that maintains the context for gcloud authorization during the connection

connect(self, *args, **kwargs)[source]
close(self)[source]
__exit__(self, type_, value, traceback)[source]
class airflow.providers.google.cloud.hooks.compute_ssh.ComputeEngineSSHHook(gcp_conn_id: str = 'google_cloud_default', instance_name: Optional[str] = None, zone: Optional[str] = None, user: Optional[str] = 'root', project_id: Optional[str] = None, hostname: Optional[str] = None, use_internal_ip: bool = False, use_iap_tunnel: bool = False, use_oslogin: bool = True, expire_time: int = 300, delegate_to: Optional[str] = None)[source]

Bases: airflow.providers.ssh.hooks.ssh.SSHHook

Hook to connect to a remote instance in compute engine

Parameters
  • instance_name (str) -- The name of the Compute Engine instance

  • zone (str) -- The zone of the Compute Engine instance

  • user (str) -- The name of the user on which the login attempt will be made

  • project_id (str) -- The project ID of the remote instance

  • gcp_conn_id (str) -- The connection id to use when fetching connection info

  • hostname (str) -- The hostname of the target instance. If it is not passed, it will be detected automatically.

  • use_iap_tunnel (bool) -- Whether to connect through IAP tunnel

  • use_internal_ip (bool) -- Whether to connect using internal IP

  • use_oslogin -- Whether to manage keys using OsLogin API. If false, keys are managed using instance metadata

  • expire_time (int) -- The maximum amount of time in seconds before the private key expires

  • gcp_conn_id -- The connection id to use when fetching connection information

  • delegate_to (str) -- The account to impersonate, if any. For this to work, the service account making the request must have domain-wide delegation enabled.

conn_name_attr = gcp_conn_id[source]
default_conn_name = google_cloud_default[source]
conn_type = gcpssh[source]
hook_name = Google Cloud SSH[source]
static get_ui_field_behaviour()[source]
_oslogin_hook(self)[source]
_compute_hook(self)[source]
_load_connection_config(self)[source]
get_conn(self)[source]

Return SSH connection.

_connect_to_instance(self, user, hostname, pkey, proxy_command)[source]
_authorize_compute_engine_instance_metadata(self, pubkey)[source]
_authorize_os_login(self, pubkey)[source]
_generate_ssh_key(self, user)[source]

Was this entry helpful?