use of com.google.bigtable.admin.v2.Snapshot in project gapic-generator-java by googleapis.
the class SubscriptionAdminClientTest method getSnapshotTest.
@Test
public void getSnapshotTest() throws Exception {
Snapshot expectedResponse = Snapshot.newBuilder().setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()).setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()).setExpireTime(Timestamp.newBuilder().build()).putAllLabels(new HashMap<String, String>()).build();
mockSubscriber.addResponse(expectedResponse);
SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
Snapshot actualResponse = client.getSnapshot(snapshot);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetSnapshotRequest actualRequest = ((GetSnapshotRequest) actualRequests.get(0));
Assert.assertEquals(snapshot.toString(), actualRequest.getSnapshot());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.Snapshot in project gapic-generator-java by googleapis.
the class SyncUpdateSnapshot method syncUpdateSnapshot.
public static void syncUpdateSnapshot() throws Exception {
// It may require modifications to work in your environment.
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
UpdateSnapshotRequest request = UpdateSnapshotRequest.newBuilder().setSnapshot(Snapshot.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).build();
Snapshot response = subscriptionAdminClient.updateSnapshot(request);
}
}
use of com.google.bigtable.admin.v2.Snapshot in project gapic-generator-java by googleapis.
the class SyncGetSnapshot method syncGetSnapshot.
public static void syncGetSnapshot() throws Exception {
// It may require modifications to work in your environment.
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()).build();
Snapshot response = subscriptionAdminClient.getSnapshot(request);
}
}
use of com.google.bigtable.admin.v2.Snapshot in project gapic-generator-java by googleapis.
the class SyncGetSnapshotSnapshotname method syncGetSnapshotSnapshotname.
public static void syncGetSnapshotSnapshotname() throws Exception {
// It may require modifications to work in your environment.
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
}
}
use of com.google.bigtable.admin.v2.Snapshot in project gapic-generator-java by googleapis.
the class AsyncGetSnapshot method asyncGetSnapshot.
public static void asyncGetSnapshot() throws Exception {
// It may require modifications to work in your environment.
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()).build();
ApiFuture<Snapshot> future = subscriptionAdminClient.getSnapshotCallable().futureCall(request);
// Do something.
Snapshot response = future.get();
}
}
Aggregations