|
33 | 33 |
|
34 | 34 | from google.api_core import operation # type: ignore
|
35 | 35 | from google.api_core import operation_async # type: ignore
|
| 36 | +from google.longrunning import operations_pb2 |
36 | 37 | from google.protobuf import empty_pb2 # type: ignore
|
37 | 38 | from google.protobuf import timestamp_pb2 # type: ignore
|
38 | 39 | from google.type import postal_address_pb2 # type: ignore
|
@@ -5179,6 +5180,223 @@ async def sample_list_subscribers():
|
5179 | 5180 | # Done; return the response.
|
5180 | 5181 | return response
|
5181 | 5182 |
|
| 5183 | + async def list_operations( |
| 5184 | + self, |
| 5185 | + request: operations_pb2.ListOperationsRequest = None, |
| 5186 | + *, |
| 5187 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 5188 | + timeout: float = None, |
| 5189 | + metadata: Sequence[Tuple[str, str]] = (), |
| 5190 | + ) -> operations_pb2.ListOperationsResponse: |
| 5191 | + r"""Lists operations that match the specified filter in the request. |
| 5192 | +
|
| 5193 | + Args: |
| 5194 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 5195 | + The request object. Request message for |
| 5196 | + `ListOperations` method. |
| 5197 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 5198 | + if any, should be retried. |
| 5199 | + timeout (float): The timeout for this request. |
| 5200 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 5201 | + sent along with the request as metadata. |
| 5202 | + Returns: |
| 5203 | + ~.operations_pb2.ListOperationsResponse: |
| 5204 | + Response message for ``ListOperations`` method. |
| 5205 | + """ |
| 5206 | + # Create or coerce a protobuf request object. |
| 5207 | + # The request isn't a proto-plus wrapped type, |
| 5208 | + # so it must be constructed via keyword expansion. |
| 5209 | + if isinstance(request, dict): |
| 5210 | + request = operations_pb2.ListOperationsRequest(**request) |
| 5211 | + |
| 5212 | + # Wrap the RPC method; this adds retry and timeout information, |
| 5213 | + # and friendly error handling. |
| 5214 | + rpc = gapic_v1.method.wrap_method( |
| 5215 | + self._client._transport.list_operations, |
| 5216 | + default_timeout=None, |
| 5217 | + client_info=DEFAULT_CLIENT_INFO, |
| 5218 | + ) |
| 5219 | + |
| 5220 | + # Certain fields should be provided within the metadata header; |
| 5221 | + # add these here. |
| 5222 | + metadata = tuple(metadata) + ( |
| 5223 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 5224 | + ) |
| 5225 | + |
| 5226 | + # Send the request. |
| 5227 | + response = await rpc( |
| 5228 | + request, |
| 5229 | + retry=retry, |
| 5230 | + timeout=timeout, |
| 5231 | + metadata=metadata, |
| 5232 | + ) |
| 5233 | + |
| 5234 | + # Done; return the response. |
| 5235 | + return response |
| 5236 | + |
| 5237 | + async def get_operation( |
| 5238 | + self, |
| 5239 | + request: operations_pb2.GetOperationRequest = None, |
| 5240 | + *, |
| 5241 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 5242 | + timeout: float = None, |
| 5243 | + metadata: Sequence[Tuple[str, str]] = (), |
| 5244 | + ) -> operations_pb2.Operation: |
| 5245 | + r"""Gets the latest state of a long-running operation. |
| 5246 | +
|
| 5247 | + Args: |
| 5248 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 5249 | + The request object. Request message for |
| 5250 | + `GetOperation` method. |
| 5251 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 5252 | + if any, should be retried. |
| 5253 | + timeout (float): The timeout for this request. |
| 5254 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 5255 | + sent along with the request as metadata. |
| 5256 | + Returns: |
| 5257 | + ~.operations_pb2.Operation: |
| 5258 | + An ``Operation`` object. |
| 5259 | + """ |
| 5260 | + # Create or coerce a protobuf request object. |
| 5261 | + # The request isn't a proto-plus wrapped type, |
| 5262 | + # so it must be constructed via keyword expansion. |
| 5263 | + if isinstance(request, dict): |
| 5264 | + request = operations_pb2.GetOperationRequest(**request) |
| 5265 | + |
| 5266 | + # Wrap the RPC method; this adds retry and timeout information, |
| 5267 | + # and friendly error handling. |
| 5268 | + rpc = gapic_v1.method.wrap_method( |
| 5269 | + self._client._transport.get_operation, |
| 5270 | + default_timeout=None, |
| 5271 | + client_info=DEFAULT_CLIENT_INFO, |
| 5272 | + ) |
| 5273 | + |
| 5274 | + # Certain fields should be provided within the metadata header; |
| 5275 | + # add these here. |
| 5276 | + metadata = tuple(metadata) + ( |
| 5277 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 5278 | + ) |
| 5279 | + |
| 5280 | + # Send the request. |
| 5281 | + response = await rpc( |
| 5282 | + request, |
| 5283 | + retry=retry, |
| 5284 | + timeout=timeout, |
| 5285 | + metadata=metadata, |
| 5286 | + ) |
| 5287 | + |
| 5288 | + # Done; return the response. |
| 5289 | + return response |
| 5290 | + |
| 5291 | + async def delete_operation( |
| 5292 | + self, |
| 5293 | + request: operations_pb2.DeleteOperationRequest = None, |
| 5294 | + *, |
| 5295 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 5296 | + timeout: float = None, |
| 5297 | + metadata: Sequence[Tuple[str, str]] = (), |
| 5298 | + ) -> None: |
| 5299 | + r"""Deletes a long-running operation. |
| 5300 | +
|
| 5301 | + This method indicates that the client is no longer interested |
| 5302 | + in the operation result. It does not cancel the operation. |
| 5303 | + If the server doesn't support this method, it returns |
| 5304 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 5305 | +
|
| 5306 | + Args: |
| 5307 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 5308 | + The request object. Request message for |
| 5309 | + `DeleteOperation` method. |
| 5310 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 5311 | + if any, should be retried. |
| 5312 | + timeout (float): The timeout for this request. |
| 5313 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 5314 | + sent along with the request as metadata. |
| 5315 | + Returns: |
| 5316 | + None |
| 5317 | + """ |
| 5318 | + # Create or coerce a protobuf request object. |
| 5319 | + # The request isn't a proto-plus wrapped type, |
| 5320 | + # so it must be constructed via keyword expansion. |
| 5321 | + if isinstance(request, dict): |
| 5322 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 5323 | + |
| 5324 | + # Wrap the RPC method; this adds retry and timeout information, |
| 5325 | + # and friendly error handling. |
| 5326 | + rpc = gapic_v1.method.wrap_method( |
| 5327 | + self._client._transport.delete_operation, |
| 5328 | + default_timeout=None, |
| 5329 | + client_info=DEFAULT_CLIENT_INFO, |
| 5330 | + ) |
| 5331 | + |
| 5332 | + # Certain fields should be provided within the metadata header; |
| 5333 | + # add these here. |
| 5334 | + metadata = tuple(metadata) + ( |
| 5335 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 5336 | + ) |
| 5337 | + |
| 5338 | + # Send the request. |
| 5339 | + await rpc( |
| 5340 | + request, |
| 5341 | + retry=retry, |
| 5342 | + timeout=timeout, |
| 5343 | + metadata=metadata, |
| 5344 | + ) |
| 5345 | + |
| 5346 | + async def cancel_operation( |
| 5347 | + self, |
| 5348 | + request: operations_pb2.CancelOperationRequest = None, |
| 5349 | + *, |
| 5350 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 5351 | + timeout: float = None, |
| 5352 | + metadata: Sequence[Tuple[str, str]] = (), |
| 5353 | + ) -> None: |
| 5354 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 5355 | +
|
| 5356 | + The server makes a best effort to cancel the operation, but success |
| 5357 | + is not guaranteed. If the server doesn't support this method, it returns |
| 5358 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 5359 | +
|
| 5360 | + Args: |
| 5361 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 5362 | + The request object. Request message for |
| 5363 | + `CancelOperation` method. |
| 5364 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 5365 | + if any, should be retried. |
| 5366 | + timeout (float): The timeout for this request. |
| 5367 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 5368 | + sent along with the request as metadata. |
| 5369 | + Returns: |
| 5370 | + None |
| 5371 | + """ |
| 5372 | + # Create or coerce a protobuf request object. |
| 5373 | + # The request isn't a proto-plus wrapped type, |
| 5374 | + # so it must be constructed via keyword expansion. |
| 5375 | + if isinstance(request, dict): |
| 5376 | + request = operations_pb2.CancelOperationRequest(**request) |
| 5377 | + |
| 5378 | + # Wrap the RPC method; this adds retry and timeout information, |
| 5379 | + # and friendly error handling. |
| 5380 | + rpc = gapic_v1.method.wrap_method( |
| 5381 | + self._client._transport.cancel_operation, |
| 5382 | + default_timeout=None, |
| 5383 | + client_info=DEFAULT_CLIENT_INFO, |
| 5384 | + ) |
| 5385 | + |
| 5386 | + # Certain fields should be provided within the metadata header; |
| 5387 | + # add these here. |
| 5388 | + metadata = tuple(metadata) + ( |
| 5389 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 5390 | + ) |
| 5391 | + |
| 5392 | + # Send the request. |
| 5393 | + await rpc( |
| 5394 | + request, |
| 5395 | + retry=retry, |
| 5396 | + timeout=timeout, |
| 5397 | + metadata=metadata, |
| 5398 | + ) |
| 5399 | + |
5182 | 5400 | async def __aenter__(self):
|
5183 | 5401 | return self
|
5184 | 5402 |
|
|
0 commit comments