apache-airflow-providers-google 12.0.0rc2__py3-none-any.whl → 14.0.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 (163) hide show
  1. airflow/providers/google/LICENSE +0 -52
  2. airflow/providers/google/__init__.py +1 -1
  3. airflow/providers/google/ads/hooks/ads.py +27 -13
  4. airflow/providers/google/ads/transfers/ads_to_gcs.py +18 -4
  5. airflow/providers/google/assets/bigquery.py +17 -0
  6. airflow/providers/google/cloud/_internal_client/secret_manager_client.py +2 -3
  7. airflow/providers/google/cloud/hooks/alloy_db.py +736 -8
  8. airflow/providers/google/cloud/hooks/automl.py +10 -4
  9. airflow/providers/google/cloud/hooks/bigquery.py +125 -22
  10. airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
  11. airflow/providers/google/cloud/hooks/bigtable.py +2 -3
  12. airflow/providers/google/cloud/hooks/cloud_batch.py +3 -4
  13. airflow/providers/google/cloud/hooks/cloud_build.py +4 -5
  14. airflow/providers/google/cloud/hooks/cloud_composer.py +3 -4
  15. airflow/providers/google/cloud/hooks/cloud_memorystore.py +3 -4
  16. airflow/providers/google/cloud/hooks/cloud_run.py +3 -4
  17. airflow/providers/google/cloud/hooks/cloud_sql.py +7 -3
  18. airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +119 -7
  19. airflow/providers/google/cloud/hooks/compute.py +3 -3
  20. airflow/providers/google/cloud/hooks/datacatalog.py +3 -4
  21. airflow/providers/google/cloud/hooks/dataflow.py +12 -12
  22. airflow/providers/google/cloud/hooks/dataform.py +2 -3
  23. airflow/providers/google/cloud/hooks/datafusion.py +2 -2
  24. airflow/providers/google/cloud/hooks/dataplex.py +1032 -11
  25. airflow/providers/google/cloud/hooks/dataproc.py +4 -5
  26. airflow/providers/google/cloud/hooks/dataproc_metastore.py +3 -4
  27. airflow/providers/google/cloud/hooks/dlp.py +3 -4
  28. airflow/providers/google/cloud/hooks/gcs.py +7 -6
  29. airflow/providers/google/cloud/hooks/kms.py +2 -3
  30. airflow/providers/google/cloud/hooks/kubernetes_engine.py +8 -8
  31. airflow/providers/google/cloud/hooks/life_sciences.py +1 -1
  32. airflow/providers/google/cloud/hooks/managed_kafka.py +482 -0
  33. airflow/providers/google/cloud/hooks/natural_language.py +2 -3
  34. airflow/providers/google/cloud/hooks/os_login.py +2 -3
  35. airflow/providers/google/cloud/hooks/pubsub.py +6 -6
  36. airflow/providers/google/cloud/hooks/secret_manager.py +2 -3
  37. airflow/providers/google/cloud/hooks/spanner.py +2 -2
  38. airflow/providers/google/cloud/hooks/speech_to_text.py +2 -3
  39. airflow/providers/google/cloud/hooks/stackdriver.py +4 -4
  40. airflow/providers/google/cloud/hooks/tasks.py +3 -4
  41. airflow/providers/google/cloud/hooks/text_to_speech.py +2 -3
  42. airflow/providers/google/cloud/hooks/translate.py +236 -5
  43. airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +9 -4
  44. airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -4
  45. airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +4 -5
  46. airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +3 -4
  47. airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +2 -3
  48. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +3 -4
  49. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +1 -181
  50. airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +3 -4
  51. airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +2 -3
  52. airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +3 -4
  53. airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +2 -3
  54. airflow/providers/google/cloud/hooks/video_intelligence.py +2 -3
  55. airflow/providers/google/cloud/hooks/vision.py +3 -4
  56. airflow/providers/google/cloud/hooks/workflows.py +2 -3
  57. airflow/providers/google/cloud/links/alloy_db.py +46 -0
  58. airflow/providers/google/cloud/links/bigquery.py +25 -0
  59. airflow/providers/google/cloud/links/dataplex.py +172 -2
  60. airflow/providers/google/cloud/links/kubernetes_engine.py +1 -2
  61. airflow/providers/google/cloud/links/managed_kafka.py +104 -0
  62. airflow/providers/google/cloud/links/translate.py +28 -0
  63. airflow/providers/google/cloud/log/gcs_task_handler.py +3 -3
  64. airflow/providers/google/cloud/log/stackdriver_task_handler.py +11 -10
  65. airflow/providers/google/cloud/openlineage/facets.py +67 -0
  66. airflow/providers/google/cloud/openlineage/mixins.py +438 -173
  67. airflow/providers/google/cloud/openlineage/utils.py +394 -61
  68. airflow/providers/google/cloud/operators/alloy_db.py +980 -69
  69. airflow/providers/google/cloud/operators/automl.py +83 -245
  70. airflow/providers/google/cloud/operators/bigquery.py +377 -74
  71. airflow/providers/google/cloud/operators/bigquery_dts.py +126 -13
  72. airflow/providers/google/cloud/operators/bigtable.py +1 -3
  73. airflow/providers/google/cloud/operators/cloud_base.py +1 -2
  74. airflow/providers/google/cloud/operators/cloud_batch.py +2 -4
  75. airflow/providers/google/cloud/operators/cloud_build.py +3 -5
  76. airflow/providers/google/cloud/operators/cloud_composer.py +5 -7
  77. airflow/providers/google/cloud/operators/cloud_memorystore.py +4 -6
  78. airflow/providers/google/cloud/operators/cloud_run.py +6 -5
  79. airflow/providers/google/cloud/operators/cloud_sql.py +20 -8
  80. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +62 -8
  81. airflow/providers/google/cloud/operators/compute.py +3 -4
  82. airflow/providers/google/cloud/operators/datacatalog.py +9 -11
  83. airflow/providers/google/cloud/operators/dataflow.py +1 -112
  84. airflow/providers/google/cloud/operators/dataform.py +3 -5
  85. airflow/providers/google/cloud/operators/datafusion.py +1 -1
  86. airflow/providers/google/cloud/operators/dataplex.py +2046 -7
  87. airflow/providers/google/cloud/operators/dataproc.py +102 -17
  88. airflow/providers/google/cloud/operators/dataproc_metastore.py +7 -9
  89. airflow/providers/google/cloud/operators/dlp.py +17 -19
  90. airflow/providers/google/cloud/operators/gcs.py +14 -17
  91. airflow/providers/google/cloud/operators/kubernetes_engine.py +2 -2
  92. airflow/providers/google/cloud/operators/managed_kafka.py +788 -0
  93. airflow/providers/google/cloud/operators/natural_language.py +3 -5
  94. airflow/providers/google/cloud/operators/pubsub.py +39 -7
  95. airflow/providers/google/cloud/operators/speech_to_text.py +3 -5
  96. airflow/providers/google/cloud/operators/stackdriver.py +3 -5
  97. airflow/providers/google/cloud/operators/tasks.py +4 -6
  98. airflow/providers/google/cloud/operators/text_to_speech.py +2 -4
  99. airflow/providers/google/cloud/operators/translate.py +414 -5
  100. airflow/providers/google/cloud/operators/translate_speech.py +2 -4
  101. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +9 -8
  102. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +4 -6
  103. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +6 -8
  104. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +4 -6
  105. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +4 -6
  106. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +0 -322
  107. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +4 -6
  108. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +4 -6
  109. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +4 -6
  110. airflow/providers/google/cloud/operators/video_intelligence.py +3 -5
  111. airflow/providers/google/cloud/operators/vision.py +4 -6
  112. airflow/providers/google/cloud/operators/workflows.py +5 -7
  113. airflow/providers/google/cloud/secrets/secret_manager.py +1 -2
  114. airflow/providers/google/cloud/sensors/bigquery_dts.py +3 -5
  115. airflow/providers/google/cloud/sensors/bigtable.py +2 -3
  116. airflow/providers/google/cloud/sensors/cloud_composer.py +32 -8
  117. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +39 -1
  118. airflow/providers/google/cloud/sensors/dataplex.py +4 -6
  119. airflow/providers/google/cloud/sensors/dataproc.py +2 -3
  120. airflow/providers/google/cloud/sensors/dataproc_metastore.py +1 -2
  121. airflow/providers/google/cloud/sensors/gcs.py +2 -4
  122. airflow/providers/google/cloud/sensors/pubsub.py +2 -3
  123. airflow/providers/google/cloud/sensors/workflows.py +3 -5
  124. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +5 -5
  125. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +10 -12
  126. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
  127. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +36 -4
  128. airflow/providers/google/cloud/transfers/mssql_to_gcs.py +27 -2
  129. airflow/providers/google/cloud/transfers/mysql_to_gcs.py +27 -2
  130. airflow/providers/google/cloud/transfers/postgres_to_gcs.py +27 -2
  131. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +34 -5
  132. airflow/providers/google/cloud/transfers/sql_to_gcs.py +15 -0
  133. airflow/providers/google/cloud/transfers/trino_to_gcs.py +25 -2
  134. airflow/providers/google/cloud/triggers/bigquery_dts.py +1 -2
  135. airflow/providers/google/cloud/triggers/cloud_batch.py +1 -2
  136. airflow/providers/google/cloud/triggers/cloud_build.py +1 -2
  137. airflow/providers/google/cloud/triggers/cloud_composer.py +13 -3
  138. airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +102 -4
  139. airflow/providers/google/cloud/triggers/dataflow.py +2 -3
  140. airflow/providers/google/cloud/triggers/dataplex.py +1 -2
  141. airflow/providers/google/cloud/triggers/dataproc.py +2 -3
  142. airflow/providers/google/cloud/triggers/kubernetes_engine.py +1 -1
  143. airflow/providers/google/cloud/triggers/pubsub.py +1 -2
  144. airflow/providers/google/cloud/triggers/vertex_ai.py +7 -8
  145. airflow/providers/google/cloud/utils/credentials_provider.py +15 -8
  146. airflow/providers/google/cloud/utils/external_token_supplier.py +1 -0
  147. airflow/providers/google/common/auth_backend/google_openid.py +4 -4
  148. airflow/providers/google/common/consts.py +1 -2
  149. airflow/providers/google/common/hooks/base_google.py +8 -7
  150. airflow/providers/google/get_provider_info.py +186 -134
  151. airflow/providers/google/marketing_platform/hooks/analytics_admin.py +2 -3
  152. airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
  153. airflow/providers/google/marketing_platform/operators/analytics_admin.py +5 -7
  154. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/METADATA +40 -57
  155. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/RECORD +157 -159
  156. airflow/providers/google/cloud/example_dags/example_facebook_ads_to_gcs.py +0 -141
  157. airflow/providers/google/cloud/example_dags/example_looker.py +0 -64
  158. airflow/providers/google/cloud/example_dags/example_presto_to_gcs.py +0 -194
  159. airflow/providers/google/cloud/example_dags/example_salesforce_to_gcs.py +0 -129
  160. airflow/providers/google/marketing_platform/example_dags/__init__.py +0 -16
  161. airflow/providers/google/marketing_platform/example_dags/example_display_video.py +0 -213
  162. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/WHEEL +0 -0
  163. {apache_airflow_providers_google-12.0.0rc2.dist-info → apache_airflow_providers_google-14.0.0rc1.dist-info}/entry_points.txt +0 -0
