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

Commit

Permalink
chore: use gapic-generator-python 0.53.4 (#134)
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: googleapis/googleapis-gen@2ff001f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 1, 2021
1 parent aba052b commit 826da22
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 166 deletions.
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.cloud.bigquery_connection_v1.services.connection_service import pagers
from google.cloud.bigquery_connection_v1.types import connection
from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection
Expand Down Expand Up @@ -167,19 +169,19 @@ def __init__(

async def create_connection(
self,
request: gcbc_connection.CreateConnectionRequest = None,
request: Union[gcbc_connection.CreateConnectionRequest, dict] = None,
*,
parent: str = None,
connection: gcbc_connection.Connection = None,
connection_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcbc_connection.Connection:
r"""Creates a new connection.
Args:
request (:class:`google.cloud.bigquery_connection_v1.types.CreateConnectionRequest`):
request (Union[google.cloud.bigquery_connection_v1.types.CreateConnectionRequest, dict]):
The request object. The request for
[ConnectionService.CreateConnection][google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection].
parent (:class:`str`):
Expand Down Expand Up @@ -257,17 +259,17 @@ async def create_connection(

async def get_connection(
self,
request: connection.GetConnectionRequest = None,
request: Union[connection.GetConnectionRequest, 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]] = (),
) -> connection.Connection:
r"""Returns specified connection.
Args:
request (:class:`google.cloud.bigquery_connection_v1.types.GetConnectionRequest`):
request (Union[google.cloud.bigquery_connection_v1.types.GetConnectionRequest, dict]):
The request object. The request for
[ConnectionService.GetConnection][google.cloud.bigquery.connection.v1.ConnectionService.GetConnection].
name (:class:`str`):
Expand Down Expand Up @@ -339,17 +341,17 @@ async def get_connection(

async def list_connections(
self,
request: connection.ListConnectionsRequest = None,
request: Union[connection.ListConnectionsRequest, 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.ListConnectionsAsyncPager:
r"""Returns a list of connections in the given project.
Args:
request (:class:`google.cloud.bigquery_connection_v1.types.ListConnectionsRequest`):
request (Union[google.cloud.bigquery_connection_v1.types.ListConnectionsRequest, dict]):
The request object. The request for
[ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
parent (:class:`str`):
Expand Down Expand Up @@ -429,12 +431,12 @@ async def list_connections(

async def update_connection(
self,
request: gcbc_connection.UpdateConnectionRequest = None,
request: Union[gcbc_connection.UpdateConnectionRequest, dict] = None,
*,
name: str = None,
connection: gcbc_connection.Connection = 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]] = (),
) -> gcbc_connection.Connection:
Expand All @@ -443,7 +445,7 @@ async def update_connection(
are in the update field mask.
Args:
request (:class:`google.cloud.bigquery_connection_v1.types.UpdateConnectionRequest`):
request (Union[google.cloud.bigquery_connection_v1.types.UpdateConnectionRequest, dict]):
The request object. The request for
[ConnectionService.UpdateConnection][google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection].
name (:class:`str`):
Expand Down Expand Up @@ -523,17 +525,17 @@ async def update_connection(

async def delete_connection(
self,
request: connection.DeleteConnectionRequest = None,
request: Union[connection.DeleteConnectionRequest, 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:
r"""Deletes connection and associated credential.
Args:
request (:class:`google.cloud.bigquery_connection_v1.types.DeleteConnectionRequest`):
request (Union[google.cloud.bigquery_connection_v1.types.DeleteConnectionRequest, dict]):
The request object. The request for
[ConnectionService.DeleteConnectionRequest][].
name (:class:`str`):
Expand Down Expand Up @@ -597,10 +599,10 @@ async def delete_connection(

async def get_iam_policy(
self,
request: iam_policy_pb2.GetIamPolicyRequest = None,
request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand All @@ -609,7 +611,7 @@ async def get_iam_policy(
not have a policy set.
Args:
request (:class:`google.iam.v1.iam_policy_pb2.GetIamPolicyRequest`):
request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]):
The request object. Request message for `GetIamPolicy`
method.
resource (:class:`str`):
Expand Down Expand Up @@ -725,10 +727,10 @@ async def get_iam_policy(

async def set_iam_policy(
self,
request: iam_policy_pb2.SetIamPolicyRequest = None,
request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand All @@ -739,7 +741,7 @@ async def set_iam_policy(
``PERMISSION_DENIED`` errors.
Args:
request (:class:`google.iam.v1.iam_policy_pb2.SetIamPolicyRequest`):
request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]):
The request object. Request message for `SetIamPolicy`
method.
resource (:class:`str`):
Expand Down Expand Up @@ -855,11 +857,11 @@ async def set_iam_policy(

async def test_iam_permissions(
self,
request: iam_policy_pb2.TestIamPermissionsRequest = None,
request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None,
*,
resource: str = None,
permissions: Sequence[str] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> iam_policy_pb2.TestIamPermissionsResponse:
Expand All @@ -873,7 +875,7 @@ async def test_iam_permissions(
warning.
Args:
request (:class:`google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest`):
request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]):
The request object. Request message for
`TestIamPermissions` method.
resource (:class:`str`):
Expand Down
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.bigquery_connection_v1.services.connection_service import pagers
from google.cloud.bigquery_connection_v1.types import connection
from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection
Expand Down Expand Up @@ -360,7 +362,7 @@ def create_connection(
parent: str = None,
connection: gcbc_connection.Connection = None,
connection_id: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcbc_connection.Connection:
Expand Down Expand Up @@ -448,7 +450,7 @@ def get_connection(
request: Union[connection.GetConnectionRequest, 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]] = (),
) -> connection.Connection:
Expand Down Expand Up @@ -520,7 +522,7 @@ def list_connections(
request: Union[connection.ListConnectionsRequest, 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.ListConnectionsPager:
Expand Down Expand Up @@ -602,7 +604,7 @@ def update_connection(
name: str = None,
connection: gcbc_connection.Connection = 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]] = (),
) -> gcbc_connection.Connection:
Expand Down Expand Up @@ -694,7 +696,7 @@ def delete_connection(
request: Union[connection.DeleteConnectionRequest, 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 @@ -758,7 +760,7 @@ def get_iam_policy(
request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand Down Expand Up @@ -885,7 +887,7 @@ def set_iam_policy(
request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None,
*,
resource: str = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> policy_pb2.Policy:
Expand Down Expand Up @@ -1015,7 +1017,7 @@ def test_iam_permissions(
*,
resource: str = None,
permissions: Sequence[str] = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> iam_policy_pb2.TestIamPermissionsResponse:
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 ConnectionServiceTransport(abc.ABC):
"""Abstract transport class for ConnectionService."""
Expand Down Expand Up @@ -102,7 +92,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 @@ -135,29 +125,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 @@ -20,7 +20,6 @@
from google.api_core import grpc_helpers_async # 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
19 changes: 19 additions & 0 deletions google/cloud/bigquery_connection_v1/types/connection.py
Expand Up @@ -148,6 +148,13 @@ class Connection(proto.Message):
r"""Configuration parameters to establish connection with an
external data source, except the credential attributes.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
name (str):
The resource name of the connection in the form of:
Expand All @@ -159,10 +166,13 @@ class Connection(proto.Message):
User provided description.
cloud_sql (google.cloud.bigquery_connection_v1.types.CloudSqlProperties):
Cloud SQL properties.
This field is a member of `oneof`_ ``properties``.
aws (google.cloud.bigquery_connection_v1.types.AwsProperties):
Amazon Web Services (AWS) properties.
This field is a member of `oneof`_ ``properties``.
cloud_spanner (google.cloud.bigquery_connection_v1.types.CloudSpannerProperties):
Cloud Spanner properties.
This field is a member of `oneof`_ ``properties``.
creation_time (int):
Output only. The creation timestamp of the
connection.
Expand Down Expand Up @@ -251,14 +261,23 @@ class CloudSpannerProperties(proto.Message):
class AwsProperties(proto.Message):
r"""Connection properties specific to Amazon Web Services (AWS).
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
cross_account_role (google.cloud.bigquery_connection_v1.types.AwsCrossAccountRole):
Authentication using Google owned AWS IAM
user's access key to assume into customer's AWS
IAM Role.
This field is a member of `oneof`_ ``authentication_method``.
access_role (google.cloud.bigquery_connection_v1.types.AwsAccessRole):
Authentication using Google owned service
account to assume into customer's AWS IAM Role.
This field is a member of `oneof`_ ``authentication_method``.
"""

cross_account_role = proto.Field(
Expand Down

0 comments on commit 826da22

Please sign in to comment.