@@ -864,6 +864,195 @@ async def sample_update_cluster():
864
864
# Done; return the response.
865
865
return response
866
866
867
+ async def export_cluster (
868
+ self ,
869
+ request : Optional [Union [service .ExportClusterRequest , dict ]] = None ,
870
+ * ,
871
+ name : Optional [str ] = None ,
872
+ gcs_destination : Optional [service .GcsDestination ] = None ,
873
+ database : Optional [str ] = None ,
874
+ csv_export_options : Optional [
875
+ service .ExportClusterRequest .CsvExportOptions
876
+ ] = None ,
877
+ sql_export_options : Optional [
878
+ service .ExportClusterRequest .SqlExportOptions
879
+ ] = None ,
880
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
881
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
882
+ metadata : Sequence [Tuple [str , Union [str , bytes ]]] = (),
883
+ ) -> operation_async .AsyncOperation :
884
+ r"""Exports data from the cluster.
885
+ Imperative only.
886
+
887
+ .. code-block:: python
888
+
889
+ # This snippet has been automatically generated and should be regarded as a
890
+ # code template only.
891
+ # It will require modifications to work:
892
+ # - It may require correct/in-range values for request initialization.
893
+ # - It may require specifying regional endpoints when creating the service
894
+ # client as shown in:
895
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
896
+ from google.cloud import alloydb_v1beta
897
+
898
+ async def sample_export_cluster():
899
+ # Create a client
900
+ client = alloydb_v1beta.AlloyDBAdminAsyncClient()
901
+
902
+ # Initialize request argument(s)
903
+ gcs_destination = alloydb_v1beta.GcsDestination()
904
+ gcs_destination.uri = "uri_value"
905
+
906
+ csv_export_options = alloydb_v1beta.CsvExportOptions()
907
+ csv_export_options.select_query = "select_query_value"
908
+
909
+ request = alloydb_v1beta.ExportClusterRequest(
910
+ gcs_destination=gcs_destination,
911
+ csv_export_options=csv_export_options,
912
+ name="name_value",
913
+ database="database_value",
914
+ )
915
+
916
+ # Make the request
917
+ operation = client.export_cluster(request=request)
918
+
919
+ print("Waiting for operation to complete...")
920
+
921
+ response = (await operation).result()
922
+
923
+ # Handle the response
924
+ print(response)
925
+
926
+ Args:
927
+ request (Optional[Union[google.cloud.alloydb_v1beta.types.ExportClusterRequest, dict]]):
928
+ The request object. Export cluster request.
929
+ name (:class:`str`):
930
+ Required. The resource name of the
931
+ cluster.
932
+
933
+ This corresponds to the ``name`` field
934
+ on the ``request`` instance; if ``request`` is provided, this
935
+ should not be set.
936
+ gcs_destination (:class:`google.cloud.alloydb_v1beta.types.GcsDestination`):
937
+ Required. Option to export data to
938
+ cloud storage.
939
+
940
+ This corresponds to the ``gcs_destination`` field
941
+ on the ``request`` instance; if ``request`` is provided, this
942
+ should not be set.
943
+ database (:class:`str`):
944
+ Required. Name of the database where the export command
945
+ will be executed. Note - Value provided should be the
946
+ same as expected from ``SELECT current_database();`` and
947
+ NOT as a resource reference.
948
+
949
+ This corresponds to the ``database`` field
950
+ on the ``request`` instance; if ``request`` is provided, this
951
+ should not be set.
952
+ csv_export_options (:class:`google.cloud.alloydb_v1beta.types.ExportClusterRequest.CsvExportOptions`):
953
+ Options for exporting data in CSV
954
+ format. Required field to be set for CSV
955
+ file type.
956
+
957
+ This corresponds to the ``csv_export_options`` field
958
+ on the ``request`` instance; if ``request`` is provided, this
959
+ should not be set.
960
+ sql_export_options (:class:`google.cloud.alloydb_v1beta.types.ExportClusterRequest.SqlExportOptions`):
961
+ Options for exporting data in SQL
962
+ format. Required field to be set for SQL
963
+ file type.
964
+
965
+ This corresponds to the ``sql_export_options`` field
966
+ on the ``request`` instance; if ``request`` is provided, this
967
+ should not be set.
968
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
969
+ should be retried.
970
+ timeout (float): The timeout for this request.
971
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
972
+ sent along with the request as metadata. Normally, each value must be of type `str`,
973
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
974
+ be of type `bytes`.
975
+
976
+ Returns:
977
+ google.api_core.operation_async.AsyncOperation:
978
+ An object representing a long-running operation.
979
+
980
+ The result type for the operation will be
981
+ :class:`google.cloud.alloydb_v1beta.types.ExportClusterResponse`
982
+ Response of export cluster rpc.
983
+
984
+ """
985
+ # Create or coerce a protobuf request object.
986
+ # - Quick check: If we got a request object, we should *not* have
987
+ # gotten any keyword arguments that map to the request.
988
+ flattened_params = [
989
+ name ,
990
+ gcs_destination ,
991
+ database ,
992
+ csv_export_options ,
993
+ sql_export_options ,
994
+ ]
995
+ has_flattened_params = (
996
+ len ([param for param in flattened_params if param is not None ]) > 0
997
+ )
998
+ if request is not None and has_flattened_params :
999
+ raise ValueError (
1000
+ "If the `request` argument is set, then none of "
1001
+ "the individual field arguments should be set."
1002
+ )
1003
+
1004
+ # - Use the request object if provided (there's no risk of modifying the input as
1005
+ # there are no flattened fields), or create one.
1006
+ if not isinstance (request , service .ExportClusterRequest ):
1007
+ request = service .ExportClusterRequest (request )
1008
+
1009
+ # If we have keyword arguments corresponding to fields on the
1010
+ # request, apply these.
1011
+ if name is not None :
1012
+ request .name = name
1013
+ if gcs_destination is not None :
1014
+ request .gcs_destination = gcs_destination
1015
+ if database is not None :
1016
+ request .database = database
1017
+ if csv_export_options is not None :
1018
+ request .csv_export_options = csv_export_options
1019
+ if sql_export_options is not None :
1020
+ request .sql_export_options = sql_export_options
1021
+
1022
+ # Wrap the RPC method; this adds retry and timeout information,
1023
+ # and friendly error handling.
1024
+ rpc = self ._client ._transport ._wrapped_methods [
1025
+ self ._client ._transport .export_cluster
1026
+ ]
1027
+
1028
+ # Certain fields should be provided within the metadata header;
1029
+ # add these here.
1030
+ metadata = tuple (metadata ) + (
1031
+ gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1032
+ )
1033
+
1034
+ # Validate the universe domain.
1035
+ self ._client ._validate_universe_domain ()
1036
+
1037
+ # Send the request.
1038
+ response = await rpc (
1039
+ request ,
1040
+ retry = retry ,
1041
+ timeout = timeout ,
1042
+ metadata = metadata ,
1043
+ )
1044
+
1045
+ # Wrap the response in an operation future.
1046
+ response = operation_async .from_gapic (
1047
+ response ,
1048
+ self ._client ._transport .operations_client ,
1049
+ service .ExportClusterResponse ,
1050
+ metadata_type = service .OperationMetadata ,
1051
+ )
1052
+
1053
+ # Done; return the response.
1054
+ return response
1055
+
867
1056
async def upgrade_cluster (
868
1057
self ,
869
1058
request : Optional [Union [service .UpgradeClusterRequest , dict ]] = None ,
0 commit comments