@@ -23,15 +23,17 @@ from collections.abc import Sequence
23
23
  from copy import deepcopy
24
24
  from typing import TYPE_CHECKING
25
25
 
26
- from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
27
- from google.cloud import alloydb_v1
26
+ import tenacity
28
27
 
29
28
  from airflow.exceptions import AirflowException
30
29
  from airflow.providers.google.common.consts import CLIENT_INFO
31
30
  from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
31
+ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
32
+ from google.cloud import alloydb_v1
32
33
 
33
34
  if TYPE_CHECKING:
34
35
  import proto
36
+
35
37
  from google.api_core.operation import Operation
36
38
  from google.api_core.retry import Retry
37
39
  from google.protobuf.field_mask_pb2 import FieldMask
@@ -48,7 +50,8 @@ class AlloyDbHook(GoogleBaseHook):
48
50
  """Retrieve AlloyDB client."""
49
51
  if not self._client:
50
52
  self._client = alloydb_v1.AlloyDBAdminClient(
51
- credentials=self.get_credentials(), client_info=CLIENT_INFO
53
+ credentials=self.get_credentials(),
54
+ client_info=CLIENT_INFO,
52
55
  )
53
56
  return self._client
54
57
 
@@ -87,7 +90,15 @@ class AlloyDbHook(GoogleBaseHook):
87
90
  https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Cluster
