use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method deleteSnapshotTest2.
@Test
public void deleteSnapshotTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockBigtableTableAdmin.addResponse(expectedResponse);
String name = "name3373707";
client.deleteSnapshot(name);
List<AbstractMessage> actualRequests = mockBigtableTableAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method deleteSnapshotTest.
@Test
public void deleteSnapshotTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockBigtableTableAdmin.addResponse(expectedResponse);
SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
client.deleteSnapshot(name);
List<AbstractMessage> actualRequests = mockBigtableTableAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project java-pubsub by googleapis.
the class SubscriptionAdminClientTest method deleteSnapshotTest2.
@Test
public void deleteSnapshotTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockSubscriber.addResponse(expectedResponse);
String snapshot = "snapshot284874180";
client.deleteSnapshot(snapshot);
List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0));
Assert.assertEquals(snapshot, actualRequest.getSnapshot());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project java-pubsub by googleapis.
the class SubscriptionAdminClientTest method deleteSnapshotTest.
@Test
public void deleteSnapshotTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockSubscriber.addResponse(expectedResponse);
SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
client.deleteSnapshot(snapshot);
List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0));
Assert.assertEquals(snapshot.toString(), actualRequest.getSnapshot());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project java-pubsub by googleapis.
the class SubscriptionAdminClient method deleteSnapshot.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Removes an existing snapshot. Snapshots are used in [Seek]
* (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage
* message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in
* an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all
* messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new
* one may be created with the same name, but the new one has no association with the old snapshot
* or its subscription, unless the same subscription is specified.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
* SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
* subscriptionAdminClient.deleteSnapshot(snapshot);
* }
* }</pre>
*
* @param snapshot Required. The name of the snapshot to delete. Format is
* `projects/{project}/snapshots/{snap}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteSnapshot(SnapshotName snapshot) {
DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot == null ? null : snapshot.toString()).build();
deleteSnapshot(request);
}
Aggregations