38
38
from google .cloud .dialogflow_v2 import gapic_version as package_version
39
39
40
40
try :
41
- OptionalRetry = Union [retries .AsyncRetry , gapic_v1 .method ._MethodDefault ]
41
+ OptionalRetry = Union [retries .AsyncRetry , gapic_v1 .method ._MethodDefault , None ]
42
42
except AttributeError : # pragma: NO COVER
43
- OptionalRetry = Union [retries .AsyncRetry , object ] # type: ignore
43
+ OptionalRetry = Union [retries .AsyncRetry , object , None ] # type: ignore
44
44
45
45
from google .api_core import operation # type: ignore
46
46
from google .api_core import operation_async # type: ignore
@@ -64,8 +64,12 @@ class AgentsAsyncClient:
64
64
65
65
_client : AgentsClient
66
66
67
+ # Copy defaults from the synchronous client for use here.
68
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
67
69
DEFAULT_ENDPOINT = AgentsClient .DEFAULT_ENDPOINT
68
70
DEFAULT_MTLS_ENDPOINT = AgentsClient .DEFAULT_MTLS_ENDPOINT
71
+ _DEFAULT_ENDPOINT_TEMPLATE = AgentsClient ._DEFAULT_ENDPOINT_TEMPLATE
72
+ _DEFAULT_UNIVERSE = AgentsClient ._DEFAULT_UNIVERSE
69
73
70
74
agent_path = staticmethod (AgentsClient .agent_path )
71
75
parse_agent_path = staticmethod (AgentsClient .parse_agent_path )
@@ -162,6 +166,25 @@ def transport(self) -> AgentsTransport:
162
166
"""
163
167
return self ._client .transport
164
168
169
+ @property
170
+ def api_endpoint (self ):
171
+ """Return the API endpoint used by the client instance.
172
+
173
+ Returns:
174
+ str: The API endpoint used by the client instance.
175
+ """
176
+ return self ._client ._api_endpoint
177
+
178
+ @property
179
+ def universe_domain (self ) -> str :
180
+ """Return the universe domain used by the client instance.
181
+
182
+ Returns:
183
+ str: The universe domain used
184
+ by the client instance.
185
+ """
186
+ return self ._client ._universe_domain
187
+
165
188
get_transport_class = functools .partial (
166
189
type (AgentsClient ).get_transport_class , type (AgentsClient )
167
190
)
@@ -174,7 +197,7 @@ def __init__(
174
197
client_options : Optional [ClientOptions ] = None ,
175
198
client_info : gapic_v1 .client_info .ClientInfo = DEFAULT_CLIENT_INFO ,
176
199
) -> None :
177
- """Instantiates the agents client.
200
+ """Instantiates the agents async client.
178
201
179
202
Args:
180
203
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -185,23 +208,38 @@ def __init__(
185
208
transport (Union[str, ~.AgentsTransport]): The
186
209
transport to use. If set to None, a transport is chosen
187
210
automatically.
188
- client_options (ClientOptions): Custom options for the client. It
189
- won't take effect if a ``transport`` instance is provided.
190
- (1) The ``api_endpoint`` property can be used to override the
191
- default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
192
- environment variable can also be used to override the endpoint:
211
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
212
+ Custom options for the client.
213
+
214
+ 1. The ``api_endpoint`` property can be used to override the
215
+ default endpoint provided by the client when ``transport`` is
216
+ not explicitly provided. Only if this property is not set and
217
+ ``transport`` was not explicitly provided, the endpoint is
218
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
219
+ variable, which have one of the following values:
193
220
"always" (always use the default mTLS endpoint), "never" (always
194
- use the default regular endpoint) and "auto" (auto switch to the
195
- default mTLS endpoint if client certificate is present, this is
196
- the default value). However, the ``api_endpoint`` property takes
197
- precedence if provided.
198
- (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
221
+ use the default regular endpoint) and "auto" (auto- switch to the
222
+ default mTLS endpoint if client certificate is present; this is
223
+ the default value).
224
+
225
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
199
226
is "true", then the ``client_cert_source`` property can be used
200
- to provide client certificate for mutual TLS transport. If
227
+ to provide a client certificate for mTLS transport. If
201
228
not provided, the default SSL client certificate will be used if
202
229
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
203
230
set, no client certificate will be used.
204
231
232
+ 3. The ``universe_domain`` property can be used to override the
233
+ default "googleapis.com" universe. Note that ``api_endpoint``
234
+ property still takes precedence; and ``universe_domain`` is
235
+ currently not supported for mTLS.
236
+
237
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
238
+ The client info used to send a user-agent string along with
239
+ API requests. If ``None``, then default info will be used.
240
+ Generally, you only need to set this if you're developing
241
+ your own client library.
242
+
205
243
Raises:
206
244
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
207
245
creation failed for any reason.
@@ -313,6 +351,9 @@ async def sample_get_agent():
313
351
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
314
352
)
315
353
354
+ # Validate the universe domain.
355
+ self ._client ._validate_universe_domain ()
356
+
316
357
# Send the request.
317
358
response = await rpc (
318
359
request ,
@@ -434,6 +475,9 @@ async def sample_set_agent():
434
475
),
435
476
)
436
477
478
+ # Validate the universe domain.
479
+ self ._client ._validate_universe_domain ()
480
+
437
481
# Send the request.
438
482
response = await rpc (
439
483
request ,
@@ -527,6 +571,9 @@ async def sample_delete_agent():
527
571
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
528
572
)
529
573
574
+ # Validate the universe domain.
575
+ self ._client ._validate_universe_domain ()
576
+
530
577
# Send the request.
531
578
await rpc (
532
579
request ,
@@ -636,6 +683,9 @@ async def sample_search_agents():
636
683
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
637
684
)
638
685
686
+ # Validate the universe domain.
687
+ self ._client ._validate_universe_domain ()
688
+
639
689
# Send the request.
640
690
response = await rpc (
641
691
request ,
@@ -775,6 +825,9 @@ async def sample_train_agent():
775
825
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
776
826
)
777
827
828
+ # Validate the universe domain.
829
+ self ._client ._validate_universe_domain ()
830
+
778
831
# Send the request.
779
832
response = await rpc (
780
833
request ,
@@ -902,6 +955,9 @@ async def sample_export_agent():
902
955
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
903
956
)
904
957
958
+ # Validate the universe domain.
959
+ self ._client ._validate_universe_domain ()
960
+
905
961
# Send the request.
906
962
response = await rpc (
907
963
request ,
@@ -1033,6 +1089,9 @@ async def sample_import_agent():
1033
1089
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
1034
1090
)
1035
1091
1092
+ # Validate the universe domain.
1093
+ self ._client ._validate_universe_domain ()
1094
+
1036
1095
# Send the request.
1037
1096
response = await rpc (
1038
1097
request ,
@@ -1162,6 +1221,9 @@ async def sample_restore_agent():
1162
1221
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
1163
1222
)
1164
1223
1224
+ # Validate the universe domain.
1225
+ self ._client ._validate_universe_domain ()
1226
+
1165
1227
# Send the request.
1166
1228
response = await rpc (
1167
1229
request ,
@@ -1252,6 +1314,9 @@ async def sample_get_validation_result():
1252
1314
gapic_v1 .routing_header .to_grpc_metadata ((("parent" , request .parent ),)),
1253
1315
)
1254
1316
1317
+ # Validate the universe domain.
1318
+ self ._client ._validate_universe_domain ()
1319
+
1255
1320
# Send the request.
1256
1321
response = await rpc (
1257
1322
request ,
@@ -1306,6 +1371,9 @@ async def list_operations(
1306
1371
gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1307
1372
)
1308
1373
1374
+ # Validate the universe domain.
1375
+ self ._client ._validate_universe_domain ()
1376
+
1309
1377
# Send the request.
1310
1378
response = await rpc (
1311
1379
request ,
@@ -1360,6 +1428,9 @@ async def get_operation(
1360
1428
gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1361
1429
)
1362
1430
1431
+ # Validate the universe domain.
1432
+ self ._client ._validate_universe_domain ()
1433
+
1363
1434
# Send the request.
1364
1435
response = await rpc (
1365
1436
request ,
@@ -1417,6 +1488,9 @@ async def cancel_operation(
1417
1488
gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1418
1489
)
1419
1490
1491
+ # Validate the universe domain.
1492
+ self ._client ._validate_universe_domain ()
1493
+
1420
1494
# Send the request.
1421
1495
await rpc (
1422
1496
request ,
@@ -1468,6 +1542,9 @@ async def get_location(
1468
1542
gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1469
1543
)
1470
1544
1545
+ # Validate the universe domain.
1546
+ self ._client ._validate_universe_domain ()
1547
+
1471
1548
# Send the request.
1472
1549
response = await rpc (
1473
1550
request ,
@@ -1522,6 +1599,9 @@ async def list_locations(
1522
1599
gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1523
1600
)
1524
1601
1602
+ # Validate the universe domain.
1603
+ self ._client ._validate_universe_domain ()
1604
+
1525
1605
# Send the request.
1526
1606
response = await rpc (
1527
1607
request ,
0 commit comments