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.
Files changed (166) hide show
  1. airflow/providers/google/__init__.py +1 -1
  2. airflow/providers/google/ads/hooks/ads.py +9 -5
  3. airflow/providers/google/ads/operators/ads.py +1 -1
  4. airflow/providers/google/ads/transfers/ads_to_gcs.py +1 -1
  5. airflow/providers/google/cloud/hooks/bigquery.py +2 -3
  6. airflow/providers/google/cloud/hooks/cloud_sql.py +8 -4
  7. airflow/providers/google/cloud/hooks/datacatalog.py +9 -1
  8. airflow/providers/google/cloud/hooks/dataflow.py +2 -2
  9. airflow/providers/google/cloud/hooks/dataplex.py +1 -1
  10. airflow/providers/google/cloud/hooks/dataprep.py +4 -1
  11. airflow/providers/google/cloud/hooks/gcs.py +2 -2
  12. airflow/providers/google/cloud/hooks/looker.py +5 -1
  13. airflow/providers/google/cloud/hooks/mlengine.py +2 -1
  14. airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
  15. airflow/providers/google/cloud/hooks/spanner.py +2 -2
  16. airflow/providers/google/cloud/hooks/translate.py +1 -1
  17. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +307 -7
  18. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +43 -14
  19. airflow/providers/google/cloud/hooks/vertex_ai/ray.py +11 -2
  20. airflow/providers/google/cloud/hooks/vision.py +2 -2
  21. airflow/providers/google/cloud/links/alloy_db.py +0 -46
  22. airflow/providers/google/cloud/links/base.py +75 -11
  23. airflow/providers/google/cloud/links/bigquery.py +0 -47
  24. airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
  25. airflow/providers/google/cloud/links/bigtable.py +0 -48
  26. airflow/providers/google/cloud/links/cloud_build.py +0 -73
  27. airflow/providers/google/cloud/links/cloud_functions.py +0 -33
  28. airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
  29. airflow/providers/google/cloud/links/cloud_run.py +1 -33
  30. airflow/providers/google/cloud/links/cloud_sql.py +0 -33
  31. airflow/providers/google/cloud/links/cloud_storage_transfer.py +16 -43
  32. airflow/providers/google/cloud/links/cloud_tasks.py +6 -25
  33. airflow/providers/google/cloud/links/compute.py +0 -58
  34. airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
  35. airflow/providers/google/cloud/links/datacatalog.py +23 -54
  36. airflow/providers/google/cloud/links/dataflow.py +0 -34
  37. airflow/providers/google/cloud/links/dataform.py +0 -64
  38. airflow/providers/google/cloud/links/datafusion.py +1 -96
  39. airflow/providers/google/cloud/links/dataplex.py +0 -154
  40. airflow/providers/google/cloud/links/dataprep.py +0 -24
  41. airflow/providers/google/cloud/links/dataproc.py +14 -90
  42. airflow/providers/google/cloud/links/datastore.py +0 -31
  43. airflow/providers/google/cloud/links/kubernetes_engine.py +5 -59
  44. airflow/providers/google/cloud/links/life_sciences.py +0 -19
  45. airflow/providers/google/cloud/links/managed_kafka.py +0 -70
  46. airflow/providers/google/cloud/links/mlengine.py +0 -70
  47. airflow/providers/google/cloud/links/pubsub.py +0 -32
  48. airflow/providers/google/cloud/links/spanner.py +0 -33
  49. airflow/providers/google/cloud/links/stackdriver.py +0 -30
  50. airflow/providers/google/cloud/links/translate.py +16 -186
  51. airflow/providers/google/cloud/links/vertex_ai.py +8 -224
  52. airflow/providers/google/cloud/links/workflows.py +0 -52
  53. airflow/providers/google/cloud/operators/alloy_db.py +69 -54
  54. airflow/providers/google/cloud/operators/automl.py +16 -14
  55. airflow/providers/google/cloud/operators/bigquery.py +0 -15
  56. airflow/providers/google/cloud/operators/bigquery_dts.py +2 -4
  57. airflow/providers/google/cloud/operators/bigtable.py +35 -6
  58. airflow/providers/google/cloud/operators/cloud_base.py +21 -1
  59. airflow/providers/google/cloud/operators/cloud_build.py +74 -31
  60. airflow/providers/google/cloud/operators/cloud_composer.py +34 -35
  61. airflow/providers/google/cloud/operators/cloud_memorystore.py +68 -42
  62. airflow/providers/google/cloud/operators/cloud_run.py +0 -1
  63. airflow/providers/google/cloud/operators/cloud_sql.py +11 -15
  64. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +0 -2
  65. airflow/providers/google/cloud/operators/compute.py +7 -39
  66. airflow/providers/google/cloud/operators/datacatalog.py +156 -20
  67. airflow/providers/google/cloud/operators/dataflow.py +37 -14
  68. airflow/providers/google/cloud/operators/dataform.py +14 -4
  69. airflow/providers/google/cloud/operators/datafusion.py +4 -12
  70. airflow/providers/google/cloud/operators/dataplex.py +180 -96
  71. airflow/providers/google/cloud/operators/dataprep.py +0 -4
  72. airflow/providers/google/cloud/operators/dataproc.py +10 -16
  73. airflow/providers/google/cloud/operators/dataproc_metastore.py +95 -87
  74. airflow/providers/google/cloud/operators/datastore.py +21 -5
  75. airflow/providers/google/cloud/operators/dlp.py +3 -26
  76. airflow/providers/google/cloud/operators/functions.py +15 -6
  77. airflow/providers/google/cloud/operators/gcs.py +0 -7
  78. airflow/providers/google/cloud/operators/kubernetes_engine.py +50 -7
  79. airflow/providers/google/cloud/operators/life_sciences.py +0 -1
  80. airflow/providers/google/cloud/operators/managed_kafka.py +106 -51
  81. airflow/providers/google/cloud/operators/mlengine.py +0 -1
  82. airflow/providers/google/cloud/operators/pubsub.py +2 -4
  83. airflow/providers/google/cloud/operators/spanner.py +0 -4
  84. airflow/providers/google/cloud/operators/speech_to_text.py +0 -1
  85. airflow/providers/google/cloud/operators/stackdriver.py +0 -8
  86. airflow/providers/google/cloud/operators/tasks.py +0 -11
  87. airflow/providers/google/cloud/operators/text_to_speech.py +0 -1
  88. airflow/providers/google/cloud/operators/translate.py +37 -13
  89. airflow/providers/google/cloud/operators/translate_speech.py +0 -1
  90. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +31 -18
  91. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +28 -8
  92. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +38 -25
  93. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +69 -7
  94. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +42 -8
  95. airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +531 -0
  96. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +93 -25
  97. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +10 -8
  98. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +56 -10
  99. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +25 -6
  100. airflow/providers/google/cloud/operators/vertex_ai/ray.py +9 -6
  101. airflow/providers/google/cloud/operators/workflows.py +1 -9
  102. airflow/providers/google/cloud/sensors/bigquery.py +1 -1
  103. airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -1
  104. airflow/providers/google/cloud/sensors/bigtable.py +15 -3
  105. airflow/providers/google/cloud/sensors/cloud_composer.py +6 -1
  106. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -1
  107. airflow/providers/google/cloud/sensors/dataflow.py +3 -3
  108. airflow/providers/google/cloud/sensors/dataform.py +6 -1
  109. airflow/providers/google/cloud/sensors/datafusion.py +6 -1
  110. airflow/providers/google/cloud/sensors/dataplex.py +6 -1
  111. airflow/providers/google/cloud/sensors/dataprep.py +6 -1
  112. airflow/providers/google/cloud/sensors/dataproc.py +6 -1
  113. airflow/providers/google/cloud/sensors/dataproc_metastore.py +6 -1
  114. airflow/providers/google/cloud/sensors/gcs.py +9 -3
  115. airflow/providers/google/cloud/sensors/looker.py +6 -1
  116. airflow/providers/google/cloud/sensors/pubsub.py +8 -3
  117. airflow/providers/google/cloud/sensors/tasks.py +6 -1
  118. airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +6 -1
  119. airflow/providers/google/cloud/sensors/workflows.py +6 -1
  120. airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +1 -1
  121. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +1 -1
  122. airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +1 -2
  123. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +1 -2
  124. airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +0 -1
  125. airflow/providers/google/cloud/transfers/bigquery_to_sql.py +1 -1
  126. airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
  127. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +1 -1
  128. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +1 -1
  129. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +1 -2
  130. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
  131. airflow/providers/google/cloud/transfers/gcs_to_local.py +1 -1
  132. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +1 -1
  133. airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +5 -1
  134. airflow/providers/google/cloud/transfers/gdrive_to_local.py +1 -1
  135. airflow/providers/google/cloud/transfers/http_to_gcs.py +1 -1
  136. airflow/providers/google/cloud/transfers/local_to_gcs.py +1 -1
  137. airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +1 -1
  138. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +1 -1
  139. airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -2
  140. airflow/providers/google/cloud/transfers/sql_to_gcs.py +1 -1
  141. airflow/providers/google/cloud/utils/field_validator.py +1 -2
  142. airflow/providers/google/common/auth_backend/google_openid.py +2 -1
  143. airflow/providers/google/common/deprecated.py +2 -1
  144. airflow/providers/google/common/hooks/base_google.py +7 -3
  145. airflow/providers/google/common/links/storage.py +0 -22
  146. airflow/providers/google/firebase/operators/firestore.py +1 -1
  147. airflow/providers/google/get_provider_info.py +0 -11
  148. airflow/providers/google/leveldb/hooks/leveldb.py +5 -1
  149. airflow/providers/google/leveldb/operators/leveldb.py +1 -1
  150. airflow/providers/google/marketing_platform/links/analytics_admin.py +3 -6
  151. airflow/providers/google/marketing_platform/operators/analytics_admin.py +0 -1
  152. airflow/providers/google/marketing_platform/operators/campaign_manager.py +4 -4
  153. airflow/providers/google/marketing_platform/operators/display_video.py +6 -6
  154. airflow/providers/google/marketing_platform/operators/search_ads.py +1 -1
  155. airflow/providers/google/marketing_platform/sensors/campaign_manager.py +6 -1
  156. airflow/providers/google/marketing_platform/sensors/display_video.py +6 -1
  157. airflow/providers/google/suite/operators/sheets.py +3 -3
  158. airflow/providers/google/suite/sensors/drive.py +6 -1
  159. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +1 -1
  160. airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
  161. airflow/providers/google/suite/transfers/local_to_drive.py +1 -1
  162. airflow/providers/google/version_compat.py +28 -0
  163. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/METADATA +19 -20
  164. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/RECORD +166 -166
  165. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/WHEEL +0 -0
  166. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/entry_points.txt +0 -0
