apache-airflow-providers-google 16.0.0rc1__py3-none-any.whl → 16.1.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/google/__init__.py +1 -1
- airflow/providers/google/ads/hooks/ads.py +9 -5
- airflow/providers/google/ads/operators/ads.py +1 -1
- airflow/providers/google/ads/transfers/ads_to_gcs.py +1 -1
- airflow/providers/google/cloud/hooks/bigquery.py +2 -3
- airflow/providers/google/cloud/hooks/cloud_sql.py +8 -4
- airflow/providers/google/cloud/hooks/datacatalog.py +9 -1
- airflow/providers/google/cloud/hooks/dataflow.py +2 -2
- airflow/providers/google/cloud/hooks/dataplex.py +1 -1
- airflow/providers/google/cloud/hooks/dataprep.py +4 -1
- airflow/providers/google/cloud/hooks/gcs.py +2 -2
- airflow/providers/google/cloud/hooks/looker.py +5 -1
- airflow/providers/google/cloud/hooks/mlengine.py +2 -1
- airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
- airflow/providers/google/cloud/hooks/spanner.py +2 -2
- airflow/providers/google/cloud/hooks/translate.py +1 -1
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +307 -7
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +43 -14
- airflow/providers/google/cloud/hooks/vertex_ai/ray.py +11 -2
- airflow/providers/google/cloud/hooks/vision.py +2 -2
- airflow/providers/google/cloud/links/alloy_db.py +0 -46
- airflow/providers/google/cloud/links/base.py +75 -11
- airflow/providers/google/cloud/links/bigquery.py +0 -47
- airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
- airflow/providers/google/cloud/links/bigtable.py +0 -48
- airflow/providers/google/cloud/links/cloud_build.py +0 -73
- airflow/providers/google/cloud/links/cloud_functions.py +0 -33
- airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
- airflow/providers/google/cloud/links/cloud_run.py +1 -33
- airflow/providers/google/cloud/links/cloud_sql.py +0 -33
- airflow/providers/google/cloud/links/cloud_storage_transfer.py +16 -43
- airflow/providers/google/cloud/links/cloud_tasks.py +6 -25
- airflow/providers/google/cloud/links/compute.py +0 -58
- airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
- airflow/providers/google/cloud/links/datacatalog.py +23 -54
- airflow/providers/google/cloud/links/dataflow.py +0 -34
- airflow/providers/google/cloud/links/dataform.py +0 -64
- airflow/providers/google/cloud/links/datafusion.py +1 -96
- airflow/providers/google/cloud/links/dataplex.py +0 -154
- airflow/providers/google/cloud/links/dataprep.py +0 -24
- airflow/providers/google/cloud/links/dataproc.py +14 -90
- airflow/providers/google/cloud/links/datastore.py +0 -31
- airflow/providers/google/cloud/links/kubernetes_engine.py +5 -59
- airflow/providers/google/cloud/links/life_sciences.py +0 -19
- airflow/providers/google/cloud/links/managed_kafka.py +0 -70
- airflow/providers/google/cloud/links/mlengine.py +0 -70
- airflow/providers/google/cloud/links/pubsub.py +0 -32
- airflow/providers/google/cloud/links/spanner.py +0 -33
- airflow/providers/google/cloud/links/stackdriver.py +0 -30
- airflow/providers/google/cloud/links/translate.py +16 -186
- airflow/providers/google/cloud/links/vertex_ai.py +8 -224
- airflow/providers/google/cloud/links/workflows.py +0 -52
- airflow/providers/google/cloud/operators/alloy_db.py +69 -54
- airflow/providers/google/cloud/operators/automl.py +16 -14
- airflow/providers/google/cloud/operators/bigquery.py +0 -15
- airflow/providers/google/cloud/operators/bigquery_dts.py +2 -4
- airflow/providers/google/cloud/operators/bigtable.py +35 -6
- airflow/providers/google/cloud/operators/cloud_base.py +21 -1
- airflow/providers/google/cloud/operators/cloud_build.py +74 -31
- airflow/providers/google/cloud/operators/cloud_composer.py +34 -35
- airflow/providers/google/cloud/operators/cloud_memorystore.py +68 -42
- airflow/providers/google/cloud/operators/cloud_run.py +0 -1
- airflow/providers/google/cloud/operators/cloud_sql.py +11 -15
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +0 -2
- airflow/providers/google/cloud/operators/compute.py +7 -39
- airflow/providers/google/cloud/operators/datacatalog.py +156 -20
- airflow/providers/google/cloud/operators/dataflow.py +37 -14
- airflow/providers/google/cloud/operators/dataform.py +14 -4
- airflow/providers/google/cloud/operators/datafusion.py +4 -12
- airflow/providers/google/cloud/operators/dataplex.py +180 -96
- airflow/providers/google/cloud/operators/dataprep.py +0 -4
- airflow/providers/google/cloud/operators/dataproc.py +10 -16
- airflow/providers/google/cloud/operators/dataproc_metastore.py +95 -87
- airflow/providers/google/cloud/operators/datastore.py +21 -5
- airflow/providers/google/cloud/operators/dlp.py +3 -26
- airflow/providers/google/cloud/operators/functions.py +15 -6
- airflow/providers/google/cloud/operators/gcs.py +0 -7
- airflow/providers/google/cloud/operators/kubernetes_engine.py +50 -7
- airflow/providers/google/cloud/operators/life_sciences.py +0 -1
- airflow/providers/google/cloud/operators/managed_kafka.py +106 -51
- airflow/providers/google/cloud/operators/mlengine.py +0 -1
- airflow/providers/google/cloud/operators/pubsub.py +2 -4
- airflow/providers/google/cloud/operators/spanner.py +0 -4
- airflow/providers/google/cloud/operators/speech_to_text.py +0 -1
- airflow/providers/google/cloud/operators/stackdriver.py +0 -8
- airflow/providers/google/cloud/operators/tasks.py +0 -11
- airflow/providers/google/cloud/operators/text_to_speech.py +0 -1
- airflow/providers/google/cloud/operators/translate.py +37 -13
- airflow/providers/google/cloud/operators/translate_speech.py +0 -1
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +31 -18
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +28 -8
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +38 -25
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +69 -7
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +42 -8
- airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +531 -0
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +93 -25
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +10 -8
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +56 -10
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +25 -6
- airflow/providers/google/cloud/operators/vertex_ai/ray.py +9 -6
- airflow/providers/google/cloud/operators/workflows.py +1 -9
- airflow/providers/google/cloud/sensors/bigquery.py +1 -1
- airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -1
- airflow/providers/google/cloud/sensors/bigtable.py +15 -3
- airflow/providers/google/cloud/sensors/cloud_composer.py +6 -1
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -1
- airflow/providers/google/cloud/sensors/dataflow.py +3 -3
- airflow/providers/google/cloud/sensors/dataform.py +6 -1
- airflow/providers/google/cloud/sensors/datafusion.py +6 -1
- airflow/providers/google/cloud/sensors/dataplex.py +6 -1
- airflow/providers/google/cloud/sensors/dataprep.py +6 -1
- airflow/providers/google/cloud/sensors/dataproc.py +6 -1
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +6 -1
- airflow/providers/google/cloud/sensors/gcs.py +9 -3
- airflow/providers/google/cloud/sensors/looker.py +6 -1
- airflow/providers/google/cloud/sensors/pubsub.py +8 -3
- airflow/providers/google/cloud/sensors/tasks.py +6 -1
- airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +6 -1
- airflow/providers/google/cloud/sensors/workflows.py +6 -1
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +1 -2
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +1 -2
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +0 -1
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +1 -1
- airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +1 -2
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_local.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +1 -1
- airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +5 -1
- airflow/providers/google/cloud/transfers/gdrive_to_local.py +1 -1
- airflow/providers/google/cloud/transfers/http_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/local_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +1 -1
- airflow/providers/google/cloud/utils/field_validator.py +1 -2
- airflow/providers/google/common/auth_backend/google_openid.py +2 -1
- airflow/providers/google/common/deprecated.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +7 -3
- airflow/providers/google/common/links/storage.py +0 -22
- airflow/providers/google/firebase/operators/firestore.py +1 -1
- airflow/providers/google/get_provider_info.py +0 -11
- airflow/providers/google/leveldb/hooks/leveldb.py +5 -1
- airflow/providers/google/leveldb/operators/leveldb.py +1 -1
- airflow/providers/google/marketing_platform/links/analytics_admin.py +3 -6
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +0 -1
- airflow/providers/google/marketing_platform/operators/campaign_manager.py +4 -4
- airflow/providers/google/marketing_platform/operators/display_video.py +6 -6
- airflow/providers/google/marketing_platform/operators/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/sensors/campaign_manager.py +6 -1
- airflow/providers/google/marketing_platform/sensors/display_video.py +6 -1
- airflow/providers/google/suite/operators/sheets.py +3 -3
- airflow/providers/google/suite/sensors/drive.py +6 -1
- airflow/providers/google/suite/transfers/gcs_to_gdrive.py +1 -1
- airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
- airflow/providers/google/suite/transfers/local_to_drive.py +1 -1
- airflow/providers/google/version_compat.py +28 -0
- {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/METADATA +19 -20
- {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/RECORD +166 -166
- {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/entry_points.txt +0 -0
@@ -19,19 +19,23 @@ from __future__ import annotations
|
|
19
19
|
|
20
20
|
from typing import TYPE_CHECKING, ClassVar
|
21
21
|
|
22
|
-
from airflow.providers.google.version_compat import
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
from airflow.providers.google.version_compat import (
|
23
|
+
AIRFLOW_V_3_0_PLUS,
|
24
|
+
BaseOperator,
|
25
|
+
BaseOperatorLink,
|
26
|
+
BaseSensorOperator,
|
27
|
+
)
|
27
28
|
|
28
29
|
if AIRFLOW_V_3_0_PLUS:
|
29
|
-
from airflow.sdk import BaseOperatorLink
|
30
30
|
from airflow.sdk.execution_time.xcom import XCom
|
31
31
|
else:
|
32
|
-
from airflow.models.baseoperatorlink import BaseOperatorLink # type: ignore[no-redef]
|
33
32
|
from airflow.models.xcom import XCom # type: ignore[no-redef]
|
34
33
|
|
34
|
+
if TYPE_CHECKING:
|
35
|
+
from airflow.models.taskinstancekey import TaskInstanceKey
|
36
|
+
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
37
|
+
from airflow.utils.context import Context
|
38
|
+
|
35
39
|
BASE_LINK = "https://console.cloud.google.com"
|
36
40
|
|
37
41
|
|
@@ -39,6 +43,12 @@ class BaseGoogleLink(BaseOperatorLink):
|
|
39
43
|
"""
|
40
44
|
Base class for all Google links.
|
41
45
|
|
46
|
+
When you inherit this class in a Link class;
|
47
|
+
- You can call the persist method to push data to the XCom to use it later in the get_link method.
|
48
|
+
- If you have an operator which inherit the GoogleCloudBaseOperator or BaseSensorOperator
|
49
|
+
You can define extra_links_params method in the operator to pass the operator properties
|
50
|
+
to the get_link method.
|
51
|
+
|
42
52
|
:meta private:
|
43
53
|
"""
|
44
54
|
|
@@ -46,15 +56,69 @@ class BaseGoogleLink(BaseOperatorLink):
|
|
46
56
|
key: ClassVar[str]
|
47
57
|
format_str: ClassVar[str]
|
48
58
|
|
59
|
+
@property
|
60
|
+
def xcom_key(self) -> str:
|
61
|
+
# NOTE: in Airflow 3 we need to have xcom_key property in the Link class.
|
62
|
+
# Since we have the key property already, this is just a proxy property method to use same
|
63
|
+
# key as in Airflow 2.
|
64
|
+
return self.key
|
65
|
+
|
66
|
+
@classmethod
|
67
|
+
def persist(cls, context: Context, **value):
|
68
|
+
"""
|
69
|
+
Push arguments to the XCom to use later for link formatting at the `get_link` method.
|
70
|
+
|
71
|
+
Note: for Airflow 2 we need to call this function with context variable only
|
72
|
+
where we have the extra_links_params property method defined
|
73
|
+
"""
|
74
|
+
params = {}
|
75
|
+
# TODO: remove after Airflow v2 support dropped
|
76
|
+
if not AIRFLOW_V_3_0_PLUS:
|
77
|
+
common_params = getattr(context["task"], "extra_links_params", None)
|
78
|
+
if common_params:
|
79
|
+
params.update(common_params)
|
80
|
+
|
81
|
+
context["ti"].xcom_push(
|
82
|
+
key=cls.key,
|
83
|
+
value={
|
84
|
+
**params,
|
85
|
+
**value,
|
86
|
+
},
|
87
|
+
)
|
88
|
+
|
89
|
+
def get_config(self, operator, ti_key):
|
90
|
+
conf = {}
|
91
|
+
conf.update(getattr(operator, "extra_links_params", {}))
|
92
|
+
conf.update(XCom.get_value(key=self.key, ti_key=ti_key) or {})
|
93
|
+
|
94
|
+
# if the config did not define, return None to stop URL formatting
|
95
|
+
if not conf:
|
96
|
+
return None
|
97
|
+
|
98
|
+
# Add a default value for the 'namespace' parameter for backward compatibility.
|
99
|
+
# This is for datafusion
|
100
|
+
conf.setdefault("namespace", "default")
|
101
|
+
return conf
|
102
|
+
|
49
103
|
def get_link(
|
50
104
|
self,
|
51
105
|
operator: BaseOperator,
|
52
106
|
*,
|
53
107
|
ti_key: TaskInstanceKey,
|
54
108
|
) -> str:
|
55
|
-
|
109
|
+
if TYPE_CHECKING:
|
110
|
+
assert isinstance(operator, (GoogleCloudBaseOperator, BaseSensorOperator))
|
111
|
+
|
112
|
+
conf = self.get_config(operator, ti_key)
|
56
113
|
if not conf:
|
57
114
|
return ""
|
58
|
-
|
59
|
-
|
60
|
-
|
115
|
+
return self._format_link(**conf)
|
116
|
+
|
117
|
+
def _format_link(self, **kwargs):
|
118
|
+
try:
|
119
|
+
formatted_str = self.format_str.format(**kwargs)
|
120
|
+
if formatted_str.startswith("http"):
|
121
|
+
return formatted_str
|
122
|
+
return BASE_LINK + formatted_str
|
123
|
+
except KeyError:
|
124
|
+
return ""
|
@@ -19,14 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
24
|
BIGQUERY_BASE_LINK = "/bigquery"
|
31
25
|
BIGQUERY_DATASET_LINK = (
|
32
26
|
BIGQUERY_BASE_LINK + "?referrer=search&project={project_id}&d={dataset_id}&p={project_id}&page=dataset"
|
@@ -47,19 +41,6 @@ class BigQueryDatasetLink(BaseGoogleLink):
|
|
47
41
|
key = "bigquery_dataset"
|
48
42
|
format_str = BIGQUERY_DATASET_LINK
|
49
43
|
|
50
|
-
@staticmethod
|
51
|
-
def persist(
|
52
|
-
context: Context,
|
53
|
-
task_instance: BaseOperator,
|
54
|
-
dataset_id: str,
|
55
|
-
project_id: str,
|
56
|
-
):
|
57
|
-
task_instance.xcom_push(
|
58
|
-
context,
|
59
|
-
key=BigQueryDatasetLink.key,
|
60
|
-
value={"dataset_id": dataset_id, "project_id": project_id},
|
61
|
-
)
|
62
|
-
|
63
44
|
|
64
45
|
class BigQueryTableLink(BaseGoogleLink):
|
65
46
|
"""Helper class for constructing BigQuery Table Link."""
|
@@ -68,20 +49,6 @@ class BigQueryTableLink(BaseGoogleLink):
|
|
68
49
|
key = "bigquery_table"
|
69
50
|
format_str = BIGQUERY_TABLE_LINK
|
70
51
|
|
71
|
-
@staticmethod
|
72
|
-
def persist(
|
73
|
-
context: Context,
|
74
|
-
task_instance: BaseOperator,
|
75
|
-
project_id: str,
|
76
|
-
table_id: str,
|
77
|
-
dataset_id: str | None = None,
|
78
|
-
):
|
79
|
-
task_instance.xcom_push(
|
80
|
-
context,
|
81
|
-
key=BigQueryTableLink.key,
|
82
|
-
value={"dataset_id": dataset_id, "project_id": project_id, "table_id": table_id},
|
83
|
-
)
|
84
|
-
|
85
52
|
|
86
53
|
class BigQueryJobDetailLink(BaseGoogleLink):
|
87
54
|
"""Helper class for constructing BigQuery Job Detail Link."""
|
@@ -89,17 +56,3 @@ class BigQueryJobDetailLink(BaseGoogleLink):
|
|
89
56
|
name = "BigQuery Job Detail"
|
90
57
|
key = "bigquery_job_detail"
|
91
58
|
format_str = BIGQUERY_JOB_DETAIL_LINK
|
92
|
-
|
93
|
-
@staticmethod
|
94
|
-
def persist(
|
95
|
-
context: Context,
|
96
|
-
task_instance: BaseOperator,
|
97
|
-
project_id: str,
|
98
|
-
location: str,
|
99
|
-
job_id: str,
|
100
|
-
):
|
101
|
-
task_instance.xcom_push(
|
102
|
-
context,
|
103
|
-
key=BigQueryJobDetailLink.key,
|
104
|
-
value={"project_id": project_id, "location": location, "job_id": job_id},
|
105
|
-
)
|
@@ -19,14 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
24
|
BIGQUERY_BASE_LINK = "/bigquery/transfers"
|
31
25
|
BIGQUERY_DTS_LINK = BIGQUERY_BASE_LINK + "/locations/{region}/configs/{config_id}/runs?project={project_id}"
|
32
26
|
|
@@ -37,17 +31,3 @@ class BigQueryDataTransferConfigLink(BaseGoogleLink):
|
|
37
31
|
name = "BigQuery Data Transfer Config"
|
38
32
|
key = "bigquery_dts_config"
|
39
33
|
format_str = BIGQUERY_DTS_LINK
|
40
|
-
|
41
|
-
@staticmethod
|
42
|
-
def persist(
|
43
|
-
context: Context,
|
44
|
-
task_instance: BaseOperator,
|
45
|
-
region: str,
|
46
|
-
config_id: str,
|
47
|
-
project_id: str,
|
48
|
-
):
|
49
|
-
task_instance.xcom_push(
|
50
|
-
context,
|
51
|
-
key=BigQueryDataTransferConfigLink.key,
|
52
|
-
value={"project_id": project_id, "region": region, "config_id": config_id},
|
53
|
-
)
|
@@ -16,13 +16,8 @@
|
|
16
16
|
# under the License.
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
|
-
from typing import TYPE_CHECKING
|
20
|
-
|
21
19
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
22
20
|
|
23
|
-
if TYPE_CHECKING:
|
24
|
-
from airflow.utils.context import Context
|
25
|
-
|
26
21
|
BIGTABLE_BASE_LINK = "/bigtable"
|
27
22
|
BIGTABLE_INSTANCE_LINK = BIGTABLE_BASE_LINK + "/instances/{instance_id}/overview?project={project_id}"
|
28
23
|
BIGTABLE_CLUSTER_LINK = (
|
@@ -38,20 +33,6 @@ class BigtableInstanceLink(BaseGoogleLink):
|
|
38
33
|
key = "instance_key"
|
39
34
|
format_str = BIGTABLE_INSTANCE_LINK
|
40
35
|
|
41
|
-
@staticmethod
|
42
|
-
def persist(
|
43
|
-
context: Context,
|
44
|
-
task_instance,
|
45
|
-
):
|
46
|
-
task_instance.xcom_push(
|
47
|
-
context=context,
|
48
|
-
key=BigtableInstanceLink.key,
|
49
|
-
value={
|
50
|
-
"instance_id": task_instance.instance_id,
|
51
|
-
"project_id": task_instance.project_id,
|
52
|
-
},
|
53
|
-
)
|
54
|
-
|
55
36
|
|
56
37
|
class BigtableClusterLink(BaseGoogleLink):
|
57
38
|
"""Helper class for constructing Bigtable Cluster link."""
|
@@ -60,21 +41,6 @@ class BigtableClusterLink(BaseGoogleLink):
|
|
60
41
|
key = "cluster_key"
|
61
42
|
format_str = BIGTABLE_CLUSTER_LINK
|
62
43
|
|
63
|
-
@staticmethod
|
64
|
-
def persist(
|
65
|
-
context: Context,
|
66
|
-
task_instance,
|
67
|
-
):
|
68
|
-
task_instance.xcom_push(
|
69
|
-
context=context,
|
70
|
-
key=BigtableClusterLink.key,
|
71
|
-
value={
|
72
|
-
"instance_id": task_instance.instance_id,
|
73
|
-
"cluster_id": task_instance.cluster_id,
|
74
|
-
"project_id": task_instance.project_id,
|
75
|
-
},
|
76
|
-
)
|
77
|
-
|
78
44
|
|
79
45
|
class BigtableTablesLink(BaseGoogleLink):
|
80
46
|
"""Helper class for constructing Bigtable Tables link."""
|
@@ -82,17 +48,3 @@ class BigtableTablesLink(BaseGoogleLink):
|
|
82
48
|
name = "Bigtable Tables"
|
83
49
|
key = "tables_key"
|
84
50
|
format_str = BIGTABLE_TABLES_LINK
|
85
|
-
|
86
|
-
@staticmethod
|
87
|
-
def persist(
|
88
|
-
context: Context,
|
89
|
-
task_instance,
|
90
|
-
):
|
91
|
-
task_instance.xcom_push(
|
92
|
-
context=context,
|
93
|
-
key=BigtableTablesLink.key,
|
94
|
-
value={
|
95
|
-
"instance_id": task_instance.instance_id,
|
96
|
-
"project_id": task_instance.project_id,
|
97
|
-
},
|
98
|
-
)
|
@@ -16,13 +16,8 @@
|
|
16
16
|
# under the License.
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
|
-
from typing import TYPE_CHECKING
|
20
|
-
|
21
19
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
22
20
|
|
23
|
-
if TYPE_CHECKING:
|
24
|
-
from airflow.utils.context import Context
|
25
|
-
|
26
21
|
BUILD_BASE_LINK = "/cloud-build"
|
27
22
|
|
28
23
|
BUILD_LINK = BUILD_BASE_LINK + "/builds;region={region}/{build_id}?project={project_id}"
|
@@ -43,24 +38,6 @@ class CloudBuildLink(BaseGoogleLink):
|
|
43
38
|
key = "cloud_build_key"
|
44
39
|
format_str = BUILD_LINK
|
45
40
|
|
46
|
-
@staticmethod
|
47
|
-
def persist(
|
48
|
-
context: Context,
|
49
|
-
task_instance,
|
50
|
-
build_id: str,
|
51
|
-
project_id: str,
|
52
|
-
region: str,
|
53
|
-
):
|
54
|
-
task_instance.xcom_push(
|
55
|
-
context=context,
|
56
|
-
key=CloudBuildLink.key,
|
57
|
-
value={
|
58
|
-
"project_id": project_id,
|
59
|
-
"region": region,
|
60
|
-
"build_id": build_id,
|
61
|
-
},
|
62
|
-
)
|
63
|
-
|
64
41
|
|
65
42
|
class CloudBuildListLink(BaseGoogleLink):
|
66
43
|
"""Helper class for constructing Cloud Build List link."""
|
@@ -69,22 +46,6 @@ class CloudBuildListLink(BaseGoogleLink):
|
|
69
46
|
key = "cloud_build_list_key"
|
70
47
|
format_str = BUILD_LIST_LINK
|
71
48
|
|
72
|
-
@staticmethod
|
73
|
-
def persist(
|
74
|
-
context: Context,
|
75
|
-
task_instance,
|
76
|
-
project_id: str,
|
77
|
-
region: str,
|
78
|
-
):
|
79
|
-
task_instance.xcom_push(
|
80
|
-
context=context,
|
81
|
-
key=CloudBuildListLink.key,
|
82
|
-
value={
|
83
|
-
"project_id": project_id,
|
84
|
-
"region": region,
|
85
|
-
},
|
86
|
-
)
|
87
|
-
|
88
49
|
|
89
50
|
class CloudBuildTriggersListLink(BaseGoogleLink):
|
90
51
|
"""Helper class for constructing Cloud Build Triggers List link."""
|
@@ -93,22 +54,6 @@ class CloudBuildTriggersListLink(BaseGoogleLink):
|
|
93
54
|
key = "cloud_build_triggers_list_key"
|
94
55
|
format_str = BUILD_TRIGGERS_LIST_LINK
|
95
56
|
|
96
|
-
@staticmethod
|
97
|
-
def persist(
|
98
|
-
context: Context,
|
99
|
-
task_instance,
|
100
|
-
project_id: str,
|
101
|
-
region: str,
|
102
|
-
):
|
103
|
-
task_instance.xcom_push(
|
104
|
-
context=context,
|
105
|
-
key=CloudBuildTriggersListLink.key,
|
106
|
-
value={
|
107
|
-
"project_id": project_id,
|
108
|
-
"region": region,
|
109
|
-
},
|
110
|
-
)
|
111
|
-
|
112
57
|
|
113
58
|
class CloudBuildTriggerDetailsLink(BaseGoogleLink):
|
114
59
|
"""Helper class for constructing Cloud Build Trigger Details link."""
|
@@ -116,21 +61,3 @@ class CloudBuildTriggerDetailsLink(BaseGoogleLink):
|
|
116
61
|
name = "Cloud Build Triggers Details"
|
117
62
|
key = "cloud_build_triggers_details_key"
|
118
63
|
format_str = BUILD_TRIGGER_DETAILS_LINK
|
119
|
-
|
120
|
-
@staticmethod
|
121
|
-
def persist(
|
122
|
-
context: Context,
|
123
|
-
task_instance,
|
124
|
-
project_id: str,
|
125
|
-
region: str,
|
126
|
-
trigger_id: str,
|
127
|
-
):
|
128
|
-
task_instance.xcom_push(
|
129
|
-
context=context,
|
130
|
-
key=CloudBuildTriggerDetailsLink.key,
|
131
|
-
value={
|
132
|
-
"project_id": project_id,
|
133
|
-
"region": region,
|
134
|
-
"trigger_id": trigger_id,
|
135
|
-
},
|
136
|
-
)
|
@@ -19,15 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
|
-
|
31
24
|
CLOUD_FUNCTIONS_BASE_LINK = "https://console.cloud.google.com/functions"
|
32
25
|
|
33
26
|
CLOUD_FUNCTIONS_DETAILS_LINK = (
|
@@ -44,20 +37,6 @@ class CloudFunctionsDetailsLink(BaseGoogleLink):
|
|
44
37
|
key = "cloud_functions_details"
|
45
38
|
format_str = CLOUD_FUNCTIONS_DETAILS_LINK
|
46
39
|
|
47
|
-
@staticmethod
|
48
|
-
def persist(
|
49
|
-
context: Context,
|
50
|
-
task_instance: BaseOperator,
|
51
|
-
function_name: str,
|
52
|
-
location: str,
|
53
|
-
project_id: str,
|
54
|
-
):
|
55
|
-
task_instance.xcom_push(
|
56
|
-
context,
|
57
|
-
key=CloudFunctionsDetailsLink.key,
|
58
|
-
value={"function_name": function_name, "location": location, "project_id": project_id},
|
59
|
-
)
|
60
|
-
|
61
40
|
|
62
41
|
class CloudFunctionsListLink(BaseGoogleLink):
|
63
42
|
"""Helper class for constructing Cloud Functions Details Link."""
|
@@ -65,15 +44,3 @@ class CloudFunctionsListLink(BaseGoogleLink):
|
|
65
44
|
name = "Cloud Functions List"
|
66
45
|
key = "cloud_functions_list"
|
67
46
|
format_str = CLOUD_FUNCTIONS_LIST_LINK
|
68
|
-
|
69
|
-
@staticmethod
|
70
|
-
def persist(
|
71
|
-
context: Context,
|
72
|
-
task_instance: BaseOperator,
|
73
|
-
project_id: str,
|
74
|
-
):
|
75
|
-
task_instance.xcom_push(
|
76
|
-
context,
|
77
|
-
key=CloudFunctionsDetailsLink.key,
|
78
|
-
value={"project_id": project_id},
|
79
|
-
)
|
@@ -19,14 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
24
|
BASE_LINK = "/memorystore"
|
31
25
|
MEMCACHED_LINK = (
|
32
26
|
BASE_LINK + "/memcached/locations/{location_id}/instances/{instance_id}/details?project={project_id}"
|
@@ -45,20 +39,6 @@ class MemcachedInstanceDetailsLink(BaseGoogleLink):
|
|
45
39
|
key = "memcached_instance"
|
46
40
|
format_str = MEMCACHED_LINK
|
47
41
|
|
48
|
-
@staticmethod
|
49
|
-
def persist(
|
50
|
-
context: Context,
|
51
|
-
task_instance: BaseOperator,
|
52
|
-
instance_id: str,
|
53
|
-
location_id: str,
|
54
|
-
project_id: str | None,
|
55
|
-
):
|
56
|
-
task_instance.xcom_push(
|
57
|
-
context,
|
58
|
-
key=MemcachedInstanceDetailsLink.key,
|
59
|
-
value={"instance_id": instance_id, "location_id": location_id, "project_id": project_id},
|
60
|
-
)
|
61
|
-
|
62
42
|
|
63
43
|
class MemcachedInstanceListLink(BaseGoogleLink):
|
64
44
|
"""Helper class for constructing Memorystore Memcached List of Instances Link."""
|
@@ -67,18 +47,6 @@ class MemcachedInstanceListLink(BaseGoogleLink):
|
|
67
47
|
key = "memcached_instances"
|
68
48
|
format_str = MEMCACHED_LIST_LINK
|
69
49
|
|
70
|
-
@staticmethod
|
71
|
-
def persist(
|
72
|
-
context: Context,
|
73
|
-
task_instance: BaseOperator,
|
74
|
-
project_id: str | None,
|
75
|
-
):
|
76
|
-
task_instance.xcom_push(
|
77
|
-
context,
|
78
|
-
key=MemcachedInstanceListLink.key,
|
79
|
-
value={"project_id": project_id},
|
80
|
-
)
|
81
|
-
|
82
50
|
|
83
51
|
class RedisInstanceDetailsLink(BaseGoogleLink):
|
84
52
|
"""Helper class for constructing Memorystore Redis Instance Link."""
|
@@ -87,20 +55,6 @@ class RedisInstanceDetailsLink(BaseGoogleLink):
|
|
87
55
|
key = "redis_instance"
|
88
56
|
format_str = REDIS_LINK
|
89
57
|
|
90
|
-
@staticmethod
|
91
|
-
def persist(
|
92
|
-
context: Context,
|
93
|
-
task_instance: BaseOperator,
|
94
|
-
instance_id: str,
|
95
|
-
location_id: str,
|
96
|
-
project_id: str | None,
|
97
|
-
):
|
98
|
-
task_instance.xcom_push(
|
99
|
-
context,
|
100
|
-
key=RedisInstanceDetailsLink.key,
|
101
|
-
value={"instance_id": instance_id, "location_id": location_id, "project_id": project_id},
|
102
|
-
)
|
103
|
-
|
104
58
|
|
105
59
|
class RedisInstanceListLink(BaseGoogleLink):
|
106
60
|
"""Helper class for constructing Memorystore Redis List of Instances Link."""
|
@@ -108,15 +62,3 @@ class RedisInstanceListLink(BaseGoogleLink):
|
|
108
62
|
name = "Memorystore Redis List of Instances"
|
109
63
|
key = "redis_instances"
|
110
64
|
format_str = REDIS_LIST_LINK
|
111
|
-
|
112
|
-
@staticmethod
|
113
|
-
def persist(
|
114
|
-
context: Context,
|
115
|
-
task_instance: BaseOperator,
|
116
|
-
project_id: str | None,
|
117
|
-
):
|
118
|
-
task_instance.xcom_push(
|
119
|
-
context,
|
120
|
-
key=RedisInstanceListLink.key,
|
121
|
-
value={"project_id": project_id},
|
122
|
-
)
|
@@ -16,20 +16,7 @@
|
|
16
16
|
# under the License.
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
|
-
from typing import TYPE_CHECKING
|
20
|
-
|
21
19
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
22
|
-
from airflow.providers.google.version_compat import AIRFLOW_V_3_0_PLUS
|
23
|
-
|
24
|
-
if TYPE_CHECKING:
|
25
|
-
from airflow.models import BaseOperator
|
26
|
-
from airflow.models.taskinstancekey import TaskInstanceKey
|
27
|
-
from airflow.utils.context import Context
|
28
|
-
|
29
|
-
if AIRFLOW_V_3_0_PLUS:
|
30
|
-
from airflow.sdk.execution_time.xcom import XCom
|
31
|
-
else:
|
32
|
-
from airflow.models.xcom import XCom # type: ignore[no-redef]
|
33
20
|
|
34
21
|
|
35
22
|
class CloudRunJobLoggingLink(BaseGoogleLink):
|
@@ -37,23 +24,4 @@ class CloudRunJobLoggingLink(BaseGoogleLink):
|
|
37
24
|
|
38
25
|
name = "Cloud Run Job Logging"
|
39
26
|
key = "log_uri"
|
40
|
-
|
41
|
-
@staticmethod
|
42
|
-
def persist(
|
43
|
-
context: Context,
|
44
|
-
task_instance: BaseOperator,
|
45
|
-
log_uri: str,
|
46
|
-
):
|
47
|
-
task_instance.xcom_push(
|
48
|
-
context,
|
49
|
-
key=CloudRunJobLoggingLink.key,
|
50
|
-
value=log_uri,
|
51
|
-
)
|
52
|
-
|
53
|
-
def get_link(
|
54
|
-
self,
|
55
|
-
operator: BaseOperator,
|
56
|
-
*,
|
57
|
-
ti_key: TaskInstanceKey,
|
58
|
-
) -> str:
|
59
|
-
return XCom.get_value(key=self.key, ti_key=ti_key)
|
27
|
+
format_str = "{log_uri}"
|
@@ -19,15 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
|
-
|
31
24
|
CLOUD_SQL_BASE_LINK = "/sql"
|
32
25
|
CLOUD_SQL_INSTANCE_LINK = CLOUD_SQL_BASE_LINK + "/instances/{instance}/overview?project={project_id}"
|
33
26
|
CLOUD_SQL_INSTANCE_DATABASE_LINK = (
|
@@ -42,19 +35,6 @@ class CloudSQLInstanceLink(BaseGoogleLink):
|
|
42
35
|
key = "cloud_sql_instance"
|
43
36
|
format_str = CLOUD_SQL_INSTANCE_LINK
|
44
37
|
|
45
|
-
@staticmethod
|
46
|
-
def persist(
|
47
|
-
context: Context,
|
48
|
-
task_instance: BaseOperator,
|
49
|
-
cloud_sql_instance: str,
|
50
|
-
project_id: str | None,
|
51
|
-
):
|
52
|
-
task_instance.xcom_push(
|
53
|
-
context,
|
54
|
-
key=CloudSQLInstanceLink.key,
|
55
|
-
value={"instance": cloud_sql_instance, "project_id": project_id},
|
56
|
-
)
|
57
|
-
|
58
38
|
|
59
39
|
class CloudSQLInstanceDatabaseLink(BaseGoogleLink):
|
60
40
|
"""Helper class for constructing Cloud SQL Instance Database Link."""
|
@@ -62,16 +42,3 @@ class CloudSQLInstanceDatabaseLink(BaseGoogleLink):
|
|
62
42
|
name = "Cloud SQL Instance Database"
|
63
43
|
key = "cloud_sql_instance_database"
|
64
44
|
format_str = CLOUD_SQL_INSTANCE_DATABASE_LINK
|
65
|
-
|
66
|
-
@staticmethod
|
67
|
-
def persist(
|
68
|
-
context: Context,
|
69
|
-
task_instance: BaseOperator,
|
70
|
-
cloud_sql_instance: str,
|
71
|
-
project_id: str | None,
|
72
|
-
):
|
73
|
-
task_instance.xcom_push(
|
74
|
-
context,
|
75
|
-
key=CloudSQLInstanceDatabaseLink.key,
|
76
|
-
value={"instance": cloud_sql_instance, "project_id": project_id},
|
77
|
-
)
|