Skip to content

Commit 0d14378

Browse files
yoshi-automationbusunkim96
authored andcommitted
Add 'client_options' support, update list method docstrings (via synth). (googleapis#8504)
1 parent f34ec6f commit 0d14378

2 files changed

Lines changed: 57 additions & 42 deletions

File tree

datalabeling/google/cloud/datalabeling_v1beta1/gapic/data_labeling_service_client.py

Lines changed: 52 additions & 37 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
@@ -176,6 +177,7 @@ def __init__(
176177
credentials=None,
177178
client_config=None,
178179
client_info=None,
180+
client_options=None,
179181
):
180182
"""Constructor.
181183
@@ -206,6 +208,9 @@ def __init__(
206208
API requests. If ``None``, then default info will be used.
207209
Generally, you only need to set this if you're developing
208210
your own client library.
211+
client_options (Union[dict, google.api_core.client_options.ClientOptions]):
212+
Client options used to set user options on the client. API Endpoint
213+
should be set through client_options.
209214
"""
210215
# Raise deprecation warnings for things we want to go away.
211216
if client_config is not None:
@@ -224,6 +229,15 @@ def __init__(
224229
stacklevel=2,
225230
)
226231

232+
api_endpoint = self.SERVICE_ADDRESS
233+
if client_options:
234+
if type(client_options) == dict:
235+
client_options = google.api_core.client_options.from_dict(
236+
client_options
237+
)
238+
if client_options.api_endpoint:
239+
api_endpoint = client_options.api_endpoint
240+
227241
# Instantiate the transport.
228242
# The transport is responsible for handling serialization and
229243
# deserialization and actually sending data to the service.
@@ -232,6 +246,7 @@ def __init__(
232246
self.transport = transport(
233247
credentials=credentials,
234248
default_class=data_labeling_service_grpc_transport.DataLabelingServiceGrpcTransport,
249+
address=api_endpoint,
235250
)
236251
else:
237252
if credentials:
@@ -242,7 +257,7 @@ def __init__(
242257
self.transport = transport
243258
else:
244259
self.transport = data_labeling_service_grpc_transport.DataLabelingServiceGrpcTransport(
245-
address=self.SERVICE_ADDRESS, channel=channel, credentials=credentials
260+
address=api_endpoint, channel=channel, credentials=credentials
246261
)
247262

248263
if client_info is None:
@@ -468,10 +483,10 @@ def list_datasets(
468483
that is provided to the method.
469484
470485
Returns:
471-
A :class:`~google.gax.PageIterator` instance. By default, this
472-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Dataset` instances.
473-
This object can also be configured to iterate over the pages
474-
of the response through the `options` parameter.
486+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
487+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Dataset` instances.
488+
You can also iterate over the pages of the response
489+
using its `pages` property.
475490
476491
Raises:
477492
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -928,10 +943,10 @@ def list_data_items(
928943
that is provided to the method.
929944
930945
Returns:
931-
A :class:`~google.gax.PageIterator` instance. By default, this
932-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.DataItem` instances.
933-
This object can also be configured to iterate over the pages
934-
of the response through the `options` parameter.
946+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
947+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.DataItem` instances.
948+
You can also iterate over the pages of the response
949+
using its `pages` property.
935950
936951
Raises:
937952
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -1105,10 +1120,10 @@ def list_annotated_datasets(
11051120
that is provided to the method.
11061121
11071122
Returns:
1108-
A :class:`~google.gax.PageIterator` instance. By default, this
1109-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` instances.
1110-
This object can also be configured to iterate over the pages
1111-
of the response through the `options` parameter.
1123+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
1124+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` instances.
1125+
You can also iterate over the pages of the response
1126+
using its `pages` property.
11121127
11131128
Raises:
11141129
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -1704,10 +1719,10 @@ def list_examples(
17041719
that is provided to the method.
17051720
17061721
Returns:
1707-
A :class:`~google.gax.PageIterator` instance. By default, this
1708-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Example` instances.
1709-
This object can also be configured to iterate over the pages
1710-
of the response through the `options` parameter.
1722+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
1723+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Example` instances.
1724+
You can also iterate over the pages of the response
1725+
using its `pages` property.
17111726
17121727
Raises:
17131728
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -1962,10 +1977,10 @@ def list_annotation_spec_sets(
19621977
that is provided to the method.
19631978
19641979
Returns:
1965-
A :class:`~google.gax.PageIterator` instance. By default, this
1966-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet` instances.
1967-
This object can also be configured to iterate over the pages
1968-
of the response through the `options` parameter.
1980+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
1981+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet` instances.
1982+
You can also iterate over the pages of the response
1983+
using its `pages` property.
19691984
19701985
Raises:
19711986
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -2298,10 +2313,10 @@ def list_instructions(
22982313
that is provided to the method.
22992314
23002315
Returns:
2301-
A :class:`~google.gax.PageIterator` instance. By default, this
2302-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Instruction` instances.
2303-
This object can also be configured to iterate over the pages
2304-
of the response through the `options` parameter.
2316+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
2317+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Instruction` instances.
2318+
You can also iterate over the pages of the response
2319+
using its `pages` property.
23052320
23062321
Raises:
23072322
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -2548,10 +2563,10 @@ def search_evaluations(
25482563
that is provided to the method.
25492564
25502565
Returns:
2551-
A :class:`~google.gax.PageIterator` instance. By default, this
2552-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Evaluation` instances.
2553-
This object can also be configured to iterate over the pages
2554-
of the response through the `options` parameter.
2566+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
2567+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.Evaluation` instances.
2568+
You can also iterate over the pages of the response
2569+
using its `pages` property.
25552570
25562571
Raises:
25572572
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -2655,10 +2670,10 @@ def search_example_comparisons(
26552670
that is provided to the method.
26562671
26572672
Returns:
2658-
A :class:`~google.gax.PageIterator` instance. By default, this
2659-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.ExampleComparison` instances.
2660-
This object can also be configured to iterate over the pages
2661-
of the response through the `options` parameter.
2673+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
2674+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.ExampleComparison` instances.
2675+
You can also iterate over the pages of the response
2676+
using its `pages` property.
26622677
26632678
Raises:
26642679
google.api_core.exceptions.GoogleAPICallError: If the request
@@ -3204,10 +3219,10 @@ def list_evaluation_jobs(
32043219
that is provided to the method.
32053220
32063221
Returns:
3207-
A :class:`~google.gax.PageIterator` instance. By default, this
3208-
is an iterable of :class:`~google.cloud.datalabeling_v1beta1.types.EvaluationJob` instances.
3209-
This object can also be configured to iterate over the pages
3210-
of the response through the `options` parameter.
3222+
A :class:`~google.api_core.page_iterator.PageIterator` instance.
3223+
An iterable of :class:`~google.cloud.datalabeling_v1beta1.types.EvaluationJob` instances.
3224+
You can also iterate over the pages of the response
3225+
using its `pages` property.
32113226
32123227
Raises:
32133228
google.api_core.exceptions.GoogleAPICallError: If the request

datalabeling/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-27T19:52:21.452702Z",
2+
"updateTime": "2019-06-28T12:18:17.352035Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.29.1",
8-
"dockerImage": "googleapis/artman@sha256:b2a73f4dda03ef8fcaa973e3ba26d0cf34091f6c22c70add663af325931aef4d"
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": "f46206aff84f4b2cde590f1e0791112214f07080",
16-
"internalRef": "255318896"
15+
"sha": "84c8ad4e52f8eec8f08a60636cfa597b86969b5c",
16+
"internalRef": "255474859"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)