@@ -27,7 +27,7 @@ Operators for Google Cloud Memorystore service.
27
27
  from __future__ import annotations
28
28
 
29
29
  from collections.abc import Sequence
30
- from typing import TYPE_CHECKING
30
+ from typing import TYPE_CHECKING, Any
31
31
 
32
32
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
33
33
  from google.cloud.memcache_v1beta2.types import cloud_memcache
@@ -133,6 +133,13 @@ class CloudMemorystoreCreateInstanceOperator(GoogleCloudBaseOperator):
133
133
  self.gcp_conn_id = gcp_conn_id
134
134
  self.impersonation_chain = impersonation_chain
135
135
 
136
+ @property
137
+ def extra_links_params(self) -> dict[str, Any]:
138
+ return {
139
+ "instance_id": self.instance_id,
140
+ "location_id": self.location,
141
+ }
142
+
136
143
  def execute(self, context: Context):
137
144
  hook = CloudMemorystoreHook(
138
145
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -148,9 +155,6 @@ class CloudMemorystoreCreateInstanceOperator(GoogleCloudBaseOperator):
148
155
  )
149
156
  RedisInstanceDetailsLink.persist(
150
157
  context=context,
151
- task_instance=self,
152
- instance_id=self.instance_id,
153
- location_id=self.location,
154
158
  project_id=self.project_id or hook.project_id,
155
159
  )
