google-cloud-beyondcorp-clientgateways 0.4.7__tar.gz → 0.4.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {google-cloud-beyondcorp-clientgateways-0.4.7/google_cloud_beyondcorp_clientgateways.egg-info → google-cloud-beyondcorp-clientgateways-0.4.9}/PKG-INFO +4 -4
  2. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/README.rst +1 -1
  3. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways/__init__.py +1 -1
  4. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways/gapic_version.py +2 -2
  5. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/__init__.py +1 -1
  6. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/gapic_version.py +2 -2
  7. {google-cloud-beyondcorp-clientgateways-0.4.7/tests/unit → google-cloud-beyondcorp-clientgateways-0.4.9/google/cloud/beyondcorp_clientgateways_v1/services}/__init__.py +1 -1
  8. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/__init__.py +1 -1
  9. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/async_client.py +50 -37
  10. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/client.py +40 -31
  11. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/pagers.py +1 -1
  12. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/__init__.py +1 -1
  13. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/base.py +4 -2
  14. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/grpc.py +18 -12
  15. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/grpc_asyncio.py +44 -12
  16. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/rest.py +1 -1
  17. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/types/__init__.py +1 -1
  18. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/types/client_gateways_service.py +1 -1
  19. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9/google_cloud_beyondcorp_clientgateways.egg-info}/PKG-INFO +4 -4
  20. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google_cloud_beyondcorp_clientgateways.egg-info/requires.txt +2 -2
  21. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/setup.py +5 -3
  22. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/tests/__init__.py +1 -1
  23. {google-cloud-beyondcorp-clientgateways-0.4.7/tests/unit/gapic → google-cloud-beyondcorp-clientgateways-0.4.9/tests/unit}/__init__.py +1 -1
  24. {google-cloud-beyondcorp-clientgateways-0.4.7/google/cloud/beyondcorp_clientgateways_v1/services → google-cloud-beyondcorp-clientgateways-0.4.9/tests/unit/gapic}/__init__.py +1 -1
  25. google-cloud-beyondcorp-clientgateways-0.4.9/tests/unit/gapic/beyondcorp_clientgateways_v1/__init__.py +15 -0
  26. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/tests/unit/gapic/beyondcorp_clientgateways_v1/test_client_gateways_service.py +772 -12
  27. google-cloud-beyondcorp-clientgateways-0.4.7/tests/unit/gapic/beyondcorp_clientgateways_v1/__init__.py +0 -15
  28. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/LICENSE +0 -0
  29. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/MANIFEST.in +0 -0
  30. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways/py.typed +0 -0
  31. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/gapic_metadata.json +0 -0
  32. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google/cloud/beyondcorp_clientgateways_v1/py.typed +0 -0
  33. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google_cloud_beyondcorp_clientgateways.egg-info/SOURCES.txt +0 -0
  34. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google_cloud_beyondcorp_clientgateways.egg-info/dependency_links.txt +0 -0
  35. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google_cloud_beyondcorp_clientgateways.egg-info/not-zip-safe +0 -0
  36. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/google_cloud_beyondcorp_clientgateways.egg-info/top_level.txt +0 -0
  37. {google-cloud-beyondcorp-clientgateways-0.4.7 → google-cloud-beyondcorp-clientgateways-0.4.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: google-cloud-beyondcorp-clientgateways
3
- Version: 0.4.7
3
+ Version: 0.4.9
4
4
  Summary: Google Cloud Beyondcorp Clientgateways API client library
5
5
  Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-beyondcorp-clientgateways
6
6
  Author: Google LLC
@@ -23,9 +23,9 @@ Classifier: Topic :: Internet
23
23
  Requires-Python: >=3.7
24
24
  License-File: LICENSE
25
25
  Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.1
26
- Requires-Dist: google-auth<3.0.0dev,>=2.14.1
26
+ Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0dev,>=2.14.1
27
27
  Requires-Dist: proto-plus<2.0.0dev,>=1.22.3
28
- Requires-Dist: protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5
28
+ Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.2
29
29
  Requires-Dist: grpc-google-iam-v1<1.0.0dev,>=0.12.4
30
30
 
31
31
  Python Client for BeyondCorp ClientGateways
@@ -45,7 +45,7 @@ Python Client for BeyondCorp ClientGateways
45
45
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-beyondcorp-clientgateways.svg
46
46
  :target: https://pypi.org/project/google-cloud-beyondcorp-clientgateways/
47
47
  .. _BeyondCorp ClientGateways: https://cloud.google.com/beyondcorp/
48
- .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/beyondcorpclientgateways/latest
48
+ .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/beyondcorpclientgateways/latest/summary_overview
49
49
  .. _Product Documentation: https://cloud.google.com/beyondcorp/
50
50
 
51
51
  Quick Start
@@ -15,7 +15,7 @@ Python Client for BeyondCorp ClientGateways
15
15
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-beyondcorp-clientgateways.svg
16
16
  :target: https://pypi.org/project/google-cloud-beyondcorp-clientgateways/
17
17
  .. _BeyondCorp ClientGateways: https://cloud.google.com/beyondcorp/
18
- .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/beyondcorpclientgateways/latest
18
+ .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/beyondcorpclientgateways/latest/summary_overview
19
19
  .. _Product Documentation: https://cloud.google.com/beyondcorp/
20
20
 
21
21
  Quick Start
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -13,4 +13,4 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- __version__ = "0.4.7" # {x-release-please-version}
16
+ __version__ = "0.4.9" # {x-release-please-version}
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -13,4 +13,4 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- __version__ = "0.4.7" # {x-release-please-version}
16
+ __version__ = "0.4.9" # {x-release-please-version}
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ from collections import OrderedDict
17
17
  import functools
18
18
  import re
19
19
  from typing import (
20
+ Callable,
20
21
  Dict,
21
22
  Mapping,
22
23
  MutableMapping,
@@ -221,7 +222,13 @@ class ClientGatewaysServiceAsyncClient:
221
222
  self,
222
223
  *,
223
224
  credentials: Optional[ga_credentials.Credentials] = None,
224
- transport: Union[str, ClientGatewaysServiceTransport] = "grpc_asyncio",
225
+ transport: Optional[
226
+ Union[
227
+ str,
228
+ ClientGatewaysServiceTransport,
229
+ Callable[..., ClientGatewaysServiceTransport],
230
+ ]
231
+ ] = "grpc_asyncio",
225
232
  client_options: Optional[ClientOptions] = None,
226
233
  client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
227
234
  ) -> None:
@@ -233,9 +240,11 @@ class ClientGatewaysServiceAsyncClient:
233
240
  credentials identify the application to the service; if none
234
241
  are specified, the client will attempt to ascertain the
235
242
  credentials from the environment.
236
- transport (Union[str, ~.ClientGatewaysServiceTransport]): The
237
- transport to use. If set to None, a transport is chosen
238
- automatically.
243
+ transport (Optional[Union[str,ClientGatewaysServiceTransport,Callable[..., ClientGatewaysServiceTransport]]]):
244
+ The transport to use, or a Callable that constructs and returns a new transport to use.
245
+ If a Callable is given, it will be called with the same set of initialization
246
+ arguments as used in the ClientGatewaysServiceTransport constructor.
247
+ If set to None, a transport is chosen automatically.
239
248
  client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
240
249
  Custom options for the client.
241
250
 
@@ -346,8 +355,8 @@ class ClientGatewaysServiceAsyncClient:
346
355
 
347
356
  """
348
357
  # Create or coerce a protobuf request object.
349
- # Quick check: If we got a request object, we should *not* have
350
- # gotten any keyword arguments that map to the request.
358
+ # - Quick check: If we got a request object, we should *not* have
359
+ # gotten any keyword arguments that map to the request.
351
360
  has_flattened_params = any([parent])
352
361
  if request is not None and has_flattened_params:
353
362
  raise ValueError(
@@ -355,7 +364,10 @@ class ClientGatewaysServiceAsyncClient:
355
364
  "the individual field arguments should be set."
356
365
  )
357
366
 
358
- request = client_gateways_service.ListClientGatewaysRequest(request)
367
+ # - Use the request object if provided (there's no risk of modifying the input as
368
+ # there are no flattened fields), or create one.
369
+ if not isinstance(request, client_gateways_service.ListClientGatewaysRequest):
370
+ request = client_gateways_service.ListClientGatewaysRequest(request)
359
371
 
360
372
  # If we have keyword arguments corresponding to fields on the
361
373
  # request, apply these.
@@ -364,11 +376,9 @@ class ClientGatewaysServiceAsyncClient:
364
376
 
365
377
  # Wrap the RPC method; this adds retry and timeout information,
366
378
  # and friendly error handling.
367
- rpc = gapic_v1.method_async.wrap_method(
368
- self._client._transport.list_client_gateways,
369
- default_timeout=None,
370
- client_info=DEFAULT_CLIENT_INFO,
371
- )
379
+ rpc = self._client._transport._wrapped_methods[
380
+ self._client._transport.list_client_gateways
381
+ ]
372
382
 
373
383
  # Certain fields should be provided within the metadata header;
374
384
  # add these here.
@@ -459,8 +469,8 @@ class ClientGatewaysServiceAsyncClient:
459
469
 
460
470
  """
461
471
  # Create or coerce a protobuf request object.
462
- # Quick check: If we got a request object, we should *not* have
463
- # gotten any keyword arguments that map to the request.
472
+ # - Quick check: If we got a request object, we should *not* have
473
+ # gotten any keyword arguments that map to the request.
464
474
  has_flattened_params = any([name])
465
475
  if request is not None and has_flattened_params:
466
476
  raise ValueError(
@@ -468,7 +478,10 @@ class ClientGatewaysServiceAsyncClient:
468
478
  "the individual field arguments should be set."
469
479
  )
470
480
 
471
- request = client_gateways_service.GetClientGatewayRequest(request)
481
+ # - Use the request object if provided (there's no risk of modifying the input as
482
+ # there are no flattened fields), or create one.
483
+ if not isinstance(request, client_gateways_service.GetClientGatewayRequest):
484
+ request = client_gateways_service.GetClientGatewayRequest(request)
472
485
 
473
486
  # If we have keyword arguments corresponding to fields on the
474
487
  # request, apply these.
@@ -477,11 +490,9 @@ class ClientGatewaysServiceAsyncClient:
477
490
 
478
491
  # Wrap the RPC method; this adds retry and timeout information,
479
492
  # and friendly error handling.
480
- rpc = gapic_v1.method_async.wrap_method(
481
- self._client._transport.get_client_gateway,
482
- default_timeout=None,
483
- client_info=DEFAULT_CLIENT_INFO,
484
- )
493
+ rpc = self._client._transport._wrapped_methods[
494
+ self._client._transport.get_client_gateway
495
+ ]
485
496
 
486
497
  # Certain fields should be provided within the metadata header;
487
498
  # add these here.
@@ -593,8 +604,8 @@ class ClientGatewaysServiceAsyncClient:
593
604
 
594
605
  """
595
606
  # Create or coerce a protobuf request object.
596
- # Quick check: If we got a request object, we should *not* have
597
- # gotten any keyword arguments that map to the request.
607
+ # - Quick check: If we got a request object, we should *not* have
608
+ # gotten any keyword arguments that map to the request.
598
609
  has_flattened_params = any([parent, client_gateway, client_gateway_id])
599
610
  if request is not None and has_flattened_params:
600
611
  raise ValueError(
@@ -602,7 +613,10 @@ class ClientGatewaysServiceAsyncClient:
602
613
  "the individual field arguments should be set."
603
614
  )
604
615
 
605
- request = client_gateways_service.CreateClientGatewayRequest(request)
616
+ # - Use the request object if provided (there's no risk of modifying the input as
617
+ # there are no flattened fields), or create one.
618
+ if not isinstance(request, client_gateways_service.CreateClientGatewayRequest):
619
+ request = client_gateways_service.CreateClientGatewayRequest(request)
606
620
 
607
621
  # If we have keyword arguments corresponding to fields on the
608
622
  # request, apply these.
@@ -615,11 +629,9 @@ class ClientGatewaysServiceAsyncClient:
615
629
 
616
630
  # Wrap the RPC method; this adds retry and timeout information,
617
631
  # and friendly error handling.
618
- rpc = gapic_v1.method_async.wrap_method(
619
- self._client._transport.create_client_gateway,
620
- default_timeout=None,
621
- client_info=DEFAULT_CLIENT_INFO,
622
- )
632
+ rpc = self._client._transport._wrapped_methods[
633
+ self._client._transport.create_client_gateway
634
+ ]
623
635
 
624
636
  # Certain fields should be provided within the metadata header;
625
637
  # add these here.
@@ -723,8 +735,8 @@ class ClientGatewaysServiceAsyncClient:
723
735
 
724
736
  """
725
737
  # Create or coerce a protobuf request object.
726
- # Quick check: If we got a request object, we should *not* have
727
- # gotten any keyword arguments that map to the request.
738
+ # - Quick check: If we got a request object, we should *not* have
739
+ # gotten any keyword arguments that map to the request.
728
740
  has_flattened_params = any([name])
729
741
  if request is not None and has_flattened_params:
730
742
  raise ValueError(
@@ -732,7 +744,10 @@ class ClientGatewaysServiceAsyncClient:
732
744
  "the individual field arguments should be set."
733
745
  )
734
746
 
735
- request = client_gateways_service.DeleteClientGatewayRequest(request)
747
+ # - Use the request object if provided (there's no risk of modifying the input as
748
+ # there are no flattened fields), or create one.
749
+ if not isinstance(request, client_gateways_service.DeleteClientGatewayRequest):
750
+ request = client_gateways_service.DeleteClientGatewayRequest(request)
736
751
 
737
752
  # If we have keyword arguments corresponding to fields on the
738
753
  # request, apply these.
@@ -741,11 +756,9 @@ class ClientGatewaysServiceAsyncClient:
741
756
 
742
757
  # Wrap the RPC method; this adds retry and timeout information,
743
758
  # and friendly error handling.
744
- rpc = gapic_v1.method_async.wrap_method(
745
- self._client._transport.delete_client_gateway,
746
- default_timeout=None,
747
- client_info=DEFAULT_CLIENT_INFO,
748
- )
759
+ rpc = self._client._transport._wrapped_methods[
760
+ self._client._transport.delete_client_gateway
761
+ ]
749
762
 
750
763
  # Certain fields should be provided within the metadata header;
751
764
  # add these here.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ from collections import OrderedDict
17
17
  import os
18
18
  import re
19
19
  from typing import (
20
+ Callable,
20
21
  Dict,
21
22
  Mapping,
22
23
  MutableMapping,
@@ -553,7 +554,13 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
553
554
  self,
554
555
  *,
555
556
  credentials: Optional[ga_credentials.Credentials] = None,
556
- transport: Optional[Union[str, ClientGatewaysServiceTransport]] = None,
557
+ transport: Optional[
558
+ Union[
559
+ str,
560
+ ClientGatewaysServiceTransport,
561
+ Callable[..., ClientGatewaysServiceTransport],
562
+ ]
563
+ ] = None,
557
564
  client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
558
565
  client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
559
566
  ) -> None:
@@ -565,9 +572,11 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
565
572
  credentials identify the application to the service; if none
566
573
  are specified, the client will attempt to ascertain the
567
574
  credentials from the environment.
568
- transport (Union[str, ClientGatewaysServiceTransport]): The
569
- transport to use. If set to None, a transport is chosen
570
- automatically.
575
+ transport (Optional[Union[str,ClientGatewaysServiceTransport,Callable[..., ClientGatewaysServiceTransport]]]):
576
+ The transport to use, or a Callable that constructs and returns a new transport.
577
+ If a Callable is given, it will be called with the same set of initialization
578
+ arguments as used in the ClientGatewaysServiceTransport constructor.
579
+ If set to None, a transport is chosen automatically.
571
580
  client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
572
581
  Custom options for the client.
573
582
 
@@ -676,8 +685,16 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
676
685
  api_key_value
677
686
  )
