|
14 | 14 | # limitations under the License.
|
15 | 15 | #
|
16 | 16 | from collections import OrderedDict
|
17 |
| -from distutils import util |
18 | 17 | import os
|
19 | 18 | import re
|
20 | 19 | from typing import Dict, Optional, Sequence, Tuple, Type, Union
|
21 | 20 | import pkg_resources
|
22 | 21 | import warnings
|
23 | 22 |
|
24 |
| -from google.api_core import client_options as client_options_lib # type: ignore |
25 |
| -from google.api_core import exceptions as core_exceptions # type: ignore |
26 |
| -from google.api_core import gapic_v1 # type: ignore |
27 |
| -from google.api_core import retry as retries # type: ignore |
| 23 | +from google.api_core import client_options as client_options_lib |
| 24 | +from google.api_core import exceptions as core_exceptions |
| 25 | +from google.api_core import gapic_v1 |
| 26 | +from google.api_core import retry as retries |
28 | 27 | from google.auth import credentials as ga_credentials # type: ignore
|
29 | 28 | from google.auth.transport import mtls # type: ignore
|
30 | 29 | from google.auth.transport.grpc import SslCredentials # type: ignore
|
31 | 30 | from google.auth.exceptions import MutualTLSChannelError # type: ignore
|
32 | 31 | from google.oauth2 import service_account # type: ignore
|
33 | 32 |
|
34 |
| -OptionalRetry = Union[retries.Retry, object] |
| 33 | +try: |
| 34 | + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] |
| 35 | +except AttributeError: # pragma: NO COVER |
| 36 | + OptionalRetry = Union[retries.Retry, object] # type: ignore |
35 | 37 |
|
36 | 38 | from google.cloud.container_v1beta1.services.cluster_manager import pagers
|
37 | 39 | from google.cloud.container_v1beta1.types import cluster_service
|
@@ -280,8 +282,15 @@ def __init__(
|
280 | 282 | client_options = client_options_lib.ClientOptions()
|
281 | 283 |
|
282 | 284 | # Create SSL credentials for mutual TLS if needed.
|
283 |
| - use_client_cert = bool( |
284 |
| - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) |
| 285 | + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( |
| 286 | + "true", |
| 287 | + "false", |
| 288 | + ): |
| 289 | + raise ValueError( |
| 290 | + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" |
| 291 | + ) |
| 292 | + use_client_cert = ( |
| 293 | + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" |
285 | 294 | )
|
286 | 295 |
|
287 | 296 | client_cert_source_func = None
|
|
0 commit comments