Skip to content

Commit e9d47be

Browse files
yoshi-automationtseaver
authored andcommitted
Add 'client_options' support, update list method docstrings (via synth). (googleapis#8527)
1 parent 2ab78ae commit e9d47be

2 files changed

Lines changed: 25 additions & 10 deletions

File tree

translate/google/cloud/translate_v3beta1/gapic/translation_service_client.py

Lines changed: 20 additions & 5 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
@@ -103,6 +104,7 @@ def __init__(
103104
credentials=None,
104105
client_config=None,
105106
client_info=None,
107+
client_options=None,
106108
):
107109
"""Constructor.
108110
@@ -133,6 +135,9 @@ def __init__(
133135
API requests. If ``None``, then default info will be used.
134136
Generally, you only need to set this if you're developing
135137
your own client library.
138+
client_options (Union[dict, google.api_core.client_options.ClientOptions]):
139+
Client options used to set user options on the client. API Endpoint
140+
should be set through client_options.
136141
"""
137142
# Raise deprecation warnings for things we want to go away.
138143
if client_config is not None:
@@ -151,6 +156,15 @@ def __init__(
151156
stacklevel=2,
152157
)
153158

159+
api_endpoint = self.SERVICE_ADDRESS
160+
if client_options:
161+
if type(client_options) == dict:
162+
client_options = google.api_core.client_options.from_dict(
163+
client_options
164+
)
165+
if client_options.api_endpoint:
166+
api_endpoint = client_options.api_endpoint
167+
154168
# Instantiate the transport.
155169
# The transport is responsible for handling serialization and
156170
# deserialization and actually sending data to the service.
@@ -159,6 +173,7 @@ def __init__(
159173
self.transport = transport(
160174
credentials=credentials,
161175
default_class=translation_service_grpc_transport.TranslationServiceGrpcTransport,
176+
address=api_endpoint,
162177
)
163178
else:
164179
if credentials:
@@ -169,7 +184,7 @@ def __init__(
169184
self.transport = transport
170185
else:
171186
self.transport = translation_service_grpc_transport.TranslationServiceGrpcTransport(
172-
address=self.SERVICE_ADDRESS, channel=channel, credentials=credentials
187+
address=api_endpoint, channel=channel, credentials=credentials
173188
)
174189

175190
if client_info is None:
@@ -816,10 +831,10 @@ def list_glossaries(
816831
that is provided to the method.
817832
818833
Returns:
819-
A :class:`~google.gax.PageIterator` instance. By default, this
820-
is an iterable of :class:`~google.cloud.translate_v3beta1.types.Glossary` instances.
821-
This object can also be configured to iterate over the pages
822-
of the response through the `options` parameter.
834+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
835+
An iterable of :class:`~google.cloud.translate_v3beta1.types.Glossary` instances.
836+
You can also iterate over the pages of the response
837+
using its `pages` property.
823838
824839
Raises:
825840
google.api_core.exceptions.GoogleAPICallError: If the request

translate/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:33:22.882931Z",
2+
"updateTime": "2019-06-28T12:39:37.711369Z",
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)