OpenSearch/docs/java-rest/high-level/licensing/get-license.asciidoc

51 lines
1.9 KiB
Plaintext
Raw Normal View History

[[java-rest-high-get-license]]
=== Get License
[[java-rest-high-get-license-execution]]
==== Execution
The license can be added or updated using the `getLicense()` method:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/LicensingDocumentationIT.java[get-license-execute]
--------------------------------------------------
[[java-rest-high-get-license-response]]
==== Response
The returned `GetLicenseResponse` contains the license in the JSON format.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/LicensingDocumentationIT.java[get-license-response]
--------------------------------------------------
<1> The text of the license.
[[java-rest-high-get-license-async]]
==== Asynchronous Execution
This request can be executed asynchronously:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/LicensingDocumentationIT.java[get-license-execute-async]
--------------------------------------------------
<1> The `GetLicenseRequest` to execute and the `ActionListener` to use when
the execution completes
The asynchronous method does not block and returns immediately. Once it is
completed the `ActionListener` is called back using the `onResponse` method
if the execution successfully completed or using the `onFailure` method if
it failed.
A typical listener for `GetLicenseResponse` looks like:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests}/LicensingDocumentationIT.java[get-license-execute-listener]
--------------------------------------------------
<1> Called when the execution is successfully completed. The response is
provided as an argument
<2> Called in case of failure. The raised exception is provided as an argument