156
160
  return Instance.to_dict(result)
@@ -304,6 +308,13 @@ class CloudMemorystoreExportInstanceOperator(GoogleCloudBaseOperator):
304
308
  self.gcp_conn_id = gcp_conn_id
305
309
  self.impersonation_chain = impersonation_chain
306
310
 
311
+ @property
312
+ def extra_links_params(self) -> dict[str, Any]:
313
+ return {
314
+ "instance_id": self.instance,
315
+ "location_id": self.location,
316
+ }
317
+
307
318
  def execute(self, context: Context) -> None:
308
319
  hook = CloudMemorystoreHook(
309
320
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -320,9 +331,6 @@ class CloudMemorystoreExportInstanceOperator(GoogleCloudBaseOperator):
320
331
  )
321
332
  RedisInstanceDetailsLink.persist(
322
333
  context=context,
323
- task_instance=self,
324
- instance_id=self.instance,
325
- location_id=self.location,
326
334
  project_id=self.project_id or hook.project_id,
327
335
  )
328
336
 
@@ -397,6 +405,13 @@ class CloudMemorystoreFailoverInstanceOperator(GoogleCloudBaseOperator):
397
405
  self.gcp_conn_id = gcp_conn_id
398
406
  self.impersonation_chain = impersonation_chain
399
407
 
408
+ @property
409
+ def extra_links_params(self) -> dict[str, Any]:
410
+ return {
411
+ "instance_id": self.instance,
412
+ "location_id": self.location,
413
+ }
414
+
400
415
  def execute(self, context: Context) -> None:
401
416
  hook = CloudMemorystoreHook(
402
417
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -412,9 +427,6 @@ class CloudMemorystoreFailoverInstanceOperator(GoogleCloudBaseOperator):
412
427
  )
413
428
  RedisInstanceDetailsLink.persist(
414
429
  context=context,
415
- task_instance=self,
416
- instance_id=self.instance,
417
- location_id=self.location,
418
430
  project_id=self.project_id or hook.project_id,
419
431
  )
