Search in sources :

Example 11 with DeleteSnapshotRequest

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()) {
 *   String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
 *   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(String snapshot) {
    DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot).build();
    deleteSnapshot(request);
}
Also used : DeleteSnapshotRequest(com.google.pubsub.v1.DeleteSnapshotRequest)

Example 12 with DeleteSnapshotRequest

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
 * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
 *   ProjectSnapshotName snapshot = ProjectSnapshotName.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
 * @deprecated Use Use {@link #deleteSnapshot(SnapshotName)} instead.
 */
@Deprecated
public final void deleteSnapshot(ProjectSnapshotName snapshot) {
    DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot == null ? null : snapshot.toString()).build();
    deleteSnapshot(request);
}
Also used : DeleteSnapshotRequest(com.google.pubsub.v1.DeleteSnapshotRequest)

Example 13 with DeleteSnapshotRequest

use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project gapic-generator-java by googleapis.

the class AsyncDeleteSnapshot method asyncDeleteSnapshot.

public static void asyncDeleteSnapshot() throws Exception {
    // It may require modifications to work in your environment.
    try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
        DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()).build();
        ApiFuture<Empty> future = subscriptionAdminClient.deleteSnapshotCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : Empty(com.google.protobuf.Empty) SubscriptionAdminClient(com.google.cloud.pubsub.v1.SubscriptionAdminClient) DeleteSnapshotRequest(com.google.pubsub.v1.DeleteSnapshotRequest)

Example 14 with DeleteSnapshotRequest

use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project gapic-generator-java by googleapis.

the class SyncDeleteSnapshot method syncDeleteSnapshot.

public static void syncDeleteSnapshot() throws Exception {
    // It may require modifications to work in your environment.
    try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
        DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()).build();
        subscriptionAdminClient.deleteSnapshot(request);
    }
}
Also used : SubscriptionAdminClient(com.google.cloud.pubsub.v1.SubscriptionAdminClient) DeleteSnapshotRequest(com.google.pubsub.v1.DeleteSnapshotRequest)

Example 15 with DeleteSnapshotRequest

use of com.google.bigtable.admin.v2.DeleteSnapshotRequest in project gapic-generator-java 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);
}
Also used : DeleteSnapshotRequest(com.google.pubsub.v1.DeleteSnapshotRequest)

Aggregations

DeleteSnapshotRequest (com.google.pubsub.v1.DeleteSnapshotRequest)13 Empty (com.google.protobuf.Empty)8 Test (org.junit.Test)7 AbstractMessage (com.google.protobuf.AbstractMessage)6 DeleteSnapshotRequest (com.google.bigtable.admin.v2.DeleteSnapshotRequest)4 ByteString (com.google.protobuf.ByteString)3 SnapshotName (com.google.pubsub.v1.SnapshotName)3 SubscriptionAdminClient (com.google.cloud.pubsub.v1.SubscriptionAdminClient)2 SnapshotName (com.google.bigtable.admin.v2.SnapshotName)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1