|
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.cloud.location import locations_pb2 # type: ignore |
| 37 | +from google.longrunning import operations_pb2 |
36 | 38 | from google.protobuf import empty_pb2 # type: ignore
|
37 | 39 |
|
38 | 40 | from google.cloud.vpcaccess_v1.services.vpc_access_service import pagers
|
@@ -663,6 +665,168 @@ async def sample_delete_connector():
|
663 | 665 | # Done; return the response.
|
664 | 666 | return response
|
665 | 667 |
|
| 668 | + async def list_operations( |
| 669 | + self, |
| 670 | + request: operations_pb2.ListOperationsRequest = None, |
| 671 | + *, |
| 672 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 673 | + timeout: float = None, |
| 674 | + metadata: Sequence[Tuple[str, str]] = (), |
| 675 | + ) -> operations_pb2.ListOperationsResponse: |
| 676 | + r"""Lists operations that match the specified filter in the request. |
| 677 | +
|
| 678 | + Args: |
| 679 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 680 | + The request object. Request message for |
| 681 | + `ListOperations` method. |
| 682 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 683 | + if any, should be retried. |
| 684 | + timeout (float): The timeout for this request. |
| 685 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 686 | + sent along with the request as metadata. |
| 687 | + Returns: |
| 688 | + ~.operations_pb2.ListOperationsResponse: |
| 689 | + Response message for ``ListOperations`` method. |
| 690 | + """ |
| 691 | + # Create or coerce a protobuf request object. |
| 692 | + # The request isn't a proto-plus wrapped type, |
| 693 | + # so it must be constructed via keyword expansion. |
| 694 | + if isinstance(request, dict): |
| 695 | + request = operations_pb2.ListOperationsRequest(**request) |
| 696 | + |
| 697 | + # Wrap the RPC method; this adds retry and timeout information, |
| 698 | + # and friendly error handling. |
| 699 | + rpc = gapic_v1.method.wrap_method( |
| 700 | + self._client._transport.list_operations, |
| 701 | + default_timeout=None, |
| 702 | + client_info=DEFAULT_CLIENT_INFO, |
| 703 | + ) |
| 704 | + |
| 705 | + # Certain fields should be provided within the metadata header; |
| 706 | + # add these here. |
| 707 | + metadata = tuple(metadata) + ( |
| 708 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 709 | + ) |
| 710 | + |
| 711 | + # Send the request. |
| 712 | + response = await rpc( |
| 713 | + request, |
| 714 | + retry=retry, |
| 715 | + timeout=timeout, |
| 716 | + metadata=metadata, |
| 717 | + ) |
| 718 | + |
| 719 | + # Done; return the response. |
| 720 | + return response |
| 721 | + |
| 722 | + async def get_operation( |
| 723 | + self, |
| 724 | + request: operations_pb2.GetOperationRequest = None, |
| 725 | + *, |
| 726 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 727 | + timeout: float = None, |
| 728 | + metadata: Sequence[Tuple[str, str]] = (), |
| 729 | + ) -> operations_pb2.Operation: |
| 730 | + r"""Gets the latest state of a long-running operation. |
| 731 | +
|
| 732 | + Args: |
| 733 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 734 | + The request object. Request message for |
| 735 | + `GetOperation` method. |
| 736 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 737 | + if any, should be retried. |
| 738 | + timeout (float): The timeout for this request. |
| 739 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 740 | + sent along with the request as metadata. |
| 741 | + Returns: |
| 742 | + ~.operations_pb2.Operation: |
| 743 | + An ``Operation`` object. |
| 744 | + """ |
| 745 | + # Create or coerce a protobuf request object. |
| 746 | + # The request isn't a proto-plus wrapped type, |
| 747 | + # so it must be constructed via keyword expansion. |
| 748 | + if isinstance(request, dict): |
| 749 | + request = operations_pb2.GetOperationRequest(**request) |
| 750 | + |
| 751 | + # Wrap the RPC method; this adds retry and timeout information, |
| 752 | + # and friendly error handling. |
| 753 | + rpc = gapic_v1.method.wrap_method( |
| 754 | + self._client._transport.get_operation, |
| 755 | + default_timeout=None, |
| 756 | + client_info=DEFAULT_CLIENT_INFO, |
| 757 | + ) |
| 758 | + |
| 759 | + # Certain fields should be provided within the metadata header; |
| 760 | + # add these here. |
| 761 | + metadata = tuple(metadata) + ( |
| 762 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 763 | + ) |
| 764 | + |
| 765 | + # Send the request. |
| 766 | + response = await rpc( |
| 767 | + request, |
| 768 | + retry=retry, |
| 769 | + timeout=timeout, |
| 770 | + metadata=metadata, |
| 771 | + ) |
| 772 | + |
| 773 | + # Done; return the response. |
| 774 | + return response |
| 775 | + |
| 776 | + async def list_locations( |
| 777 | + self, |
| 778 | + request: locations_pb2.ListLocationsRequest = None, |
| 779 | + *, |
| 780 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 781 | + timeout: float = None, |
| 782 | + metadata: Sequence[Tuple[str, str]] = (), |
| 783 | + ) -> locations_pb2.ListLocationsResponse: |
| 784 | + r"""Lists information about the supported locations for this service. |
| 785 | +
|
| 786 | + Args: |
| 787 | + request (:class:`~.location_pb2.ListLocationsRequest`): |
| 788 | + The request object. Request message for |
| 789 | + `ListLocations` method. |
| 790 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 791 | + if any, should be retried. |
| 792 | + timeout (float): The timeout for this request. |
| 793 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 794 | + sent along with the request as metadata. |
| 795 | + Returns: |
| 796 | + ~.location_pb2.ListLocationsResponse: |
| 797 | + Response message for ``ListLocations`` method. |
| 798 | + """ |
| 799 | + # Create or coerce a protobuf request object. |
| 800 | + # The request isn't a proto-plus wrapped type, |
| 801 | + # so it must be constructed via keyword expansion. |
| 802 | + if isinstance(request, dict): |
| 803 | + request = locations_pb2.ListLocationsRequest(**request) |
| 804 | + |
| 805 | + # Wrap the RPC method; this adds retry and timeout information, |
| 806 | + # and friendly error handling. |
| 807 | + rpc = gapic_v1.method.wrap_method( |
| 808 | + self._client._transport.list_locations, |
| 809 | + default_timeout=None, |
| 810 | + client_info=DEFAULT_CLIENT_INFO, |
| 811 | + ) |
| 812 | + |
| 813 | + # Certain fields should be provided within the metadata header; |
| 814 | + # add these here. |
| 815 | + metadata = tuple(metadata) + ( |
| 816 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 817 | + ) |
| 818 | + |
| 819 | + # Send the request. |
| 820 | + response = await rpc( |
| 821 | + request, |
| 822 | + retry=retry, |
| 823 | + timeout=timeout, |
| 824 | + metadata=metadata, |
| 825 | + ) |
| 826 | + |
| 827 | + # Done; return the response. |
| 828 | + return response |
| 829 | + |
666 | 830 | async def __aenter__(self):
|
667 | 831 | return self
|
668 | 832 |
|
|
0 commit comments