2121import warnings
2222
2323from google .oauth2 import service_account
24+ import google .api_core .client_options
2425import google .api_core .gapic_v1 .client_info
2526import google .api_core .gapic_v1 .config
2627import google .api_core .gapic_v1 .method
@@ -160,6 +161,7 @@ def __init__(
160161 credentials = None ,
161162 client_config = None ,
162163 client_info = None ,
164+ client_options = None ,
163165 ):
164166 """Constructor.
165167
@@ -190,6 +192,9 @@ def __init__(
190192 API requests. If ``None``, then default info will be used.
191193 Generally, you only need to set this if you're developing
192194 your own client library.
195+ client_options (Union[dict, google.api_core.client_options.ClientOptions]):
196+ Client options used to set user options on the client. API Endpoint
197+ should be set through client_options.
193198 """
194199 # Raise deprecation warnings for things we want to go away.
195200 if client_config is not None :
@@ -208,6 +213,15 @@ def __init__(
208213 stacklevel = 2 ,
209214 )
210215
216+ api_endpoint = self .SERVICE_ADDRESS
217+ if client_options :
218+ if type (client_options ) == dict :
219+ client_options = google .api_core .client_options .from_dict (
220+ client_options
221+ )
222+ if client_options .api_endpoint :
223+ api_endpoint = client_options .api_endpoint
224+
211225 # Instantiate the transport.
212226 # The transport is responsible for handling serialization and
213227 # deserialization and actually sending data to the service.
@@ -216,6 +230,7 @@ def __init__(
216230 self .transport = transport (
217231 credentials = credentials ,
218232 default_class = key_management_service_grpc_transport .KeyManagementServiceGrpcTransport ,
233+ address = api_endpoint ,
219234 )
220235 else :
221236 if credentials :
@@ -226,7 +241,7 @@ def __init__(
226241 self .transport = transport
227242 else :
228243 self .transport = key_management_service_grpc_transport .KeyManagementServiceGrpcTransport (
229- address = self . SERVICE_ADDRESS , channel = channel , credentials = credentials
244+ address = api_endpoint , channel = channel , credentials = credentials
230245 )
231246
232247 if client_info is None :
@@ -307,10 +322,10 @@ def list_key_rings(
307322 that is provided to the method.
308323
309324 Returns:
310- A :class:`~google.gax. PageIterator` instance. By default, this
311- is an iterable of :class:`~google.cloud.kms_v1.types.KeyRing` instances.
312- This object can also be configured to iterate over the pages
313- of the response through the `options` parameter .
325+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
326+ An iterable of :class:`~google.cloud.kms_v1.types.KeyRing` instances.
327+ You can also iterate over the pages of the response
328+ using its `pages` property .
314329
315330 Raises:
316331 google.api_core.exceptions.GoogleAPICallError: If the request
@@ -416,10 +431,10 @@ def list_import_jobs(
416431 that is provided to the method.
417432
418433 Returns:
419- A :class:`~google.gax. PageIterator` instance. By default, this
420- is an iterable of :class:`~google.cloud.kms_v1.types.ImportJob` instances.
421- This object can also be configured to iterate over the pages
422- of the response through the `options` parameter .
434+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
435+ An iterable of :class:`~google.cloud.kms_v1.types.ImportJob` instances.
436+ You can also iterate over the pages of the response
437+ using its `pages` property .
423438
424439 Raises:
425440 google.api_core.exceptions.GoogleAPICallError: If the request
@@ -527,10 +542,10 @@ def list_crypto_keys(
527542 that is provided to the method.
528543
529544 Returns:
530- A :class:`~google.gax. PageIterator` instance. By default, this
531- is an iterable of :class:`~google.cloud.kms_v1.types.CryptoKey` instances.
532- This object can also be configured to iterate over the pages
533- of the response through the `options` parameter .
545+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
546+ An iterable of :class:`~google.cloud.kms_v1.types.CryptoKey` instances.
547+ You can also iterate over the pages of the response
548+ using its `pages` property .
534549
535550 Raises:
536551 google.api_core.exceptions.GoogleAPICallError: If the request
@@ -642,10 +657,10 @@ def list_crypto_key_versions(
642657 that is provided to the method.
643658
644659 Returns:
645- A :class:`~google.gax. PageIterator` instance. By default, this
646- is an iterable of :class:`~google.cloud.kms_v1.types.CryptoKeyVersion` instances.
647- This object can also be configured to iterate over the pages
648- of the response through the `options` parameter .
660+ A :class:`~google.api_core.page_iterator. PageIterator` instance.
661+ An iterable of :class:`~google.cloud.kms_v1.types.CryptoKeyVersion` instances.
662+ You can also iterate over the pages of the response
663+ using its `pages` property .
649664
650665 Raises:
651666 google.api_core.exceptions.GoogleAPICallError: If the request
0 commit comments