Skip to content

Commit d0530dc

Browse files
1 parent 3f86764 commit d0530dc

File tree

2,245 files changed

+51783
-877839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,245 files changed

+51783
-877839
lines changed

google/cloud/aiplatform_v1/services/dataset_service/async_client.py

Lines changed: 136 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
from google.oauth2 import service_account # type: ignore
3939

4040
try:
41-
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
41+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
4242
except AttributeError: # pragma: NO COVER
43-
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
43+
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
4444

4545
from google.api_core import operation as gac_operation # type: ignore
4646
from google.api_core import operation_async # type: ignore
@@ -76,8 +76,12 @@ class DatasetServiceAsyncClient:
7676

7777
_client: DatasetServiceClient
7878

79+
# Copy defaults from the synchronous client for use here.
80+
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
7981
DEFAULT_ENDPOINT = DatasetServiceClient.DEFAULT_ENDPOINT
8082
DEFAULT_MTLS_ENDPOINT = DatasetServiceClient.DEFAULT_MTLS_ENDPOINT
83+
_DEFAULT_ENDPOINT_TEMPLATE = DatasetServiceClient._DEFAULT_ENDPOINT_TEMPLATE
84+
_DEFAULT_UNIVERSE = DatasetServiceClient._DEFAULT_UNIVERSE
8185

