delete_snapshot.asciidoc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. [[java-rest-high-snapshot-delete-snapshot]]
  2. === Delete Snapshot API
  3. The Delete Snapshot API allows to delete a snapshot.
  4. [[java-rest-high-snapshot-delete-snapshot-request]]
  5. ==== Delete Snapshot Request
  6. A `DeleteSnapshotRequest`:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-snapshot-request]
  10. --------------------------------------------------
  11. ==== Optional Arguments
  12. The following arguments can optionally be provided:
  13. ["source","java",subs="attributes,callouts,macros"]
  14. --------------------------------------------------
  15. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-snapshot-request-masterTimeout]
  16. --------------------------------------------------
  17. <1> Timeout to connect to the master node as a `TimeValue`
  18. <2> Timeout to connect to the master node as a `String`
  19. [[java-rest-high-snapshot-delete-snapshot-sync]]
  20. ==== Synchronous Execution
  21. ["source","java",subs="attributes,callouts,macros"]
  22. --------------------------------------------------
  23. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-snapshot-execute]
  24. --------------------------------------------------
  25. [[java-rest-high-snapshot-delete-snapshot-async]]
  26. ==== Asynchronous Execution
  27. The asynchronous execution of a delete snapshot request requires both the
  28. `DeleteSnapshotRequest` instance and an `ActionListener` instance to be
  29. passed to the asynchronous method:
  30. ["source","java",subs="attributes,callouts,macros"]
  31. --------------------------------------------------
  32. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-snapshot-execute-async]
  33. --------------------------------------------------
  34. <1> The `DeleteSnapshotRequest` to execute and the `ActionListener`
  35. to use when the execution completes
  36. The asynchronous method does not block and returns immediately. Once it is
  37. completed the `ActionListener` is called back using the `onResponse` method
  38. if the execution successfully completed or using the `onFailure` method if
  39. it failed.
  40. A typical listener for `DeleteSnapshotResponse` looks like:
  41. ["source","java",subs="attributes,callouts,macros"]
  42. --------------------------------------------------
  43. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-snapshot-execute-listener]
  44. --------------------------------------------------
  45. <1> Called when the execution is successfully completed. The response is
  46. provided as an argument
  47. <2> Called in case of a failure. The raised exception is provided as an argument
  48. [[java-rest-high-cluster-delete-snapshot-response]]
  49. ==== Delete Snapshot Response
  50. The returned `DeleteSnapshotResponse` allows to retrieve information about the
  51. executed operation as follows:
  52. ["source","java",subs="attributes,callouts,macros"]
  53. --------------------------------------------------
  54. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-snapshot-response]
  55. --------------------------------------------------
  56. <1> Indicates the node has acknowledged the request