420
432
 
@@ -482,6 +494,13 @@ class CloudMemorystoreGetInstanceOperator(GoogleCloudBaseOperator):
482
494
  self.gcp_conn_id = gcp_conn_id
483
495
  self.impersonation_chain = impersonation_chain
484
496
 
497
+ @property
498
+ def extra_links_params(self) -> dict[str, Any]:
499
+ return {
500
+ "instance_id": self.instance,
501
+ "location_id": self.location,
502
+ }
503
+
485
504
  def execute(self, context: Context):
486
505
  hook = CloudMemorystoreHook(
487
506
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -496,9 +515,6 @@ class CloudMemorystoreGetInstanceOperator(GoogleCloudBaseOperator):
496
515
  )
497
516
  RedisInstanceDetailsLink.persist(
498
517
  context=context,
499
- task_instance=self,
500
- instance_id=self.instance,
501
- location_id=self.location,
502
518
  project_id=self.project_id or hook.project_id,
503
519
  )
504
520
  return Instance.to_dict(result)
@@ -577,6 +593,13 @@ class CloudMemorystoreImportOperator(GoogleCloudBaseOperator):
577
593
  self.gcp_conn_id = gcp_conn_id
578
594
  self.impersonation_chain = impersonation_chain
579
595
 
596
+ @property
597
+ def extra_links_params(self) -> dict[str, Any]:
598
+ return {
599
+ "instance_id": self.instance,
600
+ "location_id": self.location,
601
+ }
602
+
580
603
  def execute(self, context: Context) -> None:
581
604
  hook = CloudMemorystoreHook(
582
605
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -592,9 +615,6 @@ class CloudMemorystoreImportOperator(GoogleCloudBaseOperator):
592
615
  )
593
616
  RedisInstanceDetailsLink.persist(
594
617
  context=context,
595
- task_instance=self,
596
- instance_id=self.instance,
597
- location_id=self.location,
598
618
  project_id=self.project_id or hook.project_id,
599
619
  )
600
620
 
@@ -680,7 +700,6 @@ class CloudMemorystoreListInstancesOperator(GoogleCloudBaseOperator):
680
700
  )
681
701
  RedisInstanceListLink.persist(
682
702
  context=context,
683
- task_instance=self,
684
703
  project_id=self.project_id or hook.project_id,
685
704
  )
686
705
  instances = [Instance.to_dict(a) for a in result]
@@ -789,7 +808,6 @@ class CloudMemorystoreUpdateInstanceOperator(GoogleCloudBaseOperator):
789
808
  location_id, instance_id = res.name.split("/")[-3::2]
