|
52 | 52 | from google.iam.v1 import iam_policy_pb2 # type: ignore |
53 | 53 | from google.iam.v1 import policy_pb2 # type: ignore |
54 | 54 | from google.longrunning import operations_pb2 # type: ignore |
| 55 | +from google.longrunning import operations_pb2 # type: ignore |
55 | 56 | from google.protobuf import field_mask_pb2 # type: ignore |
56 | 57 | from google.protobuf import timestamp_pb2 # type: ignore |
57 | 58 | from .transports.base import InstanceAdminTransport, DEFAULT_CLIENT_INFO |
@@ -3448,6 +3449,227 @@ async def sample_move_instance(): |
3448 | 3449 | # Done; return the response. |
3449 | 3450 | return response |
3450 | 3451 |
|
| 3452 | + async def list_operations( |
| 3453 | + self, |
| 3454 | + request: Optional[operations_pb2.ListOperationsRequest] = None, |
| 3455 | + *, |
| 3456 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 3457 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 3458 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 3459 | + ) -> operations_pb2.ListOperationsResponse: |
| 3460 | + r"""Lists operations that match the specified filter in the request. |
| 3461 | +
|
| 3462 | + Args: |
| 3463 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 3464 | + The request object. Request message for |
| 3465 | + `ListOperations` method. |
| 3466 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 3467 | + if any, should be retried. |
| 3468 | + timeout (float): The timeout for this request. |
| 3469 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 3470 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 3471 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 3472 | + be of type `bytes`. |
| 3473 | + Returns: |
| 3474 | + ~.operations_pb2.ListOperationsResponse: |
| 3475 | + Response message for ``ListOperations`` method. |
| 3476 | + """ |
| 3477 | + # Create or coerce a protobuf request object. |
| 3478 | + # The request isn't a proto-plus wrapped type, |
| 3479 | + # so it must be constructed via keyword expansion. |
| 3480 | + if isinstance(request, dict): |
| 3481 | + request = operations_pb2.ListOperationsRequest(**request) |
| 3482 | + |
| 3483 | + # Wrap the RPC method; this adds retry and timeout information, |
| 3484 | + # and friendly error handling. |
| 3485 | + rpc = self.transport._wrapped_methods[self._client._transport.list_operations] |
| 3486 | + |
| 3487 | + # Certain fields should be provided within the metadata header; |
| 3488 | + # add these here. |
| 3489 | + metadata = tuple(metadata) + ( |
| 3490 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 3491 | + ) |
| 3492 | + |
| 3493 | + # Validate the universe domain. |
| 3494 | + self._client._validate_universe_domain() |
| 3495 | + |
| 3496 | + # Send the request. |
| 3497 | + response = await rpc( |
| 3498 | + request, |
| 3499 | + retry=retry, |
| 3500 | + timeout=timeout, |
| 3501 | + metadata=metadata, |
| 3502 | + ) |
| 3503 | + |
| 3504 | + # Done; return the response. |
| 3505 | + return response |
| 3506 | + |
| 3507 | + async def get_operation( |
| 3508 | + self, |
| 3509 | + request: Optional[operations_pb2.GetOperationRequest] = None, |
| 3510 | + *, |
| 3511 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 3512 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 3513 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 3514 | + ) -> operations_pb2.Operation: |
| 3515 | + r"""Gets the latest state of a long-running operation. |
| 3516 | +
|
| 3517 | + Args: |
| 3518 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 3519 | + The request object. Request message for |
| 3520 | + `GetOperation` method. |
| 3521 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 3522 | + if any, should be retried. |
| 3523 | + timeout (float): The timeout for this request. |
| 3524 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 3525 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 3526 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 3527 | + be of type `bytes`. |
| 3528 | + Returns: |
| 3529 | + ~.operations_pb2.Operation: |
| 3530 | + An ``Operation`` object. |
| 3531 | + """ |
| 3532 | + # Create or coerce a protobuf request object. |
| 3533 | + # The request isn't a proto-plus wrapped type, |
| 3534 | + # so it must be constructed via keyword expansion. |
| 3535 | + if isinstance(request, dict): |
| 3536 | + request = operations_pb2.GetOperationRequest(**request) |
| 3537 | + |
| 3538 | + # Wrap the RPC method; this adds retry and timeout information, |
| 3539 | + # and friendly error handling. |
| 3540 | + rpc = self.transport._wrapped_methods[self._client._transport.get_operation] |
| 3541 | + |
| 3542 | + # Certain fields should be provided within the metadata header; |
| 3543 | + # add these here. |
| 3544 | + metadata = tuple(metadata) + ( |
| 3545 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 3546 | + ) |
| 3547 | + |
| 3548 | + # Validate the universe domain. |
| 3549 | + self._client._validate_universe_domain() |
| 3550 | + |
| 3551 | + # Send the request. |
| 3552 | + response = await rpc( |
| 3553 | + request, |
| 3554 | + retry=retry, |
| 3555 | + timeout=timeout, |
| 3556 | + metadata=metadata, |
| 3557 | + ) |
| 3558 | + |
| 3559 | + # Done; return the response. |
| 3560 | + return response |
| 3561 | + |
| 3562 | + async def delete_operation( |
| 3563 | + self, |
| 3564 | + request: Optional[operations_pb2.DeleteOperationRequest] = None, |
| 3565 | + *, |
| 3566 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 3567 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 3568 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 3569 | + ) -> None: |
| 3570 | + r"""Deletes a long-running operation. |
| 3571 | +
|
| 3572 | + This method indicates that the client is no longer interested |
| 3573 | + in the operation result. It does not cancel the operation. |
| 3574 | + If the server doesn't support this method, it returns |
| 3575 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 3576 | +
|
| 3577 | + Args: |
| 3578 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 3579 | + The request object. Request message for |
| 3580 | + `DeleteOperation` method. |
| 3581 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 3582 | + if any, should be retried. |
| 3583 | + timeout (float): The timeout for this request. |
| 3584 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 3585 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 3586 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 3587 | + be of type `bytes`. |
| 3588 | + Returns: |
| 3589 | + None |
| 3590 | + """ |
| 3591 | + # Create or coerce a protobuf request object. |
| 3592 | + # The request isn't a proto-plus wrapped type, |
| 3593 | + # so it must be constructed via keyword expansion. |
| 3594 | + if isinstance(request, dict): |
| 3595 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 3596 | + |
| 3597 | + # Wrap the RPC method; this adds retry and timeout information, |
| 3598 | + # and friendly error handling. |
| 3599 | + rpc = self.transport._wrapped_methods[self._client._transport.delete_operation] |
| 3600 | + |
| 3601 | + # Certain fields should be provided within the metadata header; |
| 3602 | + # add these here. |
| 3603 | + metadata = tuple(metadata) + ( |
| 3604 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 3605 | + ) |
| 3606 | + |
| 3607 | + # Validate the universe domain. |
| 3608 | + self._client._validate_universe_domain() |
| 3609 | + |
| 3610 | + # Send the request. |
| 3611 | + await rpc( |
| 3612 | + request, |
| 3613 | + retry=retry, |
| 3614 | + timeout=timeout, |
| 3615 | + metadata=metadata, |
| 3616 | + ) |
| 3617 | + |
| 3618 | + async def cancel_operation( |
| 3619 | + self, |
| 3620 | + request: Optional[operations_pb2.CancelOperationRequest] = None, |
| 3621 | + *, |
| 3622 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 3623 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 3624 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 3625 | + ) -> None: |
| 3626 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 3627 | +
|
| 3628 | + The server makes a best effort to cancel the operation, but success |
| 3629 | + is not guaranteed. If the server doesn't support this method, it returns |
| 3630 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 3631 | +
|
| 3632 | + Args: |
| 3633 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 3634 | + The request object. Request message for |
| 3635 | + `CancelOperation` method. |
| 3636 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 3637 | + if any, should be retried. |
| 3638 | + timeout (float): The timeout for this request. |
| 3639 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 3640 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 3641 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 3642 | + be of type `bytes`. |
| 3643 | + Returns: |
| 3644 | + None |
| 3645 | + """ |
| 3646 | + # Create or coerce a protobuf request object. |
| 3647 | + # The request isn't a proto-plus wrapped type, |
| 3648 | + # so it must be constructed via keyword expansion. |
| 3649 | + if isinstance(request, dict): |
| 3650 | + request = operations_pb2.CancelOperationRequest(**request) |
| 3651 | + |
| 3652 | + # Wrap the RPC method; this adds retry and timeout information, |
| 3653 | + # and friendly error handling. |
| 3654 | + rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation] |
| 3655 | + |
| 3656 | + # Certain fields should be provided within the metadata header; |
| 3657 | + # add these here. |
| 3658 | + metadata = tuple(metadata) + ( |
| 3659 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 3660 | + ) |
| 3661 | + |
| 3662 | + # Validate the universe domain. |
| 3663 | + self._client._validate_universe_domain() |
| 3664 | + |
| 3665 | + # Send the request. |
| 3666 | + await rpc( |
| 3667 | + request, |
| 3668 | + retry=retry, |
| 3669 | + timeout=timeout, |
| 3670 | + metadata=metadata, |
| 3671 | + ) |
| 3672 | + |
3451 | 3673 | async def __aenter__(self) -> "InstanceAdminAsyncClient": |
3452 | 3674 | return self |
3453 | 3675 |
|
|
0 commit comments