88
91
  :param location: Required. The ID of the Google Cloud region where the cluster is located.
89
92
  :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
90
- :param request_id: Optional. The ID of an existing request object.
93
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
94
+ so that if you must retry your request, the server ignores the request if it has already been
95
+ completed. The server guarantees that for at least 60 minutes since the first request.
96
+ For example, consider a situation where you make an initial request and the request times out.
97
+ If you make the request again with the same request ID, the server can check if the original operation
98
+ with the same request ID was received, and if so, ignores the second request.
99
+ This prevents clients from accidentally creating duplicate commitments.
100
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
101
+ (00000000-0000-0000-0000-000000000000).
91
102
  :param validate_only: Optional. If set, performs request validation, but does not actually execute
92
103
  the create request.
93
104
  :param retry: Optional. Designation of what errors, if any, should be retried.
@@ -133,7 +144,15 @@ class AlloyDbHook(GoogleBaseHook):
133
144
  https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Cluster
134
145
  :param location: Required. The ID of the Google Cloud region where the cluster is located.
135
146
  :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
136
- :param request_id: Optional. The ID of an existing request object.
147
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
148
+ so that if you must retry your request, the server ignores the request if it has already been
149
+ completed. The server guarantees that for at least 60 minutes since the first request.
150
+ For example, consider a situation where you make an initial request and the request times out.
151
+ If you make the request again with the same request ID, the server can check if the original operation
152
+ with the same request ID was received, and if so, ignores the second request.
153
+ This prevents clients from accidentally creating duplicate commitments.
154
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
155
+ (00000000-0000-0000-0000-000000000000).
137
156
  :param validate_only: Optional. If set, performs request validation, but does not actually execute
138
157
  the create request.
139
158
  :param retry: Optional. Designation of what errors, if any, should be retried.
@@ -154,6 +173,11 @@ class AlloyDbHook(GoogleBaseHook):
154
173
  metadata=metadata,
155
174
  )
156
175
 
176
+ @tenacity.retry(
177
+ stop=tenacity.stop_after_attempt(5),
178
+ wait=tenacity.wait_exponential(multiplier=1, max=10),
179
+ retry=tenacity.retry_if_exception_type(ValueError),
180
+ )
157
181
  @GoogleBaseHook.fallback_to_default_project_id
158
182
  def get_cluster(
159
183
  self,
@@ -171,7 +195,7 @@ class AlloyDbHook(GoogleBaseHook):
171
195
  For more details see API documentation:
172
196
  https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.GetClusterRequest
173
197
 
174
- :param cluster_id: Required. ID of the cluster to create.
198
+ :param cluster_id: Required. ID of the cluster.
175
199
  :param location: Required. The ID of the Google Cloud region where the cluster is located.
176
200
  :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
177
201
  :param retry: Optional. Designation of what errors, if any, should be retried.
@@ -214,7 +238,15 @@ class AlloyDbHook(GoogleBaseHook):
214
238
  :param location: Required. The ID of the Google Cloud region where the cluster is located.
215
239
  :param update_mask: Optional. Field mask is used to specify the fields to be overwritten in the
216
240
  Cluster resource by the update.
217
- :param request_id: Optional. The ID of an existing request object.
241
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
242
+ so that if you must retry your request, the server ignores the request if it has already been
243
+ completed. The server guarantees that for at least 60 minutes since the first request.
244
+ For example, consider a situation where you make an initial request and the request times out.
245
+ If you make the request again with the same request ID, the server can check if the original operation
246
+ with the same request ID was received, and if so, ignores the second request.
247
+ This prevents clients from accidentally creating duplicate commitments.
248
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
249
+ (00000000-0000-0000-0000-000000000000).
218
250
  :param validate_only: Optional. If set, performs request validation, but does not actually execute
219
251
  the create request.
220
252
  :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
@@ -264,7 +296,15 @@ class AlloyDbHook(GoogleBaseHook):
264
296
  :param cluster_id: Required. ID of the cluster to delete.
265
297
  :param location: Required. The ID of the Google Cloud region where the cluster is located.
266
298
  :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
267
- :param request_id: Optional. The ID of an existing request object.
299
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
300
+ so that if you must retry your request, the server ignores the request if it has already been
301
+ completed. The server guarantees that for at least 60 minutes since the first request.
302
+ For example, consider a situation where you make an initial request and the request times out.
303
+ If you make the request again with the same request ID, the server can check if the original operation
304
+ with the same request ID was received, and if so, ignores the second request.
305
+ This prevents clients from accidentally creating duplicate commitments.
306
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
307
+ (00000000-0000-0000-0000-000000000000).
268
308
  :param etag: Optional. The current etag of the Cluster. If an etag is provided and does not match the
269
309
  current etag of the Cluster, deletion will be blocked and an ABORTED error will be returned.
270
310
  :param validate_only: Optional. If set, performs request validation, but does not actually execute
@@ -287,3 +327,691 @@ class AlloyDbHook(GoogleBaseHook):
287
327
  timeout=timeout,
288
328
  metadata=metadata,
289
329
  )