790
809
  RedisInstanceDetailsLink.persist(
791
810
  context=context,
792
- task_instance=self,
793
811
  instance_id=self.instance_id or instance_id,
794
812
  location_id=self.location or location_id,
795
813
  project_id=self.project_id or hook.project_id,
@@ -882,7 +900,6 @@ class CloudMemorystoreScaleInstanceOperator(GoogleCloudBaseOperator):
882
900
  location_id, instance_id = res.name.split("/")[-3::2]
883
901
  RedisInstanceDetailsLink.persist(
884
902
  context=context,
885
- task_instance=self,
886
903
  instance_id=self.instance_id or instance_id,
887
904
  location_id=self.location or location_id,
888
905
  project_id=self.project_id or hook.project_id,
@@ -1002,7 +1019,6 @@ class CloudMemorystoreCreateInstanceAndImportOperator(GoogleCloudBaseOperator):
1002
1019
  )
1003
1020
  RedisInstanceDetailsLink.persist(
1004
1021
  context=context,
1005
- task_instance=self,
1006
1022
  instance_id=self.instance_id,
1007
1023
  location_id=self.location,
1008
1024
  project_id=self.project_id or hook.project_id,
@@ -1171,6 +1187,14 @@ class CloudMemorystoreMemcachedApplyParametersOperator(GoogleCloudBaseOperator):
1171
1187
  self.gcp_conn_id = gcp_conn_id
1172
1188
  self.impersonation_chain = impersonation_chain
1173
1189
 
1190
+ @property
1191
+ def extra_links_params(self) -> dict[str, Any]:
1192
+ return {
1193
+ "instance_id": self.instance_id,
1194
+ "location_id": self.location,
1195
+ "project_id": self.project_id,
1196
+ }
1197
+
1174
1198
  def execute(self, context: Context):
1175
1199
  hook = CloudMemorystoreMemcachedHook(
1176
1200
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -1185,13 +1209,7 @@ class CloudMemorystoreMemcachedApplyParametersOperator(GoogleCloudBaseOperator):
1185
1209
  timeout=self.timeout,
1186
1210
  metadata=self.metadata,
1187
1211
  )
1188
- MemcachedInstanceDetailsLink.persist(
1189
- context=context,
1190
- task_instance=self,
1191
- instance_id=self.instance_id,
1192
- location_id=self.location,
1193
- project_id=self.project_id,
1194
- )
1212
+ MemcachedInstanceDetailsLink.persist(context=context)
1195
1213
 
1196
1214
 
1197
1215
  class CloudMemorystoreMemcachedCreateInstanceOperator(GoogleCloudBaseOperator):
@@ -1263,6 +1281,13 @@ class CloudMemorystoreMemcachedCreateInstanceOperator(GoogleCloudBaseOperator):
1263
1281
  self.metadata = metadata
1264
1282
  self.gcp_conn_id = gcp_conn_id
1265
1283
 
1284
+ @property
1285
+ def extra_links_params(self) -> dict[str, Any]:
1286
+ return {
1287
+ "instance_id": self.instance_id,
1288
+ "location_id": self.location,
1289
+ }
1290
+
1266
1291
  def execute(self, context: Context):
1267
1292
  hook = CloudMemorystoreMemcachedHook(gcp_conn_id=self.gcp_conn_id)
1268
1293
  result = hook.create_instance(
@@ -1276,9 +1301,6 @@ class CloudMemorystoreMemcachedCreateInstanceOperator(GoogleCloudBaseOperator):
1276
1301
  )
1277
1302
  MemcachedInstanceDetailsLink.persist(
1278
1303
  context=context,
1279
- task_instance=self,
1280
- instance_id=self.instance_id,
1281
- location_id=self.location,
1282
1304
  project_id=self.project_id or hook.project_id,
1283
1305
  )
1284
1306
  return cloud_memcache.Instance.to_dict(result)
@@ -1410,6 +1432,13 @@ class CloudMemorystoreMemcachedGetInstanceOperator(GoogleCloudBaseOperator):
1410
1432
  self.gcp_conn_id = gcp_conn_id
1411
1433
  self.impersonation_chain = impersonation_chain
1412
1434
 
1435
+ @property
1436
+ def extra_links_params(self) -> dict[str, Any]:
1437
+ return {
1438
+ "instance_id": self.instance,
1439
+ "location_id": self.location,
1440
+ }
1441
+
1413
1442
  def execute(self, context: Context):
1414
1443
  hook = CloudMemorystoreMemcachedHook(
1415
1444
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -1424,9 +1453,6 @@ class CloudMemorystoreMemcachedGetInstanceOperator(GoogleCloudBaseOperator):
1424
1453
  )
1425
1454
  MemcachedInstanceDetailsLink.persist(
1426
1455
  context=context,
1427
- task_instance=self,
1428
- instance_id=self.instance,
1429
- location_id=self.location,
1430
1456
  project_id=self.project_id or hook.project_id,
1431
1457
  )
1432
1458
  return cloud_memcache.Instance.to_dict(result)
@@ -1506,7 +1532,6 @@ class CloudMemorystoreMemcachedListInstancesOperator(GoogleCloudBaseOperator):
1506
1532
  )
1507
1533
  MemcachedInstanceListLink.persist(
1508
1534
  context=context,
1509
- task_instance=self,
1510
1535
  project_id=self.project_id or hook.project_id,
1511
1536
  )
1512
1537
  instances = [cloud_memcache.Instance.to_dict(a) for a in result]
@@ -1612,7 +1637,6 @@ class CloudMemorystoreMemcachedUpdateInstanceOperator(GoogleCloudBaseOperator):
1612
1637
  location_id, instance_id = res.name.split("/")[-3::2]
1613
1638
  MemcachedInstanceDetailsLink.persist(
1614
1639
  context=context,
1615
- task_instance=self,
1616
1640
  instance_id=self.instance_id or instance_id,
1617
1641
  location_id=self.location or location_id,
1618
1642
  project_id=self.project_id or hook.project_id,
@@ -1688,6 +1712,14 @@ class CloudMemorystoreMemcachedUpdateParametersOperator(GoogleCloudBaseOperator)
1688
1712
  self.gcp_conn_id = gcp_conn_id
1689
1713
  self.impersonation_chain = impersonation_chain
1690
1714
 
1715
+ @property
1716
+ def extra_links_params(self) -> dict[str, Any]:
1717
+ return {
1718
+ "instance_id": self.instance_id,
1719
+ "location_id": self.location,
1720
+ "project_id": self.project_id,
1721
+ }
1722
+
1691
1723
  def execute(self, context: Context):
1692
1724
  hook = CloudMemorystoreMemcachedHook(
1693
1725
  gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain
@@ -1702,10 +1734,4 @@ class CloudMemorystoreMemcachedUpdateParametersOperator(GoogleCloudBaseOperator)
1702
1734
  timeout=self.timeout,
1703
1735
  metadata=self.metadata,
1704
1736
  )
1705
- MemcachedInstanceDetailsLink.persist(
1706
- context=context,
1707
- task_instance=self,
1708
- instance_id=self.instance_id,
1709
- location_id=self.location,
1710
- project_id=self.project_id,
1711
- )
1737
+ MemcachedInstanceDetailsLink.persist(context=context)
@@ -317,7 +317,6 @@ class CloudRunExecuteJobOperator(GoogleCloudBaseOperator):
317
317
  if self.operation.metadata.log_uri:
318
318
  CloudRunJobLoggingLink.persist(
319
319
  context=context,
320
- task_instance=self,
321
320
  log_uri=self.operation.metadata.log_uri,
322
321
  )
323
322
 
@@ -28,7 +28,6 @@ from googleapiclient.errors import HttpError
28
28
 
29
29
  from airflow.configuration import conf
30
30
  from airflow.exceptions import AirflowException
31
- from airflow.hooks.base import BaseHook
32
31
  from airflow.providers.google.cloud.hooks.cloud_sql import CloudSQLDatabaseHook, CloudSQLHook
33
32
  from airflow.providers.google.cloud.links.cloud_sql import CloudSQLInstanceDatabaseLink, CloudSQLInstanceLink
34
33
  from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
@@ -37,6 +36,11 @@ from airflow.providers.google.cloud.utils.field_validator import GcpBodyFieldVal
37
36
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, get_field
38
37
  from airflow.providers.google.common.links.storage import FileDetailsLink
39
38
 
39
+ try:
40
+ from airflow.sdk import BaseHook
41
+ except ImportError:
42
+ from airflow.hooks.base import BaseHook # type: ignore[attr-defined,no-redef]
43
+
40
44
  if TYPE_CHECKING:
41
45
  from airflow.models import Connection
42
46
  from airflow.providers.openlineage.extractors import OperatorLineage
@@ -285,6 +289,12 @@ class CloudSQLBaseOperator(GoogleCloudBaseOperator):
285
289
  return False
286
290
  raise e
287
291
 
292
+ @property
293
+ def extra_links_params(self) -> dict[str, Any]:
294
+ return {
295
+ "instance": self.instance,
296
+ }
297
+
288
298
  def execute(self, context: Context):
289
299
  pass
290
300
 
@@ -384,8 +394,6 @@ class CloudSQLCreateInstanceOperator(CloudSQLBaseOperator):
384
394
 
385
395
  CloudSQLInstanceLink.persist(
386
396
  context=context,
387
- task_instance=self,
388
- cloud_sql_instance=self.instance,
389
397
  project_id=self.project_id or hook.project_id,
390
398
  )
391
399
 
@@ -479,8 +487,6 @@ class CloudSQLInstancePatchOperator(CloudSQLBaseOperator):
479
487
  )
480
488
  CloudSQLInstanceLink.persist(
481
489
  context=context,
482
- task_instance=self,
483
- cloud_sql_instance=self.instance,
484
490
  project_id=self.project_id or hook.project_id,
485
491
  )
486
492
 
@@ -714,8 +720,6 @@ class CloudSQLCreateInstanceDatabaseOperator(CloudSQLBaseOperator):
714
720
  )
