Skip to main content

oxsearch_sql/generated/
delete_async.rs

1// Generated by `cargo run -p xtask -- generate` from elastic/elasticsearch-specification 9.5 at
2// 84bf510a907bae62ffe29af35f516af287a79eab. Don't edit it: change the generator.
3
4/// Delete an async SQL search.
5///
6/// Delete an async SQL search or a stored synchronous SQL search.
7/// If the search is still running, the API cancels it.
8///
9/// If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:
10///
11/// * Users with the `cancel_task` cluster privilege.
12/// * The user who first submitted the search.
13#[derive(Clone, Debug, PartialEq)]
14#[non_exhaustive]
15pub struct Request {
16    // Path parameters.
17    /// The identifier for the search.
18    pub id: ::oxsearch_core::Id,
19}
20
21impl Request {
22    /// A `Request` with its required properties set.
23    pub fn new(id: impl ::core::convert::Into<::oxsearch_core::Id>) -> Self {
24        Self { id: id.into() }
25    }
26}
27
28impl Request {}
29
30#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
31#[serde(transparent)]
32pub struct Response(pub ::oxsearch_core::AcknowledgedResponseBase);
33
34impl ::core::ops::Deref for Response {
35    type Target = ::oxsearch_core::AcknowledgedResponseBase;
36    fn deref(&self) -> &::oxsearch_core::AcknowledgedResponseBase {
37        &self.0
38    }
39}
40
41impl ::core::ops::DerefMut for Response {
42    fn deref_mut(&mut self) -> &mut ::oxsearch_core::AcknowledgedResponseBase {
43        &mut self.0
44    }
45}
46
47impl ::oxsearch_core::Endpoint for Request {
48    type Response = crate::delete_async::Response;
49
50    fn name(&self) -> &'static str {
51        "sql.delete_async"
52    }
53
54    fn route(&self) -> ::core::result::Result<::oxsearch_core::Route, ::oxsearch_core::Error> {
55        if let (::core::option::Option::Some(p0),) = (::core::option::Option::Some(&self.id),) {
56            return ::core::result::Result::Ok(::oxsearch_core::Route::new(
57                ::oxsearch_core::Method::Delete,
58                format!(
59                    "/_sql/async/delete/{}",
60                    ::oxsearch_core::__private::path_param("id", p0)?
61                ),
62            ));
63        }
64        ::core::result::Result::Err(::oxsearch_core::__private::no_route(self.name()))
65    }
66
67    fn query(
68        &self,
69    ) -> ::core::result::Result<
70        ::std::vec::Vec<(&'static str, ::std::string::String)>,
71        ::oxsearch_core::Error,
72    > {
73        ::core::result::Result::Ok(::std::vec::Vec::new())
74    }
75
76    fn body(
77        &self,
78    ) -> ::core::result::Result<::core::option::Option<::oxsearch_core::Body>, ::oxsearch_core::Error>
79    {
80        ::core::result::Result::Ok(::core::option::Option::None)
81    }
82}