@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@Override public ListSnapshotsRequest injectToken(ListSnapshotsRequest payload, String token) { return ListSnapshotsRequest.newBuilder(payload).setPageToken(token).build(); }
@Override public ListSnapshotsRequest injectPageSize(ListSnapshotsRequest payload, int pageSize) { return ListSnapshotsRequest.newBuilder(payload).setPageSize(pageSize).build(); }
/** * Lists all snapshots associated with the specified cluster. * * <p>Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not * currently available to most Cloud Bigtable customers. This feature might be changed in * backward-incompatible ways and is not recommended for production use. It is not subject to any * SLA or deprecation policy. * * <p>Sample code: * * <pre><code> * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) { * ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); * for (Snapshot element : baseBigtableTableAdminClient.listSnapshots(parent.toString()).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param parent The unique name of the cluster for which snapshots should be listed. Values are * of the form `projects/<project>/instances/<instance>/clusters/<cluster>`. * Use `<cluster> = '-'` to list snapshots for all clusters in an instance, e.g., * `projects/<project>/instances/<instance>/clusters/-`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSnapshotsPagedResponse listSnapshots(String parent) { ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder().setParent(parent).build(); return listSnapshots(request); }
ListSnapshotsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build();
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@Override public ListSnapshotsRequest injectPageSize(ListSnapshotsRequest payload, int pageSize) { return ListSnapshotsRequest.newBuilder(payload).setPageSize(pageSize).build(); }
@Override public ListSnapshotsRequest injectToken(ListSnapshotsRequest payload, String token) { return ListSnapshotsRequest.newBuilder(payload).setPageToken(token).build(); }
@Override public CompletableFuture<List<SnapshotDescription>> listSnapshots() { return CompletableFuture.supplyAsync(() -> { try { return ListSnapshotsRequest.newBuilder() .setParent(getSnapshotClusterName().toString()) .build(); } catch (IOException e) { throw new CompletionException(e); } }).thenCompose(request -> bigtableTableAdminClient.listSnapshotsAsync(request) .thenApply(r -> r.getSnapshotsList() .stream() .map(BigtableAsyncAdmin::toSnapshotDescription) .collect(Collectors.toList()) ) ); }
@Override public CompletableFuture<List<SnapshotDescription>> listSnapshots() { return CompletableFuture.supplyAsync(() -> { try { return ListSnapshotsRequest.newBuilder() .setParent(getSnapshotClusterName().toString()) .build(); } catch (IOException e) { throw new CompletionException(e); } }).thenCompose(request -> bigtableTableAdminClient.listSnapshotsAsync(request) .thenApply(r -> r.getSnapshotsList() .stream() .map(BigtableAsyncAdmin::toSnapshotDescription) .collect(Collectors.toList()) ) ); }
/** * Lists all snapshots associated with the specified cluster. * * <p>Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not * currently available to most Cloud Bigtable customers. This feature might be changed in * backward-incompatible ways and is not recommended for production use. It is not subject to any * SLA or deprecation policy. * * <p>Sample code: * * <pre><code> * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) { * ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); * for (Snapshot element : baseBigtableTableAdminClient.listSnapshots(parent.toString()).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param parent The unique name of the cluster for which snapshots should be listed. Values are * of the form `projects/<project>/instances/<instance>/clusters/<cluster>`. * Use `<cluster> = '-'` to list snapshots for all clusters in an instance, e.g., * `projects/<project>/instances/<instance>/clusters/-`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListSnapshotsPagedResponse listSnapshots(String parent) { ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder().setParent(parent).build(); return listSnapshots(request); }
@Override public List<SnapshotDescription> listSnapshots() throws IOException { ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder() .setParent(getSnapshotClusterName().toString()) .build(); ListSnapshotsResponse snapshotList = Futures.getChecked(bigtableTableAdminClient .listSnapshotsAsync(request), IOException.class); List<SnapshotDescription> response = new ArrayList<>(); for (Snapshot snapshot : snapshotList.getSnapshotsList()) { response.add(new SnapshotDescription( snapshot.getName(), TableName.valueOf(snapshot.getSourceTable().getName()))); } return response; }
@Override public List<SnapshotDescription> listSnapshots() throws IOException { ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder() .setParent(getSnapshotClusterName().toString()) .build(); ListSnapshotsResponse snapshotList = Futures.getChecked(bigtableTableAdminClient .listSnapshotsAsync(request), IOException.class); List<SnapshotDescription> response = new ArrayList<>(); for (Snapshot snapshot : snapshotList.getSnapshotsList()) { response.add(new SnapshotDescription( snapshot.getName(), TableName.valueOf(snapshot.getSourceTable().getName()))); } return response; }
ListSnapshotsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build();
/** {@inheritDoc} */ @Override public List<HBaseProtos.SnapshotDescription> listSnapshots() throws IOException { ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder() .setParent(getSnapshotClusterName().toString()) .build(); ListSnapshotsResponse snapshotList = Futures.getChecked( bigtableTableAdminClient.listSnapshotsAsync(request), IOException.class ); List<HBaseProtos.SnapshotDescription> response = new ArrayList<>(); for (Snapshot snapshot : snapshotList.getSnapshotsList()) { BigtableSnapshotName snapshotName = new BigtableSnapshotName(snapshot.getName()); BigtableTableName tableName = new BigtableTableName(snapshot.getSourceTable().getName()); response.add(HBaseProtos.SnapshotDescription.newBuilder() .setName(snapshotName.getSnapshotId()) .setTable(tableName.getTableId()) .setCreationTime(TimeUnit.SECONDS.toMillis(snapshot.getCreateTime().getSeconds())) .build()); } return response; }