715
721
  CloudSQLInstanceDatabaseLink.persist(
716
722
  context=context,
717
- task_instance=self,
718
- cloud_sql_instance=self.instance,
719
723
  project_id=self.project_id or hook.project_id,
720
724
  )
721
725
  if self._check_if_db_exists(database, hook):
@@ -822,8 +826,6 @@ class CloudSQLPatchInstanceDatabaseOperator(CloudSQLBaseOperator):
822
826
  )
823
827
  CloudSQLInstanceDatabaseLink.persist(
824
828
  context=context,
825
- task_instance=self,
826
- cloud_sql_instance=self.instance,
827
829
  project_id=self.project_id or hook.project_id,
828
830
  )
829
831
  return hook.patch_database(
@@ -1004,13 +1006,10 @@ class CloudSQLExportInstanceOperator(CloudSQLBaseOperator):
1004
1006
  )
1005
1007
  CloudSQLInstanceLink.persist(
1006
1008
  context=context,
1007
- task_instance=self,
1008
- cloud_sql_instance=self.instance,
1009
1009
  project_id=self.project_id or hook.project_id,
1010
1010
  )
1011
1011
  FileDetailsLink.persist(
1012
1012
  context=context,
1013
- task_instance=self,
1014
1013
  uri=self.body["exportContext"]["uri"][5:],
1015
1014
  project_id=self.project_id or hook.project_id,
1016
1015
  )
@@ -1147,13 +1146,10 @@ class CloudSQLImportInstanceOperator(CloudSQLBaseOperator):
1147
1146
  )
