51
51
from google .cloud .asset_v1 .services .asset_service import pagers
52
52
from google .cloud .asset_v1 .types import asset_service
53
53
from google .cloud .asset_v1 .types import assets
54
+ from google .longrunning import operations_pb2
54
55
from google .protobuf import field_mask_pb2 # type: ignore
55
56
from google .protobuf import timestamp_pb2 # type: ignore
56
57
from google .rpc import status_pb2 # type: ignore
57
58
from google .type import expr_pb2 # type: ignore
58
59
from .transports .base import AssetServiceTransport , DEFAULT_CLIENT_INFO
59
60
from .transports .grpc import AssetServiceGrpcTransport
60
61
from .transports .grpc_asyncio import AssetServiceGrpcAsyncIOTransport
62
+ from .transports .rest import AssetServiceRestTransport
61
63
62
64
63
65
class AssetServiceClientMeta (type ):
@@ -71,6 +73,7 @@ class AssetServiceClientMeta(type):
71
73
_transport_registry = OrderedDict () # type: Dict[str, Type[AssetServiceTransport]]
72
74
_transport_registry ["grpc" ] = AssetServiceGrpcTransport
73
75
_transport_registry ["grpc_asyncio" ] = AssetServiceGrpcAsyncIOTransport
76
+ _transport_registry ["rest" ] = AssetServiceRestTransport
74
77
75
78
def get_transport_class (
76
79
cls ,
@@ -3355,6 +3358,60 @@ def __exit__(self, type, value, traceback):
3355
3358
"""
3356
3359
self .transport .close ()
3357
3360
3361
+ def get_operation (
3362
+ self ,
3363
+ request : Optional [operations_pb2 .GetOperationRequest ] = None ,
3364
+ * ,
3365
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
3366
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
3367
+ metadata : Sequence [Tuple [str , str ]] = (),
3368
+ ) -> operations_pb2 .Operation :
3369
+ r"""Gets the latest state of a long-running operation.
3370
+
3371
+ Args:
3372
+ request (:class:`~.operations_pb2.GetOperationRequest`):
3373
+ The request object. Request message for
3374
+ `GetOperation` method.
3375
+ retry (google.api_core.retry.Retry): Designation of what errors,
3376
+ if any, should be retried.
3377
+ timeout (float): The timeout for this request.
3378
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
3379
+ sent along with the request as metadata.
3380
+ Returns:
3381
+ ~.operations_pb2.Operation:
3382
+ An ``Operation`` object.
3383
+ """
3384
+ # Create or coerce a protobuf request object.
3385
+ # The request isn't a proto-plus wrapped type,
3386
+ # so it must be constructed via keyword expansion.
3387
+ if isinstance (request , dict ):
3388
+ request = operations_pb2 .GetOperationRequest (** request )
3389
+
3390
+ # Wrap the RPC method; this adds retry and timeout information,
3391
+ # and friendly error handling.
3392
+ rpc = gapic_v1 .method .wrap_method (
3393
+ self ._transport .get_operation ,
3394
+ default_timeout = None ,
3395
+ client_info = DEFAULT_CLIENT_INFO ,
3396
+ )
3397
+
3398
+ # Certain fields should be provided within the metadata header;
3399
+ # add these here.
3400
+ metadata = tuple (metadata ) + (
3401
+ gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
3402
+ )
3403
+
3404
+ # Send the request.
3405
+ response = rpc (
3406
+ request ,
3407
+ retry = retry ,
3408
+ timeout = timeout ,
3409
+ metadata = metadata ,
3410
+ )
3411
+
3412
+ # Done; return the response.
3413
+ return response
3414
+
3358
3415
3359
3416
DEFAULT_CLIENT_INFO = gapic_v1 .client_info .ClientInfo (
3360
3417
gapic_version = package_version .__version__
0 commit comments