apache-airflow-providers-google 16.0.0a1__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 (172) hide show
  1. airflow/providers/google/__init__.py +1 -1
  2. airflow/providers/google/ads/hooks/ads.py +43 -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 +63 -77
  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 +5 -5
  12. airflow/providers/google/cloud/hooks/looker.py +10 -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/auto_ml.py +0 -36
  18. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +307 -7
  19. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +44 -80
  20. airflow/providers/google/cloud/hooks/vertex_ai/ray.py +11 -2
  21. airflow/providers/google/cloud/hooks/vision.py +2 -2
  22. airflow/providers/google/cloud/links/alloy_db.py +0 -46
  23. airflow/providers/google/cloud/links/base.py +75 -11
  24. airflow/providers/google/cloud/links/bigquery.py +0 -47
  25. airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
  26. airflow/providers/google/cloud/links/bigtable.py +0 -48
  27. airflow/providers/google/cloud/links/cloud_build.py +0 -73
  28. airflow/providers/google/cloud/links/cloud_functions.py +0 -33
  29. airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
  30. airflow/providers/google/cloud/links/cloud_run.py +27 -0
  31. airflow/providers/google/cloud/links/cloud_sql.py +0 -33
  32. airflow/providers/google/cloud/links/cloud_storage_transfer.py +16 -43
  33. airflow/providers/google/cloud/links/cloud_tasks.py +6 -25
  34. airflow/providers/google/cloud/links/compute.py +0 -58
  35. airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
  36. airflow/providers/google/cloud/links/datacatalog.py +23 -54
  37. airflow/providers/google/cloud/links/dataflow.py +0 -34
  38. airflow/providers/google/cloud/links/dataform.py +0 -64
  39. airflow/providers/google/cloud/links/datafusion.py +1 -96
  40. airflow/providers/google/cloud/links/dataplex.py +0 -154
  41. airflow/providers/google/cloud/links/dataprep.py +0 -24
  42. airflow/providers/google/cloud/links/dataproc.py +14 -90
  43. airflow/providers/google/cloud/links/datastore.py +0 -31
  44. airflow/providers/google/cloud/links/kubernetes_engine.py +5 -59
  45. airflow/providers/google/cloud/links/life_sciences.py +0 -19
  46. airflow/providers/google/cloud/links/managed_kafka.py +0 -70
  47. airflow/providers/google/cloud/links/mlengine.py +0 -70
  48. airflow/providers/google/cloud/links/pubsub.py +0 -32
  49. airflow/providers/google/cloud/links/spanner.py +0 -33
  50. airflow/providers/google/cloud/links/stackdriver.py +0 -30
  51. airflow/providers/google/cloud/links/translate.py +16 -186
  52. airflow/providers/google/cloud/links/vertex_ai.py +8 -224
  53. airflow/providers/google/cloud/links/workflows.py +0 -52
  54. airflow/providers/google/cloud/log/gcs_task_handler.py +4 -4
  55. airflow/providers/google/cloud/operators/alloy_db.py +69 -54
  56. airflow/providers/google/cloud/operators/automl.py +16 -14
  57. airflow/providers/google/cloud/operators/bigquery.py +49 -25
  58. airflow/providers/google/cloud/operators/bigquery_dts.py +2 -4
  59. airflow/providers/google/cloud/operators/bigtable.py +35 -6
  60. airflow/providers/google/cloud/operators/cloud_base.py +21 -1
  61. airflow/providers/google/cloud/operators/cloud_build.py +74 -31
  62. airflow/providers/google/cloud/operators/cloud_composer.py +34 -35
  63. airflow/providers/google/cloud/operators/cloud_memorystore.py +68 -42
  64. airflow/providers/google/cloud/operators/cloud_run.py +9 -1
  65. airflow/providers/google/cloud/operators/cloud_sql.py +11 -15
  66. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +0 -2
  67. airflow/providers/google/cloud/operators/compute.py +7 -39
  68. airflow/providers/google/cloud/operators/datacatalog.py +156 -20
  69. airflow/providers/google/cloud/operators/dataflow.py +37 -14
  70. airflow/providers/google/cloud/operators/dataform.py +14 -4
  71. airflow/providers/google/cloud/operators/datafusion.py +4 -12
  72. airflow/providers/google/cloud/operators/dataplex.py +180 -96
  73. airflow/providers/google/cloud/operators/dataprep.py +0 -4
  74. airflow/providers/google/cloud/operators/dataproc.py +10 -16
  75. airflow/providers/google/cloud/operators/dataproc_metastore.py +95 -87
  76. airflow/providers/google/cloud/operators/datastore.py +21 -5
  77. airflow/providers/google/cloud/operators/dlp.py +3 -26
  78. airflow/providers/google/cloud/operators/functions.py +15 -6
  79. airflow/providers/google/cloud/operators/gcs.py +1 -7
  80. airflow/providers/google/cloud/operators/kubernetes_engine.py +53 -92
  81. airflow/providers/google/cloud/operators/life_sciences.py +0 -1
  82. airflow/providers/google/cloud/operators/managed_kafka.py +106 -51
  83. airflow/providers/google/cloud/operators/mlengine.py +0 -1
  84. airflow/providers/google/cloud/operators/pubsub.py +4 -5
  85. airflow/providers/google/cloud/operators/spanner.py +0 -4
  86. airflow/providers/google/cloud/operators/speech_to_text.py +0 -1
  87. airflow/providers/google/cloud/operators/stackdriver.py +0 -8
  88. airflow/providers/google/cloud/operators/tasks.py +0 -11
  89. airflow/providers/google/cloud/operators/text_to_speech.py +0 -1
  90. airflow/providers/google/cloud/operators/translate.py +37 -13
  91. airflow/providers/google/cloud/operators/translate_speech.py +0 -1
  92. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +31 -18
  93. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +28 -8
  94. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +38 -25
  95. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +69 -7
  96. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +42 -8
  97. airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +531 -0
  98. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +93 -117
  99. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +10 -8
  100. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +56 -10
  101. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +29 -6
  102. airflow/providers/google/cloud/operators/vertex_ai/ray.py +9 -6
  103. airflow/providers/google/cloud/operators/workflows.py +1 -9
  104. airflow/providers/google/cloud/sensors/bigquery.py +1 -1
  105. airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -1
  106. airflow/providers/google/cloud/sensors/bigtable.py +15 -3
  107. airflow/providers/google/cloud/sensors/cloud_composer.py +6 -1
  108. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -1
  109. airflow/providers/google/cloud/sensors/dataflow.py +3 -3
  110. airflow/providers/google/cloud/sensors/dataform.py +6 -1
  111. airflow/providers/google/cloud/sensors/datafusion.py +6 -1
  112. airflow/providers/google/cloud/sensors/dataplex.py +6 -1
  113. airflow/providers/google/cloud/sensors/dataprep.py +6 -1
  114. airflow/providers/google/cloud/sensors/dataproc.py +6 -1
  115. airflow/providers/google/cloud/sensors/dataproc_metastore.py +6 -1
  116. airflow/providers/google/cloud/sensors/gcs.py +9 -3
  117. airflow/providers/google/cloud/sensors/looker.py +6 -1
  118. airflow/providers/google/cloud/sensors/pubsub.py +8 -3
  119. airflow/providers/google/cloud/sensors/tasks.py +6 -1
  120. airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +6 -1
  121. airflow/providers/google/cloud/sensors/workflows.py +6 -1
  122. airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +1 -1
  123. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +1 -1
  124. airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +10 -7
  125. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +1 -2
  126. airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +0 -1
  127. airflow/providers/google/cloud/transfers/bigquery_to_sql.py +1 -1
  128. airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
  129. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +1 -1
  130. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +2 -2
  131. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +1 -2
  132. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
  133. airflow/providers/google/cloud/transfers/gcs_to_local.py +1 -1
  134. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +1 -1
  135. airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +5 -1
  136. airflow/providers/google/cloud/transfers/gdrive_to_local.py +1 -1
  137. airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
  138. airflow/providers/google/cloud/transfers/local_to_gcs.py +1 -1
  139. airflow/providers/google/cloud/transfers/s3_to_gcs.py +11 -5
  140. airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +1 -1
  141. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +1 -1
  142. airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -2
  143. airflow/providers/google/cloud/transfers/sql_to_gcs.py +1 -1
  144. airflow/providers/google/cloud/triggers/bigquery.py +32 -5
  145. airflow/providers/google/cloud/triggers/dataproc.py +62 -10
  146. airflow/providers/google/cloud/utils/field_validator.py +1 -2
  147. airflow/providers/google/common/auth_backend/google_openid.py +2 -1
  148. airflow/providers/google/common/deprecated.py +2 -1
  149. airflow/providers/google/common/hooks/base_google.py +7 -3
  150. airflow/providers/google/common/links/storage.py +0 -22
  151. airflow/providers/google/firebase/operators/firestore.py +1 -1
  152. airflow/providers/google/get_provider_info.py +14 -16
  153. airflow/providers/google/leveldb/hooks/leveldb.py +30 -1
  154. airflow/providers/google/leveldb/operators/leveldb.py +1 -1
  155. airflow/providers/google/marketing_platform/links/analytics_admin.py +3 -6
  156. airflow/providers/google/marketing_platform/operators/analytics_admin.py +0 -1
  157. airflow/providers/google/marketing_platform/operators/campaign_manager.py +4 -4
  158. airflow/providers/google/marketing_platform/operators/display_video.py +6 -6
  159. airflow/providers/google/marketing_platform/operators/search_ads.py +1 -1
  160. airflow/providers/google/marketing_platform/sensors/campaign_manager.py +6 -1
  161. airflow/providers/google/marketing_platform/sensors/display_video.py +6 -1
  162. airflow/providers/google/suite/operators/sheets.py +3 -3
  163. airflow/providers/google/suite/sensors/drive.py +6 -1
  164. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +1 -1
  165. airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
  166. airflow/providers/google/suite/transfers/local_to_drive.py +1 -1
  167. airflow/providers/google/version_compat.py +28 -0
  168. {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/METADATA +35 -35
  169. {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/RECORD +171 -170
  170. airflow/providers/google/cloud/links/automl.py +0 -193
  171. {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/WHEEL +0 -0
  172. {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0rc1.dist-info}/entry_points.txt +0 -0
@@ -67,22 +67,6 @@ class VertexAIModelLink(BaseGoogleLink):
67
67
  key = "model_conf"
68
68
  format_str = VERTEX_AI_MODEL_LINK
69
69
 
70
- @staticmethod
71
- def persist(
72
- context: Context,
73
- task_instance,
74
- model_id: str,
75
- ):
76
- task_instance.xcom_push(
77
- context=context,
78
- key=VertexAIModelLink.key,
79
- value={
80
- "model_id": model_id,
81
- "region": task_instance.region,
82
- "project_id": task_instance.project_id,
83
- },
84
- )
85
-
86
70
 
87
71
  class VertexAIModelListLink(BaseGoogleLink):
88
72
  """Helper class for constructing Vertex AI Models Link."""
@@ -91,19 +75,6 @@ class VertexAIModelListLink(BaseGoogleLink):
91
75
  key = "models_conf"
92
76
  format_str = VERTEX_AI_MODEL_LIST_LINK
93
77
 
94
- @staticmethod
95
- def persist(
96
- context: Context,
97
- task_instance,
98
- ):
99
- task_instance.xcom_push(
100
- context=context,
101
- key=VertexAIModelListLink.key,
102
- value={
103
- "project_id": task_instance.project_id,
104
- },
105
- )
106
-
107
78
 
108
79
  class VertexAIModelExportLink(BaseGoogleLink):
109
80
  """Helper class for constructing Vertex AI Model Export Link."""
@@ -117,19 +88,15 @@ class VertexAIModelExportLink(BaseGoogleLink):
117
88
  """Return bucket name from output configuration."""
118
89
  return config["artifact_destination"]["output_uri_prefix"].rpartition("gs://")[-1]
119
90
 
120
- @staticmethod
121
- def persist(
122
- context: Context,
123
- task_instance,
124
- ):
125
- task_instance.xcom_push(
91
+ @classmethod
92
+ def persist(cls, context: Context, **value):
93
+ output_config = value.get("output_config")
94
+ bucket_name = cls.extract_bucket_name(output_config)
95
+ super().persist(
126
96
  context=context,
127
- key=VertexAIModelExportLink.key,
128
- value={
129
- "project_id": task_instance.project_id,
130
- "model_id": task_instance.model_id,
131
- "bucket_name": VertexAIModelExportLink.extract_bucket_name(task_instance.output_config),
132
- },
97
+ project_id=value.get("project_id"),
98
+ model_id=value.get("model_id"),
99
+ bucket_name=bucket_name,
133
100
  )
134
101
 
135
102
 
@@ -140,22 +107,6 @@ class VertexAITrainingLink(BaseGoogleLink):
140
107
  key = "training_conf"
141
108
  format_str = VERTEX_AI_TRAINING_LINK
142
109
 
143
- @staticmethod
144
- def persist(
145
- context: Context,
146
- task_instance,
147
- training_id: str,
148
- ):
149
- task_instance.xcom_push(
150
- context=context,
151
- key=VertexAITrainingLink.key,
152
- value={
153
- "training_id": training_id,
154
- "region": task_instance.region,
155
- "project_id": task_instance.project_id,
156
- },
157
- )
158
-
159
110
 
160
111
  class VertexAITrainingPipelinesLink(BaseGoogleLink):
161
112
  """Helper class for constructing Vertex AI Training Pipelines link."""
@@ -164,19 +115,6 @@ class VertexAITrainingPipelinesLink(BaseGoogleLink):
164
115
  key = "pipelines_conf"
165
116
  format_str = VERTEX_AI_TRAINING_PIPELINES_LINK
166
117
 
167
- @staticmethod
168
- def persist(
169
- context: Context,
170
- task_instance,
171
- ):
172
- task_instance.xcom_push(
173
- context=context,
174
- key=VertexAITrainingPipelinesLink.key,
175
- value={
176
- "project_id": task_instance.project_id,
177
- },
178
- )
179
-
180
118
 
181
119
  class VertexAIDatasetLink(BaseGoogleLink):
182
120
  """Helper class for constructing Vertex AI Dataset link."""
@@ -185,18 +123,6 @@ class VertexAIDatasetLink(BaseGoogleLink):
185
123
  key = "dataset_conf"
186
124
  format_str = VERTEX_AI_DATASET_LINK
187
125
 
188
- @staticmethod
189
- def persist(context: Context, task_instance, dataset_id: str):
190
- task_instance.xcom_push(
191
- context=context,
192
- key=VertexAIDatasetLink.key,
193
- value={
194
- "dataset_id": dataset_id,
195
- "region": task_instance.region,
196
- "project_id": task_instance.project_id,
197
- },
198
- )
199
-
200
126
 
201
127
  class VertexAIDatasetListLink(BaseGoogleLink):
202
128
  """Helper class for constructing Vertex AI Datasets Link."""
@@ -205,19 +131,6 @@ class VertexAIDatasetListLink(BaseGoogleLink):
205
131
  key = "datasets_conf"
206
132
  format_str = VERTEX_AI_DATASET_LIST_LINK
207
133
 
208
- @staticmethod
209
- def persist(
210
- context: Context,
211
- task_instance,
212
- ):
213
- task_instance.xcom_push(
214
- context=context,
215
- key=VertexAIDatasetListLink.key,
216
- value={
217
- "project_id": task_instance.project_id,
218
- },
219
- )
220
-
221
134
 
222
135
  class VertexAIHyperparameterTuningJobListLink(BaseGoogleLink):
223
136
  """Helper class for constructing Vertex AI HyperparameterTuningJobs Link."""
@@ -226,19 +139,6 @@ class VertexAIHyperparameterTuningJobListLink(BaseGoogleLink):
226
139
  key = "hyperparameter_tuning_jobs_conf"
227
140
  format_str = VERTEX_AI_HYPERPARAMETER_TUNING_JOB_LIST_LINK
228
141
 
229
- @staticmethod
230
- def persist(
231
- context: Context,
232
- task_instance,
233
- ):
234
- task_instance.xcom_push(
235
- context=context,
236
- key=VertexAIHyperparameterTuningJobListLink.key,
237
- value={
238
- "project_id": task_instance.project_id,
239
- },
240
- )
241
-
242
142
 
243
143
  class VertexAIBatchPredictionJobLink(BaseGoogleLink):
244
144
  """Helper class for constructing Vertex AI BatchPredictionJob link."""
@@ -247,22 +147,6 @@ class VertexAIBatchPredictionJobLink(BaseGoogleLink):
247
147
  key = "batch_prediction_job_conf"
248
148
  format_str = VERTEX_AI_BATCH_PREDICTION_JOB_LINK
249
149
 
250
- @staticmethod
251
- def persist(
252
- context: Context,
253
- task_instance,
254
- batch_prediction_job_id: str,
255
- ):
256
- task_instance.xcom_push(
257
- context=context,
258
- key=VertexAIBatchPredictionJobLink.key,
259
- value={
260
- "batch_prediction_job_id": batch_prediction_job_id,
261
- "region": task_instance.region,
262
- "project_id": task_instance.project_id,
263
- },
264
- )
265
-
266
150
 
267
151
  class VertexAIBatchPredictionJobListLink(BaseGoogleLink):
268
152
  """Helper class for constructing Vertex AI BatchPredictionJobList link."""
@@ -271,19 +155,6 @@ class VertexAIBatchPredictionJobListLink(BaseGoogleLink):
271
155
  key = "batch_prediction_jobs_conf"
272
156
  format_str = VERTEX_AI_BATCH_PREDICTION_JOB_LIST_LINK
273
157
 
274
- @staticmethod
275
- def persist(
276
- context: Context,
277
- task_instance,
278
- ):
279
- task_instance.xcom_push(
280
- context=context,
281
- key=VertexAIBatchPredictionJobListLink.key,
282
- value={
283
- "project_id": task_instance.project_id,
284
- },
285
- )
286
-
287
158
 
288
159
  class VertexAIEndpointLink(BaseGoogleLink):
289
160
  """Helper class for constructing Vertex AI Endpoint link."""
@@ -292,22 +163,6 @@ class VertexAIEndpointLink(BaseGoogleLink):
292
163
  key = "endpoint_conf"
293
164
  format_str = VERTEX_AI_ENDPOINT_LINK
294
165
 
295
- @staticmethod
296
- def persist(
297
- context: Context,
298
- task_instance,
299
- endpoint_id: str,
300
- ):
301
- task_instance.xcom_push(
302
- context=context,
303
- key=VertexAIEndpointLink.key,
304
- value={
305
- "endpoint_id": endpoint_id,
306
- "region": task_instance.region,
307
- "project_id": task_instance.project_id,
308
- },
309
- )
310
-
311
166
 
312
167
  class VertexAIEndpointListLink(BaseGoogleLink):
313
168
  """Helper class for constructing Vertex AI EndpointList link."""
@@ -316,19 +171,6 @@ class VertexAIEndpointListLink(BaseGoogleLink):
316
171
  key = "endpoints_conf"
317
172
  format_str = VERTEX_AI_ENDPOINT_LIST_LINK
318
173
 
319
- @staticmethod
320
- def persist(
321
- context: Context,
322
- task_instance,
323
- ):
324
- task_instance.xcom_push(
325
- context=context,
326
- key=VertexAIEndpointListLink.key,
327
- value={
328
- "project_id": task_instance.project_id,
329
- },
330
- )
331
-
332
174
 
333
175
  class VertexAIPipelineJobLink(BaseGoogleLink):
334
176
  """Helper class for constructing Vertex AI PipelineJob link."""
@@ -337,22 +179,6 @@ class VertexAIPipelineJobLink(BaseGoogleLink):
337
179
  key = "pipeline_job_conf"
338
180
  format_str = VERTEX_AI_PIPELINE_JOB_LINK
339
181
 
340
- @staticmethod
341
- def persist(
342
- context: Context,
343
- task_instance,
344
- pipeline_id: str,
345
- ):
346
- task_instance.xcom_push(
347
- context=context,
348
- key=VertexAIPipelineJobLink.key,
349
- value={
350
- "pipeline_id": pipeline_id,
351
- "region": task_instance.region,
352
- "project_id": task_instance.project_id,
353
- },
354
- )
355
-
356
182
 
357
183
  class VertexAIPipelineJobListLink(BaseGoogleLink):
358
184
  """Helper class for constructing Vertex AI PipelineJobList link."""
@@ -361,19 +187,6 @@ class VertexAIPipelineJobListLink(BaseGoogleLink):
361
187
  key = "pipeline_job_list_conf"
362
188
  format_str = VERTEX_AI_PIPELINE_JOB_LIST_LINK
363
189
 
364
- @staticmethod
365
- def persist(
366
- context: Context,
367
- task_instance,
368
- ):
369
- task_instance.xcom_push(
370
- context=context,
371
- key=VertexAIPipelineJobListLink.key,
372
- value={
373
- "project_id": task_instance.project_id,
374
- },
375
- )
376
-
377
190
 
378
191
  class VertexAIRayClusterLink(BaseGoogleLink):
379
192
  """Helper class for constructing Vertex AI Ray Cluster link."""
@@ -382,22 +195,6 @@ class VertexAIRayClusterLink(BaseGoogleLink):
382
195
  key = "ray_cluster_conf"
383
196
  format_str = VERTEX_AI_RAY_CLUSTER_LINK
384
197
 
385
- @staticmethod
386
- def persist(
387
- context: Context,
388
- task_instance,
389
- cluster_id: str,
390
- ):
391
- task_instance.xcom_push(
392
- context=context,
393
- key=VertexAIRayClusterLink.key,
394
- value={
395
- "location": task_instance.location,
396
- "cluster_id": cluster_id,
397
- "project_id": task_instance.project_id,
398
- },
399
- )
400
-
401
198
 
402
199
  class VertexAIRayClusterListLink(BaseGoogleLink):
403
200
  """Helper class for constructing Vertex AI Ray Cluster List link."""
@@ -405,16 +202,3 @@ class VertexAIRayClusterListLink(BaseGoogleLink):
405
202
  name = "Ray Cluster List"
406
203
  key = "ray_cluster_list_conf"
407
204
  format_str = VERTEX_AI_RAY_CLUSTER_LIST_LINK
408
-
409
- @staticmethod
410
- def persist(
411
- context: Context,
412
- task_instance,
413
- ):
414
- task_instance.xcom_push(
415
- context=context,
416
- key=VertexAIRayClusterListLink.key,
417
- value={
418
- "project_id": task_instance.project_id,
419
- },
420
- )
@@ -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
  WORKFLOWS_BASE_LINK = "/workflows"
31
25
  WORKFLOW_LINK = WORKFLOWS_BASE_LINK + "/workflow/{location_id}/{workflow_id}/executions?project={project_id}"
32
26
  WORKFLOWS_LINK = WORKFLOWS_BASE_LINK + "?project={project_id}"
@@ -43,20 +37,6 @@ class WorkflowsWorkflowDetailsLink(BaseGoogleLink):
43
37
  key = "workflow_details"
44
38
  format_str = WORKFLOW_LINK
45
39
 
46
- @staticmethod
47
- def persist(
48
- context: Context,
49
- task_instance: BaseOperator,
50
- location_id: str,
51
- workflow_id: str,
52
- project_id: str | None,
53
- ):
54
- task_instance.xcom_push(
55
- context,
56
- key=WorkflowsWorkflowDetailsLink.key,
57
- value={"location_id": location_id, "workflow_id": workflow_id, "project_id": project_id},
58
- )
59
-
60
40
 
61
41
  class WorkflowsListOfWorkflowsLink(BaseGoogleLink):
62
42
  """Helper class for constructing list of Workflows Link."""
@@ -65,18 +45,6 @@ class WorkflowsListOfWorkflowsLink(BaseGoogleLink):
65
45
  key = "list_of_workflows"
66
46
  format_str = WORKFLOWS_LINK
67
47
 
68
- @staticmethod
69
- def persist(
70
- context: Context,
71
- task_instance: BaseOperator,
72
- project_id: str | None,
73
- ):
74
- task_instance.xcom_push(
75
- context,
76
- key=WorkflowsListOfWorkflowsLink.key,
77
- value={"project_id": project_id},
78
- )
79
-
80
48
 
81
49
  class WorkflowsExecutionLink(BaseGoogleLink):
82
50
  """Helper class for constructing Workflows Execution Link."""
@@ -84,23 +52,3 @@ class WorkflowsExecutionLink(BaseGoogleLink):
84
52
  name = "Workflow Execution"
85
53
  key = "workflow_execution"
86
54
  format_str = EXECUTION_LINK
87
-
88
- @staticmethod
89
- def persist(
90
- context: Context,
91
- task_instance: BaseOperator,
92
- location_id: str,
93
- workflow_id: str,
94
- execution_id: str,
95
- project_id: str | None,
96
- ):
97
- task_instance.xcom_push(
98
- context,
99
- key=WorkflowsExecutionLink.key,
100
- value={
101
- "location_id": location_id,
102
- "workflow_id": workflow_id,
103
- "execution_id": execution_id,
104
- "project_id": project_id,
105
- },
106
- )
@@ -61,11 +61,11 @@ class GCSRemoteLogIO(LoggingMixin): # noqa: D101
61
61
  remote_base: str
62
62
  base_log_folder: Path = attrs.field(converter=Path)
63
63
  delete_local_copy: bool
64
- project_id: str
64
+ project_id: str | None = None
65
65
 
66
- gcp_key_path: str | None
67
- gcp_keyfile_dict: dict | None
68
- scopes: Collection[str] | None
66
+ gcp_key_path: str | None = None
67
+ gcp_keyfile_dict: dict | None = None
68
+ scopes: Collection[str] | None = _DEFAULT_SCOPESS
69
69
 
70
70
  processors = ()
71
71
 
@@ -21,7 +21,7 @@ from __future__ import annotations
21
21
 
22
22
  from collections.abc import Sequence
23
23
  from functools import cached_property
24
- from typing import TYPE_CHECKING
24
+ from typing import TYPE_CHECKING, Any
25
25
 
26
26
  from google.api_core.exceptions import NotFound
27
27
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
@@ -228,15 +228,16 @@ class AlloyDBCreateClusterOperator(AlloyDBWriteBaseOperator):
228
228
  return result
229
229
  return None
230
230
 
231
- def execute(self, context: Context) -> dict | None:
232
- AlloyDBClusterLink.persist(
233
- context=context,
234
- task_instance=self,
235
- location_id=self.location,
236
- cluster_id=self.cluster_id,
237
- project_id=self.project_id,
238
- )
231
+ @property
232
+ def extra_links_params(self) -> dict[str, Any]:
233
+ return {
234
+ "location_id": self.location,
235
+ "cluster_id": self.cluster_id,
236
+ "project_id": self.project_id,
237
+ }
239
238
 
239
+ def execute(self, context: Context) -> dict | None:
240
+ AlloyDBClusterLink.persist(context=context)
240
241
  if cluster := self._get_cluster():
241
242
  return cluster
242
243
 
@@ -334,14 +335,16 @@ class AlloyDBUpdateClusterOperator(AlloyDBWriteBaseOperator):
334
335
  self.update_mask = update_mask
335
336
  self.allow_missing = allow_missing
336
337
 
338
+ @property
339
+ def extra_links_params(self) -> dict[str, Any]:
340
+ return {
341
+ "location_id": self.location,
342
+ "cluster_id": self.cluster_id,
343
+ "project_id": self.project_id,
344
+ }
345
+
337
346
  def execute(self, context: Context) -> dict | None:
338
- AlloyDBClusterLink.persist(
339
- context=context,
340
- task_instance=self,
341
- location_id=self.location,
342
- cluster_id=self.cluster_id,
343
- project_id=self.project_id,
344
- )
347
+ AlloyDBClusterLink.persist(context=context)
345
348
  if self.validate_request:
346
349
  self.log.info("Validating an Update AlloyDB cluster request.")
347
350
  else:
@@ -545,14 +548,16 @@ class AlloyDBCreateInstanceOperator(AlloyDBWriteBaseOperator):
545
548
  return result
546
549
  return None
547
550
 
551
+ @property
552
+ def extra_links_params(self) -> dict[str, Any]:
553
+ return {
554
+ "location_id": self.location,
555
+ "cluster_id": self.cluster_id,
556
+ "project_id": self.project_id,
557
+ }
558
+
548
559
  def execute(self, context: Context) -> dict | None:
549
- AlloyDBClusterLink.persist(
550
- context=context,
551
- task_instance=self,
552
- location_id=self.location,
553
- cluster_id=self.cluster_id,
554
- project_id=self.project_id,
555
- )
560
+ AlloyDBClusterLink.persist(context=context)
556
561
  if instance := self._get_instance():
557
562
  return instance
558
563
 
@@ -654,14 +659,16 @@ class AlloyDBUpdateInstanceOperator(AlloyDBWriteBaseOperator):
654
659
  self.update_mask = update_mask
655
660
  self.allow_missing = allow_missing
656
661
 
662
+ @property
663
+ def extra_links_params(self) -> dict[str, Any]:
664
+ return {
665
+ "location_id": self.location,
666
+ "cluster_id": self.cluster_id,
667
+ "project_id": self.project_id,
668
+ }
669
+
657
670
  def execute(self, context: Context) -> dict | None:
658
- AlloyDBClusterLink.persist(
659
- context=context,
660
- task_instance=self,
661
- location_id=self.location,
662
- cluster_id=self.cluster_id,
663
- project_id=self.project_id,
664
- )
671
+ AlloyDBClusterLink.persist(context=context)
665
672
  if self.validate_request:
666
673
  self.log.info("Validating an Update AlloyDB instance request.")
667
674
  else:
@@ -861,14 +868,16 @@ class AlloyDBCreateUserOperator(AlloyDBWriteBaseOperator):
861
868
  return result
862
869
  return None
863
870
 
871
+ @property
872
+ def extra_links_params(self) -> dict[str, Any]:
873
+ return {
874
+ "location_id": self.location,
875
+ "cluster_id": self.cluster_id,
876
+ "project_id": self.project_id,
877
+ }
878
+
864
879
  def execute(self, context: Context) -> dict | None:
865
- AlloyDBUsersLink.persist(
866
- context=context,
867
- task_instance=self,
868
- location_id=self.location,
869
- cluster_id=self.cluster_id,
870
- project_id=self.project_id,
871
- )
880
+ AlloyDBUsersLink.persist(context=context)
872
881
  if (_user := self._get_user()) is not None:
873
882
  return _user
874
883
 
@@ -968,14 +977,16 @@ class AlloyDBUpdateUserOperator(AlloyDBWriteBaseOperator):
968
977
  self.update_mask = update_mask
969
978
  self.allow_missing = allow_missing
970
979
 
980
+ @property
981
+ def extra_links_params(self) -> dict[str, Any]:
982
+ return {
983
+ "location_id": self.location,
984
+ "cluster_id": self.cluster_id,
985
+ "project_id": self.project_id,
986
+ }
987
+
971
988
  def execute(self, context: Context) -> dict | None:
972
- AlloyDBUsersLink.persist(
973
- context=context,
974
- task_instance=self,
975
- location_id=self.location,
976
- cluster_id=self.cluster_id,
977
- project_id=self.project_id,
978
- )
989
+ AlloyDBUsersLink.persist(context=context)
979
990
  if self.validate_request:
980
991
  self.log.info("Validating an Update AlloyDB user request.")
981
992
  else:
@@ -1159,12 +1170,14 @@ class AlloyDBCreateBackupOperator(AlloyDBWriteBaseOperator):
1159
1170
  return result
1160
1171
  return None
1161
1172
 
1173
+ @property
1174
+ def extra_links_params(self) -> dict[str, Any]:
1175
+ return {
1176
+ "project_id": self.project_id,
1177
+ }
1178
+
1162
1179
  def execute(self, context: Context) -> dict | None:
1163
- AlloyDBBackupsLink.persist(
1164
- context=context,
1165
- task_instance=self,
1166
- project_id=self.project_id,
1167
- )
1180
+ AlloyDBBackupsLink.persist(context=context)
1168
1181
  if backup := self._get_backup():
1169
1182
  return backup
1170
1183
 
@@ -1259,12 +1272,14 @@ class AlloyDBUpdateBackupOperator(AlloyDBWriteBaseOperator):
1259
1272
  self.update_mask = update_mask
1260
1273
  self.allow_missing = allow_missing
1261
1274
 
1275
+ @property
1276
+ def extra_links_params(self) -> dict[str, Any]:
1277
+ return {
1278
+ "project_id": self.project_id,
1279
+ }
1280
+
1262
1281
  def execute(self, context: Context) -> dict | None:
1263
- AlloyDBBackupsLink.persist(
1264
- context=context,
1265
- task_instance=self,
1266
- project_id=self.project_id,
1267
- )
1282
+ AlloyDBBackupsLink.persist(context=context)
1268
1283
  if self.validate_request:
1269
1284
  self.log.info("Validating an Update AlloyDB backup request.")
1270
1285
  else: