Skip to content

Commit 7746e64

Browse files
gcf-owl-bot[bot]partheadaniel-sanche
authored
fix: Allow protobuf 5.x (#888)
* chore: Update gapic-generator-python to v1.17.1 PiperOrigin-RevId: 629071173 Source-Link: googleapis/googleapis@4afa392 Source-Link: googleapis/googleapis-gen@16dbbb4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZkYmJiNGQwNDU3ZGI1ZTYxYWM5Zjk5YjBkNTJhNDYxNTQ0NTVhYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.18.0 PiperOrigin-RevId: 638650618 Source-Link: googleapis/googleapis@6330f03 Source-Link: googleapis/googleapis-gen@44fa4f1 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDRmYTRmMTk3OWRjNDVjMTc3OGZkN2NhZjEzZjhlNjFjNmQxY2FlOCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat(spanner): Add support for Cloud Spanner Scheduled Backups PiperOrigin-RevId: 649277844 Source-Link: googleapis/googleapis@fd7efa2 Source-Link: googleapis/googleapis-gen@50be251 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTBiZTI1MTMyOWQ4ZGI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * allow protobuf 5.x * update constraints * See googleapis/gapic-generator-python#2046 * chore: Update gapic-generator-python to v1.18.3 PiperOrigin-RevId: 655567917 Source-Link: googleapis/googleapis@43aa65e Source-Link: googleapis/googleapis-gen@0e38378 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGUzODM3ODc1MzA3NGMwZjY2ZmY2MzM0OGQ2ODY0OTI5ZTEwNGQ1YyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.18.3 PiperOrigin-RevId: 656040068 Source-Link: googleapis/googleapis@3f4e29a Source-Link: googleapis/googleapis-gen@b8feb21 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjhmZWIyMTA5ZGRlN2IwOTM4YzIyYzk5M2QwMDIyNTFhYzY3MTRkYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.18.4 PiperOrigin-RevId: 657207628 Source-Link: googleapis/googleapis@33fe71e Source-Link: googleapis/googleapis-gen@e02739d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTAyNzM5ZDEyMmVkMTViZDVlZjU3NzFjNTdmMTJhODNkNDdhMWRkYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]> Co-authored-by: Daniel Sanche <[email protected]>
1 parent b86081e commit 7746e64

File tree

25 files changed

+5125
-915
lines changed

25 files changed

+5125
-915
lines changed

google/cloud/logging_v2/services/config_service_v2/async_client.py

Lines changed: 276 additions & 309 deletions
Large diffs are not rendered by default.

google/cloud/logging_v2/services/config_service_v2/client.py

Lines changed: 130 additions & 170 deletions
Large diffs are not rendered by default.

google/cloud/logging_v2/services/config_service_v2/pagers.py

Lines changed: 143 additions & 10 deletions
Large diffs are not rendered by default.

google/cloud/logging_v2/services/config_service_v2/transports/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def __init__(
9090

9191
# Save the scopes.
9292
self._scopes = scopes
93+
if not hasattr(self, "_ignore_credentials"):
94+
self._ignore_credentials: bool = False
9395

9496
# If no credentials are provided, then determine the appropriate
9597
# defaults.
@@ -102,7 +104,7 @@ def __init__(
102104
credentials, _ = google.auth.load_credentials_from_file(
103105
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
104106
)
105-
elif credentials is None:
107+
elif credentials is None and not self._ignore_credentials:
106108
credentials, _ = google.auth.default(
107109
**scopes_kwargs, quota_project_id=quota_project_id
108110
)

google/cloud/logging_v2/services/config_service_v2/transports/grpc.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(
5353
credentials: Optional[ga_credentials.Credentials] = None,
5454
credentials_file: Optional[str] = None,
5555
scopes: Optional[Sequence[str]] = None,
56-
channel: Optional[grpc.Channel] = None,
56+
channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
5757
api_mtls_endpoint: Optional[str] = None,
5858
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
5959
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -73,14 +73,17 @@ def __init__(
7373
credentials identify the application to the service; if none
7474
are specified, the client will attempt to ascertain the
7575
credentials from the environment.
76-
This argument is ignored if ``channel`` is provided.
76+
This argument is ignored if a ``channel`` instance is provided.
7777
credentials_file (Optional[str]): A file with credentials that can
7878
be loaded with :func:`google.auth.load_credentials_from_file`.
79-
This argument is ignored if ``channel`` is provided.
79+
This argument is ignored if a ``channel`` instance is provided.
8080
scopes (Optional(Sequence[str])): A list of scopes. This argument is
81-
ignored if ``channel`` is provided.
82-
channel (Optional[grpc.Channel]): A ``Channel`` instance through
83-
which to make calls.
81+
ignored if a ``channel`` instance is provided.
82+
channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
83+
A ``Channel`` instance through which to make calls, or a Callable
84+
that constructs and returns one. If set to None, ``self.create_channel``
85+
is used to create the channel. If a Callable is given, it will be called
86+
with the same arguments as used in ``self.create_channel``.
8487
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
8588
If provided, it overrides the ``host`` argument and tries to create
8689
a mutual TLS channel with client SSL credentials from
@@ -90,11 +93,11 @@ def __init__(
9093
private key bytes, both in PEM format. It is ignored if
9194
``api_mtls_endpoint`` is None.
9295
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
93-
for the grpc channel. It is ignored if ``channel`` is provided.
96+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
9497
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
9598
A callback to provide client certificate bytes and private key bytes,
9699
both in PEM format. It is used to configure a mutual TLS channel. It is
97-
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
100+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
98101
quota_project_id (Optional[str]): An optional project to use for billing
99102
and quota.
100103
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -121,9 +124,10 @@ def __init__(
121124
if client_cert_source:
122125
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
123126

124-
if channel:
127+
if isinstance(channel, grpc.Channel):
125128
# Ignore credentials if a channel was passed.
126-
credentials = False
129+
credentials = None
130+
self._ignore_credentials = True
127131
# If a channel was explicitly provided, set it.
128132
self._grpc_channel = channel
129133
self._ssl_channel_credentials = None
@@ -162,7 +166,9 @@ def __init__(
162166
)
163167

164168
if not self._grpc_channel:
165-
self._grpc_channel = type(self).create_channel(
169+
# initialize with the provided callable or the default channel
170+
channel_init = channel or type(self).create_channel
171+
self._grpc_channel = channel_init(
166172
self._host,
167173
# use the credentials which are saved
168174
credentials=self._credentials,

0 commit comments

Comments
 (0)