delete_repository.asciidoc 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. [[java-rest-high-snapshot-delete-repository]]
  2. === Snapshot Delete Repository API
  3. The Snapshot Delete Repository API allows to delete a registered repository.
  4. [[java-rest-high-snapshot-delete-repository-request]]
  5. ==== Snapshot Delete Repository Request
  6. A `DeleteRepositoryRequest`:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-repository-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[create-repository-request-timeout]
  16. --------------------------------------------------
  17. <1> Timeout to wait for the all the nodes to acknowledge the settings were applied
  18. as a `TimeValue`
  19. <2> Timeout to wait for the all the nodes to acknowledge the settings were applied
  20. as a `String`
  21. ["source","java",subs="attributes,callouts,macros"]
  22. --------------------------------------------------
  23. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-repository-request-masterTimeout]
  24. --------------------------------------------------
  25. <1> Timeout to connect to the master node as a `TimeValue`
  26. <2> Timeout to connect to the master node as a `String`
  27. [[java-rest-high-snapshot-delete-repository-sync]]
  28. ==== Synchronous Execution
  29. ["source","java",subs="attributes,callouts,macros"]
  30. --------------------------------------------------
  31. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-repository-execute]
  32. --------------------------------------------------
  33. [[java-rest-high-snapshot-delete-repository-async]]
  34. ==== Asynchronous Execution
  35. The asynchronous execution of a snapshot delete repository requires both the
  36. `DeleteRepositoryRequest` instance and an `ActionListener` instance to be
  37. passed to the asynchronous method:
  38. ["source","java",subs="attributes,callouts,macros"]
  39. --------------------------------------------------
  40. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-repository-execute-async]
  41. --------------------------------------------------
  42. <1> The `DeleteRepositoryRequest` to execute and the `ActionListener`
  43. to use when the execution completes
  44. The asynchronous method does not block and returns immediately. Once it is
  45. completed the `ActionListener` is called back using the `onResponse` method
  46. if the execution successfully completed or using the `onFailure` method if
  47. it failed.
  48. A typical listener for `DeleteRepositoryResponse` looks like:
  49. ["source","java",subs="attributes,callouts,macros"]
  50. --------------------------------------------------
  51. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-repository-execute-listener]
  52. --------------------------------------------------
  53. <1> Called when the execution is successfully completed. The response is
  54. provided as an argument
  55. <2> Called in case of a failure. The raised exception is provided as an argument
  56. [[java-rest-high-cluster-delete-repository-response]]
  57. ==== Snapshot Delete Repository Response
  58. The returned `DeleteRepositoryResponse` allows to retrieve information about the
  59. executed operation as follows:
  60. ["source","java",subs="attributes,callouts,macros"]
  61. --------------------------------------------------
  62. include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[delete-repository-response]
  63. --------------------------------------------------
  64. <1> Indicates the node has acknowledged the request