diff options
author | arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> | 2020-05-27 16:07:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-27 16:07:49 -0700 |
commit | e4eaec0ff255114138d3715280f86d34d861a6fa (patch) | |
tree | 671fb072fa60eef4360a31902b41d378a238a4e0 /google | |
parent | a82f2892b8f219b82e120e6ed9f4070869c28be7 (diff) | |
download | python-api-core-e4eaec0ff255114138d3715280f86d34d861a6fa.tar.gz |
feat: add client_encryped_cert_source to ClientOptions (#31)
Diffstat (limited to 'google')
-rw-r--r-- | google/api_core/client_options.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/google/api_core/client_options.py b/google/api_core/client_options.py index 7cb49c6..b6d9384 100644 --- a/google/api_core/client_options.py +++ b/google/api_core/client_options.py @@ -56,12 +56,31 @@ class ClientOptions(object): api_endpoint (str): The desired API endpoint, e.g., compute.googleapis.com client_cert_source (Callable[[], (bytes, bytes)]): An optional callback which returns client certificate bytes and private key bytes both in - PEM format. + PEM format. ``client_cert_source`` and ``client_encrypted_cert_source`` + are mutually exclusive. + client_encrypted_cert_source (Callable[[], (str, str, bytes)]): An optional + callback which returns client certificate file path, encrypted private + key file path, and the passphrase bytes.``client_cert_source`` and + ``client_encrypted_cert_source`` are mutually exclusive. + + Raises: + ValueError: If both ``client_cert_source`` and ``client_encrypted_cert_source`` + are provided. """ - def __init__(self, api_endpoint=None, client_cert_source=None): + def __init__( + self, + api_endpoint=None, + client_cert_source=None, + client_encrypted_cert_source=None, + ): + if client_cert_source and client_encrypted_cert_source: + raise ValueError( + "client_cert_source and client_encrypted_cert_source are mutually exclusive" + ) self.api_endpoint = api_endpoint self.client_cert_source = client_cert_source + self.client_encrypted_cert_source = client_encrypted_cert_source def __repr__(self): return "ClientOptions: " + repr(self.__dict__) |