aboutsummaryrefslogtreecommitdiff
path: root/google/api_core/operation_async.py
diff options
context:
space:
mode:
Diffstat (limited to 'google/api_core/operation_async.py')
-rw-r--r--google/api_core/operation_async.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/google/api_core/operation_async.py b/google/api_core/operation_async.py
index 89500af..b137235 100644
--- a/google/api_core/operation_async.py
+++ b/google/api_core/operation_async.py
@@ -189,7 +189,7 @@ class AsyncOperation(async_future.AsyncFuture):
)
-def from_gapic(operation, operations_client, result_type, **kwargs):
+def from_gapic(operation, operations_client, result_type, grpc_metadata=None, **kwargs):
"""Create an operation future from a gapic client.
This interacts with the long-running operations `service`_ (specific
@@ -204,12 +204,14 @@ def from_gapic(operation, operations_client, result_type, **kwargs):
operations_client (google.api_core.operations_v1.OperationsClient):
The operations client.
result_type (:func:`type`): The protobuf result type.
+ grpc_metadata (Optional[List[Tuple[str, str]]]): Additional metadata to pass
+ to the rpc.
kwargs: Keyword args passed into the :class:`Operation` constructor.
Returns:
~.api_core.operation.Operation: The operation future to track the given
operation.
"""
- refresh = functools.partial(operations_client.get_operation, operation.name)
- cancel = functools.partial(operations_client.cancel_operation, operation.name)
+ refresh = functools.partial(operations_client.get_operation, operation.name, metadata=grpc_metadata)
+ cancel = functools.partial(operations_client.cancel_operation, operation.name, metadata=grpc_metadata)
return AsyncOperation(operation, refresh, cancel, result_type, **kwargs)