678
687
 
679
- Transport = type(self).get_transport_class(cast(str, transport))
680
- self._transport = Transport(
688
+ transport_init: Union[
689
+ Type[ClientGatewaysServiceTransport],
690
+ Callable[..., ClientGatewaysServiceTransport],
691
+ ] = (
692
+ type(self).get_transport_class(transport)
693
+ if isinstance(transport, str) or transport is None
694
+ else cast(Callable[..., ClientGatewaysServiceTransport], transport)
695
+ )
696
+ # initialize with the provided callable or the passed in class
697
+ self._transport = transport_init(
681
698
  credentials=credentials,
682
699
  credentials_file=self._client_options.credentials_file,
683
700
  host=self._api_endpoint,
@@ -756,8 +773,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
756
773
 
757
774
  """
758
775
  # Create or coerce a protobuf request object.
759
- # Quick check: If we got a request object, we should *not* have
760
- # gotten any keyword arguments that map to the request.
776
+ # - Quick check: If we got a request object, we should *not* have
777
+ # gotten any keyword arguments that map to the request.
761
778
  has_flattened_params = any([parent])
762
779
  if request is not None and has_flattened_params:
763
780
  raise ValueError(
@@ -765,10 +782,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
765
782
  "the individual field arguments should be set."
766
783
  )
767
784
 
768
- # Minor optimization to avoid making a copy if the user passes
769
- # in a client_gateways_service.ListClientGatewaysRequest.
770
- # There's no risk of modifying the input as we've already verified
771
- # there are no flattened fields.
785
+ # - Use the request object if provided (there's no risk of modifying the input as
786
+ # there are no flattened fields), or create one.
772
787
  if not isinstance(request, client_gateways_service.ListClientGatewaysRequest):
773
788
  request = client_gateways_service.ListClientGatewaysRequest(request)
774
789
  # If we have keyword arguments corresponding to fields on the
@@ -869,8 +884,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
869
884
 
870
885
  """
871
886
  # Create or coerce a protobuf request object.
872
- # Quick check: If we got a request object, we should *not* have
873
- # gotten any keyword arguments that map to the request.
887
+ # - Quick check: If we got a request object, we should *not* have
888
+ # gotten any keyword arguments that map to the request.
874
889
  has_flattened_params = any([name])
875
890
  if request is not None and has_flattened_params:
876
891
  raise ValueError(
@@ -878,10 +893,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
878
893
  "the individual field arguments should be set."
879
894
  )
880
895
 
881
- # Minor optimization to avoid making a copy if the user passes
882
- # in a client_gateways_service.GetClientGatewayRequest.
883
- # There's no risk of modifying the input as we've already verified
884
- # there are no flattened fields.
896
+ # - Use the request object if provided (there's no risk of modifying the input as
897
+ # there are no flattened fields), or create one.
885
898
  if not isinstance(request, client_gateways_service.GetClientGatewayRequest):
886
899
  request = client_gateways_service.GetClientGatewayRequest(request)
887
900
  # If we have keyword arguments corresponding to fields on the
@@ -1003,8 +1016,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
1003
1016
 
1004
1017
  """
1005
1018
  # Create or coerce a protobuf request object.
1006
- # Quick check: If we got a request object, we should *not* have
1007
- # gotten any keyword arguments that map to the request.
1019
+ # - Quick check: If we got a request object, we should *not* have
1020
+ # gotten any keyword arguments that map to the request.
1008
1021
  has_flattened_params = any([parent, client_gateway, client_gateway_id])
1009
1022
  if request is not None and has_flattened_params:
1010
1023
  raise ValueError(
@@ -1012,10 +1025,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
1012
1025
  "the individual field arguments should be set."
1013
1026
  )
1014
1027
 
1015
- # Minor optimization to avoid making a copy if the user passes
1016
- # in a client_gateways_service.CreateClientGatewayRequest.
1017
- # There's no risk of modifying the input as we've already verified
1018
- # there are no flattened fields.
1028
+ # - Use the request object if provided (there's no risk of modifying the input as
1029
+ # there are no flattened fields), or create one.
1019
1030
  if not isinstance(request, client_gateways_service.CreateClientGatewayRequest):
1020
1031
  request = client_gateways_service.CreateClientGatewayRequest(request)
1021
1032
  # If we have keyword arguments corresponding to fields on the
@@ -1133,8 +1144,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
1133
1144
 
1134
1145
  """
1135
1146
  # Create or coerce a protobuf request object.
1136
- # Quick check: If we got a request object, we should *not* have
1137
- # gotten any keyword arguments that map to the request.
1147
+ # - Quick check: If we got a request object, we should *not* have
1148
+ # gotten any keyword arguments that map to the request.
1138
1149
  has_flattened_params = any([name])
1139
1150
  if request is not None and has_flattened_params:
1140
1151
  raise ValueError(
@@ -1142,10 +1153,8 @@ class ClientGatewaysServiceClient(metaclass=ClientGatewaysServiceClientMeta):
1142
1153
  "the individual field arguments should be set."
1143
1154
  )
1144
1155
 
1145
- # Minor optimization to avoid making a copy if the user passes
1146
- # in a client_gateways_service.DeleteClientGatewayRequest.
1147
- # There's no risk of modifying the input as we've already verified
1148
- # there are no flattened fields.
1156
+ # - Use the request object if provided (there's no risk of modifying the input as
1157
+ # there are no flattened fields), or create one.
1149
1158
  if not isinstance(request, client_gateways_service.DeleteClientGatewayRequest):
1150
1159
  request = client_gateways_service.DeleteClientGatewayRequest(request)
1151
1160
  # If we have keyword arguments corresponding to fields on the
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -85,6 +85,8 @@ class ClientGatewaysServiceTransport(abc.ABC):
85
85
 
86
86
  # Save the scopes.
87
87
  self._scopes = scopes
88
+ if not hasattr(self, "_ignore_credentials"):
89
+ self._ignore_credentials: bool = False
88
90
 
89
91
  # If no credentials are provided, then determine the appropriate
90
92
  # defaults.
@@ -97,7 +99,7 @@ class ClientGatewaysServiceTransport(abc.ABC):
97
99
  credentials, _ = google.auth.load_credentials_from_file(
98
100
  credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
99
101
  )
100
- elif credentials is None:
102
+ elif credentials is None and not self._ignore_credentials:
101
103
  credentials, _ = google.auth.default(
102
104
  **scopes_kwargs, quota_project_id=quota_project_id
103
105
  )
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- # Copyright 2023 Google LLC
2
+ # Copyright 2024 Google LLC
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -63,7 +63,7 @@ class ClientGatewaysServiceGrpcTransport(ClientGatewaysServiceTransport):
63
63
  credentials: Optional[ga_credentials.Credentials] = None,
64
64
  credentials_file: Optional[str] = None,
65
65
  scopes: Optional[Sequence[str]] = None,
66
- channel: Optional[grpc.Channel] = None,
66
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
67
67
  api_mtls_endpoint: Optional[str] = None,
68
68
  client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
69
69
  ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -83,14 +83,17 @@ class ClientGatewaysServiceGrpcTransport(ClientGatewaysServiceTransport):
83
83
  credentials identify the application to the service; if none
84
84
  are specified, the client will attempt to ascertain the
85
85
  credentials from the environment.
86
- This argument is ignored if ``channel`` is provided.
86
+ This argument is ignored if a ``channel`` instance is provided.
87
87
  credentials_file (Optional[str]): A file with credentials that can
88
88
  be loaded with :func:`google.auth.load_credentials_from_file`.
89
- This argument is ignored if ``channel`` is provided.
89
+ This argument is ignored if a ``channel`` instance is provided.
90
90
  scopes (Optional(Sequence[str])): A list of scopes. This argument is
91
- ignored if ``channel`` is provided.
92
- channel (Optional[grpc.Channel]): A ``Channel`` instance through
93
- which to make calls.
91
+ ignored if a ``channel`` instance is provided.
92
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
93
+ A ``Channel`` instance through which to make calls, or a Callable
94
+ that constructs and returns one. If set to None, ``self.create_channel``
95
+ is used to create the channel. If a Callable is given, it will be called
96
+ with the same arguments as used in ``self.create_channel``.
94
97
  api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
95
98
  If provided, it overrides the ``host`` argument and tries to create
96
99
  a mutual TLS channel with client SSL credentials from
@@ -100,11 +103,11 @@ class ClientGatewaysServiceGrpcTransport(ClientGatewaysServiceTransport):
100
103
  private key bytes, both in PEM format. It is ignored if
101
104
  ``api_mtls_endpoint`` is None.
102
105
  ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
103
- for the grpc channel. It is ignored if ``channel`` is provided.
106
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
104
107
  client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
105
108
  A callback to provide client certificate bytes and private key bytes,
106
109
  both in PEM format. It is used to configure a mutual TLS channel. It is
107
- ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
110
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
108
111
  quota_project_id (Optional[str]): An optional project to use for billing
109
112
  and quota.
110
113
  client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -131,9 +134,10 @@ class ClientGatewaysServiceGrpcTransport(ClientGatewaysServiceTransport):
131
134
  if client_cert_source:
132
135
  warnings.warn("client_cert_source is deprecated", DeprecationWarning)
133
136
 
134
- if channel:
137
+ if isinstance(channel, grpc.Channel):
135
138
  # Ignore credentials if a channel was passed.
136
- credentials = False
139
+ credentials = None
140
+ self._ignore_credentials = True
137
141
  # If a channel was explicitly provided, set it.
138
142
  self._grpc_channel = channel
139
143
  self._ssl_channel_credentials = None
@@ -172,7 +176,9 @@ class ClientGatewaysServiceGrpcTransport(ClientGatewaysServiceTransport):
172
176
  )
173
177
 
174
178
  if not self._grpc_channel:
175
- self._grpc_channel = type(self).create_channel(
179
+ # initialize with the provided callable or the default channel
180
+ channel_init = channel or type(self).create_channel
181
+ self._grpc_channel = channel_init(
176
182
  self._host,
177
183
  # use the credentials which are saved
178
184
  credentials=self._credentials,