Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
moiseenkov committed Dec 27, 2024
1 parent 951aa38 commit 61adc58
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 12 deletions.
80 changes: 72 additions & 8 deletions providers/src/airflow/providers/google/cloud/hooks/alloy_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,15 @@ def create_cluster(
https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Cluster
:param location: Required. The ID of the Google Cloud region where the cluster is located.
:param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param validate_only: Optional. If set, performs request validation, but does not actually execute
the create request.
:param retry: Optional. Designation of what errors, if any, should be retried.
Expand Down Expand Up @@ -134,7 +142,15 @@ def create_secondary_cluster(
https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Cluster
:param location: Required. The ID of the Google Cloud region where the cluster is located.
:param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param validate_only: Optional. If set, performs request validation, but does not actually execute
the create request.
:param retry: Optional. Designation of what errors, if any, should be retried.
Expand Down Expand Up @@ -215,7 +231,15 @@ def update_cluster(
:param location: Required. The ID of the Google Cloud region where the cluster is located.
:param update_mask: Optional. Field mask is used to specify the fields to be overwritten in the
Cluster resource by the update.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param validate_only: Optional. If set, performs request validation, but does not actually execute
the create request.
:param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
Expand Down Expand Up @@ -265,7 +289,15 @@ def delete_cluster(
:param cluster_id: Required. ID of the cluster to delete.
:param location: Required. The ID of the Google Cloud region where the cluster is located.
:param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param etag: Optional. The current etag of the Cluster. If an etag is provided and does not match the
current etag of the Cluster, deletion will be blocked and an ABORTED error will be returned.
:param validate_only: Optional. If set, performs request validation, but does not actually execute
Expand Down Expand Up @@ -316,7 +348,15 @@ def create_instance(
https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Instance
:param location: Required. The ID of the Google Cloud region where the cluster is located.
:param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param validate_only: Optional. If set, performs request validation, but does not actually execute
the create request.
:param retry: Optional. Designation of what errors, if any, should be retried.
Expand Down Expand Up @@ -364,7 +404,15 @@ def create_secondary_instance(
https://cloud.google.com/python/docs/reference/alloydb/latest/google.cloud.alloydb_v1.types.Instance
:param location: Required. The ID of the Google Cloud region where the cluster is located.
:param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param validate_only: Optional. If set, performs request validation, but does not actually execute
the create request.
:param retry: Optional. Designation of what errors, if any, should be retried.
Expand Down Expand Up @@ -449,7 +497,15 @@ def update_instance(
:param location: Required. The ID of the Google Cloud region where the cluster is located.
:param update_mask: Optional. Field mask is used to specify the fields to be overwritten in the
Instance resource by the update.
:param request_id: Optional. The ID of an existing request object.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param validate_only: Optional. If set, performs request validation, but does not actually execute
the create request.
:param project_id: Optional. The ID of the Google Cloud project where the cluster is located.
Expand Down Expand Up @@ -502,7 +558,15 @@ def delete_instance(
:param cluster_id: Required. ID of the cluster.
:param location: Required. The ID of the Google Cloud region where the instance is located.
:param project_id: Optional. The ID of the Google Cloud project where the instance is located.
: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
so that if you must retry your request, the server ignores the request if it has already been
completed. The server guarantees that for at least 60 minutes since the first request.
For example, consider a situation where you make an initial request and the request times out.
If you make the request again with the same request ID, the server can check if the original operation
with the same request ID was received, and if so, ignores the second request.
This prevents clients from accidentally creating duplicate commitments.
The request ID must be a valid UUID with the exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
:param etag: Optional. The current etag of the Instance. If an etag is provided and does not match the
current etag of the Instance, deletion will be blocked and an ABORTED error will be returned.
:param validate_only: Optional. If set, performs request validation, but does not actually execute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _get_cluster(self) -> proto.Message | None:
return result
return None

def execute(self, context: Context) -> proto.Message:
def execute(self, context: Context) -> dict | None:
AlloyDBClusterLink.persist(
context=context,
task_instance=self,
Expand Down Expand Up @@ -331,7 +331,7 @@ def __init__(
self.update_mask = update_mask
self.allow_missing = allow_missing

def execute(self, context: Context) -> proto.Message | None:
def execute(self, context: Context) -> dict | None:
AlloyDBClusterLink.persist(
context=context,
task_instance=self,
Expand Down Expand Up @@ -542,7 +542,7 @@ def _get_instance(self) -> proto.Message | None:
return result
return None

def execute(self, context: Context) -> proto.Message:
def execute(self, context: Context) -> dict | None:
AlloyDBClusterLink.persist(
context=context,
task_instance=self,
Expand Down Expand Up @@ -651,7 +651,7 @@ def __init__(
self.update_mask = update_mask
self.allow_missing = allow_missing

def execute(self, context: Context) -> proto.Message | None:
def execute(self, context: Context) -> dict | None:
AlloyDBClusterLink.persist(
context=context,
task_instance=self,
Expand Down

0 comments on commit 61adc58

Please sign in to comment.