From 7271b23afddb032e49e957525704d0cd5bfa4c65 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Thu, 11 Feb 2021 18:06:02 -0700 Subject: fix: add operation name to x-goog-request-params in async client (#137) Pass the operation name in the `x-goog-request-params`header. Same as #133 for the async operations client. --- .../api_core/operations_v1/operations_async_client.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'google') diff --git a/google/api_core/operations_v1/operations_async_client.py b/google/api_core/operations_v1/operations_async_client.py index 5d7b26c..b3d0135 100644 --- a/google/api_core/operations_v1/operations_async_client.py +++ b/google/api_core/operations_v1/operations_async_client.py @@ -120,6 +120,11 @@ class OperationsAsyncClient: subclass will be raised. """ request = operations_pb2.GetOperationRequest(name=name) + + # Add routing header + metadata = metadata or [] + metadata.append(gapic_v1.routing_header.to_grpc_metadata({"name": name})) + return await self._get_operation(request, retry=retry, timeout=timeout, metadata=metadata) async def list_operations( @@ -182,6 +187,10 @@ class OperationsAsyncClient: # Create the request object. request = operations_pb2.ListOperationsRequest(name=name, filter=filter_) + # Add routing header + metadata = metadata or [] + metadata.append(gapic_v1.routing_header.to_grpc_metadata({"name": name})) + # Create the method used to fetch pages method = functools.partial(self._list_operations, retry=retry, timeout=timeout, metadata=metadata) @@ -246,6 +255,11 @@ class OperationsAsyncClient: """ # Create the request object. request = operations_pb2.CancelOperationRequest(name=name) + + # Add routing header + metadata = metadata or [] + metadata.append(gapic_v1.routing_header.to_grpc_metadata({"name": name})) + await self._cancel_operation(request, retry=retry, timeout=timeout, metadata=metadata) async def delete_operation( @@ -292,4 +306,9 @@ class OperationsAsyncClient: """ # Create the request object. request = operations_pb2.DeleteOperationRequest(name=name) + + # Add routing header + metadata = metadata or [] + metadata.append(gapic_v1.routing_header.to_grpc_metadata({"name": name})) + await self._delete_operation(request, retry=retry, timeout=timeout, metadata=metadata) -- cgit v1.2.3