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

Commit

Permalink
chore: upgrade to gapic-generator-python 0.32.0
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 327246996

Source-Author: Google APIs <noreply@google.com>
Source-Date: Tue Aug 18 09:48:39 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 09c2579cfa9f37eb91e21ba53c0eaca1481a13cf
Source-Link: googleapis/googleapis@09c2579
  • Loading branch information
yoshi-automation committed Aug 19, 2020
1 parent 6de0d0d commit 81b14ce
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 35 deletions.
Expand Up @@ -35,7 +35,7 @@
from google.iam.v1 import policy_pb2 as policy # type: ignore
from google.protobuf import field_mask_pb2 as field_mask # type: ignore

from .transports.base import ConnectionServiceTransport
from .transports.base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import ConnectionServiceGrpcAsyncIOTransport
from .client import ConnectionServiceClient

Expand Down Expand Up @@ -63,6 +63,7 @@ def __init__(
credentials: credentials.Credentials = None,
transport: Union[str, ConnectionServiceTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the connection service client.
Expand Down Expand Up @@ -95,7 +96,10 @@ def __init__(
"""

self._client = ConnectionServiceClient(
credentials=credentials, transport=transport, client_options=client_options,
credentials=credentials,
transport=transport,
client_options=client_options,
client_info=client_info,
)

async def create_connection(
Expand Down Expand Up @@ -172,7 +176,7 @@ async def create_connection(
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.create_connection,
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand Down Expand Up @@ -252,7 +256,7 @@ async def get_connection(
),
),
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand Down Expand Up @@ -334,7 +338,7 @@ async def list_connections(
),
),
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand Down Expand Up @@ -432,7 +436,7 @@ async def update_connection(
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.update_connection,
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand Down Expand Up @@ -505,7 +509,7 @@ async def delete_connection(
),
),
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand Down Expand Up @@ -648,7 +652,7 @@ async def get_iam_policy(
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.get_iam_policy,
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand Down Expand Up @@ -794,7 +798,7 @@ async def set_iam_policy(
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.set_iam_policy,
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand Down Expand Up @@ -890,7 +894,7 @@ async def test_iam_permissions(
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.test_iam_permissions,
default_timeout=60.0,
client_info=_client_info,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
Expand All @@ -907,13 +911,13 @@ async def test_iam_permissions(


try:
_client_info = gapic_v1.client_info.ClientInfo(
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-bigquery-connection",
).version,
)
except pkg_resources.DistributionNotFound:
_client_info = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()


__all__ = ("ConnectionServiceAsyncClient",)
Expand Up @@ -37,7 +37,7 @@
from google.iam.v1 import policy_pb2 as policy # type: ignore
from google.protobuf import field_mask_pb2 as field_mask # type: ignore

from .transports.base import ConnectionServiceTransport
from .transports.base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import ConnectionServiceGrpcTransport
from .transports.grpc_asyncio import ConnectionServiceGrpcAsyncIOTransport

Expand Down Expand Up @@ -156,6 +156,7 @@ def __init__(
credentials: credentials.Credentials = None,
transport: Union[str, ConnectionServiceTransport] = None,
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the connection service client.
Expand All @@ -181,6 +182,11 @@ def __init__(
(2) The ``client_cert_source`` property is used to provide client
SSL credentials for mutual TLS transport. If not provided, the
default SSL credentials will be used if present.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
Raises:
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
Expand Down Expand Up @@ -238,6 +244,7 @@ def __init__(
api_mtls_endpoint=client_options.api_endpoint,
client_cert_source=client_options.client_cert_source,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
)

def create_connection(
Expand Down Expand Up @@ -1026,13 +1033,13 @@ def test_iam_permissions(


try:
_client_info = gapic_v1.client_info.ClientInfo(
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-bigquery-connection",
).version,
)
except pkg_resources.DistributionNotFound:
_client_info = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()


__all__ = ("ConnectionServiceClient",)
Expand Up @@ -33,13 +33,13 @@


try:
_client_info = gapic_v1.client_info.ClientInfo(
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-bigquery-connection",
).version,
)
except pkg_resources.DistributionNotFound:
_client_info = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()


class ConnectionServiceTransport(abc.ABC):
Expand All @@ -58,6 +58,7 @@ def __init__(
credentials_file: typing.Optional[str] = None,
scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES,
quota_project_id: typing.Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
**kwargs,
) -> None:
"""Instantiate the transport.
Expand All @@ -75,6 +76,11 @@ def __init__(
scope (Optional[Sequence[str]]): A list of scopes.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
"""
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
Expand Down Expand Up @@ -102,13 +108,13 @@ def __init__(
self._credentials = credentials

# Lifted into its own function so it can be stubbed out during tests.
self._prep_wrapped_messages()
self._prep_wrapped_messages(client_info)

def _prep_wrapped_messages(self):
def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
self.create_connection: gapic_v1.method.wrap_method(
self.create_connection, default_timeout=60.0, client_info=_client_info,
self.create_connection, default_timeout=60.0, client_info=client_info,
),
self.get_connection: gapic_v1.method.wrap_method(
self.get_connection,
Expand All @@ -121,7 +127,7 @@ def _prep_wrapped_messages(self):
),
),
default_timeout=60.0,
client_info=_client_info,
client_info=client_info,
),
self.list_connections: gapic_v1.method.wrap_method(
self.list_connections,
Expand All @@ -134,10 +140,10 @@ def _prep_wrapped_messages(self):
),
),
default_timeout=60.0,
client_info=_client_info,
client_info=client_info,
),
self.update_connection: gapic_v1.method.wrap_method(
self.update_connection, default_timeout=60.0, client_info=_client_info,
self.update_connection, default_timeout=60.0, client_info=client_info,
),
self.delete_connection: gapic_v1.method.wrap_method(
self.delete_connection,
Expand All @@ -150,18 +156,18 @@ def _prep_wrapped_messages(self):
),
),
default_timeout=60.0,
client_info=_client_info,
client_info=client_info,
),
self.get_iam_policy: gapic_v1.method.wrap_method(
self.get_iam_policy, default_timeout=60.0, client_info=_client_info,
self.get_iam_policy, default_timeout=60.0, client_info=client_info,
),
self.set_iam_policy: gapic_v1.method.wrap_method(
self.set_iam_policy, default_timeout=60.0, client_info=_client_info,
self.set_iam_policy, default_timeout=60.0, client_info=client_info,
),
self.test_iam_permissions: gapic_v1.method.wrap_method(
self.test_iam_permissions,
default_timeout=60.0,
client_info=_client_info,
client_info=client_info,
),
}

Expand Down
Expand Up @@ -18,6 +18,7 @@
from typing import Callable, Dict, Optional, Sequence, Tuple

from google.api_core import grpc_helpers # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google import auth # type: ignore
from google.auth import credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
Expand All @@ -31,7 +32,7 @@
from google.iam.v1 import policy_pb2 as policy # type: ignore
from google.protobuf import empty_pb2 as empty # type: ignore

from .base import ConnectionServiceTransport
from .base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO


class ConnectionServiceGrpcTransport(ConnectionServiceTransport):
Expand Down Expand Up @@ -59,7 +60,8 @@ def __init__(
channel: grpc.Channel = None,
api_mtls_endpoint: str = None,
client_cert_source: Callable[[], Tuple[bytes, bytes]] = None,
quota_project_id: Optional[str] = None
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -88,6 +90,11 @@ def __init__(
is None.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
Raises:
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
Expand Down Expand Up @@ -143,6 +150,7 @@ def __init__(
credentials_file=credentials_file,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
client_info=client_info,
)

@classmethod
Expand All @@ -153,7 +161,7 @@ def create_channel(
credentials_file: str = None,
scopes: Optional[Sequence[str]] = None,
quota_project_id: Optional[str] = None,
**kwargs
**kwargs,
) -> grpc.Channel:
"""Create and return a gRPC channel object.
Args:
Expand Down Expand Up @@ -187,7 +195,7 @@ def create_channel(
credentials_file=credentials_file,
scopes=scopes,
quota_project_id=quota_project_id,
**kwargs
**kwargs,
)

@property
Expand Down
Expand Up @@ -17,6 +17,7 @@

from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple

from google.api_core import gapic_v1 # type: ignore
from google.api_core import grpc_helpers_async # type: ignore
from google.auth import credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
Expand All @@ -30,7 +31,7 @@
from google.iam.v1 import policy_pb2 as policy # type: ignore
from google.protobuf import empty_pb2 as empty # type: ignore

from .base import ConnectionServiceTransport
from .base import ConnectionServiceTransport, DEFAULT_CLIENT_INFO
from .grpc import ConnectionServiceGrpcTransport


Expand Down Expand Up @@ -102,6 +103,7 @@ def __init__(
api_mtls_endpoint: str = None,
client_cert_source: Callable[[], Tuple[bytes, bytes]] = None,
quota_project_id=None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -131,6 +133,11 @@ def __init__(
is None.
quota_project_id (Optional[str]): An optional project to use for billing
and quota.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
Raises:
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
Expand Down Expand Up @@ -179,6 +186,7 @@ def __init__(
credentials_file=credentials_file,
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
client_info=client_info,
)

self._stubs = {}
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Expand Up @@ -4,15 +4,15 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-bigquery-connection.git",
"sha": "58eb8615e1858b50a9727db7a56cec3610959d4f"
"sha": "6de0d0d32b161359aebaf66750521e1b80bc2c07"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "fb84629a56703d04f0b5304c4a9ade7313ebd92d",
"internalRef": "325339219"
"sha": "09c2579cfa9f37eb91e21ba53c0eaca1481a13cf",
"internalRef": "327246996"
}
},
{
Expand Down

0 comments on commit 81b14ce

Please sign in to comment.