Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 43b0e7d

Browse filesBrowse files
chore: use gapic-generator-python 0.62.1 (#32)
- [ ] 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 3dddff0 commit 43b0e7d
Copy full SHA for 43b0e7d

File tree

Expand file treeCollapse file tree

5 files changed

+102
-26
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+102
-26
lines changed

‎packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/async_client.py

Copy file name to clipboardExpand all lines: packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/async_client.py
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ async def list_instances(
280280
281281
"""
282282
# Create or coerce a protobuf request object.
283-
# Sanity check: If we got a request object, we should *not* have
283+
# Quick check: If we got a request object, we should *not* have
284284
# gotten any keyword arguments that map to the request.
285285
has_flattened_params = any([parent])
286286
if request is not None and has_flattened_params:
@@ -364,7 +364,7 @@ async def get_instance(
364364
A Cloud Filestore instance.
365365
"""
366366
# Create or coerce a protobuf request object.
367-
# Sanity check: If we got a request object, we should *not* have
367+
# Quick check: If we got a request object, we should *not* have
368368
# gotten any keyword arguments that map to the request.
369369
has_flattened_params = any([name])
370370
if request is not None and has_flattened_params:
@@ -470,7 +470,7 @@ async def create_instance(
470470
471471
"""
472472
# Create or coerce a protobuf request object.
473-
# Sanity check: If we got a request object, we should *not* have
473+
# Quick check: If we got a request object, we should *not* have
474474
# gotten any keyword arguments that map to the request.
475475
has_flattened_params = any([parent, instance, instance_id])
476476
if request is not None and has_flattened_params:
@@ -567,7 +567,7 @@ async def update_instance(
567567
568568
"""
569569
# Create or coerce a protobuf request object.
570-
# Sanity check: If we got a request object, we should *not* have
570+
# Quick check: If we got a request object, we should *not* have
571571
# gotten any keyword arguments that map to the request.
572572
has_flattened_params = any([instance, update_mask])
573573
if request is not None and has_flattened_params:
@@ -727,7 +727,7 @@ async def delete_instance(
727727
728728
"""
729729
# Create or coerce a protobuf request object.
730-
# Sanity check: If we got a request object, we should *not* have
730+
# Quick check: If we got a request object, we should *not* have
731731
# gotten any keyword arguments that map to the request.
732732
has_flattened_params = any([name])
733733
if request is not None and has_flattened_params:
@@ -813,7 +813,7 @@ async def list_backups(
813813
814814
"""
815815
# Create or coerce a protobuf request object.
816-
# Sanity check: If we got a request object, we should *not* have
816+
# Quick check: If we got a request object, we should *not* have
817817
# gotten any keyword arguments that map to the request.
818818
has_flattened_params = any([parent])
819819
if request is not None and has_flattened_params:
@@ -897,7 +897,7 @@ async def get_backup(
897897
A Cloud Filestore backup.
898898
"""
899899
# Create or coerce a protobuf request object.
900-
# Sanity check: If we got a request object, we should *not* have
900+
# Quick check: If we got a request object, we should *not* have
901901
# gotten any keyword arguments that map to the request.
902902
has_flattened_params = any([name])
903903
if request is not None and has_flattened_params:
@@ -1004,7 +1004,7 @@ async def create_backup(
10041004
10051005
"""
10061006
# Create or coerce a protobuf request object.
1007-
# Sanity check: If we got a request object, we should *not* have
1007+
# Quick check: If we got a request object, we should *not* have
10081008
# gotten any keyword arguments that map to the request.
10091009
has_flattened_params = any([parent, backup, backup_id])
10101010
if request is not None and has_flattened_params:
@@ -1100,7 +1100,7 @@ async def delete_backup(
11001100
11011101
"""
11021102
# Create or coerce a protobuf request object.
1103-
# Sanity check: If we got a request object, we should *not* have
1103+
# Quick check: If we got a request object, we should *not* have
11041104
# gotten any keyword arguments that map to the request.
11051105
has_flattened_params = any([name])
11061106
if request is not None and has_flattened_params:
@@ -1191,7 +1191,7 @@ async def update_backup(
11911191
11921192
"""
11931193
# Create or coerce a protobuf request object.
1194-
# Sanity check: If we got a request object, we should *not* have
1194+
# Quick check: If we got a request object, we should *not* have
11951195
# gotten any keyword arguments that map to the request.
11961196
has_flattened_params = any([backup, update_mask])
11971197
if request is not None and has_flattened_params:

‎packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/client.py

Copy file name to clipboardExpand all lines: packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/client.py
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def list_instances(
490490
491491
"""
492492
# Create or coerce a protobuf request object.
493-
# Sanity check: If we got a request object, we should *not* have
493+
# Quick check: If we got a request object, we should *not* have
494494
# gotten any keyword arguments that map to the request.
495495
has_flattened_params = any([parent])
496496
if request is not None and has_flattened_params:
@@ -565,7 +565,7 @@ def get_instance(
565565
A Cloud Filestore instance.
566566
"""
567567
# Create or coerce a protobuf request object.
568-
# Sanity check: If we got a request object, we should *not* have
568+
# Quick check: If we got a request object, we should *not* have
569569
# gotten any keyword arguments that map to the request.
570570
has_flattened_params = any([name])
571571
if request is not None and has_flattened_params:
@@ -662,7 +662,7 @@ def create_instance(
662662
663663
"""
664664
# Create or coerce a protobuf request object.
665-
# Sanity check: If we got a request object, we should *not* have
665+
# Quick check: If we got a request object, we should *not* have
666666
# gotten any keyword arguments that map to the request.
667667
has_flattened_params = any([parent, instance, instance_id])
668668
if request is not None and has_flattened_params:
@@ -759,7 +759,7 @@ def update_instance(
759759
760760
"""
761761
# Create or coerce a protobuf request object.
762-
# Sanity check: If we got a request object, we should *not* have
762+
# Quick check: If we got a request object, we should *not* have
763763
# gotten any keyword arguments that map to the request.
764764
has_flattened_params = any([instance, update_mask])
765765
if request is not None and has_flattened_params:
@@ -920,7 +920,7 @@ def delete_instance(
920920
921921
"""
922922
# Create or coerce a protobuf request object.
923-
# Sanity check: If we got a request object, we should *not* have
923+
# Quick check: If we got a request object, we should *not* have
924924
# gotten any keyword arguments that map to the request.
925925
has_flattened_params = any([name])
926926
if request is not None and has_flattened_params:
@@ -1006,7 +1006,7 @@ def list_backups(
10061006
10071007
"""
10081008
# Create or coerce a protobuf request object.
1009-
# Sanity check: If we got a request object, we should *not* have
1009+
# Quick check: If we got a request object, we should *not* have
10101010
# gotten any keyword arguments that map to the request.
10111011
has_flattened_params = any([parent])
10121012
if request is not None and has_flattened_params:
@@ -1081,7 +1081,7 @@ def get_backup(
10811081
A Cloud Filestore backup.
10821082
"""
10831083
# Create or coerce a protobuf request object.
1084-
# Sanity check: If we got a request object, we should *not* have
1084+
# Quick check: If we got a request object, we should *not* have
10851085
# gotten any keyword arguments that map to the request.
10861086
has_flattened_params = any([name])
10871087
if request is not None and has_flattened_params:
@@ -1179,7 +1179,7 @@ def create_backup(
11791179
11801180
"""
11811181
# Create or coerce a protobuf request object.
1182-
# Sanity check: If we got a request object, we should *not* have
1182+
# Quick check: If we got a request object, we should *not* have
11831183
# gotten any keyword arguments that map to the request.
11841184
has_flattened_params = any([parent, backup, backup_id])
11851185
if request is not None and has_flattened_params:
@@ -1275,7 +1275,7 @@ def delete_backup(
12751275
12761276
"""
12771277
# Create or coerce a protobuf request object.
1278-
# Sanity check: If we got a request object, we should *not* have
1278+
# Quick check: If we got a request object, we should *not* have
12791279
# gotten any keyword arguments that map to the request.
12801280
has_flattened_params = any([name])
12811281
if request is not None and has_flattened_params:
@@ -1366,7 +1366,7 @@ def update_backup(
13661366
13671367
"""
13681368
# Create or coerce a protobuf request object.
1369-
# Sanity check: If we got a request object, we should *not* have
1369+
# Quick check: If we got a request object, we should *not* have
13701370
# gotten any keyword arguments that map to the request.
13711371
has_flattened_params = any([backup, update_mask])
13721372
if request is not None and has_flattened_params:

‎packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/grpc.py

Copy file name to clipboardExpand all lines: packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/grpc.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,11 @@ def __init__(
183183
if not self._grpc_channel:
184184
self._grpc_channel = type(self).create_channel(
185185
self._host,
186+
# use the credentials which are saved
186187
credentials=self._credentials,
187-
credentials_file=credentials_file,
188+
# Set ``credentials_file`` to ``None`` here as
189+
# the credentials that we saved earlier should be used.
190+
credentials_file=None,
188191
scopes=self._scopes,
189192
ssl_credentials=self._ssl_channel_credentials,
190193
quota_project_id=quota_project_id,
@@ -257,7 +260,7 @@ def operations_client(self) -> operations_v1.OperationsClient:
257260
This property caches on the instance; repeated calls return the same
258261
client.
259262
"""
260-
# Sanity check: Only create a new client if we do not already have one.
263+
# Quick check: Only create a new client if we do not already have one.
261264
if self._operations_client is None:
262265
self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
263266

‎packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/grpc_asyncio.py

Copy file name to clipboardExpand all lines: packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/grpc_asyncio.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,11 @@ def __init__(
228228
if not self._grpc_channel:
229229
self._grpc_channel = type(self).create_channel(
230230
self._host,
231+
# use the credentials which are saved
231232
credentials=self._credentials,
232-
credentials_file=credentials_file,
233+
# Set ``credentials_file`` to ``None`` here as
234+
# the credentials that we saved earlier should be used.
235+
credentials_file=None,
233236
scopes=self._scopes,
234237
ssl_credentials=self._ssl_channel_credentials,
235238
quota_project_id=quota_project_id,
@@ -259,7 +262,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient:
259262
This property caches on the instance; repeated calls return the same
260263
client.
261264
"""
262-
# Sanity check: Only create a new client if we do not already have one.
265+
# Quick check: Only create a new client if we do not already have one.
263266
if self._operations_client is None:
264267
self._operations_client = operations_v1.OperationsAsyncClient(
265268
self.grpc_channel

‎packages/google-cloud-filestore/tests/unit/gapic/filestore_v1/test_cloud_filestore_manager.py

Copy file name to clipboardExpand all lines: packages/google-cloud-filestore/tests/unit/gapic/filestore_v1/test_cloud_filestore_manager.py
+72-2Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from google.api_core import gapic_v1
3030
from google.api_core import grpc_helpers
3131
from google.api_core import grpc_helpers_async
32+
from google.api_core import operation
3233
from google.api_core import operation_async # type: ignore
3334
from google.api_core import operations_v1
3435
from google.api_core import path_template
@@ -539,25 +540,28 @@ def test_cloud_filestore_manager_client_client_options_scopes(
539540

540541

541542
@pytest.mark.parametrize(
542-
"client_class,transport_class,transport_name",
543+
"client_class,transport_class,transport_name,grpc_helpers",
543544
[
544545
(
545546
CloudFilestoreManagerClient,
546547
transports.CloudFilestoreManagerGrpcTransport,
547548
"grpc",
549+
grpc_helpers,
548550
),
549551
(
550552
CloudFilestoreManagerAsyncClient,
551553
transports.CloudFilestoreManagerGrpcAsyncIOTransport,
552554
"grpc_asyncio",
555+
grpc_helpers_async,
553556
),
554557
],
555558
)
556559
def test_cloud_filestore_manager_client_client_options_credentials_file(
557-
client_class, transport_class, transport_name
560+
client_class, transport_class, transport_name, grpc_helpers
558561
):
559562
# Check the case credentials file is provided.
560563
options = client_options.ClientOptions(credentials_file="credentials.json")
564+
561565
with mock.patch.object(transport_class, "__init__") as patched:
562566
patched.return_value = None
563567
client = client_class(client_options=options, transport=transport_name)
@@ -593,6 +597,72 @@ def test_cloud_filestore_manager_client_client_options_from_dict():
593597
)
594598

595599

600+
@pytest.mark.parametrize(
601+
"client_class,transport_class,transport_name,grpc_helpers",
602+
[
603+
(
604+
CloudFilestoreManagerClient,
605+
transports.CloudFilestoreManagerGrpcTransport,
606+
"grpc",
607+
grpc_helpers,
608+
),
609+
(
610+
CloudFilestoreManagerAsyncClient,
611+
transports.CloudFilestoreManagerGrpcAsyncIOTransport,
612+
"grpc_asyncio",
613+
grpc_helpers_async,
614+
),
615+
],
616+
)
617+
def test_cloud_filestore_manager_client_create_channel_credentials_file(
618+
client_class, transport_class, transport_name, grpc_helpers
619+
):
620+
# Check the case credentials file is provided.
621+
options = client_options.ClientOptions(credentials_file="credentials.json")
622+
623+
with mock.patch.object(transport_class, "__init__") as patched:
624+
patched.return_value = None
625+
client = client_class(client_options=options, transport=transport_name)
626+
patched.assert_called_once_with(
627+
credentials=None,
628+
credentials_file="credentials.json",
629+
host=client.DEFAULT_ENDPOINT,
630+
scopes=None,
631+
client_cert_source_for_mtls=None,
632+
quota_project_id=None,
633+
client_info=transports.base.DEFAULT_CLIENT_INFO,
634+
always_use_jwt_access=True,
635+
)
636+
637+
# test that the credentials from file are saved and used as the credentials.
638+
with mock.patch.object(
639+
google.auth, "load_credentials_from_file", autospec=True
640+
) as load_creds, mock.patch.object(
641+
google.auth, "default", autospec=True
642+
) as adc, mock.patch.object(
643+
grpc_helpers, "create_channel"
644+
) as create_channel:
645+
creds = ga_credentials.AnonymousCredentials()
646+
file_creds = ga_credentials.AnonymousCredentials()
647+
load_creds.return_value = (file_creds, None)
648+
adc.return_value = (creds, None)
649+
client = client_class(client_options=options, transport=transport_name)
650+
create_channel.assert_called_with(
651+
"file.googleapis.com:443",
652+
credentials=file_creds,
653+
credentials_file=None,
654+
quota_project_id=None,
655+
default_scopes=("https://www.googleapis.com/auth/cloud-platform",),
656+
scopes=None,
657+
default_host="file.googleapis.com",
658+
ssl_credentials=None,
659+
options=[
660+
("grpc.max_send_message_length", -1),
661+
("grpc.max_receive_message_length", -1),
662+
],
663+
)
664+
665+
596666
@pytest.mark.parametrize(
597667
"request_type", [cloud_filestore_service.ListInstancesRequest, dict,]
598668
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.