330
+
331
+ @GoogleBaseHook.fallback_to_default_project_id
332
+ def create_instance(
333
+ self,
334
+ cluster_id: str,
335
+ instance_id: str,
336
+ instance: alloydb_v1.Instance | dict,
337
+ location: str,
338
+ project_id: str = PROVIDE_PROJECT_ID,
339
+ request_id: str | None = None,
340
+ validate_only: bool = False,
341
+ retry: Retry | _MethodDefault = DEFAULT,
342
+ timeout: float | None = None,
343
+ metadata: Sequence[tuple[str, str]] = (),
344
+ ) -> Operation:
345
+ """
346
+ Create an instance in a given Alloy DB cluster.
347
+
348
+ .. seealso::
349
+ For more details see API documentation:
350
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.CreateInstanceRequest
351
+
352
+ :param cluster_id: Required. ID of the cluster for creating an instance in.
353
+ :param instance_id: Required. ID of the instance to create.
354
+ :param instance: Required. Instance to create. For more details please see API documentation:
355
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Instance
356
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
357
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
358
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
359
+ so that if you must retry your request, the server ignores the request if it has already been
360
+ completed. The server guarantees that for at least 60 minutes since the first request.
361
+ For example, consider a situation where you make an initial request and the request times out.
362
+ If you make the request again with the same request ID, the server can check if the original operation
363
+ with the same request ID was received, and if so, ignores the second request.
364
+ This prevents clients from accidentally creating duplicate commitments.
365
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
366
+ (00000000-0000-0000-0000-000000000000).
367
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
368
+ the create request.
369
+ :param retry: Optional. Designation of what errors, if any, should be retried.
370
+ :param timeout: Optional. The timeout for this request.
371
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
372
+ """
373
+ client = self.get_alloy_db_admin_client()
374
+ return client.create_instance(
375
+ request={
376
+ "parent": client.cluster_path(project_id, location, cluster_id),
377
+ "instance_id": instance_id,
378
+ "instance": instance,
379
+ "request_id": request_id,
380
+ "validate_only": validate_only,
381
+ },
382
+ retry=retry,
383
+ timeout=timeout,
384
+ metadata=metadata,
385
+ )
386
+
387
+ @GoogleBaseHook.fallback_to_default_project_id
388
+ def create_secondary_instance(
389
+ self,
390
+ cluster_id: str,
391
+ instance_id: str,
392
+ instance: alloydb_v1.Instance | dict,
393
+ location: str,
394
+ project_id: str = PROVIDE_PROJECT_ID,
395
+ request_id: str | None = None,
396
+ validate_only: bool = False,
397
+ retry: Retry | _MethodDefault = DEFAULT,
398
+ timeout: float | None = None,
399
+ metadata: Sequence[tuple[str, str]] = (),
400
+ ) -> Operation:
401
+ """
402
+ Create a secondary instance in a given Alloy DB cluster.
403
+
404
+ .. seealso::
405
+ For more details see API documentation:
406
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.CreateSecondaryInstanceRequest
407
+
408
+ :param cluster_id: Required. ID of the cluster for creating an instance in.
409
+ :param instance_id: Required. ID of the instance to create.
410
+ :param instance: Required. Instance to create. For more details please see API documentation:
411
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Instance
412
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
413
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
414
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
415
+ so that if you must retry your request, the server ignores the request if it has already been
416
+ completed. The server guarantees that for at least 60 minutes since the first request.
417
+ For example, consider a situation where you make an initial request and the request times out.
418
+ If you make the request again with the same request ID, the server can check if the original operation
419
+ with the same request ID was received, and if so, ignores the second request.
420
+ This prevents clients from accidentally creating duplicate commitments.
421
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
422
+ (00000000-0000-0000-0000-000000000000).
423
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
424
+ the create request.
425
+ :param retry: Optional. Designation of what errors, if any, should be retried.
426
+ :param timeout: Optional. The timeout for this request.
427
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
428
+ """
429
+ client = self.get_alloy_db_admin_client()
430
+ return client.create_secondary_instance(
431
+ request={
432
+ "parent": client.cluster_path(project_id, location, cluster_id),
433
+ "instance_id": instance_id,
434
+ "instance": instance,
435
+ "request_id": request_id,
436
+ "validate_only": validate_only,
437
+ },
438
+ retry=retry,
439
+ timeout=timeout,
440
+ metadata=metadata,
441
+ )
442
+
443
+ @tenacity.retry(
444
+ stop=tenacity.stop_after_attempt(5),
445
+ wait=tenacity.wait_exponential(multiplier=1, max=10),
446
+ retry=tenacity.retry_if_exception_type(ValueError),
447
+ )
448
+ @GoogleBaseHook.fallback_to_default_project_id
449
+ def get_instance(
450
+ self,
451
+ cluster_id: str,
452
+ instance_id: str,
453
+ location: str,
454
+ project_id: str = PROVIDE_PROJECT_ID,
455
+ retry: Retry | _MethodDefault = DEFAULT,
456
+ timeout: float | None = None,
457
+ metadata: Sequence[tuple[str, str]] = (),
458
+ ) -> alloydb_v1.Instance:
459
+ """
460
+ Retrieve an Alloy DB instance.
461
+
462
+ .. seealso::
463
+ For more details see API documentation:
464
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.GetInstanceRequest
465
+
466
+ :param cluster_id: Required. ID of the cluster.
467
+ :param instance_id: Required. ID of the instance.
468
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
469
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
470
+ :param retry: Optional. Designation of what errors, if any, should be retried.
471
+ :param timeout: Optional. The timeout for this request.
472
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
473
+ """
474
+ client = self.get_alloy_db_admin_client()
475
+ return client.get_instance(
476
+ request={"name": client.instance_path(project_id, location, cluster_id, instance_id)},
477
+ retry=retry,
478
+ timeout=timeout,
479
+ metadata=metadata,
480
+ )
481
+
482
+ @GoogleBaseHook.fallback_to_default_project_id
483
+ def update_instance(
484
+ self,
485
+ cluster_id: str,
486
+ instance_id: str,
487
+ instance: alloydb_v1.Instance | dict,
488
+ location: str,
489
+ update_mask: FieldMask | dict | None = None,
490
+ project_id: str = PROVIDE_PROJECT_ID,
491
+ allow_missing: bool = False,
492
+ request_id: str | None = None,
493
+ validate_only: bool = False,
494
+ retry: Retry | _MethodDefault = DEFAULT,
495
+ timeout: float | None = None,
496
+ metadata: Sequence[tuple[str, str]] = (),
497
+ ) -> Operation:
498
+ """
499
+ Update an Alloy DB instance.
500
+
501
+ .. seealso::
502
+ For more details see API documentation:
503
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.UpdateInstanceRequest
504
+
505
+ :param cluster_id: Required. ID of the cluster.
506
+ :param instance_id: Required. ID of the cluster to update.
507
+ :param instance: Required. Cluster to update. For more details please see API documentation:
508
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Instance
509
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
510
+ :param update_mask: Optional. Field mask is used to specify the fields to be overwritten in the
511
+ Instance resource by the update.
512
+ :param request_id: Optional. The ID of an existing request object.:param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
513
+ so that if you must retry your request, the server ignores the request if it has already been
514
+ completed. The server guarantees that for at least 60 minutes since the first request.
515
+ For example, consider a situation where you make an initial request and the request times out.
516
+ If you make the request again with the same request ID, the server can check if the original operation
517
+ with the same request ID was received, and if so, ignores the second request.
518
+ This prevents clients from accidentally creating duplicate commitments.
519
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
520
+ (00000000-0000-0000-0000-000000000000).
521
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
522
+ the create request.
523
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
524
+ :param allow_missing: Optional. If set to true, update succeeds even if cluster is not found.
525
+ In that case, a new cluster is created and update_mask is ignored.
526
+ :param retry: Optional. Designation of what errors, if any, should be retried.
527
+ :param timeout: Optional. The timeout for this request.
528
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
529
+ """
530
+ client = self.get_alloy_db_admin_client()
531
+ _instance = (
532
+ deepcopy(instance) if isinstance(instance, dict) else alloydb_v1.Instance.to_dict(instance)
533
+ )
534
+ _instance["name"] = client.instance_path(project_id, location, cluster_id, instance_id)
535
+ return client.update_instance(
536
+ request={
537
+ "update_mask": update_mask,
538
+ "instance": _instance,
539
+ "request_id": request_id,
540
+ "validate_only": validate_only,
541
+ "allow_missing": allow_missing,
542
+ },
543
+ retry=retry,
544
+ timeout=timeout,
545
+ metadata=metadata,
546
+ )
547
+
548
+ @GoogleBaseHook.fallback_to_default_project_id
549
+ def delete_instance(
550
+ self,
551
+ instance_id: str,
552
+ cluster_id: str,
553
+ location: str,
554
+ project_id: str = PROVIDE_PROJECT_ID,
555
+ request_id: str | None = None,
556
+ etag: str | None = None,
557
+ validate_only: bool = False,
558
+ retry: Retry | _MethodDefault = DEFAULT,
559
+ timeout: float | None = None,
560
+ metadata: Sequence[tuple[str, str]] = (),
561
+ ):
562
+ """
563
+ Delete an Alloy DB instance.
564
+
565
+ .. seealso::
566
+ For more details see API documentation:
567
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.DeleteInstanceRequest
568
+
569
+ :param instance_id: Required. ID of the instance to delete.
570
+ :param cluster_id: Required. ID of the cluster.
571
+ :param location: Required. The ID of the Google Cloud region where the instance is located.
572
+ :param project_id: Optional. The ID of the Google Cloud project where the instance is located.
573
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
574
+ so that if you must retry your request, the server ignores the request if it has already been
575
+ completed. The server guarantees that for at least 60 minutes since the first request.
576
+ For example, consider a situation where you make an initial request and the request times out.
577
+ If you make the request again with the same request ID, the server can check if the original operation
578
+ with the same request ID was received, and if so, ignores the second request.
579
+ This prevents clients from accidentally creating duplicate commitments.
580
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
581
+ (00000000-0000-0000-0000-000000000000).
582
+ :param etag: Optional. The current etag of the Instance. If an etag is provided and does not match the
583
+ current etag of the Instance, deletion will be blocked and an ABORTED error will be returned.
584
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
585
+ the delete request.
586
+ :param retry: Optional. Designation of what errors, if any, should be retried.
587
+ :param timeout: Optional. The timeout for this request.
588
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
589
+ """
590
+ client = self.get_alloy_db_admin_client()
591
+ return client.delete_instance(
592
+ request={
593
+ "name": client.instance_path(project_id, location, cluster_id, instance_id),
594
+ "request_id": request_id,
595
+ "etag": etag,
596
+ "validate_only": validate_only,
597
+ },
598
+ retry=retry,
599
+ timeout=timeout,
600
+ metadata=metadata,
601
+ )
602
+
603
+ @GoogleBaseHook.fallback_to_default_project_id
604
+ def create_user(
605
+ self,
606
+ user_id: str,
607
+ user: alloydb_v1.User | dict,
608
+ cluster_id: str,
609
+ location: str,
610
+ project_id: str = PROVIDE_PROJECT_ID,
611
+ request_id: str | None = None,
612
+ validate_only: bool = False,
613
+ retry: Retry | _MethodDefault = DEFAULT,
614
+ timeout: float | None = None,
615
+ metadata: Sequence[tuple[str, str]] = (),
616
+ ) -> alloydb_v1.User:
617
+ """
618
+ Create a user in a given Alloy DB cluster.
619
+
620
+ .. seealso::
621
+ For more details see API documentation:
622
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.CreateUserRequest
623
+
624
+ :param user_id: Required. ID of the user to create.
625
+ :param user: Required. The user to create. For more details please see API documentation:
626
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.User
627
+ :param cluster_id: Required. ID of the cluster for creating a user in.
628
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
629
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
630
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
631
+ so that if you must retry your request, the server ignores the request if it has already been
632
+ completed. The server guarantees that for at least 60 minutes since the first request.
633
+ For example, consider a situation where you make an initial request and the request times out.
634
+ If you make the request again with the same request ID, the server can check if the original operation
635
+ with the same request ID was received, and if so, ignores the second request.
636
+ This prevents clients from accidentally creating duplicate commitments.
637
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
638
+ (00000000-0000-0000-0000-000000000000).
639
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
640
+ the create request.
641
+ :param retry: Optional. Designation of what errors, if any, should be retried.
642
+ :param timeout: Optional. The timeout for this request.
643
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
644
+ """
645
+ client = self.get_alloy_db_admin_client()
646
+ return client.create_user(
647
+ request={
648
+ "parent": client.cluster_path(project_id, location, cluster_id),
649
+ "user_id": user_id,
650
+ "user": user,
651
+ "request_id": request_id,
652
+ "validate_only": validate_only,
653
+ },
654
+ retry=retry,
655
+ timeout=timeout,
656
+ metadata=metadata,
657
+ )
658
+
659
+ @tenacity.retry(
660
+ stop=tenacity.stop_after_attempt(5),
661
+ wait=tenacity.wait_exponential(multiplier=1, max=10),
662
+ retry=tenacity.retry_if_exception_type(ValueError),
663
+ )
664
+ @GoogleBaseHook.fallback_to_default_project_id
665
+ def get_user(
666
+ self,
667
+ user_id: str,
668
+ cluster_id: str,
669
+ location: str,
670
+ project_id: str = PROVIDE_PROJECT_ID,
671
+ retry: Retry | _MethodDefault = DEFAULT,
672
+ timeout: float | None = None,
673
+ metadata: Sequence[tuple[str, str]] = (),
674
+ ) -> alloydb_v1.User:
675
+ """
676
+ Get a user in a given Alloy DB cluster.
677
+
678
+ .. seealso::
679
+ For more details see API documentation:
680
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.GetUserRequest
681
+
682
+ :param user_id: Required. ID of the user to create.
683
+ :param cluster_id: Required. ID of the cluster for creating a user in.
684
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
685
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
686
+ :param retry: Optional. Designation of what errors, if any, should be retried.
687
+ :param timeout: Optional. The timeout for this request.
688
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
689
+ """
690
+ client = self.get_alloy_db_admin_client()
691
+ return client.get_user(
692
+ request={
693
+ "name": client.user_path(project_id, location, cluster_id, user_id),
694
+ },
695
+ retry=retry,
696
+ timeout=timeout,
697
+ metadata=metadata,
698
+ )
699
+
700
+ @GoogleBaseHook.fallback_to_default_project_id
701
+ def update_user(
702
+ self,
703
+ cluster_id: str,
704
+ user_id: str,
705
+ user: alloydb_v1.User | dict,
706
+ location: str,
707
+ update_mask: FieldMask | dict | None = None,
708
+ allow_missing: bool = False,
709
+ project_id: str = PROVIDE_PROJECT_ID,
710
+ request_id: str | None = None,
711
+ validate_only: bool = False,
712
+ retry: Retry | _MethodDefault = DEFAULT,
713
+ timeout: float | None = None,
714
+ metadata: Sequence[tuple[str, str]] = (),
715
+ ) -> alloydb_v1.User:
716
+ """
717
+ Update an Alloy DB user.
718
+
719
+ .. seealso::
720
+ For more details see API documentation:
721
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.UpdateUserRequest
722
+
723
+ :param cluster_id: Required. ID of the cluster.
724
+ :param user_id: Required. ID of the user to update.
725
+ :param user: Required. User to update. For more details please see API documentation:
726
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.User
727
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
728
+ :param update_mask: Optional. Field mask is used to specify the fields to be overwritten in the
729
+ User resource by the update.
730
+ :param request_id: Optional. The ID of an existing request object.:param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
731
+ so that if you must retry your request, the server ignores the request if it has already been
732
+ completed. The server guarantees that for at least 60 minutes since the first request.
733
+ For example, consider a situation where you make an initial request and the request times out.
734
+ If you make the request again with the same request ID, the server can check if the original operation
735
+ with the same request ID was received, and if so, ignores the second request.
736
+ This prevents clients from accidentally creating duplicate commitments.
737
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
738
+ (00000000-0000-0000-0000-000000000000).
739
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
740
+ the create request.
741
+ :param allow_missing: Optional. If set to true, update succeeds even if cluster is not found.
742
+ In that case, a new cluster is created and update_mask is ignored.
743
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
744
+ :param retry: Optional. Designation of what errors, if any, should be retried.
745
+ :param timeout: Optional. The timeout for this request.
746
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
747
+ """
748
+ client = self.get_alloy_db_admin_client()
749
+ _user = deepcopy(user) if isinstance(user, dict) else alloydb_v1.User.to_dict(user)
750
+ _user["name"] = client.user_path(project_id, location, cluster_id, user_id)
751
+ return client.update_user(
752
+ request={
753
+ "update_mask": update_mask,
754
+ "user": _user,
755
+ "request_id": request_id,
756
+ "validate_only": validate_only,
757
+ "allow_missing": allow_missing,
758
+ },
759
+ retry=retry,
760
+ timeout=timeout,
761
+ metadata=metadata,
762
+ )
763
+
764
+ @GoogleBaseHook.fallback_to_default_project_id
765
+ def delete_user(
766
+ self,
767
+ user_id: str,
768
+ cluster_id: str,
769
+ location: str,
770
+ project_id: str = PROVIDE_PROJECT_ID,
771
+ request_id: str | None = None,
772
+ validate_only: bool = False,
773
+ retry: Retry | _MethodDefault = DEFAULT,
774
+ timeout: float | None = None,
775
+ metadata: Sequence[tuple[str, str]] = (),
776
+ ):
777
+ """
778
+ Delete an Alloy DB user.
779
+
780
+ .. seealso::
781
+ For more details see API documentation:
782
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.DeleteUserRequest
783
+
784
+ :param user_id: Required. ID of the user to delete.
785
+ :param cluster_id: Required. ID of the cluster.
786
+ :param location: Required. The ID of the Google Cloud region where the instance is located.
787
+ :param project_id: Optional. The ID of the Google Cloud project where the instance is located.
788
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
789
+ so that if you must retry your request, the server ignores the request if it has already been
790
+ completed. The server guarantees that for at least 60 minutes since the first request.
791
+ For example, consider a situation where you make an initial request and the request times out.
792
+ If you make the request again with the same request ID, the server can check if the original operation
793
+ with the same request ID was received, and if so, ignores the second request.
794
+ This prevents clients from accidentally creating duplicate commitments.
795
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
796
+ (00000000-0000-0000-0000-000000000000).
797
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
798
+ the delete request.
799
+ :param retry: Optional. Designation of what errors, if any, should be retried.
800
+ :param timeout: Optional. The timeout for this request.
801
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
802
+ """
803
+ client = self.get_alloy_db_admin_client()
804
+ return client.delete_user(
805
+ request={
806
+ "name": client.user_path(project_id, location, cluster_id, user_id),
807
+ "request_id": request_id,
808
+ "validate_only": validate_only,
809
+ },
810
+ retry=retry,
811
+ timeout=timeout,
812
+ metadata=metadata,
813
+ )
814
+
815
+ @GoogleBaseHook.fallback_to_default_project_id
816
+ def create_backup(
817
+ self,
818
+ backup_id: str,
819
+ backup: alloydb_v1.Backup | dict,
820
+ location: str,
821
+ project_id: str = PROVIDE_PROJECT_ID,
822
+ request_id: str | None = None,
823
+ validate_only: bool = False,
824
+ retry: Retry | _MethodDefault = DEFAULT,
825
+ timeout: float | None = None,
826
+ metadata: Sequence[tuple[str, str]] = (),
827
+ ) -> Operation:
828
+ """
829
+ Create a backup in a given Alloy DB cluster.
830
+
831
+ .. seealso::
832
+ For more details see API documentation:
833
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.CreateBackupRequest
834
+
835
+ :param backup_id: Required. ID of the backup to create.
836
+ :param backup: Required. The backup to create. For more details please see API documentation:
837
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Backup
838
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
839
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
840
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
841
+ so that if you must retry your request, the server ignores the request if it has already been
842
+ completed. The server guarantees that for at least 60 minutes since the first request.
843
+ For example, consider a situation where you make an initial request and the request times out.
844
+ If you make the request again with the same request ID, the server can check if the original operation
845
+ with the same request ID was received, and if so, ignores the second request.
846
+ This prevents clients from accidentally creating duplicate commitments.
847
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
848
+ (00000000-0000-0000-0000-000000000000).
849
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
850
+ the create request.
851
+ :param retry: Optional. Designation of what errors, if any, should be retried.
852
+ :param timeout: Optional. The timeout for this request.
853
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
854
+ """
855
+ client = self.get_alloy_db_admin_client()
856
+ return client.create_backup(
857
+ request={
858
+ "parent": client.common_location_path(project_id, location),
859
+ "backup_id": backup_id,
860
+ "backup": backup,
861
+ "request_id": request_id,
862
+ "validate_only": validate_only,
863
+ },
864
+ retry=retry,
865
+ timeout=timeout,
866
+ metadata=metadata,
867
+ )
868
+
869
+ @tenacity.retry(
870
+ stop=tenacity.stop_after_attempt(5),
871
+ wait=tenacity.wait_exponential(multiplier=1, max=10),
872
+ retry=tenacity.retry_if_exception_type(ValueError),
873
+ )
874
+ @GoogleBaseHook.fallback_to_default_project_id
875
+ def get_backup(
876
+ self,
877
+ backup_id: str,
878
+ location: str,
879
+ project_id: str = PROVIDE_PROJECT_ID,
880
+ retry: Retry | _MethodDefault = DEFAULT,
881
+ timeout: float | None = None,
882
+ metadata: Sequence[tuple[str, str]] = (),
883
+ ) -> alloydb_v1.Backup:
884
+ """
885
+ Get a backup in a given Alloy DB cluster.
886
+
887
+ .. seealso::
888
+ For more details see API documentation:
889
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.GetBackupRequest
890
+
891
+ :param backup_id: Required. ID of the backup to create.
892
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
893
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
894
+ :param retry: Optional. Designation of what errors, if any, should be retried.
895
+ :param timeout: Optional. The timeout for this request.
896
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
897
+ """
898
+ client = self.get_alloy_db_admin_client()
899
+ return client.get_backup(
900
+ request={
901
+ "name": client.backup_path(project_id, location, backup_id),
902
+ },
903
+ retry=retry,
904
+ timeout=timeout,
905
+ metadata=metadata,
906
+ )
907
+
908
+ @GoogleBaseHook.fallback_to_default_project_id
909
+ def update_backup(
910
+ self,
911
+ backup_id: str,
912
+ backup: alloydb_v1.Backup | dict,
913
+ location: str,
914
+ update_mask: FieldMask | dict | None = None,
915
+ allow_missing: bool = False,
916
+ project_id: str = PROVIDE_PROJECT_ID,
917
+ request_id: str | None = None,
918
+ validate_only: bool = False,
919
+ retry: Retry | _MethodDefault = DEFAULT,
920
+ timeout: float | None = None,
921
+ metadata: Sequence[tuple[str, str]] = (),
922
+ ) -> Operation:
923
+ """
924
+ Update an Alloy DB backup.
925
+
926
+ .. seealso::
927
+ For more details see API documentation:
928
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.UpdateBackupRequest
929
+
930
+ :param backup_id: Required. ID of the backup to update.
931
+ :param backup: Required. Backup to update. For more details please see API documentation:
932
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Backup
933
+ :param location: Required. The ID of the Google Cloud region where the cluster is located.
934
+ :param update_mask: Optional. Field mask is used to specify the fields to be overwritten in the
935
+ Backup resource by the update.
936
+ :param request_id: Optional. The ID of an existing request object.:param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
937
+ so that if you must retry your request, the server ignores the request if it has already been
938
+ completed. The server guarantees that for at least 60 minutes since the first request.
939
+ For example, consider a situation where you make an initial request and the request times out.
940
+ If you make the request again with the same request ID, the server can check if the original operation
941
+ with the same request ID was received, and if so, ignores the second request.
942
+ This prevents clients from accidentally creating duplicate commitments.
943
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
944
+ (00000000-0000-0000-0000-000000000000).
945
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
946
+ the create request.
947
+ :param allow_missing: Optional. If set to true, update succeeds even if cluster is not found.
948
+ In that case, a new cluster is created and update_mask is ignored.
949
+ :param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
950
+ :param retry: Optional. Designation of what errors, if any, should be retried.
951
+ :param timeout: Optional. The timeout for this request.
952
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
953
+ """
954
+ client = self.get_alloy_db_admin_client()
955
+ _backup = deepcopy(backup) if isinstance(backup, dict) else alloydb_v1.Backup.to_dict(backup)
956
+ _backup["name"] = client.backup_path(project_id, location, backup_id)
957
+ return client.update_backup(
958
+ request={
959
+ "update_mask": update_mask,
960
+ "backup": _backup,
961
+ "request_id": request_id,
962
+ "validate_only": validate_only,
963
+ "allow_missing": allow_missing,
964
+ },
965
+ retry=retry,
966
+ timeout=timeout,
967
+ metadata=metadata,
968
+ )
969
+
970
+ @GoogleBaseHook.fallback_to_default_project_id
971
+ def delete_backup(
972
+ self,
973
+ backup_id: str,
974
+ location: str,
975
+ project_id: str = PROVIDE_PROJECT_ID,
976
+ request_id: str | None = None,
977
+ validate_only: bool = False,
978
+ retry: Retry | _MethodDefault = DEFAULT,
979
+ timeout: float | None = None,
980
+ metadata: Sequence[tuple[str, str]] = (),
981
+ ):
982
+ """
983
+ Delete an Alloy DB backup.
984
+
985
+ .. seealso::
986
+ For more details see API documentation:
987
+ https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.DeleteBackupRequest
988
+
989
+ :param backup_id: Required. ID of the backup to delete.
990
+ :param location: Required. The ID of the Google Cloud region where the instance is located.
991
+ :param project_id: Optional. The ID of the Google Cloud project where the instance is located.
992
+ :param request_id: Optional. An optional request ID to identify requests. Specify a unique request ID
993
+ so that if you must retry your request, the server ignores the request if it has already been
994
+ completed. The server guarantees that for at least 60 minutes since the first request.
995
+ For example, consider a situation where you make an initial request and the request times out.
996
+ If you make the request again with the same request ID, the server can check if the original operation
997
+ with the same request ID was received, and if so, ignores the second request.
998
+ This prevents clients from accidentally creating duplicate commitments.
999
+ The request ID must be a valid UUID with the exception that zero UUID is not supported
1000
+ (00000000-0000-0000-0000-000000000000).
1001
+ :param validate_only: Optional. If set, performs request validation, but does not actually execute
1002
+ the delete request.
1003
+ :param retry: Optional. Designation of what errors, if any, should be retried.
1004
+ :param timeout: Optional. The timeout for this request.
1005
+ :param metadata: Optional. Strings which should be sent along with the request as metadata.
1006
+ """
1007
+ client = self.get_alloy_db_admin_client()
1008
+ return client.delete_backup(
1009
+ request={
1010
+ "name": client.backup_path(project_id, location, backup_id),
1011
+ "request_id": request_id,
1012
+ "validate_only": validate_only,
1013
+ },
1014
+ retry=retry,
1015
+ timeout=timeout,
1016
+ metadata=metadata,
1017
+ )