Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wait_for_completion to DeleteSnapshotRequest #3135

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package com.sksamuel.elastic4s.requests.snapshots

case class DeleteSnapshotRequest(snapshotName: String, repositoryName: String)
import com.sksamuel.elastic4s.ext.OptionImplicits._

case class DeleteSnapshotRequest(snapshotName: String, repositoryName: String, waitForCompletion: Option[Boolean] = None) {
def waitForCompletion(wait: Boolean): DeleteSnapshotRequest = copy(waitForCompletion = wait.some)
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ trait SnapshotHandlers {
implicit object DeleteSnapshotHandler extends Handler[DeleteSnapshotRequest, DeleteSnapshotResponse] {
override def build(request: DeleteSnapshotRequest): ElasticRequest = {
val endpoint = s"/_snapshot/" + request.repositoryName + "/" + request.snapshotName
ElasticRequest("DELETE", endpoint)
val params = scala.collection.mutable.Map.empty[String, String]
request.waitForCompletion.map(_.toString).foreach(params.put("wait_for_completion", _))
ElasticRequest("DELETE", endpoint, params.toMap)
}
}

Expand Down