8286
annotation_path = staticmethod(DatasetServiceClient.annotation_path)
8387
parse_annotation_path = staticmethod(DatasetServiceClient.parse_annotation_path)
@@ -198,6 +202,25 @@ def transport(self) -> DatasetServiceTransport:
198202
"""
199203
return self._client.transport
200204

205+
@property
206+
def api_endpoint(self):
207+
"""Return the API endpoint used by the client instance.
208+
209+
Returns:
210+
str: The API endpoint used by the client instance.
211+
"""
212+
return self._client._api_endpoint
213+
214+
@property
215+
def universe_domain(self) -> str:
216+
"""Return the universe domain used by the client instance.
217+
218+
Returns:
219+
str: The universe domain used
220+
by the client instance.
221+
"""
222+
return self._client._universe_domain
223+
201224
get_transport_class = functools.partial(
202225
type(DatasetServiceClient).get_transport_class, type(DatasetServiceClient)
203226
)
@@ -210,7 +233,7 @@ def __init__(
210233
client_options: Optional[ClientOptions] = None,
211234
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
212235
) -> None:
213-
"""Instantiates the dataset service client.
236+
"""Instantiates the dataset service async client.
214237
215238
Args:
216239
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -221,23 +244,38 @@ def __init__(
221244
transport (Union[str, ~.DatasetServiceTransport]): The
222245
transport to use. If set to None, a transport is chosen
223246
automatically.
224-
client_options (ClientOptions): Custom options for the client. It
225-
won't take effect if a ``transport`` instance is provided.
226-
(1) The ``api_endpoint`` property can be used to override the
227-
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
228-
environment variable can also be used to override the endpoint:
247+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
248+
Custom options for the client.
249+
250+
1. The ``api_endpoint`` property can be used to override the
251+
default endpoint provided by the client when ``transport`` is
252+
not explicitly provided. Only if this property is not set and
253+
``transport`` was not explicitly provided, the endpoint is
254+
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
255+
variable, which have one of the following values:
229256
"always" (always use the default mTLS endpoint), "never" (always
230-
use the default regular endpoint) and "auto" (auto switch to the
231-
default mTLS endpoint if client certificate is present, this is
232-
the default value). However, the ``api_endpoint`` property takes
233-
precedence if provided.
234-
(2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
257+
use the default regular endpoint) and "auto" (auto-switch to the
258+
default mTLS endpoint if client certificate is present; this is
259+
the default value).
260+
261+
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
235262
is "true", then the ``client_cert_source`` property can be used
236-
to provide client certificate for mutual TLS transport. If
263+
to provide a client certificate for mTLS transport. If
237264
not provided, the default SSL client certificate will be used if
238265
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
239266
set, no client certificate will be used.
240267
268+
3. The ``universe_domain`` property can be used to override the
269+
default "googleapis.com" universe. Note that ``api_endpoint``
270+
property still takes precedence; and ``universe_domain`` is
271+
currently not supported for mTLS.
272+
273+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
274+
The client info used to send a user-agent string along with
275+
API requests. If ``None``, then default info will be used.
276+
Generally, you only need to set this if you're developing
277+
your own client library.
278+
241279
Raises:
242280
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
243281
creation failed for any reason.
@@ -362,6 +400,9 @@ async def sample_create_dataset():
362400
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
363401
)
364402

403+
# Validate the universe domain.
404+
self._client._validate_universe_domain()
405+
365406
# Send the request.
366407
response = await rpc(
367408
request,
@@ -472,6 +513,9 @@ async def sample_get_dataset():
472513
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
473514
)
474515

516+
# Validate the universe domain.
517+
self._client._validate_universe_domain()
518+
475519
# Send the request.
476520
response = await rpc(
477521
request,
@@ -597,6 +641,9 @@ async def sample_update_dataset():
597641
),
598642
)
599643

644+
# Validate the universe domain.
645+
self._client._validate_universe_domain()
646+
600647
# Send the request.
601648
response = await rpc(
602649
request,
@@ -703,6 +750,9 @@ async def sample_list_datasets():
703750
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
704751
)
705752

753+
# Validate the universe domain.
754+
self._client._validate_universe_domain()
755+
706756
# Send the request.
707757
response = await rpc(
708758
request,
@@ -829,6 +879,9 @@ async def sample_delete_dataset():
829879
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
830880
)
831881

882+
# Validate the universe domain.
883+
self._client._validate_universe_domain()
884+
832885
# Send the request.
833886
response = await rpc(
834887
request,
@@ -961,6 +1014,9 @@ async def sample_import_data():
9611014
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
9621015
)
9631016

1017+
# Validate the universe domain.
1018+
self._client._validate_universe_domain()
1019+
9641020
# Send the request.
9651021
response = await rpc(
9661022
request,
@@ -1091,6 +1147,9 @@ async def sample_export_data():
10911147
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
10921148
)
10931149

1150+
# Validate the universe domain.
1151+
self._client._validate_universe_domain()
1152+
10941153
# Send the request.
10951154
response = await rpc(
10961155
request,
@@ -1223,6 +1282,9 @@ async def sample_create_dataset_version():
12231282
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
12241283
)
12251284

1285+
# Validate the universe domain.
1286+
self._client._validate_universe_domain()
1287+
12261288
# Send the request.
12271289
response = await rpc(
12281290
request,
@@ -1350,6 +1412,9 @@ async def sample_delete_dataset_version():
13501412
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
13511413
)
13521414

1415+
# Validate the universe domain.
1416+
self._client._validate_universe_domain()
1417+
13531418
# Send the request.
13541419
response = await rpc(
13551420
request,
@@ -1459,6 +1524,9 @@ async def sample_get_dataset_version():
14591524
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
14601525
)
14611526

1527+
# Validate the universe domain.
1528+
self._client._validate_universe_domain()
1529+
14621530
# Send the request.
14631531
response = await rpc(
14641532
request,
@@ -1568,6 +1636,9 @@ async def sample_list_dataset_versions():
15681636
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
15691637
)
15701638

1639+
# Validate the universe domain.
1640+
self._client._validate_universe_domain()
1641+
15711642
# Send the request.
15721643
response = await rpc(
15731644
request,
@@ -1689,6 +1760,9 @@ async def sample_restore_dataset_version():
16891760
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
16901761
)
16911762

1763+
# Validate the universe domain.
1764+
self._client._validate_universe_domain()
1765+
16921766
# Send the request.
16931767
response = await rpc(
16941768
request,
@@ -1804,6 +1878,9 @@ async def sample_list_data_items():
18041878
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
18051879
)
18061880

1881+
# Validate the universe domain.
1882+
self._client._validate_universe_domain()
1883+
18071884
# Send the request.
18081885
response = await rpc(
18091886
request,
@@ -1898,6 +1975,9 @@ async def sample_search_data_items():
18981975
gapic_v1.routing_header.to_grpc_metadata((("dataset", request.dataset),)),
18991976
)
19001977

1978+
# Validate the universe domain.
1979+
self._client._validate_universe_domain()
1980+
19011981
# Send the request.
19021982
response = await rpc(
19031983
request,
@@ -2014,6 +2094,9 @@ async def sample_list_saved_queries():
20142094
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
20152095
)
20162096

2097+
# Validate the universe domain.
2098+
self._client._validate_universe_domain()
2099+
20172100
# Send the request.
20182101
response = await rpc(
20192102
request,
@@ -2140,6 +2223,9 @@ async def sample_delete_saved_query():
21402223
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
21412224
)
21422225

2226+
# Validate the universe domain.
2227+
self._client._validate_universe_domain()
2228+
21432229
# Send the request.
21442230
response = await rpc(
21452231
request,
@@ -2251,6 +2337,9 @@ async def sample_get_annotation_spec():
22512337
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
22522338
)
22532339

2340+
# Validate the universe domain.
2341+
self._client._validate_universe_domain()
2342+
22542343
# Send the request.
22552344
response = await rpc(
22562345
request,
@@ -2358,6 +2447,9 @@ async def sample_list_annotations():
23582447
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
23592448
)
23602449

2450+
# Validate the universe domain.
2451+
self._client._validate_universe_domain()
2452+
23612453
# Send the request.
23622454
response = await rpc(
23632455
request,
@@ -2421,6 +2513,9 @@ async def list_operations(
24212513
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
24222514
)
24232515

2516+
# Validate the universe domain.
2517+
self._client._validate_universe_domain()
2518+
24242519
# Send the request.
24252520
response = await rpc(
24262521
request,
@@ -2475,6 +2570,9 @@ async def get_operation(
24752570
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
24762571
)
24772572

2573+
# Validate the universe domain.
2574+
self._client._validate_universe_domain()
2575+
24782576
# Send the request.
24792577
response = await rpc(
24802578
request,
@@ -2533,6 +2631,9 @@ async def delete_operation(
25332631
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
25342632
)
25352633

2634+
# Validate the universe domain.
2635+
self._client._validate_universe_domain()
2636+
25362637
# Send the request.
25372638
await rpc(
25382639
request,
@@ -2587,6 +2688,9 @@ async def cancel_operation(
25872688
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
25882689
)
25892690

2691+
# Validate the universe domain.
2692+
self._client._validate_universe_domain()
2693+
25902694
# Send the request.
25912695
await rpc(
25922696
request,
@@ -2644,6 +2748,9 @@ async def wait_operation(
26442748
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
26452749
)
26462750

2751+
# Validate the universe domain.
2752+
self._client._validate_universe_domain()
2753+
26472754
# Send the request.
26482755
response = await rpc(
26492756
request,
@@ -2764,6 +2871,9 @@ async def set_iam_policy(
27642871
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
27652872
)
27662873

2874+
# Validate the universe domain.
2875+
self._client._validate_universe_domain()
2876+
27672877
# Send the request.
27682878
response = await rpc(
27692879
request,
@@ -2885,6 +2995,9 @@ async def get_iam_policy(
28852995
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
28862996
)
28872997

2998+
# Validate the universe domain.
2999+
self._client._validate_universe_domain()
3000+
28883001
# Send the request.
28893002
response = await rpc(
28903003
request,
@@ -2944,6 +3057,9 @@ async def test_iam_permissions(
29443057
gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
29453058
)
29463059

3060+
# Validate the universe domain.
3061+
self._client._validate_universe_domain()
3062+
29473063
# Send the request.
29483064
response = await rpc(
29493065
request,
@@ -2998,6 +3114,9 @@ async def get_location(
29983114
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
29993115
)
30003116

3117+
# Validate the universe domain.
3118+
self._client._validate_universe_domain()
3119+
30013120
# Send the request.
30023121
response = await rpc(
30033122
request,
@@ -3052,6 +3171,9 @@ async def list_locations(
30523171
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
30533172
)
30543173

3174+
# Validate the universe domain.
3175+
self._client._validate_universe_domain()
3176+
30553177
# Send the request.
30563178
response = await rpc(
30573179
request,

0 commit comments

Comments
 (0)