From eaa3b957618e5e2bc62ba3d8b1f379528e648d7a Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Mon, 18 Nov 2024 18:34:17 +0100 Subject: [PATCH] Generate code for 8.16.0 --- elasticsearch/src/cluster.rs | 18 +- elasticsearch/src/http/transport.rs | 28 +- elasticsearch/src/indices.rs | 132 +++++++-- elasticsearch/src/inference.rs | 174 ++++++++++++ elasticsearch/src/ingest.rs | 415 +++++++++++++++++++++++++++- elasticsearch/src/query_rules.rs | 154 +++++++++++ elasticsearch/src/root/mod.rs | 23 +- elasticsearch/src/security.rs | 14 - elasticsearch/src/snapshot.rs | 248 +++++++++++++++++ elasticsearch/tests/auth.rs | 2 + elasticsearch/tests/cert.rs | 5 + elasticsearch/tests/common/mod.rs | 16 ++ xtask/src/main.rs | 2 +- 13 files changed, 1159 insertions(+), 72 deletions(-) diff --git a/elasticsearch/src/cluster.rs b/elasticsearch/src/cluster.rs index 0a395a9d..7013f2cc 100644 --- a/elasticsearch/src/cluster.rs +++ b/elasticsearch/src/cluster.rs @@ -2457,9 +2457,9 @@ pub struct ClusterStats<'a, 'b> { parts: ClusterStatsParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, - flat_settings: Option, headers: HeaderMap, human: Option, + include_remotes: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, @@ -2475,8 +2475,8 @@ impl<'a, 'b> ClusterStats<'a, 'b> { headers, error_trace: None, filter_path: None, - flat_settings: None, human: None, + include_remotes: None, pretty: None, request_timeout: None, source: None, @@ -2493,11 +2493,6 @@ impl<'a, 'b> ClusterStats<'a, 'b> { self.filter_path = Some(filter_path); self } - #[doc = "Return settings in flat format (default: false)"] - pub fn flat_settings(mut self, flat_settings: bool) -> Self { - self.flat_settings = Some(flat_settings); - self - } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -2508,6 +2503,11 @@ impl<'a, 'b> ClusterStats<'a, 'b> { self.human = Some(human); self } + #[doc = "Include remote cluster data into the response (default: false)"] + pub fn include_remotes(mut self, include_remotes: bool) -> Self { + self.include_remotes = Some(include_remotes); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -2541,8 +2541,8 @@ impl<'a, 'b> ClusterStats<'a, 'b> { error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - flat_settings: Option, human: Option, + include_remotes: Option, pretty: Option, source: Option<&'b str>, timeout: Option<&'b str>, @@ -2550,8 +2550,8 @@ impl<'a, 'b> ClusterStats<'a, 'b> { let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, - flat_settings: self.flat_settings, human: self.human, + include_remotes: self.include_remotes, pretty: self.pretty, source: self.source, timeout: self.timeout, diff --git a/elasticsearch/src/http/transport.rs b/elasticsearch/src/http/transport.rs index 42a7136d..6f190adc 100644 --- a/elasticsearch/src/http/transport.rs +++ b/elasticsearch/src/http/transport.rs @@ -18,7 +18,10 @@ */ //! HTTP transport and connection components -#[cfg(all(target_arch = "wasm32", any(feature = "native-tls", feature = "rustls-tls")))] +#[cfg(all( + target_arch = "wasm32", + any(feature = "native-tls", feature = "rustls-tls") +))] compile_error!("TLS features are not compatible with the wasm target"); #[cfg(any(feature = "native-tls", feature = "rustls-tls"))] @@ -481,8 +484,7 @@ impl Transport { headers: HeaderMap, query_string: Option<&Q>, body: Option, - #[allow(unused_variables)] - timeout: Option, + #[allow(unused_variables)] timeout: Option, ) -> Result where B: Body, @@ -589,15 +591,17 @@ impl Transport { let connection = self.conn_pool.next(); // Build node info request - let node_request = self.request_builder( - &connection, - Method::Get, - "_nodes/http?filter_path=nodes.*.http", - HeaderMap::default(), - None::<&()>, - None::<()>, - None, - ).unwrap(); + let node_request = self + .request_builder( + &connection, + Method::Get, + "_nodes/http?filter_path=nodes.*.http", + HeaderMap::default(), + None::<&()>, + None::<()>, + None, + ) + .unwrap(); let scheme = connection.url.scheme(); let resp = node_request.send().await.unwrap(); diff --git a/elasticsearch/src/indices.rs b/elasticsearch/src/indices.rs index 91f4b7a4..ec3c591d 100644 --- a/elasticsearch/src/indices.rs +++ b/elasticsearch/src/indices.rs @@ -1217,9 +1217,11 @@ pub struct IndicesCreateDataStream<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } impl<'a, 'b, B> IndicesCreateDataStream<'a, 'b, B> where @@ -1236,9 +1238,11 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "The body for the API call"] @@ -1254,9 +1258,11 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + timeout: self.timeout, } } #[doc = "Include the stack trace of returned errors."] @@ -1279,6 +1285,11 @@ where self.human = Some(human); self } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1294,6 +1305,11 @@ where self.source = Some(source); self } + #[doc = "Specify timeout for acknowledging the cluster state update"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Indices Create Data Stream API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); @@ -1308,15 +1324,19 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -1762,14 +1782,12 @@ impl<'a, 'b> IndicesDeleteAlias<'a, 'b> { Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Indices Delete Data Lifecycle API"] pub enum IndicesDeleteDataLifecycleParts<'b> { #[doc = "Name"] Name(&'b [&'b str]), } -#[cfg(feature = "experimental-apis")] impl<'b> IndicesDeleteDataLifecycleParts<'b> { #[doc = "Builds a relative URL path to the Indices Delete Data Lifecycle API"] pub fn url(self) -> Cow<'static, str> { @@ -1788,8 +1806,6 @@ impl<'b> IndicesDeleteDataLifecycleParts<'b> { } } #[doc = "Builder for the [Indices Delete Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-delete-lifecycle.html)\n\nDeletes the data stream lifecycle of the selected data streams."] -#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] -#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] pub struct IndicesDeleteDataLifecycle<'a, 'b> { transport: &'a Transport, @@ -1805,7 +1821,6 @@ pub struct IndicesDeleteDataLifecycle<'a, 'b> { source: Option<&'b str>, timeout: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b> IndicesDeleteDataLifecycle<'a, 'b> { #[doc = "Creates a new instance of [IndicesDeleteDataLifecycle] with the specified API parts"] pub fn new(transport: &'a Transport, parts: IndicesDeleteDataLifecycleParts<'b>) -> Self { @@ -1948,6 +1963,7 @@ pub struct IndicesDeleteDataStream<'a, 'b> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, @@ -1964,6 +1980,7 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { expand_wildcards: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1994,6 +2011,11 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { self.human = Some(human); self } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -2025,6 +2047,7 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, } @@ -2033,6 +2056,7 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -3311,14 +3335,12 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Indices Explain Data Lifecycle API"] pub enum IndicesExplainDataLifecycleParts<'b> { #[doc = "Index"] Index(&'b str), } -#[cfg(feature = "experimental-apis")] impl<'b> IndicesExplainDataLifecycleParts<'b> { #[doc = "Builds a relative URL path to the Indices Explain Data Lifecycle API"] pub fn url(self) -> Cow<'static, str> { @@ -3336,8 +3358,6 @@ impl<'b> IndicesExplainDataLifecycleParts<'b> { } } #[doc = "Builder for the [Indices Explain Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-explain-lifecycle.html)\n\nRetrieves information about the index's current data stream lifecycle, such as any potential encountered error, time since creation etc."] -#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] -#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] pub struct IndicesExplainDataLifecycle<'a, 'b> { transport: &'a Transport, @@ -3352,7 +3372,6 @@ pub struct IndicesExplainDataLifecycle<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b> IndicesExplainDataLifecycle<'a, 'b> { #[doc = "Creates a new instance of [IndicesExplainDataLifecycle] with the specified API parts"] pub fn new(transport: &'a Transport, parts: IndicesExplainDataLifecycleParts<'b>) -> Self { @@ -4418,14 +4437,12 @@ impl<'a, 'b> IndicesGetAlias<'a, 'b> { Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Indices Get Data Lifecycle API"] pub enum IndicesGetDataLifecycleParts<'b> { #[doc = "Name"] Name(&'b [&'b str]), } -#[cfg(feature = "experimental-apis")] impl<'b> IndicesGetDataLifecycleParts<'b> { #[doc = "Builds a relative URL path to the Indices Get Data Lifecycle API"] pub fn url(self) -> Cow<'static, str> { @@ -4444,8 +4461,6 @@ impl<'b> IndicesGetDataLifecycleParts<'b> { } } #[doc = "Builder for the [Indices Get Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-get-lifecycle.html)\n\nReturns the data stream lifecycle of the selected data streams."] -#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] -#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] pub struct IndicesGetDataLifecycle<'a, 'b> { transport: &'a Transport, @@ -4456,11 +4471,11 @@ pub struct IndicesGetDataLifecycle<'a, 'b> { headers: HeaderMap, human: Option, include_defaults: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b> IndicesGetDataLifecycle<'a, 'b> { #[doc = "Creates a new instance of [IndicesGetDataLifecycle] with the specified API parts"] pub fn new(transport: &'a Transport, parts: IndicesGetDataLifecycleParts<'b>) -> Self { @@ -4474,6 +4489,7 @@ impl<'a, 'b> IndicesGetDataLifecycle<'a, 'b> { filter_path: None, human: None, include_defaults: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -4509,6 +4525,11 @@ impl<'a, 'b> IndicesGetDataLifecycle<'a, 'b> { self.include_defaults = Some(include_defaults); self } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -4541,6 +4562,7 @@ impl<'a, 'b> IndicesGetDataLifecycle<'a, 'b> { filter_path: Option<&'b [&'b str]>, human: Option, include_defaults: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, } @@ -4550,6 +4572,7 @@ impl<'a, 'b> IndicesGetDataLifecycle<'a, 'b> { filter_path: self.filter_path, human: self.human, include_defaults: self.include_defaults, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -4599,9 +4622,11 @@ pub struct IndicesGetDataStream<'a, 'b> { headers: HeaderMap, human: Option, include_defaults: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, + verbose: Option, } impl<'a, 'b> IndicesGetDataStream<'a, 'b> { #[doc = "Creates a new instance of [IndicesGetDataStream] with the specified API parts"] @@ -4616,9 +4641,11 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { filter_path: None, human: None, include_defaults: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + verbose: None, } } #[doc = "Include the stack trace of returned errors."] @@ -4651,6 +4678,11 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { self.include_defaults = Some(include_defaults); self } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -4666,6 +4698,11 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { self.source = Some(source); self } + #[doc = "Whether the maximum timestamp for each data stream should be calculated and returned (default: false)"] + pub fn verbose(mut self, verbose: bool) -> Self { + self.verbose = Some(verbose); + self + } #[doc = "Creates an asynchronous call to the Indices Get Data Stream API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); @@ -4683,8 +4720,10 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { filter_path: Option<&'b [&'b str]>, human: Option, include_defaults: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, + verbose: Option, } let query_params = QueryParams { error_trace: self.error_trace, @@ -4692,8 +4731,10 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { filter_path: self.filter_path, human: self.human, include_defaults: self.include_defaults, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + verbose: self.verbose, }; Some(query_params) }; @@ -5611,9 +5652,11 @@ pub struct IndicesMigrateToDataStream<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } impl<'a, 'b, B> IndicesMigrateToDataStream<'a, 'b, B> where @@ -5630,9 +5673,11 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "The body for the API call"] @@ -5648,9 +5693,11 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + timeout: self.timeout, } } #[doc = "Include the stack trace of returned errors."] @@ -5673,6 +5720,11 @@ where self.human = Some(human); self } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -5688,6 +5740,11 @@ where self.source = Some(source); self } + #[doc = "Specify timeout for acknowledging the cluster state update"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Indices Migrate To Data Stream API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); @@ -5702,15 +5759,19 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -6092,6 +6153,7 @@ pub struct IndicesPromoteDataStream<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, @@ -6111,6 +6173,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -6129,6 +6192,7 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, @@ -6154,6 +6218,11 @@ where self.human = Some(human); self } + #[doc = "Specify timeout for connection to master"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -6183,6 +6252,7 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, } @@ -6190,6 +6260,7 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -6370,14 +6441,12 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Indices Put Data Lifecycle API"] pub enum IndicesPutDataLifecycleParts<'b> { #[doc = "Name"] Name(&'b [&'b str]), } -#[cfg(feature = "experimental-apis")] impl<'b> IndicesPutDataLifecycleParts<'b> { #[doc = "Builds a relative URL path to the Indices Put Data Lifecycle API"] pub fn url(self) -> Cow<'static, str> { @@ -6396,8 +6465,6 @@ impl<'b> IndicesPutDataLifecycleParts<'b> { } } #[doc = "Builder for the [Indices Put Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-put-lifecycle.html)\n\nUpdates the data stream lifecycle of the selected data streams."] -#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] -#[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] pub struct IndicesPutDataLifecycle<'a, 'b, B> { transport: &'a Transport, @@ -6414,7 +6481,6 @@ pub struct IndicesPutDataLifecycle<'a, 'b, B> { source: Option<&'b str>, timeout: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> IndicesPutDataLifecycle<'a, 'b, B> where B: Body, @@ -8020,11 +8086,13 @@ impl<'b> IndicesResolveIndexParts<'b> { pub struct IndicesResolveIndex<'a, 'b> { transport: &'a Transport, parts: IndicesResolveIndexParts<'b>, + allow_no_indices: Option, error_trace: Option, expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + ignore_unavailable: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, @@ -8037,15 +8105,22 @@ impl<'a, 'b> IndicesResolveIndex<'a, 'b> { transport, parts, headers, + allow_no_indices: None, error_trace: None, expand_wildcards: None, filter_path: None, human: None, + ignore_unavailable: None, pretty: None, request_timeout: None, source: None, } } + #[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"] + pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self { + self.allow_no_indices = Some(allow_no_indices); + self + } #[doc = "Include the stack trace of returned errors."] pub fn error_trace(mut self, error_trace: bool) -> Self { self.error_trace = Some(error_trace); @@ -8071,6 +8146,11 @@ impl<'a, 'b> IndicesResolveIndex<'a, 'b> { self.human = Some(human); self } + #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"] + pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self { + self.ignore_unavailable = Some(ignore_unavailable); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -8096,20 +8176,24 @@ impl<'a, 'b> IndicesResolveIndex<'a, 'b> { #[serde_with::skip_serializing_none] #[derive(Serialize)] struct QueryParams<'b> { + allow_no_indices: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] expand_wildcards: Option<&'b [ExpandWildcards]>, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + ignore_unavailable: Option, pretty: Option, source: Option<&'b str>, } let query_params = QueryParams { + allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, + ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, source: self.source, }; @@ -10316,8 +10400,6 @@ impl<'a> Indices<'a> { IndicesDeleteAlias::new(self.transport(), parts) } #[doc = "[Indices Delete Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-delete-lifecycle.html)\n\nDeletes the data stream lifecycle of the selected data streams."] - #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] - #[cfg(feature = "experimental-apis")] pub fn delete_data_lifecycle<'b>( &'a self, parts: IndicesDeleteDataLifecycleParts<'b>, @@ -10389,8 +10471,6 @@ impl<'a> Indices<'a> { IndicesExistsTemplate::new(self.transport(), parts) } #[doc = "[Indices Explain Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-explain-lifecycle.html)\n\nRetrieves information about the index's current data stream lifecycle, such as any potential encountered error, time since creation etc."] - #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] - #[cfg(feature = "experimental-apis")] pub fn explain_data_lifecycle<'b>( &'a self, parts: IndicesExplainDataLifecycleParts<'b>, @@ -10426,8 +10506,6 @@ impl<'a> Indices<'a> { IndicesGetAlias::new(self.transport(), parts) } #[doc = "[Indices Get Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-get-lifecycle.html)\n\nReturns the data stream lifecycle of the selected data streams."] - #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] - #[cfg(feature = "experimental-apis")] pub fn get_data_lifecycle<'b>( &'a self, parts: IndicesGetDataLifecycleParts<'b>, @@ -10503,8 +10581,6 @@ impl<'a> Indices<'a> { IndicesPutAlias::new(self.transport(), parts) } #[doc = "[Indices Put Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/data-streams-put-lifecycle.html)\n\nUpdates the data stream lifecycle of the selected data streams."] - #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] - #[cfg(feature = "experimental-apis")] pub fn put_data_lifecycle<'b>( &'a self, parts: IndicesPutDataLifecycleParts<'b>, diff --git a/elasticsearch/src/inference.rs b/elasticsearch/src/inference.rs index 2df5adfa..a3c774f6 100644 --- a/elasticsearch/src/inference.rs +++ b/elasticsearch/src/inference.rs @@ -673,6 +673,171 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq, Eq)] +#[doc = "API parts for the Inference Stream Inference API"] +pub enum InferenceStreamInferenceParts<'b> { + #[doc = "InferenceId"] + InferenceId(&'b str), + #[doc = "TaskType and InferenceId"] + TaskTypeInferenceId(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> InferenceStreamInferenceParts<'b> { + #[doc = "Builds a relative URL path to the Inference Stream Inference API"] + pub fn url(self) -> Cow<'static, str> { + match self { + InferenceStreamInferenceParts::InferenceId(inference_id) => { + let encoded_inference_id: Cow = + percent_encode(inference_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_inference_id.len()); + p.push_str("/_inference/"); + p.push_str(encoded_inference_id.as_ref()); + p.push_str("/_stream"); + p.into() + } + InferenceStreamInferenceParts::TaskTypeInferenceId(task_type, inference_id) => { + let encoded_task_type: Cow = + percent_encode(task_type.as_bytes(), PARTS_ENCODED).into(); + let encoded_inference_id: Cow = + percent_encode(inference_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 21usize + encoded_task_type.len() + encoded_inference_id.len(), + ); + p.push_str("/_inference/"); + p.push_str(encoded_task_type.as_ref()); + p.push('/'); + p.push_str(encoded_inference_id.as_ref()); + p.push_str("/_stream"); + p.into() + } + } + } +} +#[doc = "Builder for the [Inference Stream Inference API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/post-stream-inference-api.html)\n\nPerform streaming inference"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct InferenceStreamInference<'a, 'b, B> { + transport: &'a Transport, + parts: InferenceStreamInferenceParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> InferenceStreamInference<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [InferenceStreamInference] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: InferenceStreamInferenceParts<'b>) -> Self { + let headers = HeaderMap::new(); + InferenceStreamInference { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> InferenceStreamInference<'a, 'b, JsonBody> + where + T: Serialize, + { + InferenceStreamInference { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Inference Stream Inference API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = http::Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} #[doc = "Namespace client for Inference APIs"] #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] #[cfg(feature = "experimental-apis")] @@ -715,6 +880,15 @@ impl<'a> Inference<'a> { pub fn put<'b>(&'a self, parts: InferencePutParts<'b>) -> InferencePut<'a, 'b, ()> { InferencePut::new(self.transport(), parts) } + #[doc = "[Inference Stream Inference API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/post-stream-inference-api.html)\n\nPerform streaming inference"] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn stream_inference<'b>( + &'a self, + parts: InferenceStreamInferenceParts<'b>, + ) -> InferenceStreamInference<'a, 'b, ()> { + InferenceStreamInference::new(self.transport(), parts) + } } #[cfg(feature = "experimental-apis")] impl Elasticsearch { diff --git a/elasticsearch/src/ingest.rs b/elasticsearch/src/ingest.rs index 039bd9bf..dad418b3 100644 --- a/elasticsearch/src/ingest.rs +++ b/elasticsearch/src/ingest.rs @@ -79,7 +79,7 @@ impl<'b> IngestDeleteGeoipDatabaseParts<'b> { } } } -#[doc = "Builder for the [Ingest Delete Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html)\n\nDeletes a geoip database configuration"] +#[doc = "Builder for the [Ingest Delete Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/delete-geoip-database-api.html)\n\nDeletes a geoip database configuration"] #[derive(Clone, Debug)] pub struct IngestDeleteGeoipDatabase<'a, 'b> { transport: &'a Transport, @@ -178,6 +178,125 @@ impl<'a, 'b> IngestDeleteGeoipDatabase<'a, 'b> { } } #[derive(Debug, Clone, PartialEq, Eq)] +#[doc = "API parts for the Ingest Delete Ip Location Database API"] +pub enum IngestDeleteIpLocationDatabaseParts<'b> { + #[doc = "Id"] + Id(&'b [&'b str]), +} +impl<'b> IngestDeleteIpLocationDatabaseParts<'b> { + #[doc = "Builds a relative URL path to the Ingest Delete Ip Location Database API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IngestDeleteIpLocationDatabaseParts::Id(id) => { + let id_str = id.join(","); + let encoded_id: Cow = percent_encode(id_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(30usize + encoded_id.len()); + p.push_str("/_ingest/ip_location/database/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ingest Delete Ip Location Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/delete-ip-location-database-api.html)\n\nDeletes an ip location database configuration"] +#[derive(Clone, Debug)] +pub struct IngestDeleteIpLocationDatabase<'a, 'b> { + transport: &'a Transport, + parts: IngestDeleteIpLocationDatabaseParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> IngestDeleteIpLocationDatabase<'a, 'b> { + #[doc = "Creates a new instance of [IngestDeleteIpLocationDatabase] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IngestDeleteIpLocationDatabaseParts<'b>) -> Self { + let headers = HeaderMap::new(); + IngestDeleteIpLocationDatabase { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ingest Delete Ip Location Database API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = http::Method::Delete; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Ingest Delete Pipeline API"] pub enum IngestDeletePipelineParts<'b> { #[doc = "Id"] @@ -449,7 +568,7 @@ impl<'b> IngestGetGeoipDatabaseParts<'b> { } } } -#[doc = "Builder for the [Ingest Get Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html)\n\nReturns geoip database configuration."] +#[doc = "Builder for the [Ingest Get Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/get-geoip-database-api.html)\n\nReturns geoip database configuration."] #[derive(Clone, Debug)] pub struct IngestGetGeoipDatabase<'a, 'b> { transport: &'a Transport, @@ -548,6 +667,128 @@ impl<'a, 'b> IngestGetGeoipDatabase<'a, 'b> { } } #[derive(Debug, Clone, PartialEq, Eq)] +#[doc = "API parts for the Ingest Get Ip Location Database API"] +pub enum IngestGetIpLocationDatabaseParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Id"] + Id(&'b [&'b str]), +} +impl<'b> IngestGetIpLocationDatabaseParts<'b> { + #[doc = "Builds a relative URL path to the Ingest Get Ip Location Database API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IngestGetIpLocationDatabaseParts::None => "/_ingest/ip_location/database".into(), + IngestGetIpLocationDatabaseParts::Id(id) => { + let id_str = id.join(","); + let encoded_id: Cow = percent_encode(id_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(30usize + encoded_id.len()); + p.push_str("/_ingest/ip_location/database/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ingest Get Ip Location Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/get-ip-location-database-api.html)\n\nReturns the specified ip location database configuration"] +#[derive(Clone, Debug)] +pub struct IngestGetIpLocationDatabase<'a, 'b> { + transport: &'a Transport, + parts: IngestGetIpLocationDatabaseParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> IngestGetIpLocationDatabase<'a, 'b> { + #[doc = "Creates a new instance of [IngestGetIpLocationDatabase] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IngestGetIpLocationDatabaseParts<'b>) -> Self { + let headers = HeaderMap::new(); + IngestGetIpLocationDatabase { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ingest Get Ip Location Database API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = http::Method::Get; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Ingest Get Pipeline API"] pub enum IngestGetPipelineParts<'b> { #[doc = "No parts"] @@ -818,7 +1059,7 @@ impl<'b> IngestPutGeoipDatabaseParts<'b> { } } } -#[doc = "Builder for the [Ingest Put Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html)\n\nPuts the configuration for a geoip database to be downloaded"] +#[doc = "Builder for the [Ingest Put Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/put-geoip-database-api.html)\n\nPuts the configuration for a geoip database to be downloaded"] #[derive(Clone, Debug)] pub struct IngestPutGeoipDatabase<'a, 'b, B> { transport: &'a Transport, @@ -940,6 +1181,147 @@ where } } #[derive(Debug, Clone, PartialEq, Eq)] +#[doc = "API parts for the Ingest Put Ip Location Database API"] +pub enum IngestPutIpLocationDatabaseParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> IngestPutIpLocationDatabaseParts<'b> { + #[doc = "Builds a relative URL path to the Ingest Put Ip Location Database API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IngestPutIpLocationDatabaseParts::Id(id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(30usize + encoded_id.len()); + p.push_str("/_ingest/ip_location/database/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ingest Put Ip Location Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/put-ip-location-database-api.html)\n\nPuts the configuration for a ip location database to be downloaded"] +#[derive(Clone, Debug)] +pub struct IngestPutIpLocationDatabase<'a, 'b, B> { + transport: &'a Transport, + parts: IngestPutIpLocationDatabaseParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> IngestPutIpLocationDatabase<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IngestPutIpLocationDatabase] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IngestPutIpLocationDatabaseParts<'b>) -> Self { + let headers = HeaderMap::new(); + IngestPutIpLocationDatabase { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> IngestPutIpLocationDatabase<'a, 'b, JsonBody> + where + T: Serialize, + { + IngestPutIpLocationDatabase { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Ingest Put Ip Location Database API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = http::Method::Put; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Ingest Put Pipeline API"] pub enum IngestPutPipelineParts<'b> { #[doc = "Id"] @@ -1280,13 +1662,20 @@ impl<'a> Ingest<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ingest Delete Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html)\n\nDeletes a geoip database configuration"] + #[doc = "[Ingest Delete Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/delete-geoip-database-api.html)\n\nDeletes a geoip database configuration"] pub fn delete_geoip_database<'b>( &'a self, parts: IngestDeleteGeoipDatabaseParts<'b>, ) -> IngestDeleteGeoipDatabase<'a, 'b> { IngestDeleteGeoipDatabase::new(self.transport(), parts) } + #[doc = "[Ingest Delete Ip Location Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/delete-ip-location-database-api.html)\n\nDeletes an ip location database configuration"] + pub fn delete_ip_location_database<'b>( + &'a self, + parts: IngestDeleteIpLocationDatabaseParts<'b>, + ) -> IngestDeleteIpLocationDatabase<'a, 'b> { + IngestDeleteIpLocationDatabase::new(self.transport(), parts) + } #[doc = "[Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/delete-pipeline-api.html)\n\nDeletes a pipeline."] pub fn delete_pipeline<'b>( &'a self, @@ -1298,13 +1687,20 @@ impl<'a> Ingest<'a> { pub fn geo_ip_stats<'b>(&'a self) -> IngestGeoIpStats<'a, 'b> { IngestGeoIpStats::new(self.transport()) } - #[doc = "[Ingest Get Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html)\n\nReturns geoip database configuration."] + #[doc = "[Ingest Get Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/get-geoip-database-api.html)\n\nReturns geoip database configuration."] pub fn get_geoip_database<'b>( &'a self, parts: IngestGetGeoipDatabaseParts<'b>, ) -> IngestGetGeoipDatabase<'a, 'b> { IngestGetGeoipDatabase::new(self.transport(), parts) } + #[doc = "[Ingest Get Ip Location Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/get-ip-location-database-api.html)\n\nReturns the specified ip location database configuration"] + pub fn get_ip_location_database<'b>( + &'a self, + parts: IngestGetIpLocationDatabaseParts<'b>, + ) -> IngestGetIpLocationDatabase<'a, 'b> { + IngestGetIpLocationDatabase::new(self.transport(), parts) + } #[doc = "[Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/get-pipeline-api.html)\n\nReturns a pipeline."] pub fn get_pipeline<'b>( &'a self, @@ -1316,13 +1712,20 @@ impl<'a> Ingest<'a> { pub fn processor_grok<'b>(&'a self) -> IngestProcessorGrok<'a, 'b> { IngestProcessorGrok::new(self.transport()) } - #[doc = "[Ingest Put Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html)\n\nPuts the configuration for a geoip database to be downloaded"] + #[doc = "[Ingest Put Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/put-geoip-database-api.html)\n\nPuts the configuration for a geoip database to be downloaded"] pub fn put_geoip_database<'b>( &'a self, parts: IngestPutGeoipDatabaseParts<'b>, ) -> IngestPutGeoipDatabase<'a, 'b, ()> { IngestPutGeoipDatabase::new(self.transport(), parts) } + #[doc = "[Ingest Put Ip Location Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/put-ip-location-database-api.html)\n\nPuts the configuration for a ip location database to be downloaded"] + pub fn put_ip_location_database<'b>( + &'a self, + parts: IngestPutIpLocationDatabaseParts<'b>, + ) -> IngestPutIpLocationDatabase<'a, 'b, ()> { + IngestPutIpLocationDatabase::new(self.transport(), parts) + } #[doc = "[Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/put-pipeline-api.html)\n\nCreates or updates a pipeline."] pub fn put_pipeline<'b>( &'a self, diff --git a/elasticsearch/src/query_rules.rs b/elasticsearch/src/query_rules.rs index c2b884a7..f6c27224 100644 --- a/elasticsearch/src/query_rules.rs +++ b/elasticsearch/src/query_rules.rs @@ -954,6 +954,154 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq, Eq)] +#[doc = "API parts for the Query Rules Test API"] +pub enum QueryRulesTestParts<'b> { + #[doc = "RulesetId"] + RulesetId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> QueryRulesTestParts<'b> { + #[doc = "Builds a relative URL path to the Query Rules Test API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesTestParts::RulesetId(ruleset_id) => { + let encoded_ruleset_id: Cow = + percent_encode(ruleset_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_ruleset_id.len()); + p.push_str("/_query_rules/"); + p.push_str(encoded_ruleset_id.as_ref()); + p.push_str("/_test"); + p.into() + } + } + } +} +#[doc = "Builder for the [Query Rules Test API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/test-query-ruleset.html)\n\nTests a query ruleset to identify the rules that would match input criteria"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct QueryRulesTest<'a, 'b, B> { + transport: &'a Transport, + parts: QueryRulesTestParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> QueryRulesTest<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [QueryRulesTest] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: QueryRulesTestParts<'b>) -> Self { + let headers = HeaderMap::new(); + QueryRulesTest { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> QueryRulesTest<'a, 'b, JsonBody> + where + T: Serialize, + { + QueryRulesTest { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Creates an asynchronous call to the Query Rules Test API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = http::Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} #[doc = "Namespace client for QueryRules APIs"] pub struct QueryRules<'a> { transport: &'a Transport, @@ -1009,6 +1157,12 @@ impl<'a> QueryRules<'a> { ) -> QueryRulesPutRuleset<'a, 'b, ()> { QueryRulesPutRuleset::new(self.transport(), parts) } + #[doc = "[Query Rules Test API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/test-query-ruleset.html)\n\nTests a query ruleset to identify the rules that would match input criteria"] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn test<'b>(&'a self, parts: QueryRulesTestParts<'b>) -> QueryRulesTest<'a, 'b, ()> { + QueryRulesTest::new(self.transport(), parts) + } } impl Elasticsearch { #[doc = "Creates a namespace client for QueryRules APIs"] diff --git a/elasticsearch/src/root/mod.rs b/elasticsearch/src/root/mod.rs index 3d8365e1..c5a9800e 100644 --- a/elasticsearch/src/root/mod.rs +++ b/elasticsearch/src/root/mod.rs @@ -326,7 +326,7 @@ impl CapabilitiesParts { } } } -#[doc = "Builder for the [Capabilities API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/capabilities.html)\n\nChecks if the specified combination of method, API, parameters, and arbitrary capabilities are supported"] +#[doc = "Builder for the [Capabilities API](https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/README.asciidoc#require-or-skip-api-capabilities)\n\nChecks if the specified combination of method, API, parameters, and arbitrary capabilities are supported"] #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] #[cfg(feature = "experimental-apis")] #[derive(Clone, Debug)] @@ -338,6 +338,7 @@ pub struct Capabilities<'a, 'b> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + local_only: Option, method: Option, parameters: Option<&'b str>, path: Option<&'b str>, @@ -358,6 +359,7 @@ impl<'a, 'b> Capabilities<'a, 'b> { error_trace: None, filter_path: None, human: None, + local_only: None, method: None, parameters: None, path: None, @@ -391,6 +393,11 @@ impl<'a, 'b> Capabilities<'a, 'b> { self.human = Some(human); self } + #[doc = "True if only the node being called should be considered"] + pub fn local_only(mut self, local_only: bool) -> Self { + self.local_only = Some(local_only); + self + } #[doc = "REST method to check"] pub fn method(mut self, method: Method) -> Self { self.method = Some(method); @@ -436,6 +443,7 @@ impl<'a, 'b> Capabilities<'a, 'b> { #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + local_only: Option, method: Option, parameters: Option<&'b str>, path: Option<&'b str>, @@ -447,6 +455,7 @@ impl<'a, 'b> Capabilities<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + local_only: self.local_only, method: self.method, parameters: self.parameters, path: self.path, @@ -7766,6 +7775,7 @@ pub struct SearchShards<'a, 'b, B> { human: Option, ignore_unavailable: Option, local: Option, + master_timeout: Option<&'b str>, preference: Option<&'b str>, pretty: Option, request_timeout: Option, @@ -7791,6 +7801,7 @@ where human: None, ignore_unavailable: None, local: None, + master_timeout: None, preference: None, pretty: None, request_timeout: None, @@ -7820,6 +7831,7 @@ where human: self.human, ignore_unavailable: self.ignore_unavailable, local: self.local, + master_timeout: self.master_timeout, preference: self.preference, pretty: self.pretty, request_timeout: self.request_timeout, @@ -7862,6 +7874,11 @@ where self.local = Some(local); self } + #[doc = "Explicit operation timeout for connection to master node"] + pub fn master_timeout(mut self, master_timeout: &'b str) -> Self { + self.master_timeout = Some(master_timeout); + self + } #[doc = "Specify the node or shard the operation should be performed on (default: random)"] pub fn preference(mut self, preference: &'b str) -> Self { self.preference = Some(preference); @@ -7909,6 +7926,7 @@ where human: Option, ignore_unavailable: Option, local: Option, + master_timeout: Option<&'b str>, preference: Option<&'b str>, pretty: Option, routing: Option<&'b str>, @@ -7922,6 +7940,7 @@ where human: self.human, ignore_unavailable: self.ignore_unavailable, local: self.local, + master_timeout: self.master_timeout, preference: self.preference, pretty: self.pretty, routing: self.routing, @@ -9521,7 +9540,7 @@ impl Elasticsearch { pub fn bulk<'a, 'b>(&'a self, parts: BulkParts<'b>) -> Bulk<'a, 'b, ()> { Bulk::new(self.transport(), parts) } - #[doc = "[Capabilities API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/capabilities.html)\n\nChecks if the specified combination of method, API, parameters, and arbitrary capabilities are supported"] + #[doc = "[Capabilities API](https://github.com/elastic/elasticsearch/blob/main/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/README.asciidoc#require-or-skip-api-capabilities)\n\nChecks if the specified combination of method, API, parameters, and arbitrary capabilities are supported"] #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] #[cfg(feature = "experimental-apis")] pub fn capabilities<'a, 'b>(&'a self) -> Capabilities<'a, 'b> { diff --git a/elasticsearch/src/security.rs b/elasticsearch/src/security.rs index 128a63c2..b23ecef9 100644 --- a/elasticsearch/src/security.rs +++ b/elasticsearch/src/security.rs @@ -1770,14 +1770,12 @@ where Ok(response) } } -#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Security Create Cross Cluster Api Key API"] pub enum SecurityCreateCrossClusterApiKeyParts { #[doc = "No parts"] None, } -#[cfg(feature = "beta-apis")] impl SecurityCreateCrossClusterApiKeyParts { #[doc = "Builds a relative URL path to the Security Create Cross Cluster Api Key API"] pub fn url(self) -> Cow<'static, str> { @@ -1789,8 +1787,6 @@ impl SecurityCreateCrossClusterApiKeyParts { } } #[doc = "Builder for the [Security Create Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-create-cross-cluster-api-key.html)\n\nCreates a cross-cluster API key for API key based remote cluster access."] -#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] -#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] pub struct SecurityCreateCrossClusterApiKey<'a, 'b, B> { transport: &'a Transport, @@ -1804,7 +1800,6 @@ pub struct SecurityCreateCrossClusterApiKey<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "beta-apis")] impl<'a, 'b, B> SecurityCreateCrossClusterApiKey<'a, 'b, B> where B: Body, @@ -8395,14 +8390,12 @@ where Ok(response) } } -#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Security Update Cross Cluster Api Key API"] pub enum SecurityUpdateCrossClusterApiKeyParts<'b> { #[doc = "Id"] Id(&'b str), } -#[cfg(feature = "beta-apis")] impl<'b> SecurityUpdateCrossClusterApiKeyParts<'b> { #[doc = "Builds a relative URL path to the Security Update Cross Cluster Api Key API"] pub fn url(self) -> Cow<'static, str> { @@ -8418,8 +8411,6 @@ impl<'b> SecurityUpdateCrossClusterApiKeyParts<'b> { } } #[doc = "Builder for the [Security Update Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-update-cross-cluster-api-key.html)\n\nUpdates attributes of an existing cross-cluster API key."] -#[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] -#[cfg(feature = "beta-apis")] #[derive(Clone, Debug)] pub struct SecurityUpdateCrossClusterApiKey<'a, 'b, B> { transport: &'a Transport, @@ -8433,7 +8424,6 @@ pub struct SecurityUpdateCrossClusterApiKey<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "beta-apis")] impl<'a, 'b, B> SecurityUpdateCrossClusterApiKey<'a, 'b, B> where B: Body, @@ -8947,8 +8937,6 @@ impl<'a> Security<'a> { SecurityCreateApiKey::new(self.transport()) } #[doc = "[Security Create Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-create-cross-cluster-api-key.html)\n\nCreates a cross-cluster API key for API key based remote cluster access."] - #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] - #[cfg(feature = "beta-apis")] pub fn create_cross_cluster_api_key<'b>( &'a self, ) -> SecurityCreateCrossClusterApiKey<'a, 'b, ()> { @@ -9206,8 +9194,6 @@ impl<'a> Security<'a> { SecurityUpdateApiKey::new(self.transport(), parts) } #[doc = "[Security Update Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-update-cross-cluster-api-key.html)\n\nUpdates attributes of an existing cross-cluster API key."] - #[doc = " \n# Optional, beta\nThis requires the `beta-apis` feature. On track to become stable but breaking changes can\nhappen in minor versions.\n "] - #[cfg(feature = "beta-apis")] pub fn update_cross_cluster_api_key<'b>( &'a self, parts: SecurityUpdateCrossClusterApiKeyParts<'b>, diff --git a/elasticsearch/src/snapshot.rs b/elasticsearch/src/snapshot.rs index d65ef670..303783d7 100644 --- a/elasticsearch/src/snapshot.rs +++ b/elasticsearch/src/snapshot.rs @@ -1638,6 +1638,245 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq, Eq)] +#[doc = "API parts for the Snapshot Repository Verify Integrity API"] +pub enum SnapshotRepositoryVerifyIntegrityParts<'b> { + #[doc = "Repository"] + Repository(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SnapshotRepositoryVerifyIntegrityParts<'b> { + #[doc = "Builds a relative URL path to the Snapshot Repository Verify Integrity API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SnapshotRepositoryVerifyIntegrityParts::Repository(repository) => { + let encoded_repository: Cow = + percent_encode(repository.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_repository.len()); + p.push_str("/_snapshot/"); + p.push_str(encoded_repository.as_ref()); + p.push_str("/_verify_integrity"); + p.into() + } + } + } +} +#[doc = "Builder for the [Snapshot Repository Verify Integrity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/modules-snapshots.html)\n\nVerifies the integrity of the contents of a snapshot repository"] +#[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] +#[cfg(feature = "experimental-apis")] +#[derive(Clone, Debug)] +pub struct SnapshotRepositoryVerifyIntegrity<'a, 'b, B> { + transport: &'a Transport, + parts: SnapshotRepositoryVerifyIntegrityParts<'b>, + blob_thread_pool_concurrency: Option, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + index_snapshot_verification_concurrency: Option, + index_verification_concurrency: Option, + max_bytes_per_sec: Option<&'b str>, + max_failed_shard_snapshots: Option, + meta_thread_pool_concurrency: Option, + pretty: Option, + request_timeout: Option, + snapshot_verification_concurrency: Option, + source: Option<&'b str>, + verify_blob_contents: Option, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> SnapshotRepositoryVerifyIntegrity<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SnapshotRepositoryVerifyIntegrity] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: SnapshotRepositoryVerifyIntegrityParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + SnapshotRepositoryVerifyIntegrity { + transport, + parts, + headers, + blob_thread_pool_concurrency: None, + body: None, + error_trace: None, + filter_path: None, + human: None, + index_snapshot_verification_concurrency: None, + index_verification_concurrency: None, + max_bytes_per_sec: None, + max_failed_shard_snapshots: None, + meta_thread_pool_concurrency: None, + pretty: None, + request_timeout: None, + snapshot_verification_concurrency: None, + source: None, + verify_blob_contents: None, + } + } + #[doc = "Number of threads to use for reading blob contents"] + pub fn blob_thread_pool_concurrency(mut self, blob_thread_pool_concurrency: i64) -> Self { + self.blob_thread_pool_concurrency = Some(blob_thread_pool_concurrency); + self + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SnapshotRepositoryVerifyIntegrity<'a, 'b, JsonBody> + where + T: Serialize, + { + SnapshotRepositoryVerifyIntegrity { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + blob_thread_pool_concurrency: self.blob_thread_pool_concurrency, + error_trace: self.error_trace, + filter_path: self.filter_path, + headers: self.headers, + human: self.human, + index_snapshot_verification_concurrency: self.index_snapshot_verification_concurrency, + index_verification_concurrency: self.index_verification_concurrency, + max_bytes_per_sec: self.max_bytes_per_sec, + max_failed_shard_snapshots: self.max_failed_shard_snapshots, + meta_thread_pool_concurrency: self.meta_thread_pool_concurrency, + pretty: self.pretty, + request_timeout: self.request_timeout, + snapshot_verification_concurrency: self.snapshot_verification_concurrency, + source: self.source, + verify_blob_contents: self.verify_blob_contents, + } + } + #[doc = "Include the stack trace of returned errors."] + pub fn error_trace(mut self, error_trace: bool) -> Self { + self.error_trace = Some(error_trace); + self + } + #[doc = "A comma-separated list of filters used to reduce the response."] + pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self { + self.filter_path = Some(filter_path); + self + } + #[doc = "Adds a HTTP header"] + pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { + self.headers.insert(key, value); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Number of snapshots to verify concurrently within each index"] + pub fn index_snapshot_verification_concurrency( + mut self, + index_snapshot_verification_concurrency: i64, + ) -> Self { + self.index_snapshot_verification_concurrency = + Some(index_snapshot_verification_concurrency); + self + } + #[doc = "Number of indices to verify concurrently"] + pub fn index_verification_concurrency(mut self, index_verification_concurrency: i64) -> Self { + self.index_verification_concurrency = Some(index_verification_concurrency); + self + } + #[doc = "Rate limit for individual blob verification"] + pub fn max_bytes_per_sec(mut self, max_bytes_per_sec: &'b str) -> Self { + self.max_bytes_per_sec = Some(max_bytes_per_sec); + self + } + #[doc = "Maximum permitted number of failed shard snapshots"] + pub fn max_failed_shard_snapshots(mut self, max_failed_shard_snapshots: i64) -> Self { + self.max_failed_shard_snapshots = Some(max_failed_shard_snapshots); + self + } + #[doc = "Number of threads to use for reading metadata"] + pub fn meta_thread_pool_concurrency(mut self, meta_thread_pool_concurrency: i64) -> Self { + self.meta_thread_pool_concurrency = Some(meta_thread_pool_concurrency); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."] + pub fn request_timeout(mut self, timeout: Duration) -> Self { + self.request_timeout = Some(timeout); + self + } + #[doc = "Number of snapshots to verify concurrently"] + pub fn snapshot_verification_concurrency( + mut self, + snapshot_verification_concurrency: i64, + ) -> Self { + self.snapshot_verification_concurrency = Some(snapshot_verification_concurrency); + self + } + #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."] + pub fn source(mut self, source: &'b str) -> Self { + self.source = Some(source); + self + } + #[doc = "Whether to verify the contents of individual blobs"] + pub fn verify_blob_contents(mut self, verify_blob_contents: bool) -> Self { + self.verify_blob_contents = Some(verify_blob_contents); + self + } + #[doc = "Creates an asynchronous call to the Snapshot Repository Verify Integrity API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = http::Method::Post; + let headers = self.headers; + let timeout = self.request_timeout; + let query_string = { + #[serde_with::skip_serializing_none] + #[derive(Serialize)] + struct QueryParams<'b> { + blob_thread_pool_concurrency: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + index_snapshot_verification_concurrency: Option, + index_verification_concurrency: Option, + max_bytes_per_sec: Option<&'b str>, + max_failed_shard_snapshots: Option, + meta_thread_pool_concurrency: Option, + pretty: Option, + snapshot_verification_concurrency: Option, + source: Option<&'b str>, + verify_blob_contents: Option, + } + let query_params = QueryParams { + blob_thread_pool_concurrency: self.blob_thread_pool_concurrency, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + index_snapshot_verification_concurrency: self + .index_snapshot_verification_concurrency, + index_verification_concurrency: self.index_verification_concurrency, + max_bytes_per_sec: self.max_bytes_per_sec, + max_failed_shard_snapshots: self.max_failed_shard_snapshots, + meta_thread_pool_concurrency: self.meta_thread_pool_concurrency, + pretty: self.pretty, + snapshot_verification_concurrency: self.snapshot_verification_concurrency, + source: self.source, + verify_blob_contents: self.verify_blob_contents, + }; + Some(query_params) + }; + let body = self.body; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} #[derive(Debug, Clone, PartialEq, Eq)] #[doc = "API parts for the Snapshot Restore API"] pub enum SnapshotRestoreParts<'b> { @@ -2192,6 +2431,15 @@ impl<'a> Snapshot<'a> { ) -> SnapshotRepositoryAnalyze<'a, 'b, ()> { SnapshotRepositoryAnalyze::new(self.transport(), parts) } + #[doc = "[Snapshot Repository Verify Integrity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/modules-snapshots.html)\n\nVerifies the integrity of the contents of a snapshot repository"] + #[doc = " \n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n "] + #[cfg(feature = "experimental-apis")] + pub fn repository_verify_integrity<'b>( + &'a self, + parts: SnapshotRepositoryVerifyIntegrityParts<'b>, + ) -> SnapshotRepositoryVerifyIntegrity<'a, 'b, ()> { + SnapshotRepositoryVerifyIntegrity::new(self.transport(), parts) + } #[doc = "[Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/modules-snapshots.html)\n\nRestores a snapshot."] pub fn restore<'b>(&'a self, parts: SnapshotRestoreParts<'b>) -> SnapshotRestore<'a, 'b, ()> { SnapshotRestore::new(self.transport(), parts) diff --git a/elasticsearch/tests/auth.rs b/elasticsearch/tests/auth.rs index 75935d99..0c3e5281 100644 --- a/elasticsearch/tests/auth.rs +++ b/elasticsearch/tests/auth.rs @@ -23,9 +23,11 @@ use elasticsearch::auth::Credentials; use base64::{engine::general_purpose::STANDARD as BASE64_STANDARD, write::EncoderWriter}; use std::io::Write; +use std::ops::Deref; #[tokio::test] async fn basic_auth_header() -> Result<(), failure::Error> { + eprintln!("Got tracker: {:?}", common::TRACKER.deref()); let server = server::http(move |req| async move { let mut header_value = b"Basic ".to_vec(); { diff --git a/elasticsearch/tests/cert.rs b/elasticsearch/tests/cert.rs index 5b4bad1c..5e4a9648 100644 --- a/elasticsearch/tests/cert.rs +++ b/elasticsearch/tests/cert.rs @@ -28,7 +28,9 @@ extern crate os_type; pub mod common; + use common::*; +use std::ops::Deref; use elasticsearch::cert::{Certificate, CertificateValidation}; use os_type::OSType; @@ -54,6 +56,7 @@ fn expected_error_message() -> String { #[tokio::test] #[cfg(feature = "native-tls")] async fn default_certificate_validation() -> Result<(), failure::Error> { + eprintln!("Got tracker: {:?}", common::TRACKER.deref()); let builder = client::create_default_builder().cert_validation(CertificateValidation::Default); let client = client::create(builder); let result = client.ping().send().await; @@ -107,6 +110,7 @@ async fn default_certificate_validation_rustls_tls() -> Result<(), failure::Erro /// Allows any certificate through #[tokio::test] async fn none_certificate_validation() -> Result<(), failure::Error> { + eprintln!("Got tracker: {:?}", common::TRACKER.deref()); let builder = client::create_default_builder().cert_validation(CertificateValidation::None); let client = client::create(builder); let _response = client.ping().send().await?; @@ -118,6 +122,7 @@ async fn none_certificate_validation() -> Result<(), failure::Error> { #[tokio::test] #[cfg(feature = "rustls-tls")] // Fails with native-tls async fn full_certificate_ca_validation() -> Result<(), failure::Error> { + eprintln!("Got tracker: {:?}", common::TRACKER.deref()); let cert = Certificate::from_pem(CA_CERT)?; let builder = client::create_default_builder().cert_validation(CertificateValidation::Full(cert)); diff --git a/elasticsearch/tests/common/mod.rs b/elasticsearch/tests/common/mod.rs index 01a9c95f..4d6cd965 100644 --- a/elasticsearch/tests/common/mod.rs +++ b/elasticsearch/tests/common/mod.rs @@ -16,8 +16,24 @@ * specific language governing permissions and limitations * under the License. */ +use std::sync::LazyLock; + pub mod client; pub mod server; #[allow(unused)] pub static DEFAULT_USER_AGENT: &str = concat!("elasticsearch-rs/", env!("CARGO_PKG_VERSION")); + +#[derive(Debug)] +pub struct Tracker {} + +impl Drop for Tracker { + fn drop(&mut self) { + eprintln!("Destroying tracker"); + } +} + +pub static TRACKER: std::sync::LazyLock = LazyLock::new(|| { + eprintln!("Creating tracker"); + Tracker {} +}); diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 2756114a..34a91704 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -18,11 +18,11 @@ */ use anyhow::bail; +use clap::Parser; use once_cell::sync::Lazy; use std::env; use std::ops::Deref; use std::path; -use clap::Parser; pub mod artifacts;