Skip to content

Commit f0afcae

Browse files
chore: use gapic-generator-python 0.62.1 (#225)
- [ ] Regenerate this pull request now. fix: resolve DuplicateCredentialArgs error when using credentials_file committer: parthea PiperOrigin-RevId: 425964861 Source-Link: googleapis/googleapis@84b1a5a Source-Link: googleapis/googleapis-gen@4fb761b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9
1 parent b207f2c commit f0afcae

File tree

17 files changed

+261
-28
lines changed

17 files changed

+261
-28
lines changed

devtools-clouderrorreporting-v1beta1-py.tar.gz

Whitespace-only changes.

google/cloud/errorreporting_v1beta1/services/error_group_service/async_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ async def get_group(
243243
244244
"""
245245
# Create or coerce a protobuf request object.
246-
# Sanity check: If we got a request object, we should *not* have
246+
# Quick check: If we got a request object, we should *not* have
247247
# gotten any keyword arguments that map to the request.
248248
has_flattened_params = any([group_name])
249249
if request is not None and has_flattened_params:
@@ -317,7 +317,7 @@ async def update_group(
317317
318318
"""
319319
# Create or coerce a protobuf request object.
320-
# Sanity check: If we got a request object, we should *not* have
320+
# Quick check: If we got a request object, we should *not* have
321321
# gotten any keyword arguments that map to the request.
322322
has_flattened_params = any([group])
323323
if request is not None and has_flattened_params:

google/cloud/errorreporting_v1beta1/services/error_group_service/client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def get_group(
435435
436436
"""
437437
# Create or coerce a protobuf request object.
438-
# Sanity check: If we got a request object, we should *not* have
438+
# Quick check: If we got a request object, we should *not* have
439439
# gotten any keyword arguments that map to the request.
440440
has_flattened_params = any([group_name])
441441
if request is not None and has_flattened_params:
@@ -509,7 +509,7 @@ def update_group(
509509
510510
"""
511511
# Create or coerce a protobuf request object.
512-
# Sanity check: If we got a request object, we should *not* have
512+
# Quick check: If we got a request object, we should *not* have
513513
# gotten any keyword arguments that map to the request.
514514
has_flattened_params = any([group])
515515
if request is not None and has_flattened_params:

google/cloud/errorreporting_v1beta1/services/error_group_service/transports/grpc.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ def __init__(
159159
if not self._grpc_channel:
160160
self._grpc_channel = type(self).create_channel(
161161
self._host,
162+
# use the credentials which are saved
162163
credentials=self._credentials,
163-
credentials_file=credentials_file,
164+
# Set ``credentials_file`` to ``None`` here as
165+
# the credentials that we saved earlier should be used.
166+
credentials_file=None,
164167
scopes=self._scopes,
165168
ssl_credentials=self._ssl_channel_credentials,
166169
quota_project_id=quota_project_id,

google/cloud/errorreporting_v1beta1/services/error_group_service/transports/grpc_asyncio.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,11 @@ def __init__(
204204
if not self._grpc_channel:
205205
self._grpc_channel = type(self).create_channel(
206206
self._host,
207+
# use the credentials which are saved
207208
credentials=self._credentials,
208-
credentials_file=credentials_file,
209+
# Set ``credentials_file`` to ``None`` here as
210+
# the credentials that we saved earlier should be used.
211+
credentials_file=None,
209212
scopes=self._scopes,
210213
ssl_credentials=self._ssl_channel_credentials,
211214
quota_project_id=quota_project_id,

google/cloud/errorreporting_v1beta1/services/error_stats_service/async_client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ async def list_group_stats(
265265
266266
"""
267267
# Create or coerce a protobuf request object.
268-
# Sanity check: If we got a request object, we should *not* have
268+
# Quick check: If we got a request object, we should *not* have
269269
# gotten any keyword arguments that map to the request.
270270
has_flattened_params = any([project_name, time_range])
271271
if request is not None and has_flattened_params:
@@ -361,7 +361,7 @@ async def list_events(
361361
362362
"""
363363
# Create or coerce a protobuf request object.
364-
# Sanity check: If we got a request object, we should *not* have
364+
# Quick check: If we got a request object, we should *not* have
365365
# gotten any keyword arguments that map to the request.
366366
has_flattened_params = any([project_name, group_id])
367367
if request is not None and has_flattened_params:
@@ -445,7 +445,7 @@ async def delete_events(
445445
446446
"""
447447
# Create or coerce a protobuf request object.
448-
# Sanity check: If we got a request object, we should *not* have
448+
# Quick check: If we got a request object, we should *not* have
449449
# gotten any keyword arguments that map to the request.
450450
has_flattened_params = any([project_name])
451451
if request is not None and has_flattened_params:

google/cloud/errorreporting_v1beta1/services/error_stats_service/client.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def list_group_stats(
457457
458458
"""
459459
# Create or coerce a protobuf request object.
460-
# Sanity check: If we got a request object, we should *not* have
460+
# Quick check: If we got a request object, we should *not* have
461461
# gotten any keyword arguments that map to the request.
462462
has_flattened_params = any([project_name, time_range])
463463
if request is not None and has_flattened_params:
@@ -553,7 +553,7 @@ def list_events(
553553
554554
"""
555555
# Create or coerce a protobuf request object.
556-
# Sanity check: If we got a request object, we should *not* have
556+
# Quick check: If we got a request object, we should *not* have
557557
# gotten any keyword arguments that map to the request.
558558
has_flattened_params = any([project_name, group_id])
559559
if request is not None and has_flattened_params:
@@ -637,7 +637,7 @@ def delete_events(
637637
638638
"""
639639
# Create or coerce a protobuf request object.
640-
# Sanity check: If we got a request object, we should *not* have
640+
# Quick check: If we got a request object, we should *not* have
641641
# gotten any keyword arguments that map to the request.
642642
has_flattened_params = any([project_name])
643643
if request is not None and has_flattened_params:

google/cloud/errorreporting_v1beta1/services/error_stats_service/transports/grpc.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ def __init__(
159159
if not self._grpc_channel:
160160
self._grpc_channel = type(self).create_channel(
161161
self._host,
162+
# use the credentials which are saved
162163
credentials=self._credentials,
163-
credentials_file=credentials_file,
164+
# Set ``credentials_file`` to ``None`` here as
165+
# the credentials that we saved earlier should be used.
166+
credentials_file=None,
164167
scopes=self._scopes,
165168
ssl_credentials=self._ssl_channel_credentials,
166169
quota_project_id=quota_project_id,

google/cloud/errorreporting_v1beta1/services/error_stats_service/transports/grpc_asyncio.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,11 @@ def __init__(
204204
if not self._grpc_channel:
205205
self._grpc_channel = type(self).create_channel(
206206
self._host,
207+
# use the credentials which are saved
207208
credentials=self._credentials,
208-
credentials_file=credentials_file,
209+
# Set ``credentials_file`` to ``None`` here as
210+
# the credentials that we saved earlier should be used.
211+
credentials_file=None,
209212
scopes=self._scopes,
210213
ssl_credentials=self._ssl_channel_credentials,
211214
quota_project_id=quota_project_id,

google/cloud/errorreporting_v1beta1/services/report_errors_service/async_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ async def report_error_event(
263263
264264
"""
265265
# Create or coerce a protobuf request object.
266-
# Sanity check: If we got a request object, we should *not* have
266+
# Quick check: If we got a request object, we should *not* have
267267
# gotten any keyword arguments that map to the request.
268268
has_flattened_params = any([project_name, event])
269269
if request is not None and has_flattened_params:

google/cloud/errorreporting_v1beta1/services/report_errors_service/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def report_error_event(
447447
448448
"""
449449
# Create or coerce a protobuf request object.
450-
# Sanity check: If we got a request object, we should *not* have
450+
# Quick check: If we got a request object, we should *not* have
451451
# gotten any keyword arguments that map to the request.
452452
has_flattened_params = any([project_name, event])
453453
if request is not None and has_flattened_params:

google/cloud/errorreporting_v1beta1/services/report_errors_service/transports/grpc.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ def __init__(
158158
if not self._grpc_channel:
159159
self._grpc_channel = type(self).create_channel(
160160
self._host,
161+
# use the credentials which are saved
161162
credentials=self._credentials,
162-
credentials_file=credentials_file,
163+
# Set ``credentials_file`` to ``None`` here as
164+
# the credentials that we saved earlier should be used.
165+
credentials_file=None,
163166
scopes=self._scopes,
164167
ssl_credentials=self._ssl_channel_credentials,
165168
quota_project_id=quota_project_id,

google/cloud/errorreporting_v1beta1/services/report_errors_service/transports/grpc_asyncio.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,11 @@ def __init__(
203203
if not self._grpc_channel:
204204
self._grpc_channel = type(self).create_channel(
205205
self._host,
206+
# use the credentials which are saved
206207
credentials=self._credentials,
207-
credentials_file=credentials_file,
208+
# Set ``credentials_file`` to ``None`` here as
209+
# the credentials that we saved earlier should be used.
210+
credentials_file=None,
208211
scopes=self._scopes,
209212
ssl_credentials=self._ssl_channel_credentials,
210213
quota_project_id=quota_project_id,

google/cloud/errorreporting_v1beta1/types/common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class ErrorGroup(proto.Message):
4848
Attributes:
4949
name (str):
5050
The group resource name.
51-
Example: <code>projects/my-
52-
project-123/groups/CNSgkpnppqKCUw</code>
51+
Example:
52+
<code>projects/my-project-123/groups/CNSgkpnppqKCUw</code>
5353
group_id (str):
5454
Group IDs are unique for a given project. If
5555
the same kind of error occurs in different

tests/unit/gapic/errorreporting_v1beta1/test_error_group_service.py

+76-3
Original file line numberDiff line numberDiff line change
@@ -523,21 +523,28 @@ def test_error_group_service_client_client_options_scopes(
523523

524524

525525
@pytest.mark.parametrize(
526-
"client_class,transport_class,transport_name",
526+
"client_class,transport_class,transport_name,grpc_helpers",
527527
[
528-
(ErrorGroupServiceClient, transports.ErrorGroupServiceGrpcTransport, "grpc"),
528+
(
529+
ErrorGroupServiceClient,
530+
transports.ErrorGroupServiceGrpcTransport,
531+
"grpc",
532+
grpc_helpers,
533+
),
529534
(
530535
ErrorGroupServiceAsyncClient,
531536
transports.ErrorGroupServiceGrpcAsyncIOTransport,
532537
"grpc_asyncio",
538+
grpc_helpers_async,
533539
),
534540
],
535541
)
536542
def test_error_group_service_client_client_options_credentials_file(
537-
client_class, transport_class, transport_name
543+
client_class, transport_class, transport_name, grpc_helpers
538544
):
539545
# Check the case credentials file is provided.
540546
options = client_options.ClientOptions(credentials_file="credentials.json")
547+
541548
with mock.patch.object(transport_class, "__init__") as patched:
542549
patched.return_value = None
543550
client = client_class(client_options=options, transport=transport_name)
@@ -573,6 +580,72 @@ def test_error_group_service_client_client_options_from_dict():
573580
)
574581

575582

583+
@pytest.mark.parametrize(
584+
"client_class,transport_class,transport_name,grpc_helpers",
585+
[
586+
(
587+
ErrorGroupServiceClient,
588+
transports.ErrorGroupServiceGrpcTransport,
589+
"grpc",
590+
grpc_helpers,
591+
),
592+
(
593+
ErrorGroupServiceAsyncClient,
594+
transports.ErrorGroupServiceGrpcAsyncIOTransport,
595+
"grpc_asyncio",
596+
grpc_helpers_async,
597+
),
598+
],
599+
)
600+
def test_error_group_service_client_create_channel_credentials_file(
601+
client_class, transport_class, transport_name, grpc_helpers
602+
):
603+
# Check the case credentials file is provided.
604+
options = client_options.ClientOptions(credentials_file="credentials.json")
605+
606+
with mock.patch.object(transport_class, "__init__") as patched:
607+
patched.return_value = None
608+
client = client_class(client_options=options, transport=transport_name)
609+
patched.assert_called_once_with(
610+
credentials=None,
611+
credentials_file="credentials.json",
612+
host=client.DEFAULT_ENDPOINT,
613+
scopes=None,
614+
client_cert_source_for_mtls=None,
615+
quota_project_id=None,
616+
client_info=transports.base.DEFAULT_CLIENT_INFO,
617+
always_use_jwt_access=True,
618+
)
619+
620+
# test that the credentials from file are saved and used as the credentials.
621+
with mock.patch.object(
622+
google.auth, "load_credentials_from_file", autospec=True
623+
) as load_creds, mock.patch.object(
624+
google.auth, "default", autospec=True
625+
) as adc, mock.patch.object(
626+
grpc_helpers, "create_channel"
627+
) as create_channel:
628+
creds = ga_credentials.AnonymousCredentials()
629+
file_creds = ga_credentials.AnonymousCredentials()
630+
load_creds.return_value = (file_creds, None)
631+
adc.return_value = (creds, None)
632+
client = client_class(client_options=options, transport=transport_name)
633+
create_channel.assert_called_with(
634+
"clouderrorreporting.googleapis.com:443",
635+
credentials=file_creds,
636+
credentials_file=None,
637+
quota_project_id=None,
638+
default_scopes=("https://www.googleapis.com/auth/cloud-platform",),
639+
scopes=None,
640+
default_host="clouderrorreporting.googleapis.com",
641+
ssl_credentials=None,
642+
options=[
643+
("grpc.max_send_message_length", -1),
644+
("grpc.max_receive_message_length", -1),
645+
],
646+
)
647+
648+
576649
@pytest.mark.parametrize("request_type", [error_group_service.GetGroupRequest, dict,])
577650
def test_get_group(request_type, transport: str = "grpc"):
578651
client = ErrorGroupServiceClient(

0 commit comments

Comments
 (0)