Skip to content

Commit fb1d3ba

Browse files
yoshi-automationbusunkim96
authored andcommitted
Add 'client_options' support, update list method docstrings (via synth). (#8514)
1 parent 39d5730 commit fb1d3ba

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

packages/google-cloud-kms/google/cloud/kms_v1/gapic/key_management_service_client.py

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import warnings
2222

2323
from google.oauth2 import service_account
24+
import google.api_core.client_options
2425
import google.api_core.gapic_v1.client_info
2526
import google.api_core.gapic_v1.config
2627
import 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

packages/google-cloud-kms/synth.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-06-18T12:21:24.691727Z",
2+
"updateTime": "2019-06-28T12:27:15.106812Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.27.0",
8-
"dockerImage": "googleapis/artman@sha256:b036a7f4278d9deb5796f065e5c7f608d47d75369985ca7ab5039998120e972d"
7+
"version": "0.29.2",
8+
"dockerImage": "googleapis/artman@sha256:45263333b058a4b3c26a8b7680a2710f43eae3d250f791a6cb66423991dcb2df"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "384aa843867c4d17756d14a01f047b6368494d32",
16-
"internalRef": "253675319"
15+
"sha": "84c8ad4e52f8eec8f08a60636cfa597b86969b5c",
16+
"internalRef": "255474859"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)