1148
1147
  CloudSQLInstanceLink.persist(
1149
1148
  context=context,
1150
- task_instance=self,
1151
- cloud_sql_instance=self.instance,
1152
1149
  project_id=self.project_id or hook.project_id,
1153
1150
  )
1154
1151
  FileDetailsLink.persist(
1155
1152
  context=context,
1156
- task_instance=self,
1157
1153
  uri=self.body["importContext"]["uri"][5:],
1158
1154
  project_id=self.project_id or hook.project_id,
1159
1155
  )
@@ -586,7 +586,6 @@ class CloudDataTransferServiceGetOperationOperator(GoogleCloudBaseOperator):
586
586
  if project_id:
587
587
  CloudStorageTransferDetailsLink.persist(
588
588
  context=context,
589
- task_instance=self,
590
589
  project_id=project_id,
591
590
  operation_name=self.operation_name,
592
591
  )
@@ -663,7 +662,6 @@ class CloudDataTransferServiceListOperationsOperator(GoogleCloudBaseOperator):
663
662
  if project_id:
664
663
  CloudStorageTransferListLink.persist(
665
664
  context=context,
666
- task_instance=self,
667
665
  project_id=project_id,
668
666
  )
669
667
 
@@ -74,6 +74,13 @@ class ComputeEngineBaseOperator(GoogleCloudBaseOperator):
74
74
  if not self.zone:
75
75
  raise AirflowException("The required parameter 'zone' is missing")
76
76
 
77
+ @property
78
+ def extra_links_params(self) -> dict[str, Any]:
79
+ return {
80
+ "location_id": self.zone,
81
+ "resource_id": self.resource_id,
82
+ }
83
+
77
84
  def execute(self, context: Context):
78
85
  pass
79
86
 
@@ -225,9 +232,6 @@ class ComputeEngineInsertInstanceOperator(ComputeEngineBaseOperator):
225
232
  self.log.info("The %s Instance already exists", self.resource_id)
226
233
  ComputeInstanceDetailsLink.persist(
227
234
  context=context,
228
- task_instance=self,
229
- location_id=self.zone,
230
- resource_id=self.resource_id,
231
235
  project_id=self.project_id or hook.project_id,
232
236
  )
233
237
  return Instance.to_dict(existing_instance)
@@ -247,9 +251,6 @@ class ComputeEngineInsertInstanceOperator(ComputeEngineBaseOperator):
247
251
  )
248
252
  ComputeInstanceDetailsLink.persist(
249
253
  context=context,
250
- task_instance=self,
251
- location_id=self.zone,
252
- resource_id=self.resource_id,
253
254
  project_id=self.project_id or hook.project_id,
254
255
  )
255
256
  return Instance.to_dict(new_instance)
@@ -397,9 +398,6 @@ class ComputeEngineInsertInstanceFromTemplateOperator(ComputeEngineBaseOperator)
397
398
  self.log.info("The %s Instance already exists", self.resource_id)
398
399
  ComputeInstanceDetailsLink.persist(
399
400
  context=context,
400
- task_instance=self,
401
- location_id=self.zone,
402
- resource_id=self.resource_id,
403
401
  project_id=self.project_id or hook.project_id,
404
402
  )
405
403
  return Instance.to_dict(existing_instance)
@@ -420,9 +418,6 @@ class ComputeEngineInsertInstanceFromTemplateOperator(ComputeEngineBaseOperator)
420
418
  )
421
419
  ComputeInstanceDetailsLink.persist(
422
420
  context=context,
423
- task_instance=self,
424
- location_id=self.zone,
425
- resource_id=self.resource_id,
426
421
  project_id=self.project_id or hook.project_id,
427
422
  )
428
423
  return Instance.to_dict(new_instance_from_template)
@@ -598,9 +593,6 @@ class ComputeEngineStartInstanceOperator(ComputeEngineBaseOperator):
598
593
  )
599
594
  ComputeInstanceDetailsLink.persist(
600
595
  context=context,
601
- task_instance=self,
602
- location_id=self.zone,
603
- resource_id=self.resource_id,
604
596
  project_id=self.project_id or hook.project_id,
605
597
  )
606
598
  hook.start_instance(zone=self.zone, resource_id=self.resource_id, project_id=self.project_id)
@@ -659,9 +651,6 @@ class ComputeEngineStopInstanceOperator(ComputeEngineBaseOperator):
659
651
  )
660
652
  ComputeInstanceDetailsLink.persist(
661
653
  context=context,
662
- task_instance=self,
663
- location_id=self.zone,
664
- resource_id=self.resource_id,
665
654
  project_id=self.project_id or hook.project_id,
666
655
  )
667
656
  hook.stop_instance(zone=self.zone, resource_id=self.resource_id, project_id=self.project_id)
