potiuk commented on a change in pull request #21267:
URL: https://github.com/apache/airflow/pull/21267#discussion_r798419344



##########
File path: airflow/providers/google/cloud/operators/dataproc_metastore.py
##########
@@ -29,13 +29,121 @@
 from googleapiclient.errors import HttpError
 
 from airflow import AirflowException
-from airflow.models import BaseOperator
+from airflow.models import BaseOperator, BaseOperatorLink
+from airflow.models.taskinstance import TaskInstance
 from airflow.providers.google.cloud.hooks.dataproc_metastore import 
DataprocMetastoreHook
+from airflow.providers.google.common.links.storage import StorageLink
 
 if TYPE_CHECKING:
     from airflow.utils.context import Context
 
 
+BASE_LINK = "https://console.cloud.google.com";
+METASTORE_BASE_LINK = BASE_LINK + 
"/dataproc/metastore/services/{region}/{service_id}"
+METASTORE_BACKUP_LINK = METASTORE_BASE_LINK + 
"/backups/{backup_id}?project={project_id}"
+METASTORE_BACKUPS_LINK = METASTORE_BASE_LINK + 
"/backuprestore?project={project_id}"
+METASTORE_EXPORT_LINK = METASTORE_BASE_LINK + 
"/importexport?project={project_id}"
+METASTORE_IMPORT_LINK = METASTORE_BASE_LINK + 
"/imports/{import_id}?project={project_id}"
+METASTORE_SERVICE_LINK = METASTORE_BASE_LINK + "/config?project={project_id}"
+
+
+class DataprocMetastoreBackupLink(BaseOperatorLink):
+    """Helper class for constructing Dataproc Metastore Backup link"""
+
+    name = "Dataproc Metastore Backup"
+
+    def get_link(self, operator, dttm):
+        ti = TaskInstance(task=operator, execution_date=dttm)
+        backup_conf = ti.xcom_pull(task_ids=operator.task_id, 
key="backup_conf")

Review comment:
       @lwyszomi  - merged :). You can rebase now.




-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to