delete-calendar.asciidoc 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. [[java-rest-high-x-pack-ml-delete-calendar]]
  2. === Delete Calendar API
  3. Delete a {ml} calendar.
  4. The API accepts a `DeleteCalendarRequest` and responds
  5. with a `AcknowledgedResponse` object.
  6. [[java-rest-high-x-pack-ml-delete-calendar-request]]
  7. ==== Delete Calendar Request
  8. A `DeleteCalendar` object requires a non-null `calendarId`.
  9. ["source","java",subs="attributes,callouts,macros"]
  10. ---------------------------------------------------
  11. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-calendar-request]
  12. ---------------------------------------------------
  13. <1> Constructing a new request referencing an existing Calendar
  14. [[java-rest-high-x-pack-ml-delete-calendar-response]]
  15. ==== Delete Calendar Response
  16. The returned `AcknowledgedResponse` object indicates the acknowledgement of the request:
  17. ["source","java",subs="attributes,callouts,macros"]
  18. ---------------------------------------------------
  19. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-calendar-response]
  20. ---------------------------------------------------
  21. <1> `isAcknowledged` was the deletion request acknowledged or not
  22. [[java-rest-high-x-pack-ml-delete-calendar-execution]]
  23. ==== Execution
  24. The request can be executed through the `MachineLearningClient` contained
  25. in the `RestHighLevelClient` object, accessed via the `machineLearningClient()` method.
  26. ["source","java",subs="attributes,callouts,macros"]
  27. --------------------------------------------------
  28. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-calendar-execute]
  29. --------------------------------------------------
  30. [[java-rest-high-x-pack-ml-delete-calendar-async]]
  31. ==== Delete Calendar Asynchronously
  32. This request can also be made asynchronously.
  33. ["source","java",subs="attributes,callouts,macros"]
  34. ---------------------------------------------------
  35. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-calendar-execute-async]
  36. ---------------------------------------------------
  37. <1> The `DeleteCalendarRequest` to execute and the `ActionListener` to alert on completion or error.
  38. The deletion request returns immediately. Once the request is completed, the `ActionListener` is
  39. called back using the `onResponse` or `onFailure`. The latter indicates some failure occurred when
  40. making the request.
  41. A typical listener for a `DeleteCalendarRequest` could be defined as follows:
  42. ["source","java",subs="attributes,callouts,macros"]
  43. ---------------------------------------------------
  44. include-tagged::{doc-tests}/MlClientDocumentationIT.java[x-pack-ml-delete-calendar-listener]
  45. ---------------------------------------------------
  46. <1> The action to be taken when it is completed
  47. <2> What to do when a failure occurs