|
16 | 16 | package com.google.cloud.bigtable.grpc;
|
17 | 17 |
|
18 | 18 | import com.google.api.core.InternalExtensionOnly;
|
19 |
| -import com.google.bigtable.admin.v2.CreateTableFromSnapshotRequest; |
| 19 | +import com.google.bigtable.admin.v2.CreateBackupRequest; |
20 | 20 | import com.google.bigtable.admin.v2.CreateTableRequest;
|
21 |
| -import com.google.bigtable.admin.v2.DeleteSnapshotRequest; |
| 21 | +import com.google.bigtable.admin.v2.DeleteBackupRequest; |
22 | 22 | import com.google.bigtable.admin.v2.DeleteTableRequest;
|
23 | 23 | import com.google.bigtable.admin.v2.DropRowRangeRequest;
|
24 |
| -import com.google.bigtable.admin.v2.GetSnapshotRequest; |
| 24 | +import com.google.bigtable.admin.v2.GetBackupRequest; |
25 | 25 | import com.google.bigtable.admin.v2.GetTableRequest;
|
26 |
| -import com.google.bigtable.admin.v2.ListSnapshotsRequest; |
27 |
| -import com.google.bigtable.admin.v2.ListSnapshotsResponse; |
| 26 | +import com.google.bigtable.admin.v2.ListBackupsRequest; |
| 27 | +import com.google.bigtable.admin.v2.ListBackupsResponse; |
28 | 28 | import com.google.bigtable.admin.v2.ListTablesRequest;
|
29 | 29 | import com.google.bigtable.admin.v2.ListTablesResponse;
|
30 | 30 | import com.google.bigtable.admin.v2.ModifyColumnFamiliesRequest;
|
31 |
| -import com.google.bigtable.admin.v2.Snapshot; |
32 |
| -import com.google.bigtable.admin.v2.SnapshotTableRequest; |
| 31 | +import com.google.bigtable.admin.v2.RestoreTableRequest; |
33 | 32 | import com.google.bigtable.admin.v2.Table;
|
34 | 33 | import com.google.common.util.concurrent.ListenableFuture;
|
35 | 34 | import com.google.iam.v1.GetIamPolicyRequest;
|
36 | 35 | import com.google.iam.v1.Policy;
|
37 | 36 | import com.google.iam.v1.SetIamPolicyRequest;
|
38 | 37 | import com.google.iam.v1.TestIamPermissionsRequest;
|
39 | 38 | import com.google.iam.v1.TestIamPermissionsResponse;
|
| 39 | +import com.google.longrunning.GetOperationRequest; |
40 | 40 | import com.google.longrunning.Operation;
|
41 | 41 | import com.google.protobuf.Empty;
|
| 42 | +import java.io.IOException; |
| 43 | +import java.util.concurrent.TimeUnit; |
42 | 44 | import java.util.concurrent.TimeoutException;
|
43 | 45 |
|
44 | 46 | /** A client for the Cloud Bigtable Table Admin API. */
|
@@ -183,24 +185,70 @@ void waitForReplication(BigtableTableName tableName, long timeout)
|
183 | 185 | */
|
184 | 186 | TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request);
|
185 | 187 |
|
186 |
| - // ////////////// SNAPSHOT methods ///////////// |
187 |
| - /** @deprecated Snapshots will be removed in the future */ |
188 |
| - @Deprecated |
189 |
| - ListenableFuture<Operation> snapshotTableAsync(SnapshotTableRequest request); |
| 188 | + /** |
| 189 | + * Creates a new backup from a table in a specific cluster. |
| 190 | + * |
| 191 | + * @param request a {@link com.google.bigtable.admin.v2.CreateBackupRequest} object. |
| 192 | + * @return The long running {@link Operation} for the request. |
| 193 | + */ |
| 194 | + ListenableFuture<Operation> createBackupAsync( |
| 195 | + com.google.bigtable.admin.v2.CreateBackupRequest request); |
| 196 | + |
| 197 | + /** |
| 198 | + * Lists all backups associated with the specified cluster. |
| 199 | + * |
| 200 | + * @param request a {@link GetBackupRequest} object. |
| 201 | + * @return The {@link ListBackupsResponse} which has the list of the backups in the cluster. |
| 202 | + */ |
| 203 | + ListenableFuture<ListBackupsResponse> listBackupsAsync(ListBackupsRequest request); |
| 204 | + |
| 205 | + /** |
| 206 | + * Permanently deletes the specified backup. |
| 207 | + * |
| 208 | + * @param request a {@link DeleteBackupRequest} object. |
| 209 | + */ |
| 210 | + ListenableFuture<Empty> deleteBackupAsync(DeleteBackupRequest request); |
190 | 211 |
|
191 |
| - /** @deprecated Snapshots will be removed in the future */ |
192 |
| - @Deprecated |
193 |
| - ListenableFuture<Snapshot> getSnapshotAsync(GetSnapshotRequest request); |
| 212 | + /** |
| 213 | + * Creates a new table from a backup. |
| 214 | + * |
| 215 | + * @param request a {@link com.google.bigtable.admin.v2.RestoreTableRequest} object. |
| 216 | + * @return The long running {@link Operation} for the request. |
| 217 | + */ |
| 218 | + ListenableFuture<Operation> restoreTableAsync( |
| 219 | + com.google.bigtable.admin.v2.RestoreTableRequest request); |
194 | 220 |
|
195 |
| - /** @deprecated Snapshots will be removed in the future */ |
196 |
| - @Deprecated |
197 |
| - ListenableFuture<ListSnapshotsResponse> listSnapshotsAsync(ListSnapshotsRequest request); |
| 221 | + /** |
| 222 | + * Gets the latest state of a long-running operation. Clients may use this method to poll the |
| 223 | + * operation result at intervals as recommended by the API service. |
| 224 | + * |
| 225 | + * <p>{@link #createBackupAsync(CreateBackupRequest)} and {@link |
| 226 | + * #restoreTableAsync(RestoreTableRequest)} will return a {@link |
| 227 | + * com.google.longrunning.Operation}. Use this method and pass in the {@link |
| 228 | + * com.google.longrunning.Operation}'s name in the request to see if the Operation is done via |
| 229 | + * {@link com.google.longrunning.Operation#getDone()}. The backup will not be available until that |
| 230 | + * happens. |
| 231 | + * |
| 232 | + * @param request a {@link com.google.longrunning.GetOperationRequest} object. |
| 233 | + * @return a {@link com.google.longrunning.Operation} object. |
| 234 | + */ |
| 235 | + Operation getOperation(GetOperationRequest request); |
198 | 236 |
|
199 |
| - /** @deprecated Snapshots will be removed in the future */ |
200 |
| - @Deprecated |
201 |
| - ListenableFuture<Empty> deleteSnapshotAsync(DeleteSnapshotRequest request); |
| 237 | + /** |
| 238 | + * Waits for the long running operation to complete by polling with exponential backoff. A default |
| 239 | + * timeout of 10 minutes is used. |
| 240 | + * |
| 241 | + * @throws IOException |
| 242 | + * @throws TimeoutException If the timeout is exceeded. |
| 243 | + */ |
| 244 | + Operation waitForOperation(Operation operation) throws TimeoutException, IOException; |
202 | 245 |
|
203 |
| - /** @deprecated Snapshots will be removed in the future */ |
204 |
| - @Deprecated |
205 |
| - ListenableFuture<Operation> createTableFromSnapshotAsync(CreateTableFromSnapshotRequest request); |
| 246 | + /** |
| 247 | + * Waits for the long running operation to complete by polling with exponential backoff. |
| 248 | + * |
| 249 | + * @throws IOException |
| 250 | + * @throws TimeoutException If the timeout is exceeded. |
| 251 | + */ |
| 252 | + Operation waitForOperation(Operation operation, long timeout, TimeUnit timeUnit) |
| 253 | + throws IOException, TimeoutException; |
206 | 254 | }
|
0 commit comments