34
34
from google .api_core .client_options import ClientOptions
35
35
from google .auth import credentials as ga_credentials # type: ignore
36
36
from google .oauth2 import service_account # type: ignore
37
- import pkg_resources
37
+
38
+ from google .cloud .memcache_v1 import gapic_version as package_version
38
39
39
40
try :
40
41
OptionalRetry = Union [retries .Retry , gapic_v1 .method ._MethodDefault ]
@@ -246,7 +247,7 @@ async def list_instances(
246
247
* ,
247
248
parent : Optional [str ] = None ,
248
249
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
249
- timeout : Optional [float ] = None ,
250
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
250
251
metadata : Sequence [Tuple [str , str ]] = (),
251
252
) -> pagers .ListInstancesAsyncPager :
252
253
r"""Lists Instances in a given location.
@@ -363,7 +364,7 @@ async def get_instance(
363
364
* ,
364
365
name : Optional [str ] = None ,
365
366
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
366
- timeout : Optional [float ] = None ,
367
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
367
368
metadata : Sequence [Tuple [str , str ]] = (),
368
369
) -> cloud_memcache .Instance :
369
370
r"""Gets details of a single Instance.
@@ -467,7 +468,7 @@ async def create_instance(
467
468
instance : Optional [cloud_memcache .Instance ] = None ,
468
469
instance_id : Optional [str ] = None ,
469
470
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
470
- timeout : Optional [float ] = None ,
471
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
471
472
metadata : Sequence [Tuple [str , str ]] = (),
472
473
) -> operation_async .AsyncOperation :
473
474
r"""Creates a new Instance in a given location.
@@ -505,7 +506,7 @@ async def sample_create_instance():
505
506
506
507
print("Waiting for operation to complete...")
507
508
508
- response = await operation.result()
509
+ response = ( await operation) .result()
509
510
510
511
# Handle the response
511
512
print(response)
@@ -621,7 +622,7 @@ async def update_instance(
621
622
instance : Optional [cloud_memcache .Instance ] = None ,
622
623
update_mask : Optional [field_mask_pb2 .FieldMask ] = None ,
623
624
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
624
- timeout : Optional [float ] = None ,
625
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
625
626
metadata : Sequence [Tuple [str , str ]] = (),
626
627
) -> operation_async .AsyncOperation :
627
628
r"""Updates an existing Instance in a given project and
@@ -658,7 +659,7 @@ async def sample_update_instance():
658
659
659
660
print("Waiting for operation to complete...")
660
661
661
- response = await operation.result()
662
+ response = ( await operation) .result()
662
663
663
664
# Handle the response
664
665
print(response)
@@ -759,7 +760,7 @@ async def update_parameters(
759
760
update_mask : Optional [field_mask_pb2 .FieldMask ] = None ,
760
761
parameters : Optional [cloud_memcache .MemcacheParameters ] = None ,
761
762
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
762
- timeout : Optional [float ] = None ,
763
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
763
764
metadata : Sequence [Tuple [str , str ]] = (),
764
765
) -> operation_async .AsyncOperation :
765
766
r"""Updates the defined Memcached parameters for an existing
@@ -792,7 +793,7 @@ async def sample_update_parameters():
792
793
793
794
print("Waiting for operation to complete...")
794
795
795
- response = await operation.result()
796
+ response = ( await operation) .result()
796
797
797
798
# Handle the response
798
799
print(response)
@@ -896,7 +897,7 @@ async def delete_instance(
896
897
* ,
897
898
name : Optional [str ] = None ,
898
899
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
899
- timeout : Optional [float ] = None ,
900
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
900
901
metadata : Sequence [Tuple [str , str ]] = (),
901
902
) -> operation_async .AsyncOperation :
902
903
r"""Deletes a single Instance.
@@ -926,7 +927,7 @@ async def sample_delete_instance():
926
927
927
928
print("Waiting for operation to complete...")
928
929
929
- response = await operation.result()
930
+ response = ( await operation) .result()
930
931
931
932
# Handle the response
932
933
print(response)
@@ -1024,7 +1025,7 @@ async def apply_parameters(
1024
1025
node_ids : Optional [MutableSequence [str ]] = None ,
1025
1026
apply_all : Optional [bool ] = None ,
1026
1027
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1027
- timeout : Optional [float ] = None ,
1028
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1028
1029
metadata : Sequence [Tuple [str , str ]] = (),
1029
1030
) -> operation_async .AsyncOperation :
1030
1031
r"""``ApplyParameters`` restarts the set of specified nodes in order
@@ -1056,7 +1057,7 @@ async def sample_apply_parameters():
1056
1057
1057
1058
print("Waiting for operation to complete...")
1058
1059
1059
- response = await operation.result()
1060
+ response = ( await operation) .result()
1060
1061
1061
1062
# Handle the response
1062
1063
print(response)
@@ -1170,7 +1171,7 @@ async def reschedule_maintenance(
1170
1171
] = None ,
1171
1172
schedule_time : Optional [timestamp_pb2 .Timestamp ] = None ,
1172
1173
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1173
- timeout : Optional [float ] = None ,
1174
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1174
1175
metadata : Sequence [Tuple [str , str ]] = (),
1175
1176
) -> operation_async .AsyncOperation :
1176
1177
r"""Reschedules upcoming maintenance event.
@@ -1201,7 +1202,7 @@ async def sample_reschedule_maintenance():
1201
1202
1202
1203
print("Waiting for operation to complete...")
1203
1204
1204
- response = await operation.result()
1205
+ response = ( await operation) .result()
1205
1206
1206
1207
# Handle the response
1207
1208
print(response)
@@ -1308,7 +1309,7 @@ async def list_operations(
1308
1309
request : Optional [operations_pb2 .ListOperationsRequest ] = None ,
1309
1310
* ,
1310
1311
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1311
- timeout : Optional [float ] = None ,
1312
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1312
1313
metadata : Sequence [Tuple [str , str ]] = (),
1313
1314
) -> operations_pb2 .ListOperationsResponse :
1314
1315
r"""Lists operations that match the specified filter in the request.
@@ -1362,7 +1363,7 @@ async def get_operation(
1362
1363
request : Optional [operations_pb2 .GetOperationRequest ] = None ,
1363
1364
* ,
1364
1365
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1365
- timeout : Optional [float ] = None ,
1366
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1366
1367
metadata : Sequence [Tuple [str , str ]] = (),
1367
1368
) -> operations_pb2 .Operation :
1368
1369
r"""Gets the latest state of a long-running operation.
@@ -1416,7 +1417,7 @@ async def delete_operation(
1416
1417
request : Optional [operations_pb2 .DeleteOperationRequest ] = None ,
1417
1418
* ,
1418
1419
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1419
- timeout : Optional [float ] = None ,
1420
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1420
1421
metadata : Sequence [Tuple [str , str ]] = (),
1421
1422
) -> None :
1422
1423
r"""Deletes a long-running operation.
@@ -1471,7 +1472,7 @@ async def cancel_operation(
1471
1472
request : Optional [operations_pb2 .CancelOperationRequest ] = None ,
1472
1473
* ,
1473
1474
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1474
- timeout : Optional [float ] = None ,
1475
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1475
1476
metadata : Sequence [Tuple [str , str ]] = (),
1476
1477
) -> None :
1477
1478
r"""Starts asynchronous cancellation on a long-running operation.
@@ -1525,7 +1526,7 @@ async def get_location(
1525
1526
request : Optional [locations_pb2 .GetLocationRequest ] = None ,
1526
1527
* ,
1527
1528
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1528
- timeout : Optional [float ] = None ,
1529
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1529
1530
metadata : Sequence [Tuple [str , str ]] = (),
1530
1531
) -> locations_pb2 .Location :
1531
1532
r"""Gets information about a location.
@@ -1579,7 +1580,7 @@ async def list_locations(
1579
1580
request : Optional [locations_pb2 .ListLocationsRequest ] = None ,
1580
1581
* ,
1581
1582
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1582
- timeout : Optional [float ] = None ,
1583
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1583
1584
metadata : Sequence [Tuple [str , str ]] = (),
1584
1585
) -> locations_pb2 .ListLocationsResponse :
1585
1586
r"""Lists information about the supported locations for this service.
@@ -1635,14 +1636,9 @@ async def __aexit__(self, exc_type, exc, tb):
1635
1636
await self .transport .close ()
1636
1637
1637
1638
1638
- try :
1639
- DEFAULT_CLIENT_INFO = gapic_v1 .client_info .ClientInfo (
1640
- gapic_version = pkg_resources .get_distribution (
1641
- "google-cloud-memcache" ,
1642
- ).version ,
1643
- )
1644
- except pkg_resources .DistributionNotFound :
1645
- DEFAULT_CLIENT_INFO = gapic_v1 .client_info .ClientInfo ()
1639
+ DEFAULT_CLIENT_INFO = gapic_v1 .client_info .ClientInfo (
1640
+ gapic_version = package_version .__version__
1641
+ )
1646
1642
1647
1643
1648
1644
__all__ = ("CloudMemcacheAsyncClient" ,)
0 commit comments