mik-laj commented on a change in pull request #9879:
URL: https://github.com/apache/airflow/pull/9879#discussion_r460595488



##########
File path: airflow/providers/google/cloud/operators/compute_ssh.py
##########
@@ -0,0 +1,105 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from typing import Any, Dict, Optional
+
+from airflow.models import BaseOperator
+from airflow.providers.google.cloud.hooks.compute_ssh import 
ComputeEngineSshHook
+from airflow.utils.decorators import apply_defaults
+
+
+class ComputeEngineSSHOperator(BaseOperator):
+    """
+    Executes commands on a remote instance
+
+    .. seealso::
+        For more information on how to use this operator, take a look at the 
guide:
+        :ref:`howto/operator:ComputeEngineSSHOperator`
+
+    :param instance: The name of the remote instance
+    :type instance: str
+    :param zone: The zone of the remote instance
+    :type zone: str
+    :param cmd: The command to execute on the remote instance
+    :type cmd: str
+    :param project_id: The project ID of the remote instance
+    :type project_id: str
+    :param gcp_conn_id: The connection id to use when fetching connection info
+    :type gcp_conn_id: str
+    :param api_version: The Compute Engine discovery API version
+    :type api_version: str
+    :param hostname: The hostname of the target instance
+    :type hostname: str
+    :param use_iap_tunnel: Whether to connect through IAP tunnel
+    :type use_iap_tunnel: bool
+    :param use_internal_ip: Whether to connect using internal IP
+    :type use_internal_ip: bool
+    :param use_oslogin: Whether to manage keys using OsLogin API. If false,
+        keys are managed using instance metadata
+    :param expire_time: The maximum amount of time in seconds before the 
private key expires
+    :type expire_time: int
+    """
+    # [START remote_instance_start_template_fields]
+    template_fields = ('project_id', 'zone', 'instance', 'gcp_conn_id', 
'api_version')
+
+    # [END remote_instance_start_template_fields]
+
+    @apply_defaults
+    def __init__(self,  # pylint: disable=too-many-arguments
+                 instance: str,
+                 zone: str,
+                 cmd: str,
+                 project_id: Optional[str] = None,
+                 gcp_conn_id: str = 'google_cloud_default',
+                 api_version: str = "v1",
+                 hostname: Optional[str] = None,
+                 use_internal_ip: bool = False,
+                 use_iap_tunnel: bool = False,
+                 use_oslogin: bool = True,
+                 expiry_time: int = 300,
+                 *args: Any,

Review comment:
       ```suggestion
   ```
   See: https://github.com/apache/airflow/issues/9942




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to