@@ -764,9 +753,6 @@ class ComputeEngineSetMachineTypeOperator(ComputeEngineBaseOperator):
764
753
  self._validate_all_body_fields()
765
754
  ComputeInstanceDetailsLink.persist(
766
755
  context=context,
767
- task_instance=self,
768
- location_id=self.zone,
769
- resource_id=self.resource_id,
770
756
  project_id=self.project_id or hook.project_id,
771
757
  )
772
758
  hook.set_machine_type(
@@ -972,8 +958,6 @@ class ComputeEngineInsertInstanceTemplateOperator(ComputeEngineBaseOperator):
972
958
  self.log.info("The %s Template already exists.", existing_template)
973
959
  ComputeInstanceTemplateDetailsLink.persist(
974
960
  context=context,
975
- task_instance=self,
976
- resource_id=self.resource_id,
977
961
  project_id=self.project_id or hook.project_id,
978
962
  )
979
963
  return InstanceTemplate.to_dict(existing_template)
@@ -991,8 +975,6 @@ class ComputeEngineInsertInstanceTemplateOperator(ComputeEngineBaseOperator):
991
975
  )
992
976
  ComputeInstanceTemplateDetailsLink.persist(
993
977
  context=context,
994
- task_instance=self,
995
- resource_id=self.resource_id,
996
978
  project_id=self.project_id or hook.project_id,
997
979
  )
998
980
  return InstanceTemplate.to_dict(new_template)
@@ -1238,7 +1220,6 @@ class ComputeEngineCopyInstanceTemplateOperator(ComputeEngineBaseOperator):
1238
1220
  )
1239
1221
  ComputeInstanceTemplateDetailsLink.persist(
1240
1222
  context=context,
1241
- task_instance=self,
1242
1223
  resource_id=self.body_patch["name"],
1243
1224
  project_id=self.project_id or hook.project_id,
1244
1225
  )
@@ -1259,7 +1240,6 @@ class ComputeEngineCopyInstanceTemplateOperator(ComputeEngineBaseOperator):
1259
1240
  )
1260
1241
  ComputeInstanceTemplateDetailsLink.persist(
1261
1242
  context=context,
1262
- task_instance=self,
1263
1243
  resource_id=self.body_patch["name"],
1264
1244
  project_id=self.project_id or hook.project_id,
1265
1245
  )
@@ -1390,9 +1370,6 @@ class ComputeEngineInstanceGroupUpdateManagerTemplateOperator(ComputeEngineBaseO
1390
1370
  self.log.info("Calling patch instance template with updated body: %s", patch_body)
1391
1371
  ComputeInstanceGroupManagerDetailsLink.persist(
1392
1372
  context=context,
1393
- task_instance=self,
1394
- location_id=self.zone,
1395
- resource_id=self.resource_id,
1396
1373
  project_id=self.project_id or hook.project_id,
1397
1374
  )
1398
1375
  return hook.patch_instance_group_manager(
@@ -1405,9 +1382,6 @@ class ComputeEngineInstanceGroupUpdateManagerTemplateOperator(ComputeEngineBaseO
1405
1382
  # Idempotence achieved
1406
1383
  ComputeInstanceGroupManagerDetailsLink.persist(
1407
1384
  context=context,
1408
- task_instance=self,
1409
- location_id=self.zone,
1410
- resource_id=self.resource_id,
1411
1385
  project_id=self.project_id or hook.project_id,
1412
1386
  )
1413
1387
  return True
@@ -1552,10 +1526,7 @@ class ComputeEngineInsertInstanceGroupManagerOperator(ComputeEngineBaseOperator)
1552
1526
  self.log.info("The %s Instance Group Manager already exists", existing_instance_group_manager)
1553
1527
  ComputeInstanceGroupManagerDetailsLink.persist(
1554
1528
  context=context,
1555
- task_instance=self,
1556
- resource_id=self.resource_id,
1557
1529
  project_id=self.project_id or hook.project_id,
1558
- location_id=self.zone,
1559
1530
  )
1560
1531
  return InstanceGroupManager.to_dict(existing_instance_group_manager)
1561
1532
  self._field_sanitizer.sanitize(self.body)
@@ -1574,9 +1545,6 @@ class ComputeEngineInsertInstanceGroupManagerOperator(ComputeEngineBaseOperator)
1574
1545
  )
1575
1546
  ComputeInstanceGroupManagerDetailsLink.persist(
1576
1547
  context=context,
1577
- task_instance=self,
1578
- location_id=self.zone,
1579
- resource_id=self.resource_id,
1580
1548
  project_id=self.project_id or hook.project_id,
1581
1549
  )
1582
1550
  return InstanceGroupManager.to_dict(new_instance_group_manager)