|
74 | 74 | import com.google.spanner.admin.database.v1.UpdateBackupRequest;
|
75 | 75 | import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
|
76 | 76 | import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
|
| 77 | +import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata; |
| 78 | +import com.google.spanner.admin.database.v1.UpdateDatabaseRequest; |
77 | 79 | import java.io.IOException;
|
78 | 80 | import java.util.List;
|
79 | 81 | import java.util.concurrent.TimeUnit;
|
@@ -725,6 +727,235 @@ public final UnaryCallable<GetDatabaseRequest, Database> getDatabaseCallable() {
|
725 | 727 | return stub.getDatabaseCallable();
|
726 | 728 | }
|
727 | 729 |
|
| 730 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 731 | + /** |
| 732 | + * Updates a Cloud Spanner database. The returned [long-running |
| 733 | + * operation][google.longrunning.Operation] can be used to track the progress of updating the |
| 734 | + * database. If the named database does not exist, returns `NOT_FOUND`. |
| 735 | + * |
| 736 | + * <p>While the operation is pending: |
| 737 | + * |
| 738 | + * <p>* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] |
| 739 | + * field is set to true. * Cancelling the operation is best-effort. If the cancellation |
| 740 | + * succeeds, the operation metadata's |
| 741 | + * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the |
| 742 | + * updates are reverted, and the operation terminates with a `CANCELLED` status. * New |
| 743 | + * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation |
| 744 | + * is done (returns successfully or with error). * Reading the database via the API continues |
| 745 | + * to give the pre-request values. |
| 746 | + * |
| 747 | + * <p>Upon completion of the returned operation: |
| 748 | + * |
| 749 | + * <p>* The new values are in effect and readable via the API. * The database's |
| 750 | + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. |
| 751 | + * |
| 752 | + * <p>The returned [long-running operation][google.longrunning.Operation] will have a name of the |
| 753 | + * format |
| 754 | + * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` |
| 755 | + * and can be used to track the database modification. The |
| 756 | + * [metadata][google.longrunning.Operation.metadata] field type is |
| 757 | + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The |
| 758 | + * [response][google.longrunning.Operation.response] field type is |
| 759 | + * [Database][google.spanner.admin.database.v1.Database], if successful. |
| 760 | + * |
| 761 | + * <p>Sample code: |
| 762 | + * |
| 763 | + * <pre>{@code |
| 764 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 765 | + * // It will require modifications to work: |
| 766 | + * // - It may require correct/in-range values for request initialization. |
| 767 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 768 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 769 | + * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) { |
| 770 | + * Database database = Database.newBuilder().build(); |
| 771 | + * FieldMask updateMask = FieldMask.newBuilder().build(); |
| 772 | + * Database response = databaseAdminClient.updateDatabaseAsync(database, updateMask).get(); |
| 773 | + * } |
| 774 | + * }</pre> |
| 775 | + * |
| 776 | + * @param database Required. The database to update. The `name` field of the database is of the |
| 777 | + * form `projects/<project>/instances/<instance>/databases/<database>`. |
| 778 | + * @param updateMask Required. The list of fields to update. Currently, only |
| 779 | + * `enable_drop_protection` field can be updated. |
| 780 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 781 | + */ |
| 782 | + public final OperationFuture<Database, UpdateDatabaseMetadata> updateDatabaseAsync( |
| 783 | + Database database, FieldMask updateMask) { |
| 784 | + UpdateDatabaseRequest request = |
| 785 | + UpdateDatabaseRequest.newBuilder().setDatabase(database).setUpdateMask(updateMask).build(); |
| 786 | + return updateDatabaseAsync(request); |
| 787 | + } |
| 788 | + |
| 789 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 790 | + /** |
| 791 | + * Updates a Cloud Spanner database. The returned [long-running |
| 792 | + * operation][google.longrunning.Operation] can be used to track the progress of updating the |
| 793 | + * database. If the named database does not exist, returns `NOT_FOUND`. |
| 794 | + * |
| 795 | + * <p>While the operation is pending: |
| 796 | + * |
| 797 | + * <p>* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] |
| 798 | + * field is set to true. * Cancelling the operation is best-effort. If the cancellation |
| 799 | + * succeeds, the operation metadata's |
| 800 | + * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the |
| 801 | + * updates are reverted, and the operation terminates with a `CANCELLED` status. * New |
| 802 | + * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation |
| 803 | + * is done (returns successfully or with error). * Reading the database via the API continues |
| 804 | + * to give the pre-request values. |
| 805 | + * |
| 806 | + * <p>Upon completion of the returned operation: |
| 807 | + * |
| 808 | + * <p>* The new values are in effect and readable via the API. * The database's |
| 809 | + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. |
| 810 | + * |
| 811 | + * <p>The returned [long-running operation][google.longrunning.Operation] will have a name of the |
| 812 | + * format |
| 813 | + * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` |
| 814 | + * and can be used to track the database modification. The |
| 815 | + * [metadata][google.longrunning.Operation.metadata] field type is |
| 816 | + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The |
| 817 | + * [response][google.longrunning.Operation.response] field type is |
| 818 | + * [Database][google.spanner.admin.database.v1.Database], if successful. |
| 819 | + * |
| 820 | + * <p>Sample code: |
| 821 | + * |
| 822 | + * <pre>{@code |
| 823 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 824 | + * // It will require modifications to work: |
| 825 | + * // - It may require correct/in-range values for request initialization. |
| 826 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 827 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 828 | + * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) { |
| 829 | + * UpdateDatabaseRequest request = |
| 830 | + * UpdateDatabaseRequest.newBuilder() |
| 831 | + * .setDatabase(Database.newBuilder().build()) |
| 832 | + * .setUpdateMask(FieldMask.newBuilder().build()) |
| 833 | + * .build(); |
| 834 | + * Database response = databaseAdminClient.updateDatabaseAsync(request).get(); |
| 835 | + * } |
| 836 | + * }</pre> |
| 837 | + * |
| 838 | + * @param request The request object containing all of the parameters for the API call. |
| 839 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 840 | + */ |
| 841 | + public final OperationFuture<Database, UpdateDatabaseMetadata> updateDatabaseAsync( |
| 842 | + UpdateDatabaseRequest request) { |
| 843 | + return updateDatabaseOperationCallable().futureCall(request); |
| 844 | + } |
| 845 | + |
| 846 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 847 | + /** |
| 848 | + * Updates a Cloud Spanner database. The returned [long-running |
| 849 | + * operation][google.longrunning.Operation] can be used to track the progress of updating the |
| 850 | + * database. If the named database does not exist, returns `NOT_FOUND`. |
| 851 | + * |
| 852 | + * <p>While the operation is pending: |
| 853 | + * |
| 854 | + * <p>* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] |
| 855 | + * field is set to true. * Cancelling the operation is best-effort. If the cancellation |
| 856 | + * succeeds, the operation metadata's |
| 857 | + * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the |
| 858 | + * updates are reverted, and the operation terminates with a `CANCELLED` status. * New |
| 859 | + * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation |
| 860 | + * is done (returns successfully or with error). * Reading the database via the API continues |
| 861 | + * to give the pre-request values. |
| 862 | + * |
| 863 | + * <p>Upon completion of the returned operation: |
| 864 | + * |
| 865 | + * <p>* The new values are in effect and readable via the API. * The database's |
| 866 | + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. |
| 867 | + * |
| 868 | + * <p>The returned [long-running operation][google.longrunning.Operation] will have a name of the |
| 869 | + * format |
| 870 | + * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` |
| 871 | + * and can be used to track the database modification. The |
| 872 | + * [metadata][google.longrunning.Operation.metadata] field type is |
| 873 | + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The |
| 874 | + * [response][google.longrunning.Operation.response] field type is |
| 875 | + * [Database][google.spanner.admin.database.v1.Database], if successful. |
| 876 | + * |
| 877 | + * <p>Sample code: |
| 878 | + * |
| 879 | + * <pre>{@code |
| 880 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 881 | + * // It will require modifications to work: |
| 882 | + * // - It may require correct/in-range values for request initialization. |
| 883 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 884 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 885 | + * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) { |
| 886 | + * UpdateDatabaseRequest request = |
| 887 | + * UpdateDatabaseRequest.newBuilder() |
| 888 | + * .setDatabase(Database.newBuilder().build()) |
| 889 | + * .setUpdateMask(FieldMask.newBuilder().build()) |
| 890 | + * .build(); |
| 891 | + * OperationFuture<Database, UpdateDatabaseMetadata> future = |
| 892 | + * databaseAdminClient.updateDatabaseOperationCallable().futureCall(request); |
| 893 | + * // Do something. |
| 894 | + * Database response = future.get(); |
| 895 | + * } |
| 896 | + * }</pre> |
| 897 | + */ |
| 898 | + public final OperationCallable<UpdateDatabaseRequest, Database, UpdateDatabaseMetadata> |
| 899 | + updateDatabaseOperationCallable() { |
| 900 | + return stub.updateDatabaseOperationCallable(); |
| 901 | + } |
| 902 | + |
| 903 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 904 | + /** |
| 905 | + * Updates a Cloud Spanner database. The returned [long-running |
| 906 | + * operation][google.longrunning.Operation] can be used to track the progress of updating the |
| 907 | + * database. If the named database does not exist, returns `NOT_FOUND`. |
| 908 | + * |
| 909 | + * <p>While the operation is pending: |
| 910 | + * |
| 911 | + * <p>* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] |
| 912 | + * field is set to true. * Cancelling the operation is best-effort. If the cancellation |
| 913 | + * succeeds, the operation metadata's |
| 914 | + * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the |
| 915 | + * updates are reverted, and the operation terminates with a `CANCELLED` status. * New |
| 916 | + * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation |
| 917 | + * is done (returns successfully or with error). * Reading the database via the API continues |
| 918 | + * to give the pre-request values. |
| 919 | + * |
| 920 | + * <p>Upon completion of the returned operation: |
| 921 | + * |
| 922 | + * <p>* The new values are in effect and readable via the API. * The database's |
| 923 | + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. |
| 924 | + * |
| 925 | + * <p>The returned [long-running operation][google.longrunning.Operation] will have a name of the |
| 926 | + * format |
| 927 | + * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` |
| 928 | + * and can be used to track the database modification. The |
| 929 | + * [metadata][google.longrunning.Operation.metadata] field type is |
| 930 | + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The |
| 931 | + * [response][google.longrunning.Operation.response] field type is |
| 932 | + * [Database][google.spanner.admin.database.v1.Database], if successful. |
| 933 | + * |
| 934 | + * <p>Sample code: |
| 935 | + * |
| 936 | + * <pre>{@code |
| 937 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 938 | + * // It will require modifications to work: |
| 939 | + * // - It may require correct/in-range values for request initialization. |
| 940 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 941 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 942 | + * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) { |
| 943 | + * UpdateDatabaseRequest request = |
| 944 | + * UpdateDatabaseRequest.newBuilder() |
| 945 | + * .setDatabase(Database.newBuilder().build()) |
| 946 | + * .setUpdateMask(FieldMask.newBuilder().build()) |
| 947 | + * .build(); |
| 948 | + * ApiFuture<Operation> future = |
| 949 | + * databaseAdminClient.updateDatabaseCallable().futureCall(request); |
| 950 | + * // Do something. |
| 951 | + * Operation response = future.get(); |
| 952 | + * } |
| 953 | + * }</pre> |
| 954 | + */ |
| 955 | + public final UnaryCallable<UpdateDatabaseRequest, Operation> updateDatabaseCallable() { |
| 956 | + return stub.updateDatabaseCallable(); |
| 957 | + } |
| 958 | + |
728 | 959 | // AUTO-GENERATED DOCUMENTATION AND METHOD.
|
729 | 960 | /**
|
730 | 961 | * Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns,
|
|
0 commit comments