get-certificates.asciidoc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. [[java-rest-high-security-get-certificates]]
  2. === SSL Certificate API
  3. [[java-rest-high-security-get-certificates-execution]]
  4. ==== Execution
  5. The X.509 Certificates that are used to encrypt communications in an
  6. Elasticsearch cluster using the `security().getSslCertificates()` method:
  7. ["source","java",subs="attributes,callouts,macros"]
  8. --------------------------------------------------
  9. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-certificates-execute]
  10. --------------------------------------------------
  11. [[java-rest-high-security-get-certificates-response]]
  12. ==== Response
  13. The returned `GetSslCertificatesResponse` contains a single field, `certificates`.
  14. This field, accessed with `getCertificates` returns a List of `CertificateInfo`
  15. objects containing the information for all the certificates used.
  16. ["source","java",subs="attributes,callouts,macros"]
  17. --------------------------------------------------
  18. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-certificates-response]
  19. --------------------------------------------------
  20. <1> `certificates` is a List of `CertificateInfo`
  21. [[java-rest-high-security-get-certificates-execute-async]]
  22. ==== Asynchronous Execution
  23. This request can be executed asynchronously using the `security().getSslCertificatesAsync()`
  24. method:
  25. ["source","java",subs="attributes,callouts,macros"]
  26. --------------------------------------------------
  27. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-certificates-execute-async]
  28. --------------------------------------------------
  29. <1> The `ActionListener` to use when the execution completes.
  30. The asynchronous method does not block and returns immediately. Once the request
  31. has completed the `ActionListener` is called back using the `onResponse` method
  32. if the execution successfully completed or using the `onFailure` method if
  33. it failed.
  34. A typical listener for a `GetSslCertificatesResponse` looks like:
  35. ["source","java",subs="attributes,callouts,macros"]
  36. --------------------------------------------------
  37. include-tagged::{doc-tests}/SecurityDocumentationIT.java[get-certificates-execute-listener]
  38. --------------------------------------------------
  39. <1> Called when the execution is successfully completed. The response is
  40. provided as an argument.
  41. <2> Called in case of failure. The raised exception is provided as an argument.