public static List<String> toStringList(List<SnapshotName> values) { List<String> list = new ArrayList<String>(values.size()); for (SnapshotName value : values) { if (value == null) { list.add(""); } else { list.add(value.toString()); } } return list; }
/** * Permanently deletes the specified snapshot. * * <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()) { * SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); * baseBigtableTableAdminClient.deleteSnapshot(name); * } * </code></pre> * * @param name The unique name of the snapshot to be deleted. Values are of the form * `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteSnapshot(SnapshotName name) { DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteSnapshot(request); }
/** * Gets metadata information about the specified snapshot. * * <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()) { * SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); * Snapshot response = baseBigtableTableAdminClient.getSnapshot(name); * } * </code></pre> * * @param name The unique name of the requested snapshot. Values are of the form * `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Snapshot getSnapshot(SnapshotName name) { GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getSnapshot(request); }
public static String format(String project, String instance, String cluster, String snapshot) { return newBuilder() .setProject(project) .setInstance(instance) .setCluster(cluster) .setSnapshot(snapshot) .build() .toString(); }
.setParent(parent == null ? null : parent.toString()) .setTableId(tableId) .setSourceSnapshot(sourceSnapshot == null ? null : sourceSnapshot.toString()) .build(); return createTableFromSnapshotAsync(request);
.setName(name == null ? null : name.toString()) .setCluster(cluster == null ? null : cluster.toString()) .setSnapshotId(snapshotId == null ? null : snapshotId.toString()) .setDescription(description) .build();
@Test @SuppressWarnings("all") public void getSnapshotTest() { SnapshotName name2 = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); long dataSizeBytes = 2110122398L; String description = "description-1724546052"; Snapshot expectedResponse = Snapshot.newBuilder() .setName(name2.toString()) .setDataSizeBytes(dataSizeBytes) .setDescription(description) .build(); mockBigtableTableAdmin.addResponse(expectedResponse); SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); Snapshot actualResponse = client.getSnapshot(name); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetSnapshotRequest actualRequest = (GetSnapshotRequest) actualRequests.get(0); Assert.assertEquals(name, SnapshotName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
Snapshot expectedResponse = Snapshot.newBuilder() .setName(name2.toString()) .setDataSizeBytes(dataSizeBytes) .setDescription(description2)
public static List<String> toStringList(List<SnapshotName> values) { List<String> list = new ArrayList<String>(values.size()); for (SnapshotName value : values) { if (value == null) { list.add(""); } else { list.add(value.toString()); } } return list; }
public static String format(String project, String instance, String cluster, String snapshot) { return newBuilder() .setProject(project) .setInstance(instance) .setCluster(cluster) .setSnapshot(snapshot) .build() .toString(); }
/** * Permanently deletes the specified snapshot. * * <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()) { * SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); * baseBigtableTableAdminClient.deleteSnapshot(name); * } * </code></pre> * * @param name The unique name of the snapshot to be deleted. Values are of the form * `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteSnapshot(SnapshotName name) { DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteSnapshot(request); }
/** * Gets metadata information about the specified snapshot. * * <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()) { * SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); * Snapshot response = baseBigtableTableAdminClient.getSnapshot(name); * } * </code></pre> * * @param name The unique name of the requested snapshot. Values are of the form * `projects/<project>/instances/<instance>/clusters/<cluster>/snapshots/<snapshot>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Snapshot getSnapshot(SnapshotName name) { GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getSnapshot(request); }
.setParent(parent == null ? null : parent.toString()) .setTableId(tableId) .setSourceSnapshot(sourceSnapshot == null ? null : sourceSnapshot.toString()) .build(); return createTableFromSnapshotAsync(request);
.setName(name == null ? null : name.toString()) .setCluster(cluster == null ? null : cluster.toString()) .setSnapshotId(snapshotId == null ? null : snapshotId.toString()) .setDescription(description) .build();