Skip to content

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#268)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

docs: list oneofs in docstring
fix(deps): drop packaging dependency

committer: busunkim96@
PiperOrigin-RevId: 406468269

Source-Link: googleapis/googleapis@83d81b0

Source-Link: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 1, 2021
1 parent b6825a2 commit ce2e5ef
Show file tree
Hide file tree
Showing 37 changed files with 298 additions and 818 deletions.
118 changes: 60 additions & 58 deletions google/cloud/pubsublite_v1/services/admin_service/async_client.py

Large diffs are not rendered by default.

40 changes: 21 additions & 19 deletions google/cloud/pubsublite_v1/services/admin_service/client.py
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.pubsublite_v1.services.admin_service import pagers
Expand Down Expand Up @@ -391,7 +393,7 @@ def create_topic(
parent: str = None,
topic: common.Topic = None,
topic_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Topic:
Expand Down Expand Up @@ -480,7 +482,7 @@ def get_topic(
request: Union[admin.GetTopicRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Topic:
Expand Down Expand Up @@ -548,7 +550,7 @@ def get_topic_partitions(
request: Union[admin.GetTopicPartitionsRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> admin.TopicPartitions:
Expand Down Expand Up @@ -617,7 +619,7 @@ def list_topics(
request: Union[admin.ListTopicsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListTopicsPager:
Expand Down Expand Up @@ -697,7 +699,7 @@ def update_topic(
*,
topic: common.Topic = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Topic:
Expand Down Expand Up @@ -776,7 +778,7 @@ def delete_topic(
request: Union[admin.DeleteTopicRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down Expand Up @@ -839,7 +841,7 @@ def list_topic_subscriptions(
request: Union[admin.ListTopicSubscriptionsRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListTopicSubscriptionsPager:
Expand Down Expand Up @@ -920,7 +922,7 @@ def create_subscription(
parent: str = None,
subscription: common.Subscription = None,
subscription_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Subscription:
Expand Down Expand Up @@ -1011,7 +1013,7 @@ def get_subscription(
request: Union[admin.GetSubscriptionRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Subscription:
Expand Down Expand Up @@ -1082,7 +1084,7 @@ def list_subscriptions(
request: Union[admin.ListSubscriptionsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListSubscriptionsPager:
Expand Down Expand Up @@ -1163,7 +1165,7 @@ def update_subscription(
*,
subscription: common.Subscription = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Subscription:
Expand Down Expand Up @@ -1244,7 +1246,7 @@ def delete_subscription(
request: Union[admin.DeleteSubscriptionRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down Expand Up @@ -1306,7 +1308,7 @@ def seek_subscription(
self,
request: Union[admin.SeekSubscriptionRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -1395,7 +1397,7 @@ def create_reservation(
parent: str = None,
reservation: common.Reservation = None,
reservation_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Reservation:
Expand Down Expand Up @@ -1486,7 +1488,7 @@ def get_reservation(
request: Union[admin.GetReservationRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Reservation:
Expand Down Expand Up @@ -1557,7 +1559,7 @@ def list_reservations(
request: Union[admin.ListReservationsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListReservationsPager:
Expand Down Expand Up @@ -1638,7 +1640,7 @@ def update_reservation(
*,
reservation: common.Reservation = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> common.Reservation:
Expand Down Expand Up @@ -1719,7 +1721,7 @@ def delete_reservation(
request: Union[admin.DeleteReservationRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
Expand Down Expand Up @@ -1783,7 +1785,7 @@ def list_reservation_topics(
request: Union[admin.ListReservationTopicsRequest, dict] = None,
*,
name: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListReservationTopicsPager:
Expand Down
Expand Up @@ -15,7 +15,6 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import packaging.version
import pkg_resources

import google.auth # type: ignore
Expand All @@ -41,15 +40,6 @@
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()

try:
# google.auth.__version__ was added in 1.26.0
_GOOGLE_AUTH_VERSION = google.auth.__version__
except AttributeError:
try: # try pkg_resources if it is available
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
except pkg_resources.DistributionNotFound: # pragma: NO COVER
_GOOGLE_AUTH_VERSION = None


class AdminServiceTransport(abc.ABC):
"""Abstract transport class for AdminService."""
Expand Down Expand Up @@ -99,7 +89,7 @@ def __init__(
host += ":443"
self._host = host

scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
self._scopes = scopes
Expand Down Expand Up @@ -132,29 +122,6 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# TODO(busunkim): This method is in the base transport
# to avoid duplicating code across the transport classes. These functions
# should be deleted once the minimum required versions of google-auth is increased.

# TODO: Remove this function once google-auth >= 1.25.0 is required
@classmethod
def _get_scopes_kwargs(
cls, host: str, scopes: Optional[Sequence[str]]
) -> Dict[str, Optional[Sequence[str]]]:
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""

scopes_kwargs = {}

if _GOOGLE_AUTH_VERSION and (
packaging.version.parse(_GOOGLE_AUTH_VERSION)
>= packaging.version.parse("1.25.0")
):
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
else:
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}

return scopes_kwargs

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down Expand Up @@ -233,7 +200,7 @@ def close(self):
raise NotImplementedError()

@property
def operations_client(self) -> operations_v1.OperationsClient:
def operations_client(self):
"""Return the client designed to process long-running operations."""
raise NotImplementedError()

Expand Down
Expand Up @@ -116,7 +116,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
Expand Up @@ -21,7 +21,6 @@
from google.api_core import operations_v1 # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
import packaging.version

import grpc # type: ignore
from grpc.experimental import aio # type: ignore
Expand Down Expand Up @@ -163,7 +162,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
self._operations_client = None
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None

if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
Expand Down
18 changes: 10 additions & 8 deletions google/cloud/pubsublite_v1/services/cursor_service/async_client.py
Expand Up @@ -28,13 +28,15 @@
)
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.pubsublite_v1.services.cursor_service import pagers
from google.cloud.pubsublite_v1.types import cursor
from .transports.base import CursorServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -178,7 +180,7 @@ def streaming_commit_cursor(
self,
requests: AsyncIterator[cursor.StreamingCommitCursorRequest] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> Awaitable[AsyncIterable[cursor.StreamingCommitCursorResponse]]:
Expand Down Expand Up @@ -218,16 +220,16 @@ def streaming_commit_cursor(

async def commit_cursor(
self,
request: cursor.CommitCursorRequest = None,
request: Union[cursor.CommitCursorRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> cursor.CommitCursorResponse:
r"""Updates the committed cursor.
Args:
request (:class:`google.cloud.pubsublite_v1.types.CommitCursorRequest`):
request (Union[google.cloud.pubsublite_v1.types.CommitCursorRequest, dict]):
The request object. Request for CommitCursor.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -279,18 +281,18 @@ async def commit_cursor(

async def list_partition_cursors(
self,
request: cursor.ListPartitionCursorsRequest = None,
request: Union[cursor.ListPartitionCursorsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListPartitionCursorsAsyncPager:
r"""Returns all committed cursor information for a
subscription.
Args:
request (:class:`google.cloud.pubsublite_v1.types.ListPartitionCursorsRequest`):
request (Union[google.cloud.pubsublite_v1.types.ListPartitionCursorsRequest, dict]):
The request object. Request for ListPartitionCursors.
parent (:class:`str`):
Required. The subscription for which to retrieve
Expand Down
8 changes: 5 additions & 3 deletions google/cloud/pubsublite_v1/services/cursor_service/client.py
Expand Up @@ -30,6 +30,8 @@
from google.auth.exceptions import MutualTLSChannelError # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]

from google.cloud.pubsublite_v1.services.cursor_service import pagers
from google.cloud.pubsublite_v1.types import cursor
from .transports.base import CursorServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -353,7 +355,7 @@ def streaming_commit_cursor(
self,
requests: Iterator[cursor.StreamingCommitCursorRequest] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> Iterable[cursor.StreamingCommitCursorResponse]:
Expand Down Expand Up @@ -391,7 +393,7 @@ def commit_cursor(
self,
request: Union[cursor.CommitCursorRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> cursor.CommitCursorResponse:
Expand Down Expand Up @@ -441,7 +443,7 @@ def list_partition_cursors(
request: Union[cursor.ListPartitionCursorsRequest, dict] = None,
*,
parent: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListPartitionCursorsPager:
Expand Down

0 comments on commit ce2e5ef

Please sign in to comment.