Skip to content

Commit

Permalink
feat: add support for asynchronous long running operations (#724)
Browse files Browse the repository at this point in the history
* feat: implement `OperationsRestAsyncTransport` to support long running operations (#700)

* feat: Add OperationsRestAsyncTransport to support long running operations

* update TODO comment

* update TODO comment

* address feedback

* address feedback

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix mypy and lint issues

* minor fix

* add no cover

* fix no cover tag

* link coverage issue

* silence coverage issue

* fix statement name error

* address PR feedback

* address PR feedback

* address PR comments

---------

Co-authored-by: ohmayr <[email protected]>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* feat: implement async client for LROs (#707)

* feat: implement `AbstractOperationsAsyncClient` to support long running operations

* remove coverage guards

* address presubmit failures

* fix coverage for cancel operation

* tests cleanup

* fix incorrect tests

* file bugs

* add auth import

* address PR comments

* address PR comments

* fix unit tests and address more comments

* disable retry parameter

* add retry parameter

* address PR comments

---------

Co-authored-by: ohmayr <[email protected]>
Co-authored-by: ohmayr <[email protected]>

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Anthonios Partheniou <[email protected]>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 7, 2024
1 parent 84bf637 commit aaed69b
Show file tree
Hide file tree
Showing 14 changed files with 2,208 additions and 551 deletions.
3 changes: 2 additions & 1 deletion google/api_core/client_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class ClientInfo(object):
user_agent (Optional[str]): Prefix to the user agent header. This is
used to supply information such as application name or partner tool.
Recommended format: ``application-or-tool-ID/major.minor.version``.
rest_version (Optional[str]): The requests library version.
rest_version (Optional[str]): A string with labeled versions of the
dependencies used for REST transport.
"""

def __init__(
Expand Down
2 changes: 2 additions & 0 deletions google/api_core/gapic_v1/client_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class ClientInfo(client_info.ClientInfo):
user_agent (Optional[str]): Prefix to the user agent header. This is
used to supply information such as application name or partner tool.
Recommended format: ``application-or-tool-ID/major.minor.version``.
rest_version (Optional[str]): A string with labeled versions of the
dependencies used for REST transport.
"""

def to_grpc_metadata(self):
Expand Down
19 changes: 15 additions & 4 deletions google/api_core/operations_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

"""Package for interacting with the google.longrunning.operations meta-API."""

from google.api_core.operations_v1.abstract_operations_client import (
AbstractOperationsClient,
)
from google.api_core.operations_v1.abstract_operations_client import AbstractOperationsClient
from google.api_core.operations_v1.operations_async_client import OperationsAsyncClient
from google.api_core.operations_v1.operations_client import OperationsClient
from google.api_core.operations_v1.transports.rest import OperationsRestTransport
Expand All @@ -25,5 +23,18 @@
"AbstractOperationsClient",
"OperationsAsyncClient",
"OperationsClient",
"OperationsRestTransport",
"OperationsRestTransport"
]

try:
from google.api_core.operations_v1.transports.rest_asyncio import (
AsyncOperationsRestTransport,
)
from google.api_core.operations_v1.operations_rest_client_async import AsyncOperationsRestClient

__all__ += ["AsyncOperationsRestClient", "AsyncOperationsRestTransport"]
except ImportError:
# This import requires the `async_rest` extra.
# Don't raise an exception if `AsyncOperationsRestTransport` cannot be imported
# as other transports are still available.
pass
Loading

0 comments on commit aaed69b

Please sign in to comment.