@@ -48,18 +48,20 @@ def get_client_cert():
48
48
49
49
"""
50
50
51
+ from typing import Callable , Mapping , Optional , Sequence , Tuple
52
+
51
53
52
54
class ClientOptions (object ):
53
55
"""Client Options used to set options on clients.
54
56
55
57
Args:
56
58
api_endpoint (Optional[str]): The desired API endpoint, e.g.,
57
59
compute.googleapis.com
58
- client_cert_source (Optional[Callable[[], ( bytes, bytes) ]]): A callback
60
+ client_cert_source (Optional[Callable[[], Tuple[ bytes, bytes] ]]): A callback
59
61
which returns client certificate bytes and private key bytes both in
60
62
PEM format. ``client_cert_source`` and ``client_encrypted_cert_source``
61
63
are mutually exclusive.
62
- client_encrypted_cert_source (Optional[Callable[[], ( str, str, bytes) ]]):
64
+ client_encrypted_cert_source (Optional[Callable[[], Tuple[ str, str, bytes] ]]):
63
65
A callback which returns client certificate file path, encrypted
64
66
private key file path, and the passphrase bytes.``client_cert_source``
65
67
and ``client_encrypted_cert_source`` are mutually exclusive.
@@ -88,15 +90,17 @@ class ClientOptions(object):
88
90
89
91
def __init__ (
90
92
self ,
91
- api_endpoint = None ,
92
- client_cert_source = None ,
93
- client_encrypted_cert_source = None ,
94
- quota_project_id = None ,
95
- credentials_file = None ,
96
- scopes = None ,
97
- api_key = None ,
98
- api_audience = None ,
99
- universe_domain = None ,
93
+ api_endpoint : Optional [str ] = None ,
94
+ client_cert_source : Optional [Callable [[], Tuple [bytes , bytes ]]] = None ,
95
+ client_encrypted_cert_source : Optional [
96
+ Callable [[], Tuple [str , str , bytes ]]
97
+ ] = None ,
98
+ quota_project_id : Optional [str ] = None ,
99
+ credentials_file : Optional [str ] = None ,
100
+ scopes : Optional [Sequence [str ]] = None ,
101
+ api_key : Optional [str ] = None ,
102
+ api_audience : Optional [str ] = None ,
103
+ universe_domain : Optional [str ] = None ,
100
104
):
101
105
if client_cert_source and client_encrypted_cert_source :
102
106
raise ValueError (
@@ -114,11 +118,11 @@ def __init__(
114
118
self .api_audience = api_audience
115
119
self .universe_domain = universe_domain
116
120
117
- def __repr__ (self ):
121
+ def __repr__ (self ) -> str :
118
122
return "ClientOptions: " + repr (self .__dict__ )
119
123
120
124
121
- def from_dict (options ) :
125
+ def from_dict (options : Mapping [ str , object ]) -> ClientOptions :
122
126
"""Construct a client options object from a mapping object.
123
127
124
128
Args:
0 commit comments