Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

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

docs: list oneofs in docstring
fix(deps): require google-api-core >= 1.28.0
fix(deps): drop packaging dependency

committer: busunkim96@
PiperOrigin-RevId: 406468269

Source-Link: googleapis/googleapis@83d81b0

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Nov 1, 2021
1 parent 45e8a9f commit b4d2c35
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 151 deletions.
46 changes: 24 additions & 22 deletions google/cloud/data_fusion_v1/services/data_fusion/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
from typing import Dict, Sequence, Tuple, Type, Union
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.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.data_fusion_v1.services.data_fusion import pagers
Expand Down Expand Up @@ -165,18 +167,18 @@ def __init__(

async def list_available_versions(
self,
request: datafusion.ListAvailableVersionsRequest = None,
request: Union[datafusion.ListAvailableVersionsRequest, 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.ListAvailableVersionsAsyncPager:
r"""Lists possible versions for Data Fusion instances in
the specified project and location.
Args:
request (:class:`google.cloud.data_fusion_v1.types.ListAvailableVersionsRequest`):
request (Union[google.cloud.data_fusion_v1.types.ListAvailableVersionsRequest, dict]):
The request object. Request message for the list
available versions request.
parent (:class:`str`):
Expand Down Expand Up @@ -248,17 +250,17 @@ async def list_available_versions(

async def list_instances(
self,
request: datafusion.ListInstancesRequest = None,
request: Union[datafusion.ListInstancesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListInstancesAsyncPager:
r"""Lists Data Fusion instances in the specified project
and location.
Args:
request (:class:`google.cloud.data_fusion_v1.types.ListInstancesRequest`):
request (Union[google.cloud.data_fusion_v1.types.ListInstancesRequest, dict]):
The request object. Request message for listing Data
Fusion instances.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -307,16 +309,16 @@ async def list_instances(

async def get_instance(
self,
request: datafusion.GetInstanceRequest = None,
request: Union[datafusion.GetInstanceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> datafusion.Instance:
r"""Gets details of a single Data Fusion instance.
Args:
request (:class:`google.cloud.data_fusion_v1.types.GetInstanceRequest`):
request (Union[google.cloud.data_fusion_v1.types.GetInstanceRequest, dict]):
The request object. Request message for getting details
about a Data Fusion instance.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -354,20 +356,20 @@ async def get_instance(

async def create_instance(
self,
request: datafusion.CreateInstanceRequest = None,
request: Union[datafusion.CreateInstanceRequest, dict] = None,
*,
parent: str = None,
instance: datafusion.Instance = None,
instance_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new Data Fusion instance in the specified
project and location.
Args:
request (:class:`google.cloud.data_fusion_v1.types.CreateInstanceRequest`):
request (Union[google.cloud.data_fusion_v1.types.CreateInstanceRequest, dict]):
The request object. Request message for creating a Data
Fusion instance.
parent (:class:`str`):
Expand Down Expand Up @@ -454,17 +456,17 @@ async def create_instance(

async def delete_instance(
self,
request: datafusion.DeleteInstanceRequest = None,
request: Union[datafusion.DeleteInstanceRequest, 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]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes a single Date Fusion instance.
Args:
request (:class:`google.cloud.data_fusion_v1.types.DeleteInstanceRequest`):
request (Union[google.cloud.data_fusion_v1.types.DeleteInstanceRequest, dict]):
The request object. Request message for deleting a Data
Fusion instance.
name (:class:`str`):
Expand Down Expand Up @@ -547,18 +549,18 @@ async def delete_instance(

async def update_instance(
self,
request: datafusion.UpdateInstanceRequest = None,
request: Union[datafusion.UpdateInstanceRequest, dict] = None,
*,
instance: datafusion.Instance = 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]] = (),
) -> operation_async.AsyncOperation:
r"""Updates a single Data Fusion instance.
Args:
request (:class:`google.cloud.data_fusion_v1.types.UpdateInstanceRequest`):
request (Union[google.cloud.data_fusion_v1.types.UpdateInstanceRequest, dict]):
The request object.
instance (:class:`google.cloud.data_fusion_v1.types.Instance`):
The instance resource that replaces
Expand Down Expand Up @@ -649,17 +651,17 @@ async def update_instance(

async def restart_instance(
self,
request: datafusion.RestartInstanceRequest = None,
request: Union[datafusion.RestartInstanceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Restart a single Data Fusion instance.
At the end of an operation instance is fully restarted.
Args:
request (:class:`google.cloud.data_fusion_v1.types.RestartInstanceRequest`):
request (Union[google.cloud.data_fusion_v1.types.RestartInstanceRequest, dict]):
The request object. Request message for restarting a
Data Fusion instance.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down
16 changes: 9 additions & 7 deletions google/cloud/data_fusion_v1/services/data_fusion/client.py
Original file line number Diff line number Diff line change
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.data_fusion_v1.services.data_fusion import pagers
Expand Down Expand Up @@ -358,7 +360,7 @@ def list_available_versions(
request: Union[datafusion.ListAvailableVersionsRequest, 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.ListAvailableVersionsPager:
Expand Down Expand Up @@ -440,7 +442,7 @@ def list_instances(
self,
request: Union[datafusion.ListInstancesRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListInstancesPager:
Expand Down Expand Up @@ -500,7 +502,7 @@ def get_instance(
self,
request: Union[datafusion.GetInstanceRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> datafusion.Instance:
Expand Down Expand Up @@ -551,7 +553,7 @@ def create_instance(
parent: str = None,
instance: datafusion.Instance = None,
instance_id: str = 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 @@ -649,7 +651,7 @@ def delete_instance(
request: Union[datafusion.DeleteInstanceRequest, 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]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -743,7 +745,7 @@ def update_instance(
*,
instance: datafusion.Instance = 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]] = (),
) -> operation.Operation:
Expand Down Expand Up @@ -843,7 +845,7 @@ def restart_instance(
self,
request: Union[datafusion.RestartInstanceRequest, 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
Original file line number Diff line number Diff line change
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 @@ -39,15 +38,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 DataFusionTransport(abc.ABC):
"""Abstract transport class for DataFusion."""
Expand Down Expand Up @@ -97,7 +87,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 @@ -130,29 +120,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 @@ -191,7 +158,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
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,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
Original file line number Diff line number Diff line change
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 @@ -161,7 +160,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
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.15.0",
"packaging >= 14.3",
]

package_root = os.path.abspath(os.path.dirname(__file__))
Expand Down
4 changes: 1 addition & 3 deletions testing/constraints-3.6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
# Pin the version to the lower bound.
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
# Then this file should have google-cloud-foo==1.14.0
google-api-core==1.26.0
google-api-core==1.28.0
proto-plus==1.15.0
packaging==14.3
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 si transitively required through google-api-core
Loading

0 comments on commit b4d2c35

Please sign in to comment.