aboutsummaryrefslogtreecommitdiff
path: root/google
diff options
context:
space:
mode:
authorBu Sun Kim <8822365+busunkim96@users.noreply.github.com>2021-02-11 18:06:02 -0700
committerGitHub <noreply@github.com>2021-02-12 01:06:02 +0000
commit7271b23afddb032e49e957525704d0cd5bfa4c65 (patch)
tree377bccc67298e5831b28bf2d25a719c7ce25ea63 /google
parent7273090a011c8b840d2e90e29dda3fc8f0eed792 (diff)
downloadpython-api-core-7271b23afddb032e49e957525704d0cd5bfa4c65.tar.gz
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.
Diffstat (limited to 'google')
-rw-r--r--google/api_core/operations_v1/operations_async_client.py19
1 files changed, 19 insertions, 0 deletions
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)