get_repository.asciidoc 3.7 KB

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