From a15f168e007a78796b084bbf2f6f7bc02bc953df Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 13 Aug 2024 14:16:34 +0200 Subject: [PATCH] Bump version and generate code for 8.15.0 --- api_generator/Cargo.toml | 2 +- elasticsearch/Cargo.toml | 2 +- elasticsearch/src/.generated.toml | 8 + elasticsearch/src/async_search.rs | 35 +- elasticsearch/src/autoscaling.rs | 82 +- elasticsearch/src/cat.rs | 158 +- elasticsearch/src/ccr.rs | 214 +- elasticsearch/src/cluster.rs | 237 +- elasticsearch/src/connector.rs | 5264 +++++++++++++++++++++ elasticsearch/src/dangling_indices.rs | 20 +- elasticsearch/src/enrich.rs | 79 +- elasticsearch/src/eql.rs | 28 +- elasticsearch/src/esql.rs | 551 +++ elasticsearch/src/features.rs | 24 +- elasticsearch/src/fleet.rs | 423 +- elasticsearch/src/graph.rs | 10 +- elasticsearch/src/http/transport.rs | 1 + elasticsearch/src/ilm.rs | 68 +- elasticsearch/src/indices.rs | 1690 +++++-- elasticsearch/src/inference.rs | 721 +++ elasticsearch/src/ingest.rs | 443 +- elasticsearch/src/lib.rs | 8 + elasticsearch/src/license.rs | 122 +- elasticsearch/src/logstash.rs | 23 +- elasticsearch/src/migration.rs | 20 +- elasticsearch/src/ml.rs | 851 +++- elasticsearch/src/monitoring.rs | 8 +- elasticsearch/src/nodes.rs | 44 +- elasticsearch/src/params.rs | 16 + elasticsearch/src/profiling.rs | 621 +++ elasticsearch/src/query_rules.rs | 1012 ++++ elasticsearch/src/rollup.rs | 215 +- elasticsearch/src/root/mod.rs | 819 ++-- elasticsearch/src/search_application.rs | 1582 +++++++ elasticsearch/src/searchable_snapshots.rs | 26 +- elasticsearch/src/security.rs | 4451 +++++++++++------ elasticsearch/src/shutdown.rs | 29 +- elasticsearch/src/simulate.rs | 237 + elasticsearch/src/slm.rs | 96 +- elasticsearch/src/snapshot.rs | 83 +- elasticsearch/src/sql.rs | 42 +- elasticsearch/src/ssl.rs | 8 +- elasticsearch/src/synonyms.rs | 1027 ++++ elasticsearch/src/tasks.rs | 20 +- elasticsearch/src/text_structure.rs | 670 ++- elasticsearch/src/transform.rs | 368 +- elasticsearch/src/watcher.rs | 374 +- elasticsearch/src/xpack.rs | 14 +- xtask/Cargo.toml | 2 +- yaml_test_runner/Cargo.toml | 2 +- 50 files changed, 19639 insertions(+), 3211 deletions(-) create mode 100644 elasticsearch/src/connector.rs create mode 100644 elasticsearch/src/esql.rs create mode 100644 elasticsearch/src/inference.rs create mode 100644 elasticsearch/src/profiling.rs create mode 100644 elasticsearch/src/query_rules.rs create mode 100644 elasticsearch/src/search_application.rs create mode 100644 elasticsearch/src/simulate.rs create mode 100644 elasticsearch/src/synonyms.rs diff --git a/api_generator/Cargo.toml b/api_generator/Cargo.toml index ab9b2975..0b534148 100644 --- a/api_generator/Cargo.toml +++ b/api_generator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "api_generator" -version = "8.7.0-alpha.1" +version = "8.15.0-alpha.1" publish = false description = "Generates source code for elasticsearch package, from the Elasticsearch REST API specs" repository = "https://github.com/elastic/elasticsearch-rs" diff --git a/elasticsearch/Cargo.toml b/elasticsearch/Cargo.toml index 2eef9785..57f98f4d 100644 --- a/elasticsearch/Cargo.toml +++ b/elasticsearch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "elasticsearch" -version = "8.6.0-alpha.1" +version = "8.15.0-alpha.1" edition = "2018" authors = ["Elastic and Contributors"] description = "Official Elasticsearch Rust client" diff --git a/elasticsearch/src/.generated.toml b/elasticsearch/src/.generated.toml index 19879bad..7fea7633 100644 --- a/elasticsearch/src/.generated.toml +++ b/elasticsearch/src/.generated.toml @@ -4,14 +4,17 @@ written = [ 'cat.rs', 'ccr.rs', 'cluster.rs', + 'connector.rs', 'dangling_indices.rs', 'enrich.rs', 'eql.rs', + 'esql.rs', 'features.rs', 'fleet.rs', 'graph.rs', 'ilm.rs', 'indices.rs', + 'inference.rs', 'ingest.rs', 'license.rs', 'logstash.rs', @@ -19,15 +22,20 @@ written = [ 'ml.rs', 'monitoring.rs', 'nodes.rs', + 'profiling.rs', + 'query_rules.rs', 'rollup.rs', 'root/mod.rs', + 'search_application.rs', 'searchable_snapshots.rs', 'security.rs', 'shutdown.rs', + 'simulate.rs', 'slm.rs', 'snapshot.rs', 'sql.rs', 'ssl.rs', + 'synonyms.rs', 'tasks.rs', 'text_structure.rs', 'transform.rs', diff --git a/elasticsearch/src/async_search.rs b/elasticsearch/src/async_search.rs index 3c6f54b9..b6cec466 100644 --- a/elasticsearch/src/async_search.rs +++ b/elasticsearch/src/async_search.rs @@ -35,11 +35,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -66,7 +66,7 @@ impl<'b> AsyncSearchDeleteParts<'b> { } } } -#[doc = "Builder for the [Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] +#[doc = "Builder for the [Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] #[derive(Clone, Debug)] pub struct AsyncSearchDelete<'a, 'b> { transport: &'a Transport, @@ -133,7 +133,7 @@ impl<'a, 'b> AsyncSearchDelete<'a, 'b> { #[doc = "Creates an asynchronous call to the Async Search Delete API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -184,7 +184,7 @@ impl<'b> AsyncSearchGetParts<'b> { } } } -#[doc = "Builder for the [Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] +#[doc = "Builder for the [Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] #[derive(Clone, Debug)] pub struct AsyncSearchGet<'a, 'b> { transport: &'a Transport, @@ -272,7 +272,7 @@ impl<'a, 'b> AsyncSearchGet<'a, 'b> { #[doc = "Creates an asynchronous call to the Async Search Get API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -329,7 +329,7 @@ impl<'b> AsyncSearchStatusParts<'b> { } } } -#[doc = "Builder for the [Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."] +#[doc = "Builder for the [Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."] #[derive(Clone, Debug)] pub struct AsyncSearchStatus<'a, 'b> { transport: &'a Transport, @@ -338,6 +338,7 @@ pub struct AsyncSearchStatus<'a, 'b> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + keep_alive: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, @@ -353,6 +354,7 @@ impl<'a, 'b> AsyncSearchStatus<'a, 'b> { error_trace: None, filter_path: None, human: None, + keep_alive: None, pretty: None, request_timeout: None, source: None, @@ -378,6 +380,11 @@ impl<'a, 'b> AsyncSearchStatus<'a, 'b> { self.human = Some(human); self } + #[doc = "Specify the time interval in which the results (partial or final) for this search will be available"] + pub fn keep_alive(mut self, keep_alive: &'b str) -> Self { + self.keep_alive = Some(keep_alive); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -396,7 +403,7 @@ impl<'a, 'b> AsyncSearchStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the Async Search Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -407,6 +414,7 @@ impl<'a, 'b> AsyncSearchStatus<'a, 'b> { #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + keep_alive: Option<&'b str>, pretty: Option, source: Option<&'b str>, } @@ -414,6 +422,7 @@ impl<'a, 'b> AsyncSearchStatus<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + keep_alive: self.keep_alive, pretty: self.pretty, source: self.source, }; @@ -453,7 +462,7 @@ impl<'b> AsyncSearchSubmitParts<'b> { } } } -#[doc = "Builder for the [Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nExecutes a search request asynchronously."] +#[doc = "Builder for the [Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nExecutes a search request asynchronously."] #[derive(Clone, Debug)] pub struct AsyncSearchSubmit<'a, 'b, B> { transport: &'a Transport, @@ -871,7 +880,7 @@ where #[doc = "Creates an asynchronous call to the Async Search Submit API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1005,19 +1014,19 @@ impl<'a> AsyncSearch<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] + #[doc = "[Async Search Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nDeletes an async search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] pub fn delete<'b>(&'a self, parts: AsyncSearchDeleteParts<'b>) -> AsyncSearchDelete<'a, 'b> { AsyncSearchDelete::new(self.transport(), parts) } - #[doc = "[Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] + #[doc = "[Async Search Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nRetrieves the results of a previously submitted async search request given its ID."] pub fn get<'b>(&'a self, parts: AsyncSearchGetParts<'b>) -> AsyncSearchGet<'a, 'b> { AsyncSearchGet::new(self.transport(), parts) } - #[doc = "[Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."] + #[doc = "[Async Search Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nRetrieves the status of a previously submitted async search request given its ID."] pub fn status<'b>(&'a self, parts: AsyncSearchStatusParts<'b>) -> AsyncSearchStatus<'a, 'b> { AsyncSearchStatus::new(self.transport(), parts) } - #[doc = "[Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/async-search.html)\n\nExecutes a search request asynchronously."] + #[doc = "[Async Search Submit API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/async-search.html)\n\nExecutes a search request asynchronously."] pub fn submit<'b>( &'a self, parts: AsyncSearchSubmitParts<'b>, diff --git a/elasticsearch/src/autoscaling.rs b/elasticsearch/src/autoscaling.rs index 78cb9459..be1e9011 100644 --- a/elasticsearch/src/autoscaling.rs +++ b/elasticsearch/src/autoscaling.rs @@ -35,11 +35,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -66,7 +66,7 @@ impl<'b> AutoscalingDeleteAutoscalingPolicyParts<'b> { } } } -#[doc = "Builder for the [Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[doc = "Builder for the [Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] #[derive(Clone, Debug)] pub struct AutoscalingDeleteAutoscalingPolicy<'a, 'b> { transport: &'a Transport, @@ -75,9 +75,11 @@ pub struct AutoscalingDeleteAutoscalingPolicy<'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>, + timeout: Option<&'b str>, } impl<'a, 'b> AutoscalingDeleteAutoscalingPolicy<'a, 'b> { #[doc = "Creates a new instance of [AutoscalingDeleteAutoscalingPolicy] with the specified API parts"] @@ -93,9 +95,11 @@ impl<'a, 'b> AutoscalingDeleteAutoscalingPolicy<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "Include the stack trace of returned errors."] @@ -118,6 +122,11 @@ impl<'a, 'b> AutoscalingDeleteAutoscalingPolicy<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -133,10 +142,15 @@ impl<'a, 'b> AutoscalingDeleteAutoscalingPolicy<'a, 'b> { self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Autoscaling Delete Autoscaling Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -147,15 +161,19 @@ impl<'a, 'b> AutoscalingDeleteAutoscalingPolicy<'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>, + 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) }; @@ -181,7 +199,7 @@ impl AutoscalingGetAutoscalingCapacityParts { } } } -#[doc = "Builder for the [Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[doc = "Builder for the [Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] #[derive(Clone, Debug)] pub struct AutoscalingGetAutoscalingCapacity<'a, 'b> { transport: &'a Transport, @@ -190,6 +208,7 @@ pub struct AutoscalingGetAutoscalingCapacity<'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>, @@ -205,6 +224,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingCapacity<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -230,6 +250,11 @@ impl<'a, 'b> AutoscalingGetAutoscalingCapacity<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -248,7 +273,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingCapacity<'a, 'b> { #[doc = "Creates an asynchronous call to the Autoscaling Get Autoscaling Capacity API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -259,6 +284,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingCapacity<'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>, } @@ -266,6 +292,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingCapacity<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -299,7 +326,7 @@ impl<'b> AutoscalingGetAutoscalingPolicyParts<'b> { } } } -#[doc = "Builder for the [Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[doc = "Builder for the [Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] #[derive(Clone, Debug)] pub struct AutoscalingGetAutoscalingPolicy<'a, 'b> { transport: &'a Transport, @@ -308,6 +335,7 @@ pub struct AutoscalingGetAutoscalingPolicy<'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>, @@ -323,6 +351,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingPolicy<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -348,6 +377,11 @@ impl<'a, 'b> AutoscalingGetAutoscalingPolicy<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -366,7 +400,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingPolicy<'a, 'b> { #[doc = "Creates an asynchronous call to the Autoscaling Get Autoscaling Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -377,6 +411,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingPolicy<'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>, } @@ -384,6 +419,7 @@ impl<'a, 'b> AutoscalingGetAutoscalingPolicy<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -417,7 +453,7 @@ impl<'b> AutoscalingPutAutoscalingPolicyParts<'b> { } } } -#[doc = "Builder for the [Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[doc = "Builder for the [Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] #[derive(Clone, Debug)] pub struct AutoscalingPutAutoscalingPolicy<'a, 'b, B> { transport: &'a Transport, @@ -427,9 +463,11 @@ pub struct AutoscalingPutAutoscalingPolicy<'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> AutoscalingPutAutoscalingPolicy<'a, 'b, B> where @@ -446,9 +484,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"] @@ -464,9 +504,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."] @@ -489,6 +531,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -504,10 +551,15 @@ where self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Autoscaling Put Autoscaling Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -518,15 +570,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) }; @@ -550,25 +606,25 @@ impl<'a> Autoscaling<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + #[doc = "[Autoscaling Delete Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-delete-autoscaling-policy.html)\n\nDeletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] pub fn delete_autoscaling_policy<'b>( &'a self, parts: AutoscalingDeleteAutoscalingPolicyParts<'b>, ) -> AutoscalingDeleteAutoscalingPolicy<'a, 'b> { AutoscalingDeleteAutoscalingPolicy::new(self.transport(), parts) } - #[doc = "[Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + #[doc = "[Autoscaling Get Autoscaling Capacity API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-get-autoscaling-capacity.html)\n\nGets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] pub fn get_autoscaling_capacity<'b>(&'a self) -> AutoscalingGetAutoscalingCapacity<'a, 'b> { AutoscalingGetAutoscalingCapacity::new(self.transport()) } - #[doc = "[Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + #[doc = "[Autoscaling Get Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-get-autoscaling-policy.html)\n\nRetrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] pub fn get_autoscaling_policy<'b>( &'a self, parts: AutoscalingGetAutoscalingPolicyParts<'b>, ) -> AutoscalingGetAutoscalingPolicy<'a, 'b> { AutoscalingGetAutoscalingPolicy::new(self.transport(), parts) } - #[doc = "[Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + #[doc = "[Autoscaling Put Autoscaling Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/autoscaling-put-autoscaling-policy.html)\n\nCreates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] pub fn put_autoscaling_policy<'b>( &'a self, parts: AutoscalingPutAutoscalingPolicyParts<'b>, diff --git a/elasticsearch/src/cat.rs b/elasticsearch/src/cat.rs index 2ec6f7cc..1130c851 100644 --- a/elasticsearch/src/cat.rs +++ b/elasticsearch/src/cat.rs @@ -124,11 +124,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -160,7 +160,7 @@ impl<'b> CatAliasesParts<'b> { } } } -#[doc = "Builder for the [Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] +#[doc = "Builder for the [Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] #[derive(Clone, Debug)] pub struct CatAliases<'a, 'b> { transport: &'a Transport, @@ -278,7 +278,7 @@ impl<'a, 'b> CatAliases<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Aliases API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -351,7 +351,7 @@ impl<'b> CatAllocationParts<'b> { } } } -#[doc = "Builder for the [Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] +#[doc = "Builder for the [Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] #[derive(Clone, Debug)] pub struct CatAllocation<'a, 'b> { transport: &'a Transport, @@ -476,7 +476,7 @@ impl<'a, 'b> CatAllocation<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Allocation API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -548,7 +548,7 @@ impl<'b> CatComponentTemplatesParts<'b> { } } } -#[doc = "Builder for the [Cat Component Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-compoentn-templates.html)\n\nReturns information about existing component_templates templates."] +#[doc = "Builder for the [Cat Component Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-component-templates.html)\n\nReturns information about existing component_templates templates."] #[derive(Clone, Debug)] pub struct CatComponentTemplates<'a, 'b> { transport: &'a Transport, @@ -666,7 +666,7 @@ impl<'a, 'b> CatComponentTemplates<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Component Templates API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -738,7 +738,7 @@ impl<'b> CatCountParts<'b> { } } } -#[doc = "Builder for the [Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] +#[doc = "Builder for the [Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] #[derive(Clone, Debug)] pub struct CatCount<'a, 'b> { transport: &'a Transport, @@ -842,7 +842,7 @@ impl<'a, 'b> CatCount<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Count API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -910,7 +910,7 @@ impl<'b> CatFielddataParts<'b> { } } } -#[doc = "Builder for the [Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] +#[doc = "Builder for the [Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] #[derive(Clone, Debug)] pub struct CatFielddata<'a, 'b> { transport: &'a Transport, @@ -1028,7 +1028,7 @@ impl<'a, 'b> CatFielddata<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Fielddata API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1090,7 +1090,7 @@ impl CatHealthParts { } } } -#[doc = "Builder for the [Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-health.html)\n\nReturns a concise representation of the cluster health."] +#[doc = "Builder for the [Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-health.html)\n\nReturns a concise representation of the cluster health."] #[derive(Clone, Debug)] pub struct CatHealth<'a, 'b> { transport: &'a Transport, @@ -1208,7 +1208,7 @@ impl<'a, 'b> CatHealth<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Health API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1269,7 +1269,7 @@ impl CatHelpParts { } } } -#[doc = "Builder for the [Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat.html)\n\nReturns help for the Cat APIs."] +#[doc = "Builder for the [Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat.html)\n\nReturns help for the Cat APIs."] #[derive(Clone, Debug)] pub struct CatHelp<'a, 'b> { transport: &'a Transport, @@ -1352,7 +1352,7 @@ impl<'a, 'b> CatHelp<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Help API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1413,7 +1413,7 @@ impl<'b> CatIndicesParts<'b> { } } } -#[doc = "Builder for the [Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] +#[doc = "Builder for the [Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] #[derive(Clone, Debug)] pub struct CatIndices<'a, 'b> { transport: &'a Transport, @@ -1566,7 +1566,7 @@ impl<'a, 'b> CatIndices<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Indices API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1638,7 +1638,7 @@ impl CatMasterParts { } } } -#[doc = "Builder for the [Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-master.html)\n\nReturns information about the master node."] +#[doc = "Builder for the [Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-master.html)\n\nReturns information about the master node."] #[derive(Clone, Debug)] pub struct CatMaster<'a, 'b> { transport: &'a Transport, @@ -1756,7 +1756,7 @@ impl<'a, 'b> CatMaster<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Master API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1826,7 +1826,7 @@ impl<'b> CatMlDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] +#[doc = "Builder for the [Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] #[derive(Clone, Debug)] pub struct CatMlDataFrameAnalytics<'a, 'b> { transport: &'a Transport, @@ -1951,7 +1951,7 @@ impl<'a, 'b> CatMlDataFrameAnalytics<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Ml Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2024,7 +2024,7 @@ impl<'b> CatMlDatafeedsParts<'b> { } } } -#[doc = "Builder for the [Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] +#[doc = "Builder for the [Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] #[derive(Clone, Debug)] pub struct CatMlDatafeeds<'a, 'b> { transport: &'a Transport, @@ -2142,7 +2142,7 @@ impl<'a, 'b> CatMlDatafeeds<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Ml Datafeeds API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2213,7 +2213,7 @@ impl<'b> CatMlJobsParts<'b> { } } } -#[doc = "Builder for the [Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] +#[doc = "Builder for the [Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] #[derive(Clone, Debug)] pub struct CatMlJobs<'a, 'b> { transport: &'a Transport, @@ -2338,7 +2338,7 @@ impl<'a, 'b> CatMlJobs<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Ml Jobs API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2411,7 +2411,7 @@ impl<'b> CatMlTrainedModelsParts<'b> { } } } -#[doc = "Builder for the [Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] +#[doc = "Builder for the [Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] #[derive(Clone, Debug)] pub struct CatMlTrainedModels<'a, 'b> { transport: &'a Transport, @@ -2550,7 +2550,7 @@ impl<'a, 'b> CatMlTrainedModels<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Ml Trained Models API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2617,7 +2617,7 @@ impl CatNodeattrsParts { } } } -#[doc = "Builder for the [Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] +#[doc = "Builder for the [Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] #[derive(Clone, Debug)] pub struct CatNodeattrs<'a, 'b> { transport: &'a Transport, @@ -2735,7 +2735,7 @@ impl<'a, 'b> CatNodeattrs<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Nodeattrs API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2796,7 +2796,7 @@ impl CatNodesParts { } } } -#[doc = "Builder for the [Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] +#[doc = "Builder for the [Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] #[derive(Clone, Debug)] pub struct CatNodes<'a, 'b> { transport: &'a Transport, @@ -2935,7 +2935,7 @@ impl<'a, 'b> CatNodes<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Nodes API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3002,7 +3002,7 @@ impl CatPendingTasksParts { } } } -#[doc = "Builder for the [Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] +#[doc = "Builder for the [Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] #[derive(Clone, Debug)] pub struct CatPendingTasks<'a, 'b> { transport: &'a Transport, @@ -3127,7 +3127,7 @@ impl<'a, 'b> CatPendingTasks<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Pending Tasks API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3190,7 +3190,7 @@ impl CatPluginsParts { } } } -#[doc = "Builder for the [Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] +#[doc = "Builder for the [Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] #[derive(Clone, Debug)] pub struct CatPlugins<'a, 'b> { transport: &'a Transport, @@ -3315,7 +3315,7 @@ impl<'a, 'b> CatPlugins<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Plugins API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3389,7 +3389,7 @@ impl<'b> CatRecoveryParts<'b> { } } } -#[doc = "Builder for the [Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] +#[doc = "Builder for the [Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] #[derive(Clone, Debug)] pub struct CatRecovery<'a, 'b> { transport: &'a Transport, @@ -3528,7 +3528,7 @@ impl<'a, 'b> CatRecovery<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Recovery API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3596,7 +3596,7 @@ impl CatRepositoriesParts { } } } -#[doc = "Builder for the [Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] +#[doc = "Builder for the [Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] #[derive(Clone, Debug)] pub struct CatRepositories<'a, 'b> { transport: &'a Transport, @@ -3714,7 +3714,7 @@ impl<'a, 'b> CatRepositories<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Repositories API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3786,7 +3786,7 @@ impl<'b> CatSegmentsParts<'b> { } } } -#[doc = "Builder for the [Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] +#[doc = "Builder for the [Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] #[derive(Clone, Debug)] pub struct CatSegments<'a, 'b> { transport: &'a Transport, @@ -3897,7 +3897,7 @@ impl<'a, 'b> CatSegments<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Segments API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3967,7 +3967,7 @@ impl<'b> CatShardsParts<'b> { } } } -#[doc = "Builder for the [Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] +#[doc = "Builder for the [Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] #[derive(Clone, Debug)] pub struct CatShards<'a, 'b> { transport: &'a Transport, @@ -4092,7 +4092,7 @@ impl<'a, 'b> CatShards<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Shards API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4166,7 +4166,7 @@ impl<'b> CatSnapshotsParts<'b> { } } } -#[doc = "Builder for the [Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] +#[doc = "Builder for the [Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] #[derive(Clone, Debug)] pub struct CatSnapshots<'a, 'b> { transport: &'a Transport, @@ -4291,7 +4291,7 @@ impl<'a, 'b> CatSnapshots<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Snapshots API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4356,7 +4356,7 @@ impl CatTasksParts { } } } -#[doc = "Builder for the [Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] +#[doc = "Builder for the [Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] #[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)] @@ -4498,7 +4498,7 @@ impl<'a, 'b> CatTasks<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Tasks API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4576,7 +4576,7 @@ impl<'b> CatTemplatesParts<'b> { } } } -#[doc = "Builder for the [Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-templates.html)\n\nReturns information about existing templates."] +#[doc = "Builder for the [Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-templates.html)\n\nReturns information about existing templates."] #[derive(Clone, Debug)] pub struct CatTemplates<'a, 'b> { transport: &'a Transport, @@ -4694,7 +4694,7 @@ impl<'a, 'b> CatTemplates<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Templates API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4766,7 +4766,7 @@ impl<'b> CatThreadPoolParts<'b> { } } } -#[doc = "Builder for the [Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] +#[doc = "Builder for the [Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] #[derive(Clone, Debug)] pub struct CatThreadPool<'a, 'b> { transport: &'a Transport, @@ -4891,7 +4891,7 @@ impl<'a, 'b> CatThreadPool<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Thread Pool API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4964,7 +4964,7 @@ impl<'b> CatTransformsParts<'b> { } } } -#[doc = "Builder for the [Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-transforms.html)\n\nGets configuration and usage information about transforms."] +#[doc = "Builder for the [Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-transforms.html)\n\nGets configuration and usage information about transforms."] #[derive(Clone, Debug)] pub struct CatTransforms<'a, 'b> { transport: &'a Transport, @@ -5096,7 +5096,7 @@ impl<'a, 'b> CatTransforms<'a, 'b> { #[doc = "Creates an asynchronous call to the Cat Transforms API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5159,118 +5159,118 @@ impl<'a> Cat<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] + #[doc = "[Cat Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-alias.html)\n\nShows information about currently configured aliases to indices including filter and routing infos."] pub fn aliases<'b>(&'a self, parts: CatAliasesParts<'b>) -> CatAliases<'a, 'b> { CatAliases::new(self.transport(), parts) } - #[doc = "[Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] + #[doc = "[Cat Allocation API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-allocation.html)\n\nProvides a snapshot of how many shards are allocated to each data node and how much disk space they are using."] pub fn allocation<'b>(&'a self, parts: CatAllocationParts<'b>) -> CatAllocation<'a, 'b> { CatAllocation::new(self.transport(), parts) } - #[doc = "[Cat Component Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-compoentn-templates.html)\n\nReturns information about existing component_templates templates."] + #[doc = "[Cat Component Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-component-templates.html)\n\nReturns information about existing component_templates templates."] pub fn component_templates<'b>( &'a self, parts: CatComponentTemplatesParts<'b>, ) -> CatComponentTemplates<'a, 'b> { CatComponentTemplates::new(self.transport(), parts) } - #[doc = "[Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] + #[doc = "[Cat Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-count.html)\n\nProvides quick access to the document count of the entire cluster, or individual indices."] pub fn count<'b>(&'a self, parts: CatCountParts<'b>) -> CatCount<'a, 'b> { CatCount::new(self.transport(), parts) } - #[doc = "[Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] + #[doc = "[Cat Fielddata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-fielddata.html)\n\nShows how much heap memory is currently being used by fielddata on every data node in the cluster."] pub fn fielddata<'b>(&'a self, parts: CatFielddataParts<'b>) -> CatFielddata<'a, 'b> { CatFielddata::new(self.transport(), parts) } - #[doc = "[Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-health.html)\n\nReturns a concise representation of the cluster health."] + #[doc = "[Cat Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-health.html)\n\nReturns a concise representation of the cluster health."] pub fn health<'b>(&'a self) -> CatHealth<'a, 'b> { CatHealth::new(self.transport()) } - #[doc = "[Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat.html)\n\nReturns help for the Cat APIs."] + #[doc = "[Cat Help API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat.html)\n\nReturns help for the Cat APIs."] pub fn help<'b>(&'a self) -> CatHelp<'a, 'b> { CatHelp::new(self.transport()) } - #[doc = "[Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] + #[doc = "[Cat Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-indices.html)\n\nReturns information about indices: number of primaries and replicas, document counts, disk size, ..."] pub fn indices<'b>(&'a self, parts: CatIndicesParts<'b>) -> CatIndices<'a, 'b> { CatIndices::new(self.transport(), parts) } - #[doc = "[Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-master.html)\n\nReturns information about the master node."] + #[doc = "[Cat Master API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-master.html)\n\nReturns information about the master node."] pub fn master<'b>(&'a self) -> CatMaster<'a, 'b> { CatMaster::new(self.transport()) } - #[doc = "[Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] + #[doc = "[Cat Ml Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-dfanalytics.html)\n\nGets configuration and usage information about data frame analytics jobs."] pub fn ml_data_frame_analytics<'b>( &'a self, parts: CatMlDataFrameAnalyticsParts<'b>, ) -> CatMlDataFrameAnalytics<'a, 'b> { CatMlDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] + #[doc = "[Cat Ml Datafeeds API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-datafeeds.html)\n\nGets configuration and usage information about datafeeds."] pub fn ml_datafeeds<'b>(&'a self, parts: CatMlDatafeedsParts<'b>) -> CatMlDatafeeds<'a, 'b> { CatMlDatafeeds::new(self.transport(), parts) } - #[doc = "[Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] + #[doc = "[Cat Ml Jobs API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-anomaly-detectors.html)\n\nGets configuration and usage information about anomaly detection jobs."] pub fn ml_jobs<'b>(&'a self, parts: CatMlJobsParts<'b>) -> CatMlJobs<'a, 'b> { CatMlJobs::new(self.transport(), parts) } - #[doc = "[Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] + #[doc = "[Cat Ml Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-trained-model.html)\n\nGets configuration and usage information about inference trained models."] pub fn ml_trained_models<'b>( &'a self, parts: CatMlTrainedModelsParts<'b>, ) -> CatMlTrainedModels<'a, 'b> { CatMlTrainedModels::new(self.transport(), parts) } - #[doc = "[Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] + #[doc = "[Cat Nodeattrs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-nodeattrs.html)\n\nReturns information about custom node attributes."] pub fn nodeattrs<'b>(&'a self) -> CatNodeattrs<'a, 'b> { CatNodeattrs::new(self.transport()) } - #[doc = "[Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] + #[doc = "[Cat Nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-nodes.html)\n\nReturns basic statistics about performance of cluster nodes."] pub fn nodes<'b>(&'a self) -> CatNodes<'a, 'b> { CatNodes::new(self.transport()) } - #[doc = "[Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] + #[doc = "[Cat Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-pending-tasks.html)\n\nReturns a concise representation of the cluster pending tasks."] pub fn pending_tasks<'b>(&'a self) -> CatPendingTasks<'a, 'b> { CatPendingTasks::new(self.transport()) } - #[doc = "[Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] + #[doc = "[Cat Plugins API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-plugins.html)\n\nReturns information about installed plugins across nodes node."] pub fn plugins<'b>(&'a self) -> CatPlugins<'a, 'b> { CatPlugins::new(self.transport()) } - #[doc = "[Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] + #[doc = "[Cat Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-recovery.html)\n\nReturns information about index shard recoveries, both on-going completed."] pub fn recovery<'b>(&'a self, parts: CatRecoveryParts<'b>) -> CatRecovery<'a, 'b> { CatRecovery::new(self.transport(), parts) } - #[doc = "[Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] + #[doc = "[Cat Repositories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-repositories.html)\n\nReturns information about snapshot repositories registered in the cluster."] pub fn repositories<'b>(&'a self) -> CatRepositories<'a, 'b> { CatRepositories::new(self.transport()) } - #[doc = "[Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] + #[doc = "[Cat Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-segments.html)\n\nProvides low-level information about the segments in the shards of an index."] pub fn segments<'b>(&'a self, parts: CatSegmentsParts<'b>) -> CatSegments<'a, 'b> { CatSegments::new(self.transport(), parts) } - #[doc = "[Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] + #[doc = "[Cat Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-shards.html)\n\nProvides a detailed view of shard allocation on nodes."] pub fn shards<'b>(&'a self, parts: CatShardsParts<'b>) -> CatShards<'a, 'b> { CatShards::new(self.transport(), parts) } - #[doc = "[Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] + #[doc = "[Cat Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-snapshots.html)\n\nReturns all snapshots in a specific repository."] pub fn snapshots<'b>(&'a self, parts: CatSnapshotsParts<'b>) -> CatSnapshots<'a, 'b> { CatSnapshots::new(self.transport(), parts) } - #[doc = "[Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] + #[doc = "[Cat Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nReturns information about the tasks currently executing on one or more nodes in the cluster."] #[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 tasks<'b>(&'a self) -> CatTasks<'a, 'b> { CatTasks::new(self.transport()) } - #[doc = "[Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-templates.html)\n\nReturns information about existing templates."] + #[doc = "[Cat Templates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-templates.html)\n\nReturns information about existing templates."] pub fn templates<'b>(&'a self, parts: CatTemplatesParts<'b>) -> CatTemplates<'a, 'b> { CatTemplates::new(self.transport(), parts) } - #[doc = "[Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] + #[doc = "[Cat Thread Pool API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-thread-pool.html)\n\nReturns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools."] pub fn thread_pool<'b>(&'a self, parts: CatThreadPoolParts<'b>) -> CatThreadPool<'a, 'b> { CatThreadPool::new(self.transport(), parts) } - #[doc = "[Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cat-transforms.html)\n\nGets configuration and usage information about transforms."] + #[doc = "[Cat Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cat-transforms.html)\n\nGets configuration and usage information about transforms."] pub fn transforms<'b>(&'a self, parts: CatTransformsParts<'b>) -> CatTransforms<'a, 'b> { CatTransforms::new(self.transport(), parts) } diff --git a/elasticsearch/src/ccr.rs b/elasticsearch/src/ccr.rs index 10c830b6..5dcadbfd 100644 --- a/elasticsearch/src/ccr.rs +++ b/elasticsearch/src/ccr.rs @@ -37,11 +37,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -68,7 +68,7 @@ impl<'b> CcrDeleteAutoFollowPatternParts<'b> { } } } -#[doc = "Builder for the [Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] +#[doc = "Builder for the [Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] #[derive(Clone, Debug)] pub struct CcrDeleteAutoFollowPattern<'a, 'b> { transport: &'a Transport, @@ -77,6 +77,7 @@ pub struct CcrDeleteAutoFollowPattern<'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>, @@ -92,6 +93,7 @@ impl<'a, 'b> CcrDeleteAutoFollowPattern<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -117,6 +119,11 @@ impl<'a, 'b> CcrDeleteAutoFollowPattern<'a, 'b> { self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -135,7 +142,7 @@ impl<'a, 'b> CcrDeleteAutoFollowPattern<'a, 'b> { #[doc = "Creates an asynchronous call to the Ccr Delete Auto Follow Pattern API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -146,6 +153,7 @@ impl<'a, 'b> CcrDeleteAutoFollowPattern<'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>, } @@ -153,6 +161,7 @@ impl<'a, 'b> CcrDeleteAutoFollowPattern<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -188,7 +197,7 @@ impl<'b> CcrFollowParts<'b> { } } } -#[doc = "Builder for the [Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] +#[doc = "Builder for the [Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] #[derive(Clone, Debug)] pub struct CcrFollow<'a, 'b, B> { transport: &'a Transport, @@ -198,6 +207,7 @@ pub struct CcrFollow<'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>, @@ -218,6 +228,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -237,6 +248,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, @@ -263,6 +275,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -286,7 +303,7 @@ where #[doc = "Creates an asynchronous call to the Ccr Follow API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -297,6 +314,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>, wait_for_active_shards: Option<&'b str>, @@ -305,6 +323,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, wait_for_active_shards: self.wait_for_active_shards, @@ -342,7 +361,7 @@ impl<'b> CcrFollowInfoParts<'b> { } } } -#[doc = "Builder for the [Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] +#[doc = "Builder for the [Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] #[derive(Clone, Debug)] pub struct CcrFollowInfo<'a, 'b> { transport: &'a Transport, @@ -351,6 +370,7 @@ pub struct CcrFollowInfo<'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>, @@ -366,6 +386,7 @@ impl<'a, 'b> CcrFollowInfo<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -391,6 +412,11 @@ impl<'a, 'b> CcrFollowInfo<'a, 'b> { self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -409,7 +435,7 @@ impl<'a, 'b> CcrFollowInfo<'a, 'b> { #[doc = "Creates an asynchronous call to the Ccr Follow Info API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -420,6 +446,7 @@ impl<'a, 'b> CcrFollowInfo<'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>, } @@ -427,6 +454,7 @@ impl<'a, 'b> CcrFollowInfo<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -463,7 +491,7 @@ impl<'b> CcrFollowStatsParts<'b> { } } } -#[doc = "Builder for the [Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] +#[doc = "Builder for the [Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] #[derive(Clone, Debug)] pub struct CcrFollowStats<'a, 'b> { transport: &'a Transport, @@ -475,6 +503,7 @@ pub struct CcrFollowStats<'a, 'b> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } impl<'a, 'b> CcrFollowStats<'a, 'b> { #[doc = "Creates a new instance of [CcrFollowStats] with the specified API parts"] @@ -490,6 +519,7 @@ impl<'a, 'b> CcrFollowStats<'a, 'b> { pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "Include the stack trace of returned errors."] @@ -527,10 +557,15 @@ impl<'a, 'b> CcrFollowStats<'a, 'b> { self.source = Some(source); self } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Ccr Follow Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -543,6 +578,7 @@ impl<'a, 'b> CcrFollowStats<'a, 'b> { human: Option, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { error_trace: self.error_trace, @@ -550,6 +586,7 @@ impl<'a, 'b> CcrFollowStats<'a, 'b> { human: self.human, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -583,7 +620,7 @@ impl<'b> CcrForgetFollowerParts<'b> { } } } -#[doc = "Builder for the [Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] +#[doc = "Builder for the [Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] #[derive(Clone, Debug)] pub struct CcrForgetFollower<'a, 'b, B> { transport: &'a Transport, @@ -596,6 +633,7 @@ pub struct CcrForgetFollower<'a, 'b, B> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } impl<'a, 'b, B> CcrForgetFollower<'a, 'b, B> where @@ -615,6 +653,7 @@ where pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "The body for the API call"] @@ -633,6 +672,7 @@ where pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + timeout: self.timeout, } } #[doc = "Include the stack trace of returned errors."] @@ -670,10 +710,15 @@ where self.source = Some(source); self } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Ccr Forget Follower API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -686,6 +731,7 @@ where human: Option, pretty: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { error_trace: self.error_trace, @@ -693,6 +739,7 @@ where human: self.human, pretty: self.pretty, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -727,7 +774,7 @@ impl<'b> CcrGetAutoFollowPatternParts<'b> { } } } -#[doc = "Builder for the [Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] +#[doc = "Builder for the [Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] #[derive(Clone, Debug)] pub struct CcrGetAutoFollowPattern<'a, 'b> { transport: &'a Transport, @@ -736,6 +783,7 @@ pub struct CcrGetAutoFollowPattern<'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>, @@ -751,6 +799,7 @@ impl<'a, 'b> CcrGetAutoFollowPattern<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -776,6 +825,11 @@ impl<'a, 'b> CcrGetAutoFollowPattern<'a, 'b> { self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -794,7 +848,7 @@ impl<'a, 'b> CcrGetAutoFollowPattern<'a, 'b> { #[doc = "Creates an asynchronous call to the Ccr Get Auto Follow Pattern API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -805,6 +859,7 @@ impl<'a, 'b> CcrGetAutoFollowPattern<'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>, } @@ -812,6 +867,7 @@ impl<'a, 'b> CcrGetAutoFollowPattern<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -846,7 +902,7 @@ impl<'b> CcrPauseAutoFollowPatternParts<'b> { } } } -#[doc = "Builder for the [Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] +#[doc = "Builder for the [Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] #[derive(Clone, Debug)] pub struct CcrPauseAutoFollowPattern<'a, 'b, B> { transport: &'a Transport, @@ -856,6 +912,7 @@ pub struct CcrPauseAutoFollowPattern<'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>, @@ -875,6 +932,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -893,6 +951,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, @@ -918,6 +977,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -936,7 +1000,7 @@ where #[doc = "Creates an asynchronous call to the Ccr Pause Auto Follow Pattern API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -947,6 +1011,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>, } @@ -954,6 +1019,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, }; @@ -989,7 +1055,7 @@ impl<'b> CcrPauseFollowParts<'b> { } } } -#[doc = "Builder for the [Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] +#[doc = "Builder for the [Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] #[derive(Clone, Debug)] pub struct CcrPauseFollow<'a, 'b, B> { transport: &'a Transport, @@ -999,6 +1065,7 @@ pub struct CcrPauseFollow<'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>, @@ -1018,6 +1085,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1036,6 +1104,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, @@ -1061,6 +1130,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1079,7 +1153,7 @@ where #[doc = "Creates an asynchronous call to the Ccr Pause Follow API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1090,6 +1164,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>, } @@ -1097,6 +1172,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, }; @@ -1130,7 +1206,7 @@ impl<'b> CcrPutAutoFollowPatternParts<'b> { } } } -#[doc = "Builder for the [Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] +#[doc = "Builder for the [Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] #[derive(Clone, Debug)] pub struct CcrPutAutoFollowPattern<'a, 'b, B> { transport: &'a Transport, @@ -1140,6 +1216,7 @@ pub struct CcrPutAutoFollowPattern<'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>, @@ -1159,6 +1236,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1177,6 +1255,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, @@ -1202,6 +1281,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1220,7 +1304,7 @@ where #[doc = "Creates an asynchronous call to the Ccr Put Auto Follow Pattern API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1231,6 +1315,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>, } @@ -1238,6 +1323,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, }; @@ -1272,7 +1358,7 @@ impl<'b> CcrResumeAutoFollowPatternParts<'b> { } } } -#[doc = "Builder for the [Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] +#[doc = "Builder for the [Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] #[derive(Clone, Debug)] pub struct CcrResumeAutoFollowPattern<'a, 'b, B> { transport: &'a Transport, @@ -1282,6 +1368,7 @@ pub struct CcrResumeAutoFollowPattern<'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>, @@ -1301,6 +1388,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1319,6 +1407,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, @@ -1344,6 +1433,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1362,7 +1456,7 @@ where #[doc = "Creates an asynchronous call to the Ccr Resume Auto Follow Pattern API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1373,6 +1467,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>, } @@ -1380,6 +1475,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, }; @@ -1415,7 +1511,7 @@ impl<'b> CcrResumeFollowParts<'b> { } } } -#[doc = "Builder for the [Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] +#[doc = "Builder for the [Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] #[derive(Clone, Debug)] pub struct CcrResumeFollow<'a, 'b, B> { transport: &'a Transport, @@ -1425,6 +1521,7 @@ pub struct CcrResumeFollow<'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>, @@ -1444,6 +1541,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1462,6 +1560,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, @@ -1487,6 +1586,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1505,7 +1609,7 @@ where #[doc = "Creates an asynchronous call to the Ccr Resume Follow API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1516,6 +1620,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>, } @@ -1523,6 +1628,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, }; @@ -1550,7 +1656,7 @@ impl CcrStatsParts { } } } -#[doc = "Builder for the [Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] +#[doc = "Builder for the [Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] #[derive(Clone, Debug)] pub struct CcrStats<'a, 'b> { transport: &'a Transport, @@ -1559,9 +1665,11 @@ pub struct CcrStats<'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>, + timeout: Option<&'b str>, } impl<'a, 'b> CcrStats<'a, 'b> { #[doc = "Creates a new instance of [CcrStats]"] @@ -1574,9 +1682,11 @@ impl<'a, 'b> CcrStats<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "Include the stack trace of returned errors."] @@ -1599,6 +1709,11 @@ impl<'a, 'b> CcrStats<'a, 'b> { self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1614,10 +1729,15 @@ impl<'a, 'b> CcrStats<'a, 'b> { self.source = Some(source); self } + #[doc = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Ccr Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1628,15 +1748,19 @@ impl<'a, 'b> CcrStats<'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>, + 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) }; @@ -1670,7 +1794,7 @@ impl<'b> CcrUnfollowParts<'b> { } } } -#[doc = "Builder for the [Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] +#[doc = "Builder for the [Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] #[derive(Clone, Debug)] pub struct CcrUnfollow<'a, 'b, B> { transport: &'a Transport, @@ -1680,6 +1804,7 @@ pub struct CcrUnfollow<'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>, @@ -1699,6 +1824,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1717,6 +1843,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, @@ -1742,6 +1869,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -1760,7 +1892,7 @@ where #[doc = "Creates an asynchronous call to the Ccr Unfollow API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1771,6 +1903,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>, } @@ -1778,6 +1911,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, }; @@ -1803,79 +1937,79 @@ impl<'a> Ccr<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] + #[doc = "[Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."] pub fn delete_auto_follow_pattern<'b>( &'a self, parts: CcrDeleteAutoFollowPatternParts<'b>, ) -> CcrDeleteAutoFollowPattern<'a, 'b> { CcrDeleteAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] + #[doc = "[Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."] pub fn follow<'b>(&'a self, parts: CcrFollowParts<'b>) -> CcrFollow<'a, 'b, ()> { CcrFollow::new(self.transport(), parts) } - #[doc = "[Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] + #[doc = "[Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"] pub fn follow_info<'b>(&'a self, parts: CcrFollowInfoParts<'b>) -> CcrFollowInfo<'a, 'b> { CcrFollowInfo::new(self.transport(), parts) } - #[doc = "[Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] + #[doc = "[Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."] pub fn follow_stats<'b>(&'a self, parts: CcrFollowStatsParts<'b>) -> CcrFollowStats<'a, 'b> { CcrFollowStats::new(self.transport(), parts) } - #[doc = "[Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] + #[doc = "[Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."] pub fn forget_follower<'b>( &'a self, parts: CcrForgetFollowerParts<'b>, ) -> CcrForgetFollower<'a, 'b, ()> { CcrForgetFollower::new(self.transport(), parts) } - #[doc = "[Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] + #[doc = "[Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."] pub fn get_auto_follow_pattern<'b>( &'a self, parts: CcrGetAutoFollowPatternParts<'b>, ) -> CcrGetAutoFollowPattern<'a, 'b> { CcrGetAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] + #[doc = "[Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"] pub fn pause_auto_follow_pattern<'b>( &'a self, parts: CcrPauseAutoFollowPatternParts<'b>, ) -> CcrPauseAutoFollowPattern<'a, 'b, ()> { CcrPauseAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] + #[doc = "[Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."] pub fn pause_follow<'b>( &'a self, parts: CcrPauseFollowParts<'b>, ) -> CcrPauseFollow<'a, 'b, ()> { CcrPauseFollow::new(self.transport(), parts) } - #[doc = "[Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] + #[doc = "[Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."] pub fn put_auto_follow_pattern<'b>( &'a self, parts: CcrPutAutoFollowPatternParts<'b>, ) -> CcrPutAutoFollowPattern<'a, 'b, ()> { CcrPutAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] + #[doc = "[Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"] pub fn resume_auto_follow_pattern<'b>( &'a self, parts: CcrResumeAutoFollowPatternParts<'b>, ) -> CcrResumeAutoFollowPattern<'a, 'b, ()> { CcrResumeAutoFollowPattern::new(self.transport(), parts) } - #[doc = "[Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] + #[doc = "[Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"] pub fn resume_follow<'b>( &'a self, parts: CcrResumeFollowParts<'b>, ) -> CcrResumeFollow<'a, 'b, ()> { CcrResumeFollow::new(self.transport(), parts) } - #[doc = "[Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] + #[doc = "[Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."] pub fn stats<'b>(&'a self) -> CcrStats<'a, 'b> { CcrStats::new(self.transport()) } - #[doc = "[Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] + #[doc = "[Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."] pub fn unfollow<'b>(&'a self, parts: CcrUnfollowParts<'b>) -> CcrUnfollow<'a, 'b, ()> { CcrUnfollow::new(self.transport(), parts) } diff --git a/elasticsearch/src/cluster.rs b/elasticsearch/src/cluster.rs index 51b55cb8..469465ae 100644 --- a/elasticsearch/src/cluster.rs +++ b/elasticsearch/src/cluster.rs @@ -34,11 +34,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -59,7 +59,7 @@ impl ClusterAllocationExplainParts { } } } -#[doc = "Builder for the [Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] +#[doc = "Builder for the [Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] #[derive(Clone, Debug)] pub struct ClusterAllocationExplain<'a, 'b, B> { transport: &'a Transport, @@ -71,6 +71,7 @@ pub struct ClusterAllocationExplain<'a, 'b, B> { human: Option, include_disk_info: Option, include_yes_decisions: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, @@ -92,6 +93,7 @@ where human: None, include_disk_info: None, include_yes_decisions: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -112,6 +114,7 @@ where human: self.human, include_disk_info: self.include_disk_info, include_yes_decisions: self.include_yes_decisions, + master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, @@ -147,6 +150,11 @@ where self.include_yes_decisions = Some(include_yes_decisions); self } + #[doc = "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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -166,8 +174,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -181,6 +189,7 @@ where human: Option, include_disk_info: Option, include_yes_decisions: Option, + master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, } @@ -190,6 +199,7 @@ where human: self.human, include_disk_info: self.include_disk_info, include_yes_decisions: self.include_yes_decisions, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -223,7 +233,7 @@ impl<'b> ClusterDeleteComponentTemplateParts<'b> { } } } -#[doc = "Builder for the [Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nDeletes a component template"] +#[doc = "Builder for the [Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nDeletes a component template"] #[derive(Clone, Debug)] pub struct ClusterDeleteComponentTemplate<'a, 'b> { transport: &'a Transport, @@ -304,7 +314,7 @@ impl<'a, 'b> ClusterDeleteComponentTemplate<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Delete Component Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -355,7 +365,7 @@ impl ClusterDeleteVotingConfigExclusionsParts { } } } -#[doc = "Builder for the [Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] +#[doc = "Builder for the [Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] #[derive(Clone, Debug)] pub struct ClusterDeleteVotingConfigExclusions<'a, 'b> { transport: &'a Transport, @@ -436,7 +446,7 @@ impl<'a, 'b> ClusterDeleteVotingConfigExclusions<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Delete Voting Config Exclusions API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -491,7 +501,7 @@ impl<'b> ClusterExistsComponentTemplateParts<'b> { } } } -#[doc = "Builder for the [Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nReturns information about whether a particular component template exist"] +#[doc = "Builder for the [Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nReturns information about whether a particular component template exist"] #[derive(Clone, Debug)] pub struct ClusterExistsComponentTemplate<'a, 'b> { transport: &'a Transport, @@ -572,7 +582,7 @@ impl<'a, 'b> ClusterExistsComponentTemplate<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Exists Component Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Head; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -632,7 +642,7 @@ impl<'b> ClusterGetComponentTemplateParts<'b> { } } } -#[doc = "Builder for the [Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nReturns one or more component templates"] +#[doc = "Builder for the [Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nReturns one or more component templates"] #[derive(Clone, Debug)] pub struct ClusterGetComponentTemplate<'a, 'b> { transport: &'a Transport, @@ -641,6 +651,7 @@ pub struct ClusterGetComponentTemplate<'a, 'b> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + include_defaults: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -658,6 +669,7 @@ impl<'a, 'b> ClusterGetComponentTemplate<'a, 'b> { error_trace: None, filter_path: None, human: None, + include_defaults: None, local: None, master_timeout: None, pretty: None, @@ -685,6 +697,11 @@ impl<'a, 'b> ClusterGetComponentTemplate<'a, 'b> { self.human = Some(human); self } + #[doc = "Return all default configurations for the component template (default: false)"] + pub fn include_defaults(mut self, include_defaults: bool) -> Self { + self.include_defaults = Some(include_defaults); + self + } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); @@ -713,7 +730,7 @@ impl<'a, 'b> ClusterGetComponentTemplate<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Get Component Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -724,6 +741,7 @@ impl<'a, 'b> ClusterGetComponentTemplate<'a, 'b> { #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + include_defaults: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -733,6 +751,7 @@ impl<'a, 'b> ClusterGetComponentTemplate<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + include_defaults: self.include_defaults, local: self.local, master_timeout: self.master_timeout, pretty: self.pretty, @@ -762,7 +781,7 @@ impl ClusterGetSettingsParts { } } } -#[doc = "Builder for the [Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-get-settings.html)\n\nReturns cluster settings."] +#[doc = "Builder for the [Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-get-settings.html)\n\nReturns cluster settings."] #[derive(Clone, Debug)] pub struct ClusterGetSettings<'a, 'b> { transport: &'a Transport, @@ -857,7 +876,7 @@ impl<'a, 'b> ClusterGetSettings<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Get Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -921,7 +940,7 @@ impl<'b> ClusterHealthParts<'b> { } } } -#[doc = "Builder for the [Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-health.html)\n\nReturns basic information about the health of the cluster."] +#[doc = "Builder for the [Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-health.html)\n\nReturns basic information about the health of the cluster."] #[derive(Clone, Debug)] pub struct ClusterHealth<'a, 'b> { transport: &'a Transport, @@ -1068,7 +1087,7 @@ impl<'a, 'b> ClusterHealth<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Health API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1123,6 +1142,126 @@ impl<'a, 'b> ClusterHealth<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Cluster Info API"] +pub enum ClusterInfoParts<'b> { + #[doc = "Target"] + Target(&'b [&'b str]), +} +impl<'b> ClusterInfoParts<'b> { + #[doc = "Builds a relative URL path to the Cluster Info API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ClusterInfoParts::Target(ref target) => { + let target_str = target.join(","); + let encoded_target: Cow = + percent_encode(target_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(7usize + encoded_target.len()); + p.push_str("/_info/"); + p.push_str(encoded_target.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Cluster Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-info.html)\n\nReturns different information about the cluster."] +#[derive(Clone, Debug)] +pub struct ClusterInfo<'a, 'b> { + transport: &'a Transport, + parts: ClusterInfoParts<'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> ClusterInfo<'a, 'b> { + #[doc = "Creates a new instance of [ClusterInfo] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ClusterInfoParts<'b>) -> Self { + let headers = HeaderMap::new(); + ClusterInfo { + 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 Cluster Info 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)] #[doc = "API parts for the Cluster Pending Tasks API"] pub enum ClusterPendingTasksParts { #[doc = "No parts"] @@ -1136,7 +1275,7 @@ impl ClusterPendingTasksParts { } } } -#[doc = "Builder for the [Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] +#[doc = "Builder for the [Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] #[derive(Clone, Debug)] pub struct ClusterPendingTasks<'a, 'b> { transport: &'a Transport, @@ -1217,7 +1356,7 @@ impl<'a, 'b> ClusterPendingTasks<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Pending Tasks API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1268,7 +1407,7 @@ impl ClusterPostVotingConfigExclusionsParts { } } } -#[doc = "Builder for the [Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] +#[doc = "Builder for the [Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] #[derive(Clone, Debug)] pub struct ClusterPostVotingConfigExclusions<'a, 'b, B> { transport: &'a Transport, @@ -1390,7 +1529,7 @@ where #[doc = "Creates an asynchronous call to the Cluster Post Voting Config Exclusions API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1449,7 +1588,7 @@ impl<'b> ClusterPutComponentTemplateParts<'b> { } } } -#[doc = "Builder for the [Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nCreates or updates a component template"] +#[doc = "Builder for the [Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nCreates or updates a component template"] #[derive(Clone, Debug)] pub struct ClusterPutComponentTemplate<'a, 'b, B> { transport: &'a Transport, @@ -1563,7 +1702,7 @@ where #[doc = "Creates an asynchronous call to the Cluster Put Component Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1614,7 +1753,7 @@ impl ClusterPutSettingsParts { } } } -#[doc = "Builder for the [Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-update-settings.html)\n\nUpdates the cluster settings."] +#[doc = "Builder for the [Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-update-settings.html)\n\nUpdates the cluster settings."] #[derive(Clone, Debug)] pub struct ClusterPutSettings<'a, 'b, B> { transport: &'a Transport, @@ -1728,7 +1867,7 @@ where #[doc = "Creates an asynchronous call to the Cluster Put Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1779,7 +1918,7 @@ impl ClusterRemoteInfoParts { } } } -#[doc = "Builder for the [Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] +#[doc = "Builder for the [Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] #[derive(Clone, Debug)] pub struct ClusterRemoteInfo<'a, 'b> { transport: &'a Transport, @@ -1846,7 +1985,7 @@ impl<'a, 'b> ClusterRemoteInfo<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Remote Info API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1891,7 +2030,7 @@ impl ClusterRerouteParts { } } } -#[doc = "Builder for the [Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] +#[doc = "Builder for the [Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] #[derive(Clone, Debug)] pub struct ClusterReroute<'a, 'b, B> { transport: &'a Transport, @@ -2029,7 +2168,7 @@ where #[doc = "Creates an asynchronous call to the Cluster Reroute API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2115,7 +2254,7 @@ impl<'b> ClusterStateParts<'b> { } } } -#[doc = "Builder for the [Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] +#[doc = "Builder for the [Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] #[derive(Clone, Debug)] pub struct ClusterState<'a, 'b> { transport: &'a Transport, @@ -2238,7 +2377,7 @@ impl<'a, 'b> ClusterState<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster State API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2311,7 +2450,7 @@ impl<'b> ClusterStatsParts<'b> { } } } -#[doc = "Builder for the [Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] +#[doc = "Builder for the [Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] #[derive(Clone, Debug)] pub struct ClusterStats<'a, 'b> { transport: &'a Transport, @@ -2392,7 +2531,7 @@ impl<'a, 'b> ClusterStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Cluster Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2439,79 +2578,83 @@ impl<'a> Cluster<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] + #[doc = "[Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."] pub fn allocation_explain<'b>(&'a self) -> ClusterAllocationExplain<'a, 'b, ()> { ClusterAllocationExplain::new(self.transport()) } - #[doc = "[Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nDeletes a component template"] + #[doc = "[Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nDeletes a component template"] pub fn delete_component_template<'b>( &'a self, parts: ClusterDeleteComponentTemplateParts<'b>, ) -> ClusterDeleteComponentTemplate<'a, 'b> { ClusterDeleteComponentTemplate::new(self.transport(), parts) } - #[doc = "[Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] + #[doc = "[Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."] pub fn delete_voting_config_exclusions<'b>( &'a self, ) -> ClusterDeleteVotingConfigExclusions<'a, 'b> { ClusterDeleteVotingConfigExclusions::new(self.transport()) } - #[doc = "[Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nReturns information about whether a particular component template exist"] + #[doc = "[Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nReturns information about whether a particular component template exist"] pub fn exists_component_template<'b>( &'a self, parts: ClusterExistsComponentTemplateParts<'b>, ) -> ClusterExistsComponentTemplate<'a, 'b> { ClusterExistsComponentTemplate::new(self.transport(), parts) } - #[doc = "[Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nReturns one or more component templates"] + #[doc = "[Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nReturns one or more component templates"] pub fn get_component_template<'b>( &'a self, parts: ClusterGetComponentTemplateParts<'b>, ) -> ClusterGetComponentTemplate<'a, 'b> { ClusterGetComponentTemplate::new(self.transport(), parts) } - #[doc = "[Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-get-settings.html)\n\nReturns cluster settings."] + #[doc = "[Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-get-settings.html)\n\nReturns cluster settings."] pub fn get_settings<'b>(&'a self) -> ClusterGetSettings<'a, 'b> { ClusterGetSettings::new(self.transport()) } - #[doc = "[Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-health.html)\n\nReturns basic information about the health of the cluster."] + #[doc = "[Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-health.html)\n\nReturns basic information about the health of the cluster."] pub fn health<'b>(&'a self, parts: ClusterHealthParts<'b>) -> ClusterHealth<'a, 'b> { ClusterHealth::new(self.transport(), parts) } - #[doc = "[Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] + #[doc = "[Cluster Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-info.html)\n\nReturns different information about the cluster."] + pub fn info<'b>(&'a self, parts: ClusterInfoParts<'b>) -> ClusterInfo<'a, 'b> { + ClusterInfo::new(self.transport(), parts) + } + #[doc = "[Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-pending.html)\n\nReturns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."] pub fn pending_tasks<'b>(&'a self) -> ClusterPendingTasks<'a, 'b> { ClusterPendingTasks::new(self.transport()) } - #[doc = "[Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] + #[doc = "[Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."] pub fn post_voting_config_exclusions<'b>( &'a self, ) -> ClusterPostVotingConfigExclusions<'a, 'b, ()> { ClusterPostVotingConfigExclusions::new(self.transport()) } - #[doc = "[Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-component-template.html)\n\nCreates or updates a component template"] + #[doc = "[Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-component-template.html)\n\nCreates or updates a component template"] pub fn put_component_template<'b>( &'a self, parts: ClusterPutComponentTemplateParts<'b>, ) -> ClusterPutComponentTemplate<'a, 'b, ()> { ClusterPutComponentTemplate::new(self.transport(), parts) } - #[doc = "[Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-update-settings.html)\n\nUpdates the cluster settings."] + #[doc = "[Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-update-settings.html)\n\nUpdates the cluster settings."] pub fn put_settings<'b>(&'a self) -> ClusterPutSettings<'a, 'b, ()> { ClusterPutSettings::new(self.transport()) } - #[doc = "[Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] + #[doc = "[Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."] pub fn remote_info<'b>(&'a self) -> ClusterRemoteInfo<'a, 'b> { ClusterRemoteInfo::new(self.transport()) } - #[doc = "[Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] + #[doc = "[Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."] pub fn reroute<'b>(&'a self) -> ClusterReroute<'a, 'b, ()> { ClusterReroute::new(self.transport()) } - #[doc = "[Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] + #[doc = "[Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."] pub fn state<'b>(&'a self, parts: ClusterStateParts<'b>) -> ClusterState<'a, 'b> { ClusterState::new(self.transport(), parts) } - #[doc = "[Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] + #[doc = "[Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."] pub fn stats<'b>(&'a self, parts: ClusterStatsParts<'b>) -> ClusterStats<'a, 'b> { ClusterStats::new(self.transport(), parts) } diff --git a/elasticsearch/src/connector.rs b/elasticsearch/src/connector.rs new file mode 100644 index 00000000..ae1101b3 --- /dev/null +++ b/elasticsearch/src/connector.rs @@ -0,0 +1,5264 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![cfg(feature = "experimental-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 "] +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Check In API"] +pub enum ConnectorCheckInParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorCheckInParts<'b> { + #[doc = "Builds a relative URL path to the Connector Check In API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorCheckInParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_check_in"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Check In API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/check-in-connector-api.html)\n\nUpdates the last_seen timestamp in the connector document."] +#[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 ConnectorCheckIn<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorCheckInParts<'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> ConnectorCheckIn<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorCheckIn] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorCheckInParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorCheckIn { + 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) -> ConnectorCheckIn<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorCheckIn { + 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 Connector Check In 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Delete API"] +pub enum ConnectorDeleteParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorDeleteParts<'b> { + #[doc = "Builds a relative URL path to the Connector Delete API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorDeleteParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-connector-api.html)\n\nDeletes a connector."] +#[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 ConnectorDelete<'a, 'b> { + transport: &'a Transport, + parts: ConnectorDeleteParts<'b>, + delete_sync_jobs: 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> ConnectorDelete<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorDelete] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorDeleteParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorDelete { + transport, + parts, + headers, + delete_sync_jobs: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Determines whether associated sync jobs are also deleted."] + pub fn delete_sync_jobs(mut self, delete_sync_jobs: bool) -> Self { + self.delete_sync_jobs = Some(delete_sync_jobs); + 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); + 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 Connector Delete 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> { + delete_sync_jobs: Option, + 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 { + delete_sync_jobs: self.delete_sync_jobs, + 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Get API"] +pub enum ConnectorGetParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorGetParts<'b> { + #[doc = "Builds a relative URL path to the Connector Get API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorGetParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-connector-api.html)\n\nReturns the details about a connector."] +#[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 ConnectorGet<'a, 'b> { + transport: &'a Transport, + parts: ConnectorGetParts<'b>, + 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> ConnectorGet<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorGet] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorGetParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorGet { + 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 Connector Get 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Last Sync API"] +pub enum ConnectorLastSyncParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorLastSyncParts<'b> { + #[doc = "Builds a relative URL path to the Connector Last Sync API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorLastSyncParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(23usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_last_sync"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Last Sync API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-last-sync-api.html)\n\nUpdates the stats of last sync in the connector document."] +#[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 ConnectorLastSync<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorLastSyncParts<'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> ConnectorLastSync<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorLastSync] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorLastSyncParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorLastSync { + 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) -> ConnectorLastSync<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorLastSync { + 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 Connector Last Sync 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector List API"] +pub enum ConnectorListParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl ConnectorListParts { + #[doc = "Builds a relative URL path to the Connector List API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorListParts::None => "/_connector".into(), + } + } +} +#[doc = "Builder for the [Connector List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-connector-api.html)\n\nLists all connectors."] +#[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 ConnectorList<'a, 'b> { + transport: &'a Transport, + parts: ConnectorListParts, + connector_name: Option<&'b [&'b str]>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + index_name: Option<&'b [&'b str]>, + pretty: Option, + query: Option<&'b str>, + request_timeout: Option, + service_type: Option<&'b [&'b str]>, + size: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> ConnectorList<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorList]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ConnectorList { + transport, + parts: ConnectorListParts::None, + headers, + connector_name: None, + error_trace: None, + filter_path: None, + from: None, + human: None, + index_name: None, + pretty: None, + query: None, + request_timeout: None, + service_type: None, + size: None, + source: None, + } + } + #[doc = "A comma-separated list of connector names to fetch connector documents for"] + pub fn connector_name(mut self, connector_name: &'b [&'b str]) -> Self { + self.connector_name = Some(connector_name); + 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); + 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 = "Starting offset (default: 0)"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + 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 = "A comma-separated list of connector index names to fetch connector documents for"] + pub fn index_name(mut self, index_name: &'b [&'b str]) -> Self { + self.index_name = Some(index_name); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "A search string for querying connectors, filtering results by matching against connector names, descriptions, and index names"] + pub fn query(mut self, query: &'b str) -> Self { + self.query = Some(query); + 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 = "A comma-separated list of connector service types to fetch connector documents for"] + pub fn service_type(mut self, service_type: &'b [&'b str]) -> Self { + self.service_type = Some(service_type); + self + } + #[doc = "Specifies a max number of results to get (default: 100)"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + 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 Connector List 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> { + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + connector_name: Option<&'b [&'b str]>, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + from: Option, + human: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + index_name: Option<&'b [&'b str]>, + pretty: Option, + query: Option<&'b str>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + service_type: Option<&'b [&'b str]>, + size: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + connector_name: self.connector_name, + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + index_name: self.index_name, + pretty: self.pretty, + query: self.query, + service_type: self.service_type, + size: self.size, + 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Post API"] +pub enum ConnectorPostParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl ConnectorPostParts { + #[doc = "Builds a relative URL path to the Connector Post API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorPostParts::None => "/_connector".into(), + } + } +} +#[doc = "Builder for the [Connector Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/create-connector-api.html)\n\nCreates a connector."] +#[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 ConnectorPost<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorPostParts, + 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> ConnectorPost<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorPost]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ConnectorPost { + transport, + parts: ConnectorPostParts::None, + 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) -> ConnectorPost<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorPost { + 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 Connector Post 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Put API"] +pub enum ConnectorPutParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorPutParts<'b> { + #[doc = "Builds a relative URL path to the Connector Put API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorPutParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.into() + } + ConnectorPutParts::None => "/_connector".into(), + } + } +} +#[doc = "Builder for the [Connector Put API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/create-connector-api.html)\n\nCreates or updates a connector."] +#[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 ConnectorPut<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorPutParts<'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> ConnectorPut<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorPut] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorPutParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorPut { + 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) -> ConnectorPut<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorPut { + 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 Connector Put 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Secret Delete API"] +pub enum ConnectorSecretDeleteParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSecretDeleteParts<'b> { + #[doc = "Builds a relative URL path to the Connector Secret Delete API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSecretDeleteParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_connector/_secret/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the Connector Secret Delete API\n\nDeletes a connector secret."] +#[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 ConnectorSecretDelete<'a, 'b> { + transport: &'a Transport, + parts: ConnectorSecretDeleteParts<'b>, + 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> ConnectorSecretDelete<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorSecretDelete] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSecretDeleteParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSecretDelete { + 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 Connector Secret Delete 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Secret Get API"] +pub enum ConnectorSecretGetParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSecretGetParts<'b> { + #[doc = "Builds a relative URL path to the Connector Secret Get API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSecretGetParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_connector/_secret/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the Connector Secret Get API\n\nRetrieves a secret stored by Connectors."] +#[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 ConnectorSecretGet<'a, 'b> { + transport: &'a Transport, + parts: ConnectorSecretGetParts<'b>, + 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> ConnectorSecretGet<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorSecretGet] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSecretGetParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSecretGet { + 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 Connector Secret Get 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Secret Post API"] +pub enum ConnectorSecretPostParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl ConnectorSecretPostParts { + #[doc = "Builds a relative URL path to the Connector Secret Post API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSecretPostParts::None => "/_connector/_secret".into(), + } + } +} +#[doc = "Builder for the Connector Secret Post API\n\nCreates a secret for a Connector."] +#[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 ConnectorSecretPost<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSecretPostParts, + 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> ConnectorSecretPost<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSecretPost]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ConnectorSecretPost { + transport, + parts: ConnectorSecretPostParts::None, + 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) -> ConnectorSecretPost<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSecretPost { + 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 Connector Secret Post 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Secret Put API"] +pub enum ConnectorSecretPutParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSecretPutParts<'b> { + #[doc = "Builds a relative URL path to the Connector Secret Put API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSecretPutParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_id.len()); + p.push_str("/_connector/_secret/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the Connector Secret Put API\n\nCreates or updates a secret for a Connector."] +#[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 ConnectorSecretPut<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSecretPutParts<'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> ConnectorSecretPut<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSecretPut] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSecretPutParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSecretPut { + 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) -> ConnectorSecretPut<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSecretPut { + 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 Connector Secret Put 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Cancel API"] +pub enum ConnectorSyncJobCancelParts<'b> { + #[doc = "ConnectorSyncJobId"] + ConnectorSyncJobId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSyncJobCancelParts<'b> { + #[doc = "Builds a relative URL path to the Connector Sync Job Cancel API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobCancelParts::ConnectorSyncJobId(ref connector_sync_job_id) => { + let encoded_connector_sync_job_id: Cow = + percent_encode(connector_sync_job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(30usize + encoded_connector_sync_job_id.len()); + p.push_str("/_connector/_sync_job/"); + p.push_str(encoded_connector_sync_job_id.as_ref()); + p.push_str("/_cancel"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Sync Job Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cancel-connector-sync-job-api.html)\n\nCancels a connector sync job."] +#[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 ConnectorSyncJobCancel<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSyncJobCancelParts<'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> ConnectorSyncJobCancel<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSyncJobCancel] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSyncJobCancelParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobCancel { + 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) -> ConnectorSyncJobCancel<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSyncJobCancel { + 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 Connector Sync Job Cancel 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Check In API"] +pub enum ConnectorSyncJobCheckInParts<'b> { + #[doc = "ConnectorSyncJobId"] + ConnectorSyncJobId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSyncJobCheckInParts<'b> { + #[doc = "Builds a relative URL path to the Connector Sync Job Check In API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobCheckInParts::ConnectorSyncJobId(ref connector_sync_job_id) => { + let encoded_connector_sync_job_id: Cow = + percent_encode(connector_sync_job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(32usize + encoded_connector_sync_job_id.len()); + p.push_str("/_connector/_sync_job/"); + p.push_str(encoded_connector_sync_job_id.as_ref()); + p.push_str("/_check_in"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Sync Job Check In API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/check-in-connector-sync-job-api.html)\n\nChecks in a connector sync job (refreshes 'last_seen')."] +#[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 ConnectorSyncJobCheckIn<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSyncJobCheckInParts<'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> ConnectorSyncJobCheckIn<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSyncJobCheckIn] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSyncJobCheckInParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobCheckIn { + 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) -> ConnectorSyncJobCheckIn<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSyncJobCheckIn { + 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 Connector Sync Job Check In 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Claim API"] +pub enum ConnectorSyncJobClaimParts<'b> { + #[doc = "ConnectorSyncJobId"] + ConnectorSyncJobId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSyncJobClaimParts<'b> { + #[doc = "Builds a relative URL path to the Connector Sync Job Claim API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobClaimParts::ConnectorSyncJobId(ref connector_sync_job_id) => { + let encoded_connector_sync_job_id: Cow = + percent_encode(connector_sync_job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_connector_sync_job_id.len()); + p.push_str("/_connector/_sync_job/"); + p.push_str(encoded_connector_sync_job_id.as_ref()); + p.push_str("/_claim"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Sync Job Claim API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/claim-connector-sync-job-api.html)\n\nClaims a connector sync job."] +#[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 ConnectorSyncJobClaim<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSyncJobClaimParts<'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> ConnectorSyncJobClaim<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSyncJobClaim] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSyncJobClaimParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobClaim { + 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) -> ConnectorSyncJobClaim<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSyncJobClaim { + 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 Connector Sync Job Claim 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Delete API"] +pub enum ConnectorSyncJobDeleteParts<'b> { + #[doc = "ConnectorSyncJobId"] + ConnectorSyncJobId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSyncJobDeleteParts<'b> { + #[doc = "Builds a relative URL path to the Connector Sync Job Delete API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobDeleteParts::ConnectorSyncJobId(ref connector_sync_job_id) => { + let encoded_connector_sync_job_id: Cow = + percent_encode(connector_sync_job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_connector_sync_job_id.len()); + p.push_str("/_connector/_sync_job/"); + p.push_str(encoded_connector_sync_job_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Sync Job Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-connector-sync-job-api.html)\n\nDeletes a connector sync job."] +#[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 ConnectorSyncJobDelete<'a, 'b> { + transport: &'a Transport, + parts: ConnectorSyncJobDeleteParts<'b>, + 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> ConnectorSyncJobDelete<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorSyncJobDelete] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSyncJobDeleteParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobDelete { + 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 Connector Sync Job Delete 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Error API"] +pub enum ConnectorSyncJobErrorParts<'b> { + #[doc = "ConnectorSyncJobId"] + ConnectorSyncJobId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSyncJobErrorParts<'b> { + #[doc = "Builds a relative URL path to the Connector Sync Job Error API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobErrorParts::ConnectorSyncJobId(ref connector_sync_job_id) => { + let encoded_connector_sync_job_id: Cow = + percent_encode(connector_sync_job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_connector_sync_job_id.len()); + p.push_str("/_connector/_sync_job/"); + p.push_str(encoded_connector_sync_job_id.as_ref()); + p.push_str("/_error"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Sync Job Error API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/set-connector-sync-job-error-api.html)\n\nSets an error for a connector sync job."] +#[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 ConnectorSyncJobError<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSyncJobErrorParts<'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> ConnectorSyncJobError<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSyncJobError] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSyncJobErrorParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobError { + 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) -> ConnectorSyncJobError<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSyncJobError { + 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 Connector Sync Job Error 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Get API"] +pub enum ConnectorSyncJobGetParts<'b> { + #[doc = "ConnectorSyncJobId"] + ConnectorSyncJobId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSyncJobGetParts<'b> { + #[doc = "Builds a relative URL path to the Connector Sync Job Get API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobGetParts::ConnectorSyncJobId(ref connector_sync_job_id) => { + let encoded_connector_sync_job_id: Cow = + percent_encode(connector_sync_job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_connector_sync_job_id.len()); + p.push_str("/_connector/_sync_job/"); + p.push_str(encoded_connector_sync_job_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Sync Job Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-connector-sync-job-api.html)\n\nReturns the details about a connector sync job."] +#[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 ConnectorSyncJobGet<'a, 'b> { + transport: &'a Transport, + parts: ConnectorSyncJobGetParts<'b>, + 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> ConnectorSyncJobGet<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorSyncJobGet] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSyncJobGetParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobGet { + 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 Connector Sync Job Get 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job List API"] +pub enum ConnectorSyncJobListParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl ConnectorSyncJobListParts { + #[doc = "Builds a relative URL path to the Connector Sync Job List API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobListParts::None => "/_connector/_sync_job".into(), + } + } +} +#[doc = "Builder for the [Connector Sync Job List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-connector-sync-jobs-api.html)\n\nLists all connector sync jobs."] +#[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 ConnectorSyncJobList<'a, 'b> { + transport: &'a Transport, + parts: ConnectorSyncJobListParts, + connector_id: Option<&'b str>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + job_type: Option<&'b [&'b str]>, + pretty: Option, + request_timeout: Option, + size: Option, + source: Option<&'b str>, + status: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> ConnectorSyncJobList<'a, 'b> { + #[doc = "Creates a new instance of [ConnectorSyncJobList]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobList { + transport, + parts: ConnectorSyncJobListParts::None, + headers, + connector_id: None, + error_trace: None, + filter_path: None, + from: None, + human: None, + job_type: None, + pretty: None, + request_timeout: None, + size: None, + source: None, + status: None, + } + } + #[doc = "Id of the connector to fetch the sync jobs for"] + pub fn connector_id(mut self, connector_id: &'b str) -> Self { + self.connector_id = Some(connector_id); + 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); + 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 = "Starting offset (default: 0)"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + 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 = "A comma-separated list of job types"] + pub fn job_type(mut self, job_type: &'b [&'b str]) -> Self { + self.job_type = Some(job_type); + 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 = "specifies a max number of results to get (default: 100)"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + 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 = "Sync job status, which sync jobs are fetched for"] + pub fn status(mut self, status: &'b str) -> Self { + self.status = Some(status); + self + } + #[doc = "Creates an asynchronous call to the Connector Sync Job List 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> { + connector_id: Option<&'b str>, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + from: Option, + human: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + job_type: Option<&'b [&'b str]>, + pretty: Option, + size: Option, + source: Option<&'b str>, + status: Option<&'b str>, + } + let query_params = QueryParams { + connector_id: self.connector_id, + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + job_type: self.job_type, + pretty: self.pretty, + size: self.size, + source: self.source, + status: self.status, + }; + Some(query_params) + }; + let body = Option::<()>::None; + let response = self + .transport + .send(method, &path, headers, query_string.as_ref(), body, timeout) + .await?; + Ok(response) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Post API"] +pub enum ConnectorSyncJobPostParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl ConnectorSyncJobPostParts { + #[doc = "Builds a relative URL path to the Connector Sync Job Post API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobPostParts::None => "/_connector/_sync_job".into(), + } + } +} +#[doc = "Builder for the [Connector Sync Job Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/create-connector-sync-job-api.html)\n\nCreates a connector sync job."] +#[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 ConnectorSyncJobPost<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSyncJobPostParts, + 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> ConnectorSyncJobPost<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSyncJobPost]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobPost { + transport, + parts: ConnectorSyncJobPostParts::None, + 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) -> ConnectorSyncJobPost<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSyncJobPost { + 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 Connector Sync Job Post 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Sync Job Update Stats API"] +pub enum ConnectorSyncJobUpdateStatsParts<'b> { + #[doc = "ConnectorSyncJobId"] + ConnectorSyncJobId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorSyncJobUpdateStatsParts<'b> { + #[doc = "Builds a relative URL path to the Connector Sync Job Update Stats API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorSyncJobUpdateStatsParts::ConnectorSyncJobId(ref connector_sync_job_id) => { + let encoded_connector_sync_job_id: Cow = + percent_encode(connector_sync_job_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_connector_sync_job_id.len()); + p.push_str("/_connector/_sync_job/"); + p.push_str(encoded_connector_sync_job_id.as_ref()); + p.push_str("/_stats"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Sync Job Update Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/set-connector-sync-job-stats-api.html)\n\nUpdates the stats fields in the connector sync job document."] +#[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 ConnectorSyncJobUpdateStats<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorSyncJobUpdateStatsParts<'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> ConnectorSyncJobUpdateStats<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorSyncJobUpdateStats] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorSyncJobUpdateStatsParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorSyncJobUpdateStats { + 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) -> ConnectorSyncJobUpdateStats<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorSyncJobUpdateStats { + 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 Connector Sync Job Update Stats 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Active Filtering API"] +pub enum ConnectorUpdateActiveFilteringParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateActiveFilteringParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Active Filtering API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateActiveFilteringParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_filtering/_activate"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Active Filtering API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-filtering-api.html)\n\nActivates the draft filtering rules if they are in a validated state."] +#[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 ConnectorUpdateActiveFiltering<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateActiveFilteringParts<'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> ConnectorUpdateActiveFiltering<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateActiveFiltering] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateActiveFilteringParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateActiveFiltering { + 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) -> ConnectorUpdateActiveFiltering<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateActiveFiltering { + 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 Connector Update Active Filtering 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Api Key Id API"] +pub enum ConnectorUpdateApiKeyIdParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateApiKeyIdParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Api Key Id API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateApiKeyIdParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_api_key_id"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Api Key Id API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-api-key-id-api.html)\n\nUpdates the API key id and/or API key secret id fields in the connector document."] +#[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 ConnectorUpdateApiKeyId<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateApiKeyIdParts<'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> ConnectorUpdateApiKeyId<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateApiKeyId] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateApiKeyIdParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateApiKeyId { + 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) -> ConnectorUpdateApiKeyId<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateApiKeyId { + 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 Connector Update Api Key Id 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Configuration API"] +pub enum ConnectorUpdateConfigurationParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateConfigurationParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Configuration API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateConfigurationParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(27usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_configuration"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Configuration API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-configuration-api.html)\n\nUpdates the connector configuration."] +#[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 ConnectorUpdateConfiguration<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateConfigurationParts<'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> ConnectorUpdateConfiguration<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateConfiguration] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateConfigurationParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateConfiguration { + 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) -> ConnectorUpdateConfiguration<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateConfiguration { + 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 Connector Update Configuration 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Error API"] +pub enum ConnectorUpdateErrorParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateErrorParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Error API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateErrorParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(19usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_error"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Error API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-error-api.html)\n\nUpdates the error field in the connector document."] +#[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 ConnectorUpdateError<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateErrorParts<'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> ConnectorUpdateError<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateError] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateErrorParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateError { + 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) -> ConnectorUpdateError<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateError { + 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 Connector Update Error 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Features API"] +pub enum ConnectorUpdateFeaturesParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateFeaturesParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Features API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateFeaturesParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_features"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-features-api.html)\n\nUpdates the connector features in the connector document."] +#[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 ConnectorUpdateFeatures<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateFeaturesParts<'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> ConnectorUpdateFeatures<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateFeatures] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateFeaturesParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateFeatures { + 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) -> ConnectorUpdateFeatures<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateFeatures { + 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 Connector Update Features 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Filtering API"] +pub enum ConnectorUpdateFilteringParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateFilteringParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Filtering API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateFilteringParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(23usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_filtering"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Filtering API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-filtering-api.html)\n\nUpdates the filtering field in the connector document."] +#[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 ConnectorUpdateFiltering<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateFilteringParts<'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> ConnectorUpdateFiltering<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateFiltering] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateFilteringParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateFiltering { + 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) -> ConnectorUpdateFiltering<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateFiltering { + 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 Connector Update Filtering 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Filtering Validation API"] +pub enum ConnectorUpdateFilteringValidationParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateFilteringValidationParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Filtering Validation API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateFilteringValidationParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(35usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_filtering/_validation"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Filtering Validation API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-filtering-api.html)\n\nUpdates the validation info of the draft filtering rules."] +#[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 ConnectorUpdateFilteringValidation<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateFilteringValidationParts<'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> ConnectorUpdateFilteringValidation<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateFilteringValidation] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: ConnectorUpdateFilteringValidationParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateFilteringValidation { + 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) -> ConnectorUpdateFilteringValidation<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateFilteringValidation { + 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 Connector Update Filtering Validation 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Index Name API"] +pub enum ConnectorUpdateIndexNameParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateIndexNameParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Index Name API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateIndexNameParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_index_name"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Index Name API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-index-name-api.html)\n\nUpdates the index name of the connector."] +#[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 ConnectorUpdateIndexName<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateIndexNameParts<'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> ConnectorUpdateIndexName<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateIndexName] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateIndexNameParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateIndexName { + 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) -> ConnectorUpdateIndexName<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateIndexName { + 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 Connector Update Index Name 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Name API"] +pub enum ConnectorUpdateNameParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateNameParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Name API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateNameParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(18usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_name"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Name API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-name-description-api.html)\n\nUpdates the name and/or description fields in the connector document."] +#[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 ConnectorUpdateName<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateNameParts<'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> ConnectorUpdateName<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateName] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateNameParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateName { + 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) -> ConnectorUpdateName<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateName { + 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 Connector Update Name 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Native API"] +pub enum ConnectorUpdateNativeParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateNativeParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Native API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateNativeParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_native"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Native API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/connector-apis.html)\n\nUpdates the is_native flag of the connector."] +#[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 ConnectorUpdateNative<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateNativeParts<'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> ConnectorUpdateNative<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateNative] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateNativeParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateNative { + 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) -> ConnectorUpdateNative<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateNative { + 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 Connector Update Native 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Pipeline API"] +pub enum ConnectorUpdatePipelineParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdatePipelineParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Pipeline API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdatePipelineParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(22usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_pipeline"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-pipeline-api.html)\n\nUpdates the pipeline field in the connector document."] +#[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 ConnectorUpdatePipeline<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdatePipelineParts<'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> ConnectorUpdatePipeline<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdatePipeline] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdatePipelineParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdatePipeline { + 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) -> ConnectorUpdatePipeline<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdatePipeline { + 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 Connector Update Pipeline 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Scheduling API"] +pub enum ConnectorUpdateSchedulingParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateSchedulingParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Scheduling API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateSchedulingParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_scheduling"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Scheduling API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-scheduling-api.html)\n\nUpdates the scheduling field in the connector document."] +#[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 ConnectorUpdateScheduling<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateSchedulingParts<'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> ConnectorUpdateScheduling<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateScheduling] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateSchedulingParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateScheduling { + 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) -> ConnectorUpdateScheduling<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateScheduling { + 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 Connector Update Scheduling 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Service Type API"] +pub enum ConnectorUpdateServiceTypeParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateServiceTypeParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Service Type API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateServiceTypeParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(26usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_service_type"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Service Type API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-service-type-api.html)\n\nUpdates the service type of the connector."] +#[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 ConnectorUpdateServiceType<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateServiceTypeParts<'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> ConnectorUpdateServiceType<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateServiceType] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateServiceTypeParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateServiceType { + 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) -> ConnectorUpdateServiceType<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateServiceType { + 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 Connector Update Service Type 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Connector Update Status API"] +pub enum ConnectorUpdateStatusParts<'b> { + #[doc = "ConnectorId"] + ConnectorId(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> ConnectorUpdateStatusParts<'b> { + #[doc = "Builds a relative URL path to the Connector Update Status API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ConnectorUpdateStatusParts::ConnectorId(ref connector_id) => { + let encoded_connector_id: Cow = + percent_encode(connector_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_connector_id.len()); + p.push_str("/_connector/"); + p.push_str(encoded_connector_id.as_ref()); + p.push_str("/_status"); + p.into() + } + } + } +} +#[doc = "Builder for the [Connector Update Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-status-api.html)\n\nUpdates the status of the connector."] +#[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 ConnectorUpdateStatus<'a, 'b, B> { + transport: &'a Transport, + parts: ConnectorUpdateStatusParts<'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> ConnectorUpdateStatus<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ConnectorUpdateStatus] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: ConnectorUpdateStatusParts<'b>) -> Self { + let headers = HeaderMap::new(); + ConnectorUpdateStatus { + 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) -> ConnectorUpdateStatus<'a, 'b, JsonBody> + where + T: Serialize, + { + ConnectorUpdateStatus { + 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 Connector Update Status 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) + } +} +#[doc = "Namespace client for Connector 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")] +pub struct Connector<'a> { + transport: &'a Transport, +} +#[cfg(feature = "experimental-apis")] +impl<'a> Connector<'a> { + #[doc = "Creates a new instance of [Connector]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Connector Check In API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/check-in-connector-api.html)\n\nUpdates the last_seen timestamp in the connector document."] + #[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 check_in<'b>( + &'a self, + parts: ConnectorCheckInParts<'b>, + ) -> ConnectorCheckIn<'a, 'b, ()> { + ConnectorCheckIn::new(self.transport(), parts) + } + #[doc = "[Connector Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-connector-api.html)\n\nDeletes a connector."] + #[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<'b>(&'a self, parts: ConnectorDeleteParts<'b>) -> ConnectorDelete<'a, 'b> { + ConnectorDelete::new(self.transport(), parts) + } + #[doc = "[Connector Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-connector-api.html)\n\nReturns the details about a connector."] + #[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<'b>(&'a self, parts: ConnectorGetParts<'b>) -> ConnectorGet<'a, 'b> { + ConnectorGet::new(self.transport(), parts) + } + #[doc = "[Connector Last Sync API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-last-sync-api.html)\n\nUpdates the stats of last sync in the connector document."] + #[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 last_sync<'b>( + &'a self, + parts: ConnectorLastSyncParts<'b>, + ) -> ConnectorLastSync<'a, 'b, ()> { + ConnectorLastSync::new(self.transport(), parts) + } + #[doc = "[Connector List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-connector-api.html)\n\nLists all connectors."] + #[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 list<'b>(&'a self) -> ConnectorList<'a, 'b> { + ConnectorList::new(self.transport()) + } + #[doc = "[Connector Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/create-connector-api.html)\n\nCreates a connector."] + #[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 post<'b>(&'a self) -> ConnectorPost<'a, 'b, ()> { + ConnectorPost::new(self.transport()) + } + #[doc = "[Connector Put API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/create-connector-api.html)\n\nCreates or updates a connector."] + #[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<'b>(&'a self, parts: ConnectorPutParts<'b>) -> ConnectorPut<'a, 'b, ()> { + ConnectorPut::new(self.transport(), parts) + } + #[doc = "Connector Secret Delete API\n\nDeletes a connector secret."] + #[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 secret_delete<'b>( + &'a self, + parts: ConnectorSecretDeleteParts<'b>, + ) -> ConnectorSecretDelete<'a, 'b> { + ConnectorSecretDelete::new(self.transport(), parts) + } + #[doc = "Connector Secret Get API\n\nRetrieves a secret stored by Connectors."] + #[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 secret_get<'b>( + &'a self, + parts: ConnectorSecretGetParts<'b>, + ) -> ConnectorSecretGet<'a, 'b> { + ConnectorSecretGet::new(self.transport(), parts) + } + #[doc = "Connector Secret Post API\n\nCreates a secret for a Connector."] + #[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 secret_post<'b>(&'a self) -> ConnectorSecretPost<'a, 'b, ()> { + ConnectorSecretPost::new(self.transport()) + } + #[doc = "Connector Secret Put API\n\nCreates or updates a secret for a Connector."] + #[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 secret_put<'b>( + &'a self, + parts: ConnectorSecretPutParts<'b>, + ) -> ConnectorSecretPut<'a, 'b, ()> { + ConnectorSecretPut::new(self.transport(), parts) + } + #[doc = "[Connector Sync Job Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cancel-connector-sync-job-api.html)\n\nCancels a connector sync job."] + #[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 sync_job_cancel<'b>( + &'a self, + parts: ConnectorSyncJobCancelParts<'b>, + ) -> ConnectorSyncJobCancel<'a, 'b, ()> { + ConnectorSyncJobCancel::new(self.transport(), parts) + } + #[doc = "[Connector Sync Job Check In API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/check-in-connector-sync-job-api.html)\n\nChecks in a connector sync job (refreshes 'last_seen')."] + #[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 sync_job_check_in<'b>( + &'a self, + parts: ConnectorSyncJobCheckInParts<'b>, + ) -> ConnectorSyncJobCheckIn<'a, 'b, ()> { + ConnectorSyncJobCheckIn::new(self.transport(), parts) + } + #[doc = "[Connector Sync Job Claim API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/claim-connector-sync-job-api.html)\n\nClaims a connector sync job."] + #[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 sync_job_claim<'b>( + &'a self, + parts: ConnectorSyncJobClaimParts<'b>, + ) -> ConnectorSyncJobClaim<'a, 'b, ()> { + ConnectorSyncJobClaim::new(self.transport(), parts) + } + #[doc = "[Connector Sync Job Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-connector-sync-job-api.html)\n\nDeletes a connector sync job."] + #[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 sync_job_delete<'b>( + &'a self, + parts: ConnectorSyncJobDeleteParts<'b>, + ) -> ConnectorSyncJobDelete<'a, 'b> { + ConnectorSyncJobDelete::new(self.transport(), parts) + } + #[doc = "[Connector Sync Job Error API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/set-connector-sync-job-error-api.html)\n\nSets an error for a connector sync job."] + #[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 sync_job_error<'b>( + &'a self, + parts: ConnectorSyncJobErrorParts<'b>, + ) -> ConnectorSyncJobError<'a, 'b, ()> { + ConnectorSyncJobError::new(self.transport(), parts) + } + #[doc = "[Connector Sync Job Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-connector-sync-job-api.html)\n\nReturns the details about a connector sync job."] + #[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 sync_job_get<'b>( + &'a self, + parts: ConnectorSyncJobGetParts<'b>, + ) -> ConnectorSyncJobGet<'a, 'b> { + ConnectorSyncJobGet::new(self.transport(), parts) + } + #[doc = "[Connector Sync Job List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-connector-sync-jobs-api.html)\n\nLists all connector sync jobs."] + #[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 sync_job_list<'b>(&'a self) -> ConnectorSyncJobList<'a, 'b> { + ConnectorSyncJobList::new(self.transport()) + } + #[doc = "[Connector Sync Job Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/create-connector-sync-job-api.html)\n\nCreates a connector sync job."] + #[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 sync_job_post<'b>(&'a self) -> ConnectorSyncJobPost<'a, 'b, ()> { + ConnectorSyncJobPost::new(self.transport()) + } + #[doc = "[Connector Sync Job Update Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/set-connector-sync-job-stats-api.html)\n\nUpdates the stats fields in the connector sync job document."] + #[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 sync_job_update_stats<'b>( + &'a self, + parts: ConnectorSyncJobUpdateStatsParts<'b>, + ) -> ConnectorSyncJobUpdateStats<'a, 'b, ()> { + ConnectorSyncJobUpdateStats::new(self.transport(), parts) + } + #[doc = "[Connector Update Active Filtering API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-filtering-api.html)\n\nActivates the draft filtering rules if they are in a validated state."] + #[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 update_active_filtering<'b>( + &'a self, + parts: ConnectorUpdateActiveFilteringParts<'b>, + ) -> ConnectorUpdateActiveFiltering<'a, 'b, ()> { + ConnectorUpdateActiveFiltering::new(self.transport(), parts) + } + #[doc = "[Connector Update Api Key Id API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-api-key-id-api.html)\n\nUpdates the API key id and/or API key secret id fields in the connector document."] + #[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 update_api_key_id<'b>( + &'a self, + parts: ConnectorUpdateApiKeyIdParts<'b>, + ) -> ConnectorUpdateApiKeyId<'a, 'b, ()> { + ConnectorUpdateApiKeyId::new(self.transport(), parts) + } + #[doc = "[Connector Update Configuration API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-configuration-api.html)\n\nUpdates the connector configuration."] + #[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 update_configuration<'b>( + &'a self, + parts: ConnectorUpdateConfigurationParts<'b>, + ) -> ConnectorUpdateConfiguration<'a, 'b, ()> { + ConnectorUpdateConfiguration::new(self.transport(), parts) + } + #[doc = "[Connector Update Error API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-error-api.html)\n\nUpdates the error field in the connector document."] + #[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 update_error<'b>( + &'a self, + parts: ConnectorUpdateErrorParts<'b>, + ) -> ConnectorUpdateError<'a, 'b, ()> { + ConnectorUpdateError::new(self.transport(), parts) + } + #[doc = "[Connector Update Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-features-api.html)\n\nUpdates the connector features in the connector document."] + #[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 update_features<'b>( + &'a self, + parts: ConnectorUpdateFeaturesParts<'b>, + ) -> ConnectorUpdateFeatures<'a, 'b, ()> { + ConnectorUpdateFeatures::new(self.transport(), parts) + } + #[doc = "[Connector Update Filtering API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-filtering-api.html)\n\nUpdates the filtering field in the connector document."] + #[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 update_filtering<'b>( + &'a self, + parts: ConnectorUpdateFilteringParts<'b>, + ) -> ConnectorUpdateFiltering<'a, 'b, ()> { + ConnectorUpdateFiltering::new(self.transport(), parts) + } + #[doc = "[Connector Update Filtering Validation API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-filtering-api.html)\n\nUpdates the validation info of the draft filtering rules."] + #[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 update_filtering_validation<'b>( + &'a self, + parts: ConnectorUpdateFilteringValidationParts<'b>, + ) -> ConnectorUpdateFilteringValidation<'a, 'b, ()> { + ConnectorUpdateFilteringValidation::new(self.transport(), parts) + } + #[doc = "[Connector Update Index Name API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-index-name-api.html)\n\nUpdates the index name of the connector."] + #[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 update_index_name<'b>( + &'a self, + parts: ConnectorUpdateIndexNameParts<'b>, + ) -> ConnectorUpdateIndexName<'a, 'b, ()> { + ConnectorUpdateIndexName::new(self.transport(), parts) + } + #[doc = "[Connector Update Name API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-name-description-api.html)\n\nUpdates the name and/or description fields in the connector document."] + #[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 update_name<'b>( + &'a self, + parts: ConnectorUpdateNameParts<'b>, + ) -> ConnectorUpdateName<'a, 'b, ()> { + ConnectorUpdateName::new(self.transport(), parts) + } + #[doc = "[Connector Update Native API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/connector-apis.html)\n\nUpdates the is_native flag of the connector."] + #[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 update_native<'b>( + &'a self, + parts: ConnectorUpdateNativeParts<'b>, + ) -> ConnectorUpdateNative<'a, 'b, ()> { + ConnectorUpdateNative::new(self.transport(), parts) + } + #[doc = "[Connector Update Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-pipeline-api.html)\n\nUpdates the pipeline field in the connector document."] + #[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 update_pipeline<'b>( + &'a self, + parts: ConnectorUpdatePipelineParts<'b>, + ) -> ConnectorUpdatePipeline<'a, 'b, ()> { + ConnectorUpdatePipeline::new(self.transport(), parts) + } + #[doc = "[Connector Update Scheduling API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-scheduling-api.html)\n\nUpdates the scheduling field in the connector document."] + #[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 update_scheduling<'b>( + &'a self, + parts: ConnectorUpdateSchedulingParts<'b>, + ) -> ConnectorUpdateScheduling<'a, 'b, ()> { + ConnectorUpdateScheduling::new(self.transport(), parts) + } + #[doc = "[Connector Update Service Type API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-service-type-api.html)\n\nUpdates the service type of the connector."] + #[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 update_service_type<'b>( + &'a self, + parts: ConnectorUpdateServiceTypeParts<'b>, + ) -> ConnectorUpdateServiceType<'a, 'b, ()> { + ConnectorUpdateServiceType::new(self.transport(), parts) + } + #[doc = "[Connector Update Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-connector-status-api.html)\n\nUpdates the status of the connector."] + #[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 update_status<'b>( + &'a self, + parts: ConnectorUpdateStatusParts<'b>, + ) -> ConnectorUpdateStatus<'a, 'b, ()> { + ConnectorUpdateStatus::new(self.transport(), parts) + } +} +#[cfg(feature = "experimental-apis")] +impl Elasticsearch { + #[doc = "Creates a namespace client for Connector APIs"] + pub fn connector(&self) -> Connector { + Connector::new(self.transport()) + } +} diff --git a/elasticsearch/src/dangling_indices.rs b/elasticsearch/src/dangling_indices.rs index 42d261f2..caa6d4b2 100644 --- a/elasticsearch/src/dangling_indices.rs +++ b/elasticsearch/src/dangling_indices.rs @@ -38,11 +38,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -70,7 +70,7 @@ impl<'b> DanglingIndicesDeleteDanglingIndexParts<'b> { } } } -#[doc = "Builder for the [Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] +#[doc = "Builder for the [Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] #[derive(Clone, Debug)] pub struct DanglingIndicesDeleteDanglingIndex<'a, 'b> { transport: &'a Transport, @@ -161,7 +161,7 @@ impl<'a, 'b> DanglingIndicesDeleteDanglingIndex<'a, 'b> { #[doc = "Creates an asynchronous call to the Dangling Indices Delete Dangling Index API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -219,7 +219,7 @@ impl<'b> DanglingIndicesImportDanglingIndexParts<'b> { } } } -#[doc = "Builder for the [Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] +#[doc = "Builder for the [Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] #[derive(Clone, Debug)] pub struct DanglingIndicesImportDanglingIndex<'a, 'b, B> { transport: &'a Transport, @@ -336,7 +336,7 @@ where #[doc = "Creates an asynchronous call to the Dangling Indices Import Dangling Index API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -387,7 +387,7 @@ impl DanglingIndicesListDanglingIndicesParts { } } } -#[doc = "Builder for the [Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] +#[doc = "Builder for the [Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] #[derive(Clone, Debug)] pub struct DanglingIndicesListDanglingIndices<'a, 'b> { transport: &'a Transport, @@ -454,7 +454,7 @@ impl<'a, 'b> DanglingIndicesListDanglingIndices<'a, 'b> { #[doc = "Creates an asynchronous call to the Dangling Indices List Dangling Indices API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -497,21 +497,21 @@ impl<'a> DanglingIndices<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] + #[doc = "[Dangling Indices Delete Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-gateway-dangling-indices.html)\n\nDeletes the specified dangling index"] pub fn delete_dangling_index<'b>( &'a self, parts: DanglingIndicesDeleteDanglingIndexParts<'b>, ) -> DanglingIndicesDeleteDanglingIndex<'a, 'b> { DanglingIndicesDeleteDanglingIndex::new(self.transport(), parts) } - #[doc = "[Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] + #[doc = "[Dangling Indices Import Dangling Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-gateway-dangling-indices.html)\n\nImports the specified dangling index"] pub fn import_dangling_index<'b>( &'a self, parts: DanglingIndicesImportDanglingIndexParts<'b>, ) -> DanglingIndicesImportDanglingIndex<'a, 'b, ()> { DanglingIndicesImportDanglingIndex::new(self.transport(), parts) } - #[doc = "[Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] + #[doc = "[Dangling Indices List Dangling Indices API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-gateway-dangling-indices.html)\n\nReturns all dangling indices."] pub fn list_dangling_indices<'b>(&'a self) -> DanglingIndicesListDanglingIndices<'a, 'b> { DanglingIndicesListDanglingIndices::new(self.transport()) } diff --git a/elasticsearch/src/enrich.rs b/elasticsearch/src/enrich.rs index 13494fef..826b6dd8 100644 --- a/elasticsearch/src/enrich.rs +++ b/elasticsearch/src/enrich.rs @@ -36,11 +36,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -67,7 +67,7 @@ impl<'b> EnrichDeletePolicyParts<'b> { } } } -#[doc = "Builder for the [Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] +#[doc = "Builder for the [Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] #[derive(Clone, Debug)] pub struct EnrichDeletePolicy<'a, 'b> { transport: &'a Transport, @@ -76,6 +76,7 @@ pub struct EnrichDeletePolicy<'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>, @@ -91,6 +92,7 @@ impl<'a, 'b> EnrichDeletePolicy<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -116,6 +118,11 @@ impl<'a, 'b> EnrichDeletePolicy<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -134,7 +141,7 @@ impl<'a, 'b> EnrichDeletePolicy<'a, 'b> { #[doc = "Creates an asynchronous call to the Enrich Delete Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -145,6 +152,7 @@ impl<'a, 'b> EnrichDeletePolicy<'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>, } @@ -152,6 +160,7 @@ impl<'a, 'b> EnrichDeletePolicy<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -186,7 +195,7 @@ impl<'b> EnrichExecutePolicyParts<'b> { } } } -#[doc = "Builder for the [Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] +#[doc = "Builder for the [Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] #[derive(Clone, Debug)] pub struct EnrichExecutePolicy<'a, 'b, B> { transport: &'a Transport, @@ -196,6 +205,7 @@ pub struct EnrichExecutePolicy<'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>, @@ -216,6 +226,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -235,6 +246,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, @@ -261,6 +273,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -284,7 +301,7 @@ where #[doc = "Creates an asynchronous call to the Enrich Execute Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -295,6 +312,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>, wait_for_completion: Option, @@ -303,6 +321,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, wait_for_completion: self.wait_for_completion, @@ -342,7 +361,7 @@ impl<'b> EnrichGetPolicyParts<'b> { } } } -#[doc = "Builder for the [Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] +#[doc = "Builder for the [Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] #[derive(Clone, Debug)] pub struct EnrichGetPolicy<'a, 'b> { transport: &'a Transport, @@ -351,6 +370,7 @@ pub struct EnrichGetPolicy<'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>, @@ -366,6 +386,7 @@ impl<'a, 'b> EnrichGetPolicy<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -391,6 +412,11 @@ impl<'a, 'b> EnrichGetPolicy<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -409,7 +435,7 @@ impl<'a, 'b> EnrichGetPolicy<'a, 'b> { #[doc = "Creates an asynchronous call to the Enrich Get Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -420,6 +446,7 @@ impl<'a, 'b> EnrichGetPolicy<'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>, } @@ -427,6 +454,7 @@ impl<'a, 'b> EnrichGetPolicy<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -460,7 +488,7 @@ impl<'b> EnrichPutPolicyParts<'b> { } } } -#[doc = "Builder for the [Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] +#[doc = "Builder for the [Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] #[derive(Clone, Debug)] pub struct EnrichPutPolicy<'a, 'b, B> { transport: &'a Transport, @@ -470,6 +498,7 @@ pub struct EnrichPutPolicy<'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>, @@ -489,6 +518,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -507,6 +537,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, @@ -532,6 +563,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -550,7 +586,7 @@ where #[doc = "Creates an asynchronous call to the Enrich Put Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -561,6 +597,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>, } @@ -568,6 +605,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, }; @@ -595,7 +633,7 @@ impl EnrichStatsParts { } } } -#[doc = "Builder for the [Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] +#[doc = "Builder for the [Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] #[derive(Clone, Debug)] pub struct EnrichStats<'a, 'b> { transport: &'a Transport, @@ -604,6 +642,7 @@ pub struct EnrichStats<'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>, @@ -619,6 +658,7 @@ impl<'a, 'b> EnrichStats<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -644,6 +684,11 @@ impl<'a, 'b> EnrichStats<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -662,7 +707,7 @@ impl<'a, 'b> EnrichStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Enrich Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -673,6 +718,7 @@ impl<'a, 'b> EnrichStats<'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>, } @@ -680,6 +726,7 @@ impl<'a, 'b> EnrichStats<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -705,32 +752,32 @@ impl<'a> Enrich<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] + #[doc = "[Enrich Delete Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-enrich-policy-api.html)\n\nDeletes an existing enrich policy and its enrich index."] pub fn delete_policy<'b>( &'a self, parts: EnrichDeletePolicyParts<'b>, ) -> EnrichDeletePolicy<'a, 'b> { EnrichDeletePolicy::new(self.transport(), parts) } - #[doc = "[Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] + #[doc = "[Enrich Execute Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/execute-enrich-policy-api.html)\n\nCreates the enrich index for an existing enrich policy."] pub fn execute_policy<'b>( &'a self, parts: EnrichExecutePolicyParts<'b>, ) -> EnrichExecutePolicy<'a, 'b, ()> { EnrichExecutePolicy::new(self.transport(), parts) } - #[doc = "[Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] + #[doc = "[Enrich Get Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-enrich-policy-api.html)\n\nGets information about an enrich policy."] pub fn get_policy<'b>(&'a self, parts: EnrichGetPolicyParts<'b>) -> EnrichGetPolicy<'a, 'b> { EnrichGetPolicy::new(self.transport(), parts) } - #[doc = "[Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] + #[doc = "[Enrich Put Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-enrich-policy-api.html)\n\nCreates a new enrich policy."] pub fn put_policy<'b>( &'a self, parts: EnrichPutPolicyParts<'b>, ) -> EnrichPutPolicy<'a, 'b, ()> { EnrichPutPolicy::new(self.transport(), parts) } - #[doc = "[Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] + #[doc = "[Enrich Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/enrich-stats-api.html)\n\nGets enrich coordinator statistics and information about enrich policies that are currently executing."] pub fn stats<'b>(&'a self) -> EnrichStats<'a, 'b> { EnrichStats::new(self.transport()) } diff --git a/elasticsearch/src/eql.rs b/elasticsearch/src/eql.rs index c024fc28..df6afc8b 100644 --- a/elasticsearch/src/eql.rs +++ b/elasticsearch/src/eql.rs @@ -36,11 +36,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -67,7 +67,7 @@ impl<'b> EqlDeleteParts<'b> { } } } -#[doc = "Builder for the [Eql Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nDeletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] +#[doc = "Builder for the [Eql Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nDeletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] #[derive(Clone, Debug)] pub struct EqlDelete<'a, 'b> { transport: &'a Transport, @@ -134,7 +134,7 @@ impl<'a, 'b> EqlDelete<'a, 'b> { #[doc = "Creates an asynchronous call to the Eql Delete API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -185,7 +185,7 @@ impl<'b> EqlGetParts<'b> { } } } -#[doc = "Builder for the [Eql Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nReturns async results from previously executed Event Query Language (EQL) search"] +#[doc = "Builder for the [Eql Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nReturns async results from previously executed Event Query Language (EQL) search"] #[derive(Clone, Debug)] pub struct EqlGet<'a, 'b> { transport: &'a Transport, @@ -266,7 +266,7 @@ impl<'a, 'b> EqlGet<'a, 'b> { #[doc = "Creates an asynchronous call to the Eql Get API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -321,7 +321,7 @@ impl<'b> EqlGetStatusParts<'b> { } } } -#[doc = "Builder for the [Eql Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nReturns the status of a previously submitted async or stored Event Query Language (EQL) search"] +#[doc = "Builder for the [Eql Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nReturns the status of a previously submitted async or stored Event Query Language (EQL) search"] #[derive(Clone, Debug)] pub struct EqlGetStatus<'a, 'b> { transport: &'a Transport, @@ -388,7 +388,7 @@ impl<'a, 'b> EqlGetStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the Eql Get Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -441,7 +441,7 @@ impl<'b> EqlSearchParts<'b> { } } } -#[doc = "Builder for the [Eql Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nReturns results matching a query expressed in Event Query Language (EQL)"] +#[doc = "Builder for the [Eql Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nReturns results matching a query expressed in Event Query Language (EQL)"] #[derive(Clone, Debug)] pub struct EqlSearch<'a, 'b, B> { transport: &'a Transport, @@ -556,8 +556,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -607,19 +607,19 @@ impl<'a> Eql<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Eql Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nDeletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] + #[doc = "[Eql Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nDeletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted."] pub fn delete<'b>(&'a self, parts: EqlDeleteParts<'b>) -> EqlDelete<'a, 'b> { EqlDelete::new(self.transport(), parts) } - #[doc = "[Eql Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nReturns async results from previously executed Event Query Language (EQL) search"] + #[doc = "[Eql Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nReturns async results from previously executed Event Query Language (EQL) search"] pub fn get<'b>(&'a self, parts: EqlGetParts<'b>) -> EqlGet<'a, 'b> { EqlGet::new(self.transport(), parts) } - #[doc = "[Eql Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nReturns the status of a previously submitted async or stored Event Query Language (EQL) search"] + #[doc = "[Eql Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nReturns the status of a previously submitted async or stored Event Query Language (EQL) search"] pub fn get_status<'b>(&'a self, parts: EqlGetStatusParts<'b>) -> EqlGetStatus<'a, 'b> { EqlGetStatus::new(self.transport(), parts) } - #[doc = "[Eql Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/eql-search-api.html)\n\nReturns results matching a query expressed in Event Query Language (EQL)"] + #[doc = "[Eql Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/eql-search-api.html)\n\nReturns results matching a query expressed in Event Query Language (EQL)"] pub fn search<'b>(&'a self, parts: EqlSearchParts<'b>) -> EqlSearch<'a, 'b, ()> { EqlSearch::new(self.transport(), parts) } diff --git a/elasticsearch/src/esql.rs b/elasticsearch/src/esql.rs new file mode 100644 index 00000000..a1b6ca6b --- /dev/null +++ b/elasticsearch/src/esql.rs @@ -0,0 +1,551 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Esql Async Query API"] +pub enum EsqlAsyncQueryParts { + #[doc = "No parts"] + None, +} +impl EsqlAsyncQueryParts { + #[doc = "Builds a relative URL path to the Esql Async Query API"] + pub fn url(self) -> Cow<'static, str> { + match self { + EsqlAsyncQueryParts::None => "/_query/async".into(), + } + } +} +#[doc = "Builder for the [Esql Async Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/esql-async-query-api.html)\n\nExecutes an ESQL request asynchronously"] +#[derive(Clone, Debug)] +pub struct EsqlAsyncQuery<'a, 'b, B> { + transport: &'a Transport, + parts: EsqlAsyncQueryParts, + body: Option, + delimiter: Option<&'b str>, + drop_null_columns: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + format: Option<&'b str>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> EsqlAsyncQuery<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [EsqlAsyncQuery]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + EsqlAsyncQuery { + transport, + parts: EsqlAsyncQueryParts::None, + headers, + body: None, + delimiter: None, + drop_null_columns: None, + error_trace: None, + filter_path: None, + format: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> EsqlAsyncQuery<'a, 'b, JsonBody> + where + T: Serialize, + { + EsqlAsyncQuery { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + delimiter: self.delimiter, + drop_null_columns: self.drop_null_columns, + error_trace: self.error_trace, + filter_path: self.filter_path, + format: self.format, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "The character to use between values within a CSV row. Only valid for the csv format."] + pub fn delimiter(mut self, delimiter: &'b str) -> Self { + self.delimiter = Some(delimiter); + self + } + #[doc = "Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section."] + pub fn drop_null_columns(mut self, drop_null_columns: bool) -> Self { + self.drop_null_columns = Some(drop_null_columns); + 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); + 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 = "a short version of the Accept header, e.g. json, yaml"] + pub fn format(mut self, format: &'b str) -> Self { + self.format = Some(format); + 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 Esql Async Query 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> { + delimiter: Option<&'b str>, + drop_null_columns: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + format: Option<&'b str>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + delimiter: self.delimiter, + drop_null_columns: self.drop_null_columns, + error_trace: self.error_trace, + filter_path: self.filter_path, + format: self.format, + 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)] +#[doc = "API parts for the Esql Async Query Get API"] +pub enum EsqlAsyncQueryGetParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> EsqlAsyncQueryGetParts<'b> { + #[doc = "Builds a relative URL path to the Esql Async Query Get API"] + pub fn url(self) -> Cow<'static, str> { + match self { + EsqlAsyncQueryGetParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(14usize + encoded_id.len()); + p.push_str("/_query/async/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Esql Async Query Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/esql-async-query-get-api.html)\n\nRetrieves the results of a previously submitted async query request given its ID."] +#[derive(Clone, Debug)] +pub struct EsqlAsyncQueryGet<'a, 'b> { + transport: &'a Transport, + parts: EsqlAsyncQueryGetParts<'b>, + drop_null_columns: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + keep_alive: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, + wait_for_completion_timeout: Option<&'b str>, +} +impl<'a, 'b> EsqlAsyncQueryGet<'a, 'b> { + #[doc = "Creates a new instance of [EsqlAsyncQueryGet] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: EsqlAsyncQueryGetParts<'b>) -> Self { + let headers = HeaderMap::new(); + EsqlAsyncQueryGet { + transport, + parts, + headers, + drop_null_columns: None, + error_trace: None, + filter_path: None, + human: None, + keep_alive: None, + pretty: None, + request_timeout: None, + source: None, + wait_for_completion_timeout: None, + } + } + #[doc = "Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section."] + pub fn drop_null_columns(mut self, drop_null_columns: bool) -> Self { + self.drop_null_columns = Some(drop_null_columns); + 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); + 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 = "Specify the time interval in which the results (partial or final) for this search will be available"] + pub fn keep_alive(mut self, keep_alive: &'b str) -> Self { + self.keep_alive = Some(keep_alive); + 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 = "Specify the time that the request should block waiting for the final response"] + pub fn wait_for_completion_timeout(mut self, wait_for_completion_timeout: &'b str) -> Self { + self.wait_for_completion_timeout = Some(wait_for_completion_timeout); + self + } + #[doc = "Creates an asynchronous call to the Esql Async Query Get 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> { + drop_null_columns: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + keep_alive: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + wait_for_completion_timeout: Option<&'b str>, + } + let query_params = QueryParams { + drop_null_columns: self.drop_null_columns, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + keep_alive: self.keep_alive, + pretty: self.pretty, + source: self.source, + wait_for_completion_timeout: self.wait_for_completion_timeout, + }; + 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)] +#[doc = "API parts for the Esql Query API"] +pub enum EsqlQueryParts { + #[doc = "No parts"] + None, +} +impl EsqlQueryParts { + #[doc = "Builds a relative URL path to the Esql Query API"] + pub fn url(self) -> Cow<'static, str> { + match self { + EsqlQueryParts::None => "/_query".into(), + } + } +} +#[doc = "Builder for the [Esql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/esql-query-api.html)\n\nExecutes an ESQL request"] +#[derive(Clone, Debug)] +pub struct EsqlQuery<'a, 'b, B> { + transport: &'a Transport, + parts: EsqlQueryParts, + body: Option, + delimiter: Option<&'b str>, + drop_null_columns: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + format: Option<&'b str>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> EsqlQuery<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [EsqlQuery]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + EsqlQuery { + transport, + parts: EsqlQueryParts::None, + headers, + body: None, + delimiter: None, + drop_null_columns: None, + error_trace: None, + filter_path: None, + format: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> EsqlQuery<'a, 'b, JsonBody> + where + T: Serialize, + { + EsqlQuery { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + delimiter: self.delimiter, + drop_null_columns: self.drop_null_columns, + error_trace: self.error_trace, + filter_path: self.filter_path, + format: self.format, + headers: self.headers, + human: self.human, + pretty: self.pretty, + request_timeout: self.request_timeout, + source: self.source, + } + } + #[doc = "The character to use between values within a CSV row. Only valid for the csv format."] + pub fn delimiter(mut self, delimiter: &'b str) -> Self { + self.delimiter = Some(delimiter); + self + } + #[doc = "Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section."] + pub fn drop_null_columns(mut self, drop_null_columns: bool) -> Self { + self.drop_null_columns = Some(drop_null_columns); + 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); + 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 = "a short version of the Accept header, e.g. json, yaml"] + pub fn format(mut self, format: &'b str) -> Self { + self.format = Some(format); + 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 Esql Query 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> { + delimiter: Option<&'b str>, + drop_null_columns: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + format: Option<&'b str>, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + delimiter: self.delimiter, + drop_null_columns: self.drop_null_columns, + error_trace: self.error_trace, + filter_path: self.filter_path, + format: self.format, + 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 Esql APIs"] +pub struct Esql<'a> { + transport: &'a Transport, +} +impl<'a> Esql<'a> { + #[doc = "Creates a new instance of [Esql]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Esql Async Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/esql-async-query-api.html)\n\nExecutes an ESQL request asynchronously"] + pub fn async_query<'b>(&'a self) -> EsqlAsyncQuery<'a, 'b, ()> { + EsqlAsyncQuery::new(self.transport()) + } + #[doc = "[Esql Async Query Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/esql-async-query-get-api.html)\n\nRetrieves the results of a previously submitted async query request given its ID."] + pub fn async_query_get<'b>( + &'a self, + parts: EsqlAsyncQueryGetParts<'b>, + ) -> EsqlAsyncQueryGet<'a, 'b> { + EsqlAsyncQueryGet::new(self.transport(), parts) + } + #[doc = "[Esql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/esql-query-api.html)\n\nExecutes an ESQL request"] + pub fn query<'b>(&'a self) -> EsqlQuery<'a, 'b, ()> { + EsqlQuery::new(self.transport()) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for Esql APIs"] + pub fn esql(&self) -> Esql { + Esql::new(self.transport()) + } +} diff --git a/elasticsearch/src/features.rs b/elasticsearch/src/features.rs index a74ba093..6fa640a1 100644 --- a/elasticsearch/src/features.rs +++ b/elasticsearch/src/features.rs @@ -33,11 +33,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -58,7 +58,7 @@ impl FeaturesGetFeaturesParts { } } } -#[doc = "Builder for the [Features Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-features-api.html)\n\nGets a list of features which can be included in snapshots using the feature_states field when creating a snapshot"] +#[doc = "Builder for the [Features Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-features-api.html)\n\nGets a list of features which can be included in snapshots using the feature_states field when creating a snapshot"] #[derive(Clone, Debug)] pub struct FeaturesGetFeatures<'a, 'b> { transport: &'a Transport, @@ -132,7 +132,7 @@ impl<'a, 'b> FeaturesGetFeatures<'a, 'b> { #[doc = "Creates an asynchronous call to the Features Get Features API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -181,7 +181,7 @@ impl FeaturesResetFeaturesParts { } } } -#[doc = "Builder for the [Features Reset Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nResets the internal state of features, usually by deleting system indices"] +#[doc = "Builder for the [Features Reset Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nResets the internal state of features, usually by deleting system indices"] #[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)] @@ -193,6 +193,7 @@ pub struct FeaturesResetFeatures<'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>, @@ -213,6 +214,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -231,6 +233,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, @@ -256,6 +259,11 @@ where self.human = Some(human); 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 = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -274,7 +282,7 @@ where #[doc = "Creates an asynchronous call to the Features Reset Features API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -285,6 +293,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>, } @@ -292,6 +301,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, }; @@ -317,11 +327,11 @@ impl<'a> Features<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Features Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-features-api.html)\n\nGets a list of features which can be included in snapshots using the feature_states field when creating a snapshot"] + #[doc = "[Features Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-features-api.html)\n\nGets a list of features which can be included in snapshots using the feature_states field when creating a snapshot"] pub fn get_features<'b>(&'a self) -> FeaturesGetFeatures<'a, 'b> { FeaturesGetFeatures::new(self.transport()) } - #[doc = "[Features Reset Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nResets the internal state of features, usually by deleting system indices"] + #[doc = "[Features Reset Features API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nResets the internal state of features, usually by deleting system indices"] #[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 reset_features<'b>(&'a self) -> FeaturesResetFeatures<'a, 'b, ()> { diff --git a/elasticsearch/src/fleet.rs b/elasticsearch/src/fleet.rs index bd5bbc01..974bb619 100644 --- a/elasticsearch/src/fleet.rs +++ b/elasticsearch/src/fleet.rs @@ -31,17 +31,263 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; use percent_encoding::percent_encode; use serde::Serialize; use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Fleet Delete Secret API"] +pub enum FleetDeleteSecretParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> FleetDeleteSecretParts<'b> { + #[doc = "Builds a relative URL path to the Fleet Delete Secret API"] + pub fn url(self) -> Cow<'static, str> { + match self { + FleetDeleteSecretParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(15usize + encoded_id.len()); + p.push_str("/_fleet/secret/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the Fleet Delete Secret API\n\nDeletes a secret stored by Fleet."] +#[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 FleetDeleteSecret<'a, 'b> { + transport: &'a Transport, + parts: FleetDeleteSecretParts<'b>, + 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> FleetDeleteSecret<'a, 'b> { + #[doc = "Creates a new instance of [FleetDeleteSecret] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: FleetDeleteSecretParts<'b>) -> Self { + let headers = HeaderMap::new(); + FleetDeleteSecret { + 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 Fleet Delete Secret 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Fleet Get Secret API"] +pub enum FleetGetSecretParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> FleetGetSecretParts<'b> { + #[doc = "Builds a relative URL path to the Fleet Get Secret API"] + pub fn url(self) -> Cow<'static, str> { + match self { + FleetGetSecretParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(15usize + encoded_id.len()); + p.push_str("/_fleet/secret/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the Fleet Get Secret API\n\nRetrieves a secret stored by Fleet."] +#[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 FleetGetSecret<'a, 'b> { + transport: &'a Transport, + parts: FleetGetSecretParts<'b>, + 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> FleetGetSecret<'a, 'b> { + #[doc = "Creates a new instance of [FleetGetSecret] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: FleetGetSecretParts<'b>) -> Self { + let headers = HeaderMap::new(); + FleetGetSecret { + 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 Fleet Get Secret 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)] #[doc = "API parts for the Fleet Global Checkpoints API"] pub enum FleetGlobalCheckpointsParts<'b> { @@ -64,7 +310,7 @@ impl<'b> FleetGlobalCheckpointsParts<'b> { } } } -#[doc = "Builder for the [Fleet Global Checkpoints API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-global-checkpoints.html)\n\nReturns the current global checkpoints for an index. This API is design for internal use by the fleet server project."] +#[doc = "Builder for the [Fleet Global Checkpoints API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-global-checkpoints.html)\n\nReturns the current global checkpoints for an index. This API is design for internal use by the fleet server project."] #[derive(Clone, Debug)] pub struct FleetGlobalCheckpoints<'a, 'b> { transport: &'a Transport, @@ -159,7 +405,7 @@ impl<'a, 'b> FleetGlobalCheckpoints<'a, 'b> { #[doc = "Creates an asynchronous call to the Fleet Global Checkpoints API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -320,8 +566,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -355,6 +601,146 @@ where } #[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Fleet Post Secret API"] +pub enum FleetPostSecretParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl FleetPostSecretParts { + #[doc = "Builds a relative URL path to the Fleet Post Secret API"] + pub fn url(self) -> Cow<'static, str> { + match self { + FleetPostSecretParts::None => "/_fleet/secret".into(), + } + } +} +#[doc = "Builder for the Fleet Post Secret API\n\nCreates a secret stored by Fleet."] +#[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 FleetPostSecret<'a, 'b, B> { + transport: &'a Transport, + parts: FleetPostSecretParts, + 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> FleetPostSecret<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [FleetPostSecret]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + FleetPostSecret { + transport, + parts: FleetPostSecretParts::None, + 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) -> FleetPostSecret<'a, 'b, JsonBody> + where + T: Serialize, + { + FleetPostSecret { + 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 Fleet Post Secret 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Fleet Search API"] pub enum FleetSearchParts<'b> { #[doc = "Index"] @@ -495,8 +881,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -547,7 +933,22 @@ impl<'a> Fleet<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Fleet Global Checkpoints API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-global-checkpoints.html)\n\nReturns the current global checkpoints for an index. This API is design for internal use by the fleet server project."] + #[doc = "Fleet Delete Secret API\n\nDeletes a secret stored by Fleet."] + #[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_secret<'b>( + &'a self, + parts: FleetDeleteSecretParts<'b>, + ) -> FleetDeleteSecret<'a, 'b> { + FleetDeleteSecret::new(self.transport(), parts) + } + #[doc = "Fleet Get Secret API\n\nRetrieves a secret stored by Fleet."] + #[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_secret<'b>(&'a self, parts: FleetGetSecretParts<'b>) -> FleetGetSecret<'a, 'b> { + FleetGetSecret::new(self.transport(), parts) + } + #[doc = "[Fleet Global Checkpoints API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-global-checkpoints.html)\n\nReturns the current global checkpoints for an index. This API is design for internal use by the fleet server project."] pub fn global_checkpoints<'b>( &'a self, parts: FleetGlobalCheckpointsParts<'b>, @@ -560,6 +961,12 @@ impl<'a> Fleet<'a> { pub fn msearch<'b>(&'a self, parts: FleetMsearchParts<'b>) -> FleetMsearch<'a, 'b, ()> { FleetMsearch::new(self.transport(), parts) } + #[doc = "Fleet Post Secret API\n\nCreates a secret stored by Fleet."] + #[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 post_secret<'b>(&'a self) -> FleetPostSecret<'a, 'b, ()> { + FleetPostSecret::new(self.transport()) + } #[doc = "Fleet Search API\n\nSearch API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project."] #[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")] diff --git a/elasticsearch/src/graph.rs b/elasticsearch/src/graph.rs index aabee142..da0aaa68 100644 --- a/elasticsearch/src/graph.rs +++ b/elasticsearch/src/graph.rs @@ -35,11 +35,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -69,7 +69,7 @@ impl<'b> GraphExploreParts<'b> { } } } -#[doc = "Builder for the [Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] +#[doc = "Builder for the [Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] #[derive(Clone, Debug)] pub struct GraphExplore<'a, 'b, B> { transport: &'a Transport, @@ -176,8 +176,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -225,7 +225,7 @@ impl<'a> Graph<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] + #[doc = "[Graph Explore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/graph-explore-api.html)\n\nExplore extracted and summarized information about the documents and terms in an index."] pub fn explore<'b>(&'a self, parts: GraphExploreParts<'b>) -> GraphExplore<'a, 'b, ()> { GraphExplore::new(self.transport(), parts) } diff --git a/elasticsearch/src/http/transport.rs b/elasticsearch/src/http/transport.rs index 48f1476c..f1fd87d7 100644 --- a/elasticsearch/src/http/transport.rs +++ b/elasticsearch/src/http/transport.rs @@ -629,6 +629,7 @@ impl CloudId { /// on [Elasticsearch service in Elastic Cloud](https://www.elastic.co/cloud/). #[derive(Debug, Clone)] pub struct CloudConnectionPool { + #[allow(dead_code)] // field can be useful in debug outputs. cloud_id: CloudId, connection: Connection, } diff --git a/elasticsearch/src/ilm.rs b/elasticsearch/src/ilm.rs index 523109e2..7ac7d162 100644 --- a/elasticsearch/src/ilm.rs +++ b/elasticsearch/src/ilm.rs @@ -39,11 +39,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -71,7 +71,7 @@ impl<'b> IlmDeleteLifecycleParts<'b> { } } } -#[doc = "Builder for the [Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] +#[doc = "Builder for the [Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] #[derive(Clone, Debug)] pub struct IlmDeleteLifecycle<'a, 'b> { transport: &'a Transport, @@ -138,7 +138,7 @@ impl<'a, 'b> IlmDeleteLifecycle<'a, 'b> { #[doc = "Creates an asynchronous call to the Ilm Delete Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -191,7 +191,7 @@ impl<'b> IlmExplainLifecycleParts<'b> { } } } -#[doc = "Builder for the [Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] +#[doc = "Builder for the [Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] #[derive(Clone, Debug)] pub struct IlmExplainLifecycle<'a, 'b> { transport: &'a Transport, @@ -272,7 +272,7 @@ impl<'a, 'b> IlmExplainLifecycle<'a, 'b> { #[doc = "Creates an asynchronous call to the Ilm Explain Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -331,7 +331,7 @@ impl<'b> IlmGetLifecycleParts<'b> { } } } -#[doc = "Builder for the [Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] +#[doc = "Builder for the [Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] #[derive(Clone, Debug)] pub struct IlmGetLifecycle<'a, 'b> { transport: &'a Transport, @@ -398,7 +398,7 @@ impl<'a, 'b> IlmGetLifecycle<'a, 'b> { #[doc = "Creates an asynchronous call to the Ilm Get Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -443,7 +443,7 @@ impl IlmGetStatusParts { } } } -#[doc = "Builder for the [Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] +#[doc = "Builder for the [Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] #[derive(Clone, Debug)] pub struct IlmGetStatus<'a, 'b> { transport: &'a Transport, @@ -510,7 +510,7 @@ impl<'a, 'b> IlmGetStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the Ilm Get Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -555,7 +555,7 @@ impl IlmMigrateToDataTiersParts { } } } -#[doc = "Builder for the [Ilm Migrate To Data Tiers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-migrate-to-data-tiers.html)\n\nMigrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing"] +#[doc = "Builder for the [Ilm Migrate To Data Tiers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-migrate-to-data-tiers.html)\n\nMigrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing"] #[derive(Clone, Debug)] pub struct IlmMigrateToDataTiers<'a, 'b, B> { transport: &'a Transport, @@ -653,7 +653,7 @@ where #[doc = "Creates an asynchronous call to the Ilm Migrate To Data Tiers API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -707,7 +707,7 @@ impl<'b> IlmMoveToStepParts<'b> { } } } -#[doc = "Builder for the [Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] +#[doc = "Builder for the [Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] #[derive(Clone, Debug)] pub struct IlmMoveToStep<'a, 'b, B> { transport: &'a Transport, @@ -797,7 +797,7 @@ where #[doc = "Creates an asynchronous call to the Ilm Move To Step API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -849,7 +849,7 @@ impl<'b> IlmPutLifecycleParts<'b> { } } } -#[doc = "Builder for the [Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] +#[doc = "Builder for the [Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] #[derive(Clone, Debug)] pub struct IlmPutLifecycle<'a, 'b, B> { transport: &'a Transport, @@ -939,7 +939,7 @@ where #[doc = "Creates an asynchronous call to the Ilm Put Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -992,7 +992,7 @@ impl<'b> IlmRemovePolicyParts<'b> { } } } -#[doc = "Builder for the [Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] +#[doc = "Builder for the [Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] #[derive(Clone, Debug)] pub struct IlmRemovePolicy<'a, 'b, B> { transport: &'a Transport, @@ -1082,7 +1082,7 @@ where #[doc = "Creates an asynchronous call to the Ilm Remove Policy API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1135,7 +1135,7 @@ impl<'b> IlmRetryParts<'b> { } } } -#[doc = "Builder for the [Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] +#[doc = "Builder for the [Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] #[derive(Clone, Debug)] pub struct IlmRetry<'a, 'b, B> { transport: &'a Transport, @@ -1225,7 +1225,7 @@ where #[doc = "Creates an asynchronous call to the Ilm Retry API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1270,7 +1270,7 @@ impl IlmStartParts { } } } -#[doc = "Builder for the [Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] +#[doc = "Builder for the [Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] #[derive(Clone, Debug)] pub struct IlmStart<'a, 'b, B> { transport: &'a Transport, @@ -1360,7 +1360,7 @@ where #[doc = "Creates an asynchronous call to the Ilm Start API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1405,7 +1405,7 @@ impl IlmStopParts { } } } -#[doc = "Builder for the [Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] +#[doc = "Builder for the [Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] #[derive(Clone, Debug)] pub struct IlmStop<'a, 'b, B> { transport: &'a Transport, @@ -1495,7 +1495,7 @@ where #[doc = "Creates an asynchronous call to the Ilm Stop API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1538,59 +1538,59 @@ impl<'a> Ilm<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] + #[doc = "[Ilm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-delete-lifecycle.html)\n\nDeletes the specified lifecycle policy definition. A currently used policy cannot be deleted."] pub fn delete_lifecycle<'b>( &'a self, parts: IlmDeleteLifecycleParts<'b>, ) -> IlmDeleteLifecycle<'a, 'b> { IlmDeleteLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] + #[doc = "[Ilm Explain Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-explain-lifecycle.html)\n\nRetrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step."] pub fn explain_lifecycle<'b>( &'a self, parts: IlmExplainLifecycleParts<'b>, ) -> IlmExplainLifecycle<'a, 'b> { IlmExplainLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] + #[doc = "[Ilm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-get-lifecycle.html)\n\nReturns the specified policy definition. Includes the policy version and last modified date."] pub fn get_lifecycle<'b>(&'a self, parts: IlmGetLifecycleParts<'b>) -> IlmGetLifecycle<'a, 'b> { IlmGetLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] + #[doc = "[Ilm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-get-status.html)\n\nRetrieves the current index lifecycle management (ILM) status."] pub fn get_status<'b>(&'a self) -> IlmGetStatus<'a, 'b> { IlmGetStatus::new(self.transport()) } - #[doc = "[Ilm Migrate To Data Tiers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-migrate-to-data-tiers.html)\n\nMigrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing"] + #[doc = "[Ilm Migrate To Data Tiers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-migrate-to-data-tiers.html)\n\nMigrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing"] pub fn migrate_to_data_tiers<'b>(&'a self) -> IlmMigrateToDataTiers<'a, 'b, ()> { IlmMigrateToDataTiers::new(self.transport()) } - #[doc = "[Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] + #[doc = "[Ilm Move To Step API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-move-to-step.html)\n\nManually moves an index into the specified step and executes that step."] pub fn move_to_step<'b>(&'a self, parts: IlmMoveToStepParts<'b>) -> IlmMoveToStep<'a, 'b, ()> { IlmMoveToStep::new(self.transport(), parts) } - #[doc = "[Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] + #[doc = "[Ilm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-put-lifecycle.html)\n\nCreates a lifecycle policy"] pub fn put_lifecycle<'b>( &'a self, parts: IlmPutLifecycleParts<'b>, ) -> IlmPutLifecycle<'a, 'b, ()> { IlmPutLifecycle::new(self.transport(), parts) } - #[doc = "[Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] + #[doc = "[Ilm Remove Policy API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-remove-policy.html)\n\nRemoves the assigned lifecycle policy and stops managing the specified index"] pub fn remove_policy<'b>( &'a self, parts: IlmRemovePolicyParts<'b>, ) -> IlmRemovePolicy<'a, 'b, ()> { IlmRemovePolicy::new(self.transport(), parts) } - #[doc = "[Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] + #[doc = "[Ilm Retry API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-retry-policy.html)\n\nRetries executing the policy for an index that is in the ERROR step."] pub fn retry<'b>(&'a self, parts: IlmRetryParts<'b>) -> IlmRetry<'a, 'b, ()> { IlmRetry::new(self.transport(), parts) } - #[doc = "[Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] + #[doc = "[Ilm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-start.html)\n\nStart the index lifecycle management (ILM) plugin."] pub fn start<'b>(&'a self) -> IlmStart<'a, 'b, ()> { IlmStart::new(self.transport()) } - #[doc = "[Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] + #[doc = "[Ilm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-stop.html)\n\nHalts all lifecycle management operations and stops the index lifecycle management (ILM) plugin"] pub fn stop<'b>(&'a self) -> IlmStop<'a, 'b, ()> { IlmStop::new(self.transport()) } diff --git a/elasticsearch/src/indices.rs b/elasticsearch/src/indices.rs index d628ef0d..5c479810 100644 --- a/elasticsearch/src/indices.rs +++ b/elasticsearch/src/indices.rs @@ -34,11 +34,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -72,7 +72,7 @@ impl<'b> IndicesAddBlockParts<'b> { } } } -#[doc = "Builder for the [Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/index-modules-blocks.html)\n\nAdds a block to an index."] +#[doc = "Builder for the [Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index-modules-blocks.html)\n\nAdds a block to an index."] #[derive(Clone, Debug)] pub struct IndicesAddBlock<'a, 'b, B> { transport: &'a Transport, @@ -202,7 +202,7 @@ where #[doc = "Creates an asynchronous call to the Indices Add Block API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -269,7 +269,7 @@ impl<'b> IndicesAnalyzeParts<'b> { } } } -#[doc = "Builder for the [Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] +#[doc = "Builder for the [Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] #[derive(Clone, Debug)] pub struct IndicesAnalyze<'a, 'b, B> { transport: &'a Transport, @@ -368,8 +368,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -429,7 +429,7 @@ impl<'b> IndicesClearCacheParts<'b> { } } } -#[doc = "Builder for the [Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] +#[doc = "Builder for the [Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] #[derive(Clone, Debug)] pub struct IndicesClearCache<'a, 'b, B> { transport: &'a Transport, @@ -583,7 +583,7 @@ where #[doc = "Creates an asynchronous call to the Indices Clear Cache API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -659,7 +659,7 @@ impl<'b> IndicesCloneParts<'b> { } } } -#[doc = "Builder for the [Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-clone-index.html)\n\nClones an index"] +#[doc = "Builder for the [Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-clone-index.html)\n\nClones an index"] #[derive(Clone, Debug)] pub struct IndicesClone<'a, 'b, B> { transport: &'a Transport, @@ -773,7 +773,7 @@ where #[doc = "Creates an asynchronous call to the Indices Clone API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -833,7 +833,7 @@ impl<'b> IndicesCloseParts<'b> { } } } -#[doc = "Builder for the [Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-open-close.html)\n\nCloses an index."] +#[doc = "Builder for the [Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-open-close.html)\n\nCloses an index."] #[derive(Clone, Debug)] pub struct IndicesClose<'a, 'b, B> { transport: &'a Transport, @@ -971,7 +971,7 @@ where #[doc = "Creates an asynchronous call to the Indices Close API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1036,7 +1036,7 @@ impl<'b> IndicesCreateParts<'b> { } } } -#[doc = "Builder for the [Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-create-index.html)\n\nCreates an index with optional settings and mappings."] +#[doc = "Builder for the [Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-create-index.html)\n\nCreates an index with optional settings and mappings."] #[derive(Clone, Debug)] pub struct IndicesCreate<'a, 'b, B> { transport: &'a Transport, @@ -1150,7 +1150,7 @@ where #[doc = "Creates an asynchronous call to the Indices Create API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1207,7 +1207,7 @@ impl<'b> IndicesCreateDataStreamParts<'b> { } } } -#[doc = "Builder for the [Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nCreates a data stream"] +#[doc = "Builder for the [Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nCreates a data stream"] #[derive(Clone, Debug)] pub struct IndicesCreateDataStream<'a, 'b, B> { transport: &'a Transport, @@ -1297,7 +1297,7 @@ where #[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(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1354,7 +1354,7 @@ impl<'b> IndicesDataStreamsStatsParts<'b> { } } } -#[doc = "Builder for the [Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] +#[doc = "Builder for the [Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] #[derive(Clone, Debug)] pub struct IndicesDataStreamsStats<'a, 'b> { transport: &'a Transport, @@ -1421,7 +1421,7 @@ impl<'a, 'b> IndicesDataStreamsStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Data Streams Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1474,7 +1474,7 @@ impl<'b> IndicesDeleteParts<'b> { } } } -#[doc = "Builder for the [Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-delete-index.html)\n\nDeletes an index."] +#[doc = "Builder for the [Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-delete-index.html)\n\nDeletes an index."] #[derive(Clone, Debug)] pub struct IndicesDelete<'a, 'b> { transport: &'a Transport, @@ -1576,7 +1576,7 @@ impl<'a, 'b> IndicesDelete<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Delete API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1646,7 +1646,7 @@ impl<'b> IndicesDeleteAliasParts<'b> { } } } -#[doc = "Builder for the [Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nDeletes an alias."] +#[doc = "Builder for the [Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nDeletes an alias."] #[derive(Clone, Debug)] pub struct IndicesDeleteAlias<'a, 'b> { transport: &'a Transport, @@ -1727,7 +1727,7 @@ impl<'a, 'b> IndicesDeleteAlias<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Delete Alias API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1762,6 +1762,160 @@ impl<'a, 'b> IndicesDeleteAlias<'a, 'b> { Ok(response) } } +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[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> { + match self { + IndicesDeleteDataLifecycleParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(25usize + encoded_name.len()); + p.push_str("/_data_stream/"); + p.push_str(encoded_name.as_ref()); + p.push_str("/_lifecycle"); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Delete Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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, + parts: IndicesDeleteDataLifecycleParts<'b>, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + 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>, +} +#[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 { + let headers = HeaderMap::new(); + IndicesDeleteDataLifecycle { + transport, + parts, + headers, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: 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 = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + 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 = "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); + 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 = "Explicit timestamp for the document"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Indices Delete Data Lifecycle 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")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + #[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, + expand_wildcards: self.expand_wildcards, + 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) + }; + 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)] #[doc = "API parts for the Indices Delete Data Stream API"] pub enum IndicesDeleteDataStreamParts<'b> { @@ -1784,7 +1938,7 @@ impl<'b> IndicesDeleteDataStreamParts<'b> { } } } -#[doc = "Builder for the [Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nDeletes a data stream."] +#[doc = "Builder for the [Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nDeletes a data stream."] #[derive(Clone, Debug)] pub struct IndicesDeleteDataStream<'a, 'b> { transport: &'a Transport, @@ -1858,7 +2012,7 @@ impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Delete Data Stream API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1912,7 +2066,7 @@ impl<'b> IndicesDeleteIndexTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Delete Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nDeletes an index template."] +#[doc = "Builder for the [Indices Delete Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-delete-template.html)\n\nDeletes an index template."] #[derive(Clone, Debug)] pub struct IndicesDeleteIndexTemplate<'a, 'b> { transport: &'a Transport, @@ -1993,7 +2147,7 @@ impl<'a, 'b> IndicesDeleteIndexTemplate<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Delete Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2048,7 +2202,7 @@ impl<'b> IndicesDeleteTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nDeletes an index template."] +#[doc = "Builder for the [Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-delete-template-v1.html)\n\nDeletes an index template."] #[derive(Clone, Debug)] pub struct IndicesDeleteTemplate<'a, 'b> { transport: &'a Transport, @@ -2129,7 +2283,7 @@ impl<'a, 'b> IndicesDeleteTemplate<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Delete Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2188,7 +2342,7 @@ impl<'b> IndicesDiskUsageParts<'b> { } } } -#[doc = "Builder for the [Indices Disk Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-disk-usage.html)\n\nAnalyzes the disk usage of each field of an index or data stream"] +#[doc = "Builder for the [Indices Disk Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-disk-usage.html)\n\nAnalyzes the disk usage of each field of an index or data stream"] #[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)] @@ -2321,7 +2475,7 @@ where #[doc = "Creates an asynchronous call to the Indices Disk Usage API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2363,6 +2517,159 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Downsample API"] +pub enum IndicesDownsampleParts<'b> { + #[doc = "Index and TargetIndex"] + IndexTargetIndex(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> IndicesDownsampleParts<'b> { + #[doc = "Builds a relative URL path to the Indices Downsample API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesDownsampleParts::IndexTargetIndex(ref index, ref target_index) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let encoded_target_index: Cow = + percent_encode(target_index.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 14usize + encoded_index.len() + encoded_target_index.len(), + ); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_downsample/"); + p.push_str(encoded_target_index.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Downsample API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/xpack-rollup.html)\n\nDownsample an index"] +#[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 IndicesDownsample<'a, 'b, B> { + transport: &'a Transport, + parts: IndicesDownsampleParts<'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> IndicesDownsample<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesDownsample] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesDownsampleParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesDownsample { + 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) -> IndicesDownsample<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesDownsample { + 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 Indices Downsample 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) + } +} #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Indices Exists API"] pub enum IndicesExistsParts<'b> { @@ -2385,7 +2692,7 @@ impl<'b> IndicesExistsParts<'b> { } } } -#[doc = "Builder for the [Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-exists.html)\n\nReturns information about whether a particular index exists."] +#[doc = "Builder for the [Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-exists.html)\n\nReturns information about whether a particular index exists."] #[derive(Clone, Debug)] pub struct IndicesExists<'a, 'b> { transport: &'a Transport, @@ -2494,7 +2801,7 @@ impl<'a, 'b> IndicesExists<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Exists API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Head; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2577,7 +2884,7 @@ impl<'b> IndicesExistsAliasParts<'b> { } } } -#[doc = "Builder for the [Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] +#[doc = "Builder for the [Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] #[derive(Clone, Debug)] pub struct IndicesExistsAlias<'a, 'b> { transport: &'a Transport, @@ -2672,7 +2979,7 @@ impl<'a, 'b> IndicesExistsAlias<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Exists Alias API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Head; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2732,7 +3039,7 @@ impl<'b> IndicesExistsIndexTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Exists Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns information about whether a particular index template exists."] +#[doc = "Builder for the [Indices Exists Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index-templates.html)\n\nReturns information about whether a particular index template exists."] #[derive(Clone, Debug)] pub struct IndicesExistsIndexTemplate<'a, 'b> { transport: &'a Transport, @@ -2752,7 +3059,154 @@ impl<'a, 'b> IndicesExistsIndexTemplate<'a, 'b> { #[doc = "Creates a new instance of [IndicesExistsIndexTemplate] with the specified API parts"] pub fn new(transport: &'a Transport, parts: IndicesExistsIndexTemplateParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesExistsIndexTemplate { + IndicesExistsIndexTemplate { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + flat_settings: None, + human: None, + local: None, + master_timeout: 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 = "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); + self + } + #[doc = "Return human readable values for statistics."] + pub fn human(mut self, human: bool) -> Self { + self.human = Some(human); + self + } + #[doc = "Return local information, do not retrieve the state from master node (default: false)"] + pub fn local(mut self, local: bool) -> Self { + 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 = "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 Indices Exists Index Template API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = http::Method::Head; + 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]>, + flat_settings: Option, + human: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + flat_settings: self.flat_settings, + human: self.human, + local: self.local, + master_timeout: self.master_timeout, + 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)] +#[doc = "API parts for the Indices Exists Template API"] +pub enum IndicesExistsTemplateParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), +} +impl<'b> IndicesExistsTemplateParts<'b> { + #[doc = "Builds a relative URL path to the Indices Exists Template API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesExistsTemplateParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_name.len()); + p.push_str("/_template/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-template-exists-v1.html)\n\nReturns information about whether a particular index template exists."] +#[derive(Clone, Debug)] +pub struct IndicesExistsTemplate<'a, 'b> { + transport: &'a Transport, + parts: IndicesExistsTemplateParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + flat_settings: Option, + headers: HeaderMap, + human: Option, + local: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { + #[doc = "Creates a new instance of [IndicesExistsTemplate] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesExistsTemplateParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesExistsTemplate { transport, parts, headers, @@ -2817,10 +3271,10 @@ impl<'a, 'b> IndicesExistsIndexTemplate<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Exists Index Template API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Exists Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Head; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2857,57 +3311,60 @@ impl<'a, 'b> IndicesExistsIndexTemplate<'a, 'b> { Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Exists Template API"] -pub enum IndicesExistsTemplateParts<'b> { - #[doc = "Name"] - Name(&'b [&'b str]), +#[doc = "API parts for the Indices Explain Data Lifecycle API"] +pub enum IndicesExplainDataLifecycleParts<'b> { + #[doc = "Index"] + Index(&'b str), } -impl<'b> IndicesExistsTemplateParts<'b> { - #[doc = "Builds a relative URL path to the Indices Exists Template API"] +#[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> { match self { - IndicesExistsTemplateParts::Name(ref name) => { - let name_str = name.join(","); - let encoded_name: Cow = - percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(11usize + encoded_name.len()); - p.push_str("/_template/"); - p.push_str(encoded_name.as_ref()); + IndicesExplainDataLifecycleParts::Index(ref index) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(20usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_lifecycle/explain"); p.into() } } } } -#[doc = "Builder for the [Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns information about whether a particular index template exists."] +#[doc = "Builder for the [Indices Explain Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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 IndicesExistsTemplate<'a, 'b> { +pub struct IndicesExplainDataLifecycle<'a, 'b> { transport: &'a Transport, - parts: IndicesExistsTemplateParts<'b>, + parts: IndicesExplainDataLifecycleParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, - flat_settings: Option, headers: HeaderMap, human: Option, - local: Option, + include_defaults: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { - #[doc = "Creates a new instance of [IndicesExistsTemplate] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesExistsTemplateParts<'b>) -> Self { +#[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 { let headers = HeaderMap::new(); - IndicesExistsTemplate { + IndicesExplainDataLifecycle { transport, parts, headers, error_trace: None, filter_path: None, - flat_settings: None, human: None, - local: None, + include_defaults: None, master_timeout: None, pretty: None, request_timeout: None, @@ -2924,11 +3381,6 @@ impl<'a, 'b> IndicesExistsTemplate<'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); @@ -2939,12 +3391,12 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { self.human = Some(human); self } - #[doc = "Return local information, do not retrieve the state from master node (default: false)"] - pub fn local(mut self, local: bool) -> Self { - self.local = Some(local); + #[doc = "indicates if the API should return the default values the system uses for the index's lifecycle"] + pub fn include_defaults(mut self, include_defaults: bool) -> Self { + self.include_defaults = Some(include_defaults); self } - #[doc = "Explicit operation timeout for connection to master node"] + #[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 @@ -2964,10 +3416,10 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Exists Template API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Explain Data Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2977,9 +3429,8 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - flat_settings: Option, human: Option, - local: Option, + include_defaults: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, @@ -2987,9 +3438,8 @@ impl<'a, 'b> IndicesExistsTemplate<'a, 'b> { let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, - flat_settings: self.flat_settings, human: self.human, - local: self.local, + include_defaults: self.include_defaults, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, @@ -3028,7 +3478,7 @@ impl<'b> IndicesFieldUsageStatsParts<'b> { } } } -#[doc = "Builder for the [Indices Field Usage Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/field-usage-stats.html)\n\nReturns the field usage stats for each field of an index"] +#[doc = "Builder for the [Indices Field Usage Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/field-usage-stats.html)\n\nReturns the field usage stats for each field of an index"] #[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)] @@ -3126,7 +3576,7 @@ impl<'a, 'b> IndicesFieldUsageStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Field Usage Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3193,7 +3643,7 @@ impl<'b> IndicesFlushParts<'b> { } } } -#[doc = "Builder for the [Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] +#[doc = "Builder for the [Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] #[derive(Clone, Debug)] pub struct IndicesFlush<'a, 'b, B> { transport: &'a Transport, @@ -3324,8 +3774,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -3394,7 +3844,7 @@ impl<'b> IndicesForcemergeParts<'b> { } } } -#[doc = "Builder for the [Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] +#[doc = "Builder for the [Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] #[derive(Clone, Debug)] pub struct IndicesForcemerge<'a, 'b, B> { transport: &'a Transport, @@ -3540,7 +3990,7 @@ where #[doc = "Creates an asynchronous call to the Indices Forcemerge API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3608,7 +4058,7 @@ impl<'b> IndicesGetParts<'b> { } } } -#[doc = "Builder for the [Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-index.html)\n\nReturns information about one or more indices."] +#[doc = "Builder for the [Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-index.html)\n\nReturns information about one or more indices."] #[derive(Clone, Debug)] pub struct IndicesGet<'a, 'b> { transport: &'a Transport, @@ -3728,10 +4178,207 @@ impl<'a, 'b> IndicesGet<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Get API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Get 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> { + allow_no_indices: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + expand_wildcards: Option<&'b [ExpandWildcards]>, + features: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + flat_settings: Option, + human: Option, + ignore_unavailable: Option, + include_defaults: Option, + local: Option, + master_timeout: Option<&'b str>, + 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, + features: self.features, + filter_path: self.filter_path, + flat_settings: self.flat_settings, + human: self.human, + ignore_unavailable: self.ignore_unavailable, + include_defaults: self.include_defaults, + local: self.local, + master_timeout: self.master_timeout, + 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)] +#[doc = "API parts for the Indices Get Alias API"] +pub enum IndicesGetAliasParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Name"] + Name(&'b [&'b str]), + #[doc = "Index and Name"] + IndexName(&'b [&'b str], &'b [&'b str]), + #[doc = "Index"] + Index(&'b [&'b str]), +} +impl<'b> IndicesGetAliasParts<'b> { + #[doc = "Builds a relative URL path to the Indices Get Alias API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesGetAliasParts::None => "/_alias".into(), + IndicesGetAliasParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(8usize + encoded_name.len()); + p.push_str("/_alias/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + IndicesGetAliasParts::IndexName(ref index, ref name) => { + let index_str = index.join(","); + let name_str = name.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(9usize + encoded_index.len() + encoded_name.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_alias/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + IndicesGetAliasParts::Index(ref index) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(8usize + encoded_index.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_alias"); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nReturns an alias."] +#[derive(Clone, Debug)] +pub struct IndicesGetAlias<'a, 'b> { + transport: &'a Transport, + parts: IndicesGetAliasParts<'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, + local: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> IndicesGetAlias<'a, 'b> { + #[doc = "Creates a new instance of [IndicesGetAlias] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesGetAliasParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesGetAlias { + transport, + parts, + headers, + allow_no_indices: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_unavailable: None, + local: 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); + self + } + #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + 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 = "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 = "Return local information, do not retrieve the state from master node (default: false)"] + pub fn local(mut self, local: bool) -> Self { + self.local = Some(local); + 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 Indices Get Alias API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3742,15 +4389,11 @@ impl<'a, 'b> IndicesGet<'a, 'b> { error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] expand_wildcards: Option<&'b [ExpandWildcards]>, - features: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, - flat_settings: Option, human: Option, ignore_unavailable: Option, - include_defaults: Option, local: Option, - master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, } @@ -3758,14 +4401,10 @@ impl<'a, 'b> IndicesGet<'a, 'b> { allow_no_indices: self.allow_no_indices, error_trace: self.error_trace, expand_wildcards: self.expand_wildcards, - features: self.features, filter_path: self.filter_path, - flat_settings: self.flat_settings, human: self.human, ignore_unavailable: self.ignore_unavailable, - include_defaults: self.include_defaults, local: self.local, - master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -3779,108 +4418,73 @@ impl<'a, 'b> IndicesGet<'a, 'b> { Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Get Alias API"] -pub enum IndicesGetAliasParts<'b> { - #[doc = "No parts"] - None, +#[doc = "API parts for the Indices Get Data Lifecycle API"] +pub enum IndicesGetDataLifecycleParts<'b> { #[doc = "Name"] Name(&'b [&'b str]), - #[doc = "Index and Name"] - IndexName(&'b [&'b str], &'b [&'b str]), - #[doc = "Index"] - Index(&'b [&'b str]), } -impl<'b> IndicesGetAliasParts<'b> { - #[doc = "Builds a relative URL path to the Indices Get Alias API"] +#[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> { match self { - IndicesGetAliasParts::None => "/_alias".into(), - IndicesGetAliasParts::Name(ref name) => { - let name_str = name.join(","); - let encoded_name: Cow = - percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(8usize + encoded_name.len()); - p.push_str("/_alias/"); - p.push_str(encoded_name.as_ref()); - p.into() - } - IndicesGetAliasParts::IndexName(ref index, ref name) => { - let index_str = index.join(","); + IndicesGetDataLifecycleParts::Name(ref name) => { let name_str = name.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); let encoded_name: Cow = percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(9usize + encoded_index.len() + encoded_name.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_alias/"); + let mut p = String::with_capacity(25usize + encoded_name.len()); + p.push_str("/_data_stream/"); p.push_str(encoded_name.as_ref()); - p.into() - } - IndicesGetAliasParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(8usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_alias"); + p.push_str("/_lifecycle"); p.into() } } } } -#[doc = "Builder for the [Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nReturns an alias."] +#[doc = "Builder for the [Indices Get Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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 IndicesGetAlias<'a, 'b> { +pub struct IndicesGetDataLifecycle<'a, 'b> { transport: &'a Transport, - parts: IndicesGetAliasParts<'b>, - allow_no_indices: Option, + parts: IndicesGetDataLifecycleParts<'b>, error_trace: Option, expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - ignore_unavailable: Option, - local: Option, + include_defaults: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> IndicesGetAlias<'a, 'b> { - #[doc = "Creates a new instance of [IndicesGetAlias] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesGetAliasParts<'b>) -> Self { +#[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 { let headers = HeaderMap::new(); - IndicesGetAlias { + IndicesGetDataLifecycle { transport, parts, headers, - allow_no_indices: None, error_trace: None, expand_wildcards: None, filter_path: None, human: None, - ignore_unavailable: None, - local: None, + include_defaults: 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); self } - #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."] + #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"] pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { self.expand_wildcards = Some(expand_wildcards); self @@ -3900,14 +4504,9 @@ impl<'a, 'b> IndicesGetAlias<'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 = "Return local information, do not retrieve the state from master node (default: false)"] - pub fn local(mut self, local: bool) -> Self { - self.local = Some(local); + #[doc = "Return all relevant default configurations for the data stream (default: false)"] + pub fn include_defaults(mut self, include_defaults: bool) -> Self { + self.include_defaults = Some(include_defaults); self } #[doc = "Pretty format the returned JSON response."] @@ -3925,36 +4524,32 @@ impl<'a, 'b> IndicesGetAlias<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Get Alias API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Get Data Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + 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> { - 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, - local: Option, + include_defaults: 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, - local: self.local, + include_defaults: self.include_defaults, pretty: self.pretty, source: self.source, }; @@ -3993,7 +4588,7 @@ impl<'b> IndicesGetDataStreamParts<'b> { } } } -#[doc = "Builder for the [Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nReturns data streams."] +#[doc = "Builder for the [Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nReturns data streams."] #[derive(Clone, Debug)] pub struct IndicesGetDataStream<'a, 'b> { transport: &'a Transport, @@ -4003,6 +4598,7 @@ pub struct IndicesGetDataStream<'a, 'b> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + include_defaults: Option, pretty: Option, request_timeout: Option, source: Option<&'b str>, @@ -4019,6 +4615,7 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { expand_wildcards: None, filter_path: None, human: None, + include_defaults: None, pretty: None, request_timeout: None, source: None, @@ -4049,6 +4646,11 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { self.human = Some(human); self } + #[doc = "Return all relevant default configurations for the data stream (default: false)"] + pub fn include_defaults(mut self, include_defaults: bool) -> Self { + self.include_defaults = Some(include_defaults); + self + } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); @@ -4067,7 +4669,7 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { #[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(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4080,6 +4682,7 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + include_defaults: Option, pretty: Option, source: Option<&'b str>, } @@ -4088,6 +4691,7 @@ impl<'a, 'b> IndicesGetDataStream<'a, 'b> { expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, + include_defaults: self.include_defaults, pretty: self.pretty, source: self.source, }; @@ -4140,7 +4744,7 @@ impl<'b> IndicesGetFieldMappingParts<'b> { } } } -#[doc = "Builder for the [Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] +#[doc = "Builder for the [Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] #[derive(Clone, Debug)] pub struct IndicesGetFieldMapping<'a, 'b> { transport: &'a Transport, @@ -4242,7 +4846,7 @@ impl<'a, 'b> IndicesGetFieldMapping<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Get Field Mapping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4307,7 +4911,7 @@ impl<'b> IndicesGetIndexTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Get Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns an index template."] +#[doc = "Builder for the [Indices Get Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-template.html)\n\nReturns an index template."] #[derive(Clone, Debug)] pub struct IndicesGetIndexTemplate<'a, 'b> { transport: &'a Transport, @@ -4317,6 +4921,7 @@ pub struct IndicesGetIndexTemplate<'a, 'b> { flat_settings: Option, headers: HeaderMap, human: Option, + include_defaults: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -4335,6 +4940,7 @@ impl<'a, 'b> IndicesGetIndexTemplate<'a, 'b> { filter_path: None, flat_settings: None, human: None, + include_defaults: None, local: None, master_timeout: None, pretty: None, @@ -4367,6 +4973,11 @@ impl<'a, 'b> IndicesGetIndexTemplate<'a, 'b> { self.human = Some(human); self } + #[doc = "Return all relevant default configurations for the index template (default: false)"] + pub fn include_defaults(mut self, include_defaults: bool) -> Self { + self.include_defaults = Some(include_defaults); + self + } #[doc = "Return local information, do not retrieve the state from master node (default: false)"] pub fn local(mut self, local: bool) -> Self { self.local = Some(local); @@ -4395,7 +5006,7 @@ impl<'a, 'b> IndicesGetIndexTemplate<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Get Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4407,6 +5018,7 @@ impl<'a, 'b> IndicesGetIndexTemplate<'a, 'b> { filter_path: Option<&'b [&'b str]>, flat_settings: Option, human: Option, + include_defaults: Option, local: Option, master_timeout: Option<&'b str>, pretty: Option, @@ -4417,6 +5029,7 @@ impl<'a, 'b> IndicesGetIndexTemplate<'a, 'b> { filter_path: self.filter_path, flat_settings: self.flat_settings, human: self.human, + include_defaults: self.include_defaults, local: self.local, master_timeout: self.master_timeout, pretty: self.pretty, @@ -4458,7 +5071,7 @@ impl<'b> IndicesGetMappingParts<'b> { } } } -#[doc = "Builder for the [Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] +#[doc = "Builder for the [Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] #[derive(Clone, Debug)] pub struct IndicesGetMapping<'a, 'b> { transport: &'a Transport, @@ -4560,7 +5173,7 @@ impl<'a, 'b> IndicesGetMapping<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Get Mapping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4656,7 +5269,7 @@ impl<'b> IndicesGetSettingsParts<'b> { } } } -#[doc = "Builder for the [Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-settings.html)\n\nReturns settings for one or more indices."] +#[doc = "Builder for the [Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-settings.html)\n\nReturns settings for one or more indices."] #[derive(Clone, Debug)] pub struct IndicesGetSettings<'a, 'b> { transport: &'a Transport, @@ -4772,7 +5385,7 @@ impl<'a, 'b> IndicesGetSettings<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Get Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4843,7 +5456,7 @@ impl<'b> IndicesGetTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns an index template."] +#[doc = "Builder for the [Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-template-v1.html)\n\nReturns an index template."] #[derive(Clone, Debug)] pub struct IndicesGetTemplate<'a, 'b> { transport: &'a Transport, @@ -4931,7 +5544,7 @@ impl<'a, 'b> IndicesGetTemplate<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Get Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4988,7 +5601,7 @@ impl<'b> IndicesMigrateToDataStreamParts<'b> { } } } -#[doc = "Builder for the [Indices Migrate To Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nMigrates an alias to a data stream"] +#[doc = "Builder for the [Indices Migrate To Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nMigrates an alias to a data stream"] #[derive(Clone, Debug)] pub struct IndicesMigrateToDataStream<'a, 'b, B> { transport: &'a Transport, @@ -5078,7 +5691,7 @@ where #[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(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5123,7 +5736,7 @@ impl IndicesModifyDataStreamParts { } } } -#[doc = "Builder for the [Indices Modify Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nModifies a data stream"] +#[doc = "Builder for the [Indices Modify Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nModifies a data stream"] #[derive(Clone, Debug)] pub struct IndicesModifyDataStream<'a, 'b, B> { transport: &'a Transport, @@ -5213,7 +5826,7 @@ where #[doc = "Creates an asynchronous call to the Indices Modify Data Stream API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5267,7 +5880,7 @@ impl<'b> IndicesOpenParts<'b> { } } } -#[doc = "Builder for the [Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-open-close.html)\n\nOpens an index."] +#[doc = "Builder for the [Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-open-close.html)\n\nOpens an index."] #[derive(Clone, Debug)] pub struct IndicesOpen<'a, 'b, B> { transport: &'a Transport, @@ -5405,7 +6018,7 @@ where #[doc = "Creates an asynchronous call to the Indices Open API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5469,7 +6082,7 @@ impl<'b> IndicesPromoteDataStreamParts<'b> { } } } -#[doc = "Builder for the [Indices Promote Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"] +#[doc = "Builder for the [Indices Promote Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"] #[derive(Clone, Debug)] pub struct IndicesPromoteDataStream<'a, 'b, B> { transport: &'a Transport, @@ -5490,7 +6103,156 @@ where #[doc = "Creates a new instance of [IndicesPromoteDataStream] with the specified API parts"] pub fn new(transport: &'a Transport, parts: IndicesPromoteDataStreamParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesPromoteDataStream { + IndicesPromoteDataStream { + 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) -> IndicesPromoteDataStream<'a, 'b, JsonBody> + where + T: Serialize, + { + IndicesPromoteDataStream { + 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 Indices Promote Data Stream 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) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Put Alias API"] +pub enum IndicesPutAliasParts<'b> { + #[doc = "Index and Name"] + IndexName(&'b [&'b str], &'b str), +} +impl<'b> IndicesPutAliasParts<'b> { + #[doc = "Builds a relative URL path to the Indices Put Alias API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesPutAliasParts::IndexName(ref index, ref name) => { + let index_str = index.join(","); + let encoded_index: Cow = + percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(9usize + encoded_index.len() + encoded_name.len()); + p.push_str("/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_alias/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nCreates or updates an alias."] +#[derive(Clone, Debug)] +pub struct IndicesPutAlias<'a, 'b, B> { + transport: &'a Transport, + parts: IndicesPutAliasParts<'b>, + body: Option, + error_trace: Option, + 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> IndicesPutAlias<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IndicesPutAlias] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPutAliasParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesPutAlias { transport, parts, headers, @@ -5498,17 +6260,19 @@ 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"] - pub fn body(self, body: T) -> IndicesPromoteDataStream<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesPutAlias<'a, 'b, JsonBody> where T: Serialize, { - IndicesPromoteDataStream { + IndicesPutAlias { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5516,9 +6280,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."] @@ -5541,6 +6307,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); @@ -5556,10 +6327,15 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Indices Promote Data Stream API that can be awaited"] + #[doc = "Explicit timestamp for the document"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Indices Put Alias API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5570,15 +6346,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) }; @@ -5590,39 +6370,41 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Indices Put Alias API"] -pub enum IndicesPutAliasParts<'b> { - #[doc = "Index and Name"] - IndexName(&'b [&'b str], &'b str), +#[doc = "API parts for the Indices Put Data Lifecycle API"] +pub enum IndicesPutDataLifecycleParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), } -impl<'b> IndicesPutAliasParts<'b> { - #[doc = "Builds a relative URL path to the Indices Put Alias API"] +#[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> { match self { - IndicesPutAliasParts::IndexName(ref index, ref name) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(9usize + encoded_index.len() + encoded_name.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_alias/"); + IndicesPutDataLifecycleParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(25usize + encoded_name.len()); + p.push_str("/_data_stream/"); p.push_str(encoded_name.as_ref()); + p.push_str("/_lifecycle"); p.into() } } } } -#[doc = "Builder for the [Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nCreates or updates an alias."] +#[doc = "Builder for the [Indices Put Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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 IndicesPutAlias<'a, 'b, B> { +pub struct IndicesPutDataLifecycle<'a, 'b, B> { transport: &'a Transport, - parts: IndicesPutAliasParts<'b>, + parts: IndicesPutDataLifecycleParts<'b>, body: Option, error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, @@ -5632,19 +6414,21 @@ pub struct IndicesPutAlias<'a, 'b, B> { source: Option<&'b str>, timeout: Option<&'b str>, } -impl<'a, 'b, B> IndicesPutAlias<'a, 'b, B> +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> IndicesPutDataLifecycle<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [IndicesPutAlias] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: IndicesPutAliasParts<'b>) -> Self { + #[doc = "Creates a new instance of [IndicesPutDataLifecycle] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesPutDataLifecycleParts<'b>) -> Self { let headers = HeaderMap::new(); - IndicesPutAlias { + IndicesPutDataLifecycle { transport, parts, headers, body: None, error_trace: None, + expand_wildcards: None, filter_path: None, human: None, master_timeout: None, @@ -5655,15 +6439,16 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> IndicesPutAlias<'a, 'b, JsonBody> + pub fn body(self, body: T) -> IndicesPutDataLifecycle<'a, 'b, JsonBody> where T: Serialize, { - IndicesPutAlias { + IndicesPutDataLifecycle { transport: self.transport, parts: self.parts, body: Some(body.into()), error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, headers: self.headers, human: self.human, @@ -5679,6 +6464,11 @@ where self.error_trace = Some(error_trace); self } + #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + 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); @@ -5719,10 +6509,10 @@ where self.timeout = Some(timeout); self } - #[doc = "Creates an asynchronous call to the Indices Put Alias API that can be awaited"] + #[doc = "Creates an asynchronous call to the Indices Put Data Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5731,6 +6521,8 @@ where struct QueryParams<'b> { 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, master_timeout: Option<&'b str>, @@ -5740,6 +6532,7 @@ where } let query_params = QueryParams { error_trace: self.error_trace, + expand_wildcards: self.expand_wildcards, filter_path: self.filter_path, human: self.human, master_timeout: self.master_timeout, @@ -5777,7 +6570,7 @@ impl<'b> IndicesPutIndexTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Put Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nCreates or updates an index template."] +#[doc = "Builder for the [Indices Put Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-put-template.html)\n\nCreates or updates an index template."] #[derive(Clone, Debug)] pub struct IndicesPutIndexTemplate<'a, 'b, B> { transport: &'a Transport, @@ -5891,7 +6684,7 @@ where #[doc = "Creates an asynchronous call to the Indices Put Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5951,7 +6744,7 @@ impl<'b> IndicesPutMappingParts<'b> { } } } -#[doc = "Builder for the [Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-put-mapping.html)\n\nUpdates the index mappings."] +#[doc = "Builder for the [Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-put-mapping.html)\n\nUpdates the index mappings."] #[derive(Clone, Debug)] pub struct IndicesPutMapping<'a, 'b, B> { transport: &'a Transport, @@ -6089,7 +6882,7 @@ where #[doc = "Creates an asynchronous call to the Indices Put Mapping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6159,7 +6952,7 @@ impl<'b> IndicesPutSettingsParts<'b> { } } } -#[doc = "Builder for the [Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-update-settings.html)\n\nUpdates the index settings."] +#[doc = "Builder for the [Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-update-settings.html)\n\nUpdates the index settings."] #[derive(Clone, Debug)] pub struct IndicesPutSettings<'a, 'b, B> { transport: &'a Transport, @@ -6176,6 +6969,7 @@ pub struct IndicesPutSettings<'a, 'b, B> { master_timeout: Option<&'b str>, preserve_existing: Option, pretty: Option, + reopen: Option, request_timeout: Option, source: Option<&'b str>, timeout: Option<&'b str>, @@ -6202,6 +6996,7 @@ where master_timeout: None, preserve_existing: None, pretty: None, + reopen: None, request_timeout: None, source: None, timeout: None, @@ -6232,6 +7027,7 @@ where master_timeout: self.master_timeout, preserve_existing: self.preserve_existing, pretty: self.pretty, + reopen: self.reopen, request_timeout: self.request_timeout, source: self.source, timeout: self.timeout, @@ -6287,6 +7083,11 @@ where self.pretty = Some(pretty); self } + #[doc = "Whether to close and reopen the index to apply non-dynamic settings. If set to `true` the indices to which the settings are being applied will be closed temporarily and then reopened in order to apply the changes. The default is `false`"] + pub fn reopen(mut self, reopen: bool) -> Self { + self.reopen = Some(reopen); + 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); @@ -6305,7 +7106,7 @@ where #[doc = "Creates an asynchronous call to the Indices Put Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6324,6 +7125,7 @@ where master_timeout: Option<&'b str>, preserve_existing: Option, pretty: Option, + reopen: Option, source: Option<&'b str>, timeout: Option<&'b str>, } @@ -6338,6 +7140,7 @@ where master_timeout: self.master_timeout, preserve_existing: self.preserve_existing, pretty: self.pretty, + reopen: self.reopen, source: self.source, timeout: self.timeout, }; @@ -6371,7 +7174,7 @@ impl<'b> IndicesPutTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nCreates or updates an index template."] +#[doc = "Builder for the [Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-templates-v1.html)\n\nCreates or updates an index template."] #[derive(Clone, Debug)] pub struct IndicesPutTemplate<'a, 'b, B> { transport: &'a Transport, @@ -6485,7 +7288,7 @@ where #[doc = "Creates an asynchronous call to the Indices Put Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6548,7 +7351,7 @@ impl<'b> IndicesRecoveryParts<'b> { } } } -#[doc = "Builder for the [Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] +#[doc = "Builder for the [Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] #[derive(Clone, Debug)] pub struct IndicesRecovery<'a, 'b> { transport: &'a Transport, @@ -6629,7 +7432,7 @@ impl<'a, 'b> IndicesRecovery<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Recovery API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6690,7 +7493,7 @@ impl<'b> IndicesRefreshParts<'b> { } } } -#[doc = "Builder for the [Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] +#[doc = "Builder for the [Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] #[derive(Clone, Debug)] pub struct IndicesRefresh<'a, 'b, B> { transport: &'a Transport, @@ -6805,8 +7608,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -6868,7 +7671,7 @@ impl<'b> IndicesReloadSearchAnalyzersParts<'b> { } } } -#[doc = "Builder for the [Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] +#[doc = "Builder for the [Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] #[derive(Clone, Debug)] pub struct IndicesReloadSearchAnalyzers<'a, 'b, B> { transport: &'a Transport, @@ -6883,6 +7686,7 @@ pub struct IndicesReloadSearchAnalyzers<'a, 'b, B> { ignore_unavailable: Option, pretty: Option, request_timeout: Option, + resource: Option<&'b str>, source: Option<&'b str>, } impl<'a, 'b, B> IndicesReloadSearchAnalyzers<'a, 'b, B> @@ -6905,6 +7709,7 @@ where ignore_unavailable: None, pretty: None, request_timeout: None, + resource: None, source: None, } } @@ -6931,6 +7736,7 @@ where ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, request_timeout: self.request_timeout, + resource: self.resource, source: self.source, } } @@ -6974,6 +7780,11 @@ where self.request_timeout = Some(timeout); self } + #[doc = "changed resource to reload analyzers from if applicable"] + pub fn resource(mut self, resource: &'b str) -> Self { + self.resource = Some(resource); + 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); @@ -6983,8 +7794,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -7001,6 +7812,7 @@ where human: Option, ignore_unavailable: Option, pretty: Option, + resource: Option<&'b str>, source: Option<&'b str>, } let query_params = QueryParams { @@ -7011,6 +7823,7 @@ where human: self.human, ignore_unavailable: self.ignore_unavailable, pretty: self.pretty, + resource: self.resource, source: self.source, }; Some(query_params) @@ -7024,6 +7837,163 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Indices Resolve Cluster API"] +pub enum IndicesResolveClusterParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), +} +impl<'b> IndicesResolveClusterParts<'b> { + #[doc = "Builds a relative URL path to the Indices Resolve Cluster API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IndicesResolveClusterParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(18usize + encoded_name.len()); + p.push_str("/_resolve/cluster/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Indices Resolve Cluster API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-resolve-cluster-api.html)\n\nResolves the specified index expressions to return information about each cluster, including the local cluster, if included."] +#[derive(Clone, Debug)] +pub struct IndicesResolveCluster<'a, 'b> { + transport: &'a Transport, + parts: IndicesResolveClusterParts<'b>, + allow_no_indices: Option, + error_trace: Option, + expand_wildcards: Option<&'b [ExpandWildcards]>, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + ignore_throttled: Option, + ignore_unavailable: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> IndicesResolveCluster<'a, 'b> { + #[doc = "Creates a new instance of [IndicesResolveCluster] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IndicesResolveClusterParts<'b>) -> Self { + let headers = HeaderMap::new(); + IndicesResolveCluster { + transport, + parts, + headers, + allow_no_indices: None, + error_trace: None, + expand_wildcards: None, + filter_path: None, + human: None, + ignore_throttled: 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); + self + } + #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"] + pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self { + self.expand_wildcards = Some(expand_wildcards); + 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 = "Whether specified concrete, expanded or aliased indices should be ignored when throttled"] + pub fn ignore_throttled(mut self, ignore_throttled: bool) -> Self { + self.ignore_throttled = Some(ignore_throttled); + 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); + 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 Indices Resolve Cluster 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> { + 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_throttled: 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_throttled: self.ignore_throttled, + ignore_unavailable: self.ignore_unavailable, + 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)] #[doc = "API parts for the Indices Resolve Index API"] pub enum IndicesResolveIndexParts<'b> { #[doc = "Name"] @@ -7045,7 +8015,7 @@ impl<'b> IndicesResolveIndexParts<'b> { } } } -#[doc = "Builder for the [Indices Resolve Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-resolve-index-api.html)\n\nReturns information about any matching indices, aliases, and data streams"] +#[doc = "Builder for the [Indices Resolve Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-resolve-index-api.html)\n\nReturns information about any matching indices, aliases, and data streams"] #[derive(Clone, Debug)] pub struct IndicesResolveIndex<'a, 'b> { transport: &'a Transport, @@ -7119,7 +8089,7 @@ impl<'a, 'b> IndicesResolveIndex<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Resolve Index API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7190,7 +8160,7 @@ impl<'b> IndicesRolloverParts<'b> { } } } -#[doc = "Builder for the [Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] +#[doc = "Builder for the [Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] #[derive(Clone, Debug)] pub struct IndicesRollover<'a, 'b, B> { transport: &'a Transport, @@ -7201,10 +8171,12 @@ pub struct IndicesRollover<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + lazy: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, + target_failure_store: Option, timeout: Option<&'b str>, wait_for_active_shards: Option<&'b str>, } @@ -7224,10 +8196,12 @@ where error_trace: None, filter_path: None, human: None, + lazy: None, master_timeout: None, pretty: None, request_timeout: None, source: None, + target_failure_store: None, timeout: None, wait_for_active_shards: None, } @@ -7246,10 +8220,12 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, + lazy: self.lazy, master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + target_failure_store: self.target_failure_store, timeout: self.timeout, wait_for_active_shards: self.wait_for_active_shards, } @@ -7279,6 +8255,11 @@ where self.human = Some(human); self } + #[doc = "If set to true, the rollover action will only mark a data stream to signal that it needs to be rolled over at the next write. Only allowed on data streams."] + pub fn lazy(mut self, lazy: bool) -> Self { + self.lazy = Some(lazy); + 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); @@ -7299,6 +8280,11 @@ where self.source = Some(source); self } + #[doc = "If set to true, the rollover action will be applied on the failure store of the data stream."] + pub fn target_failure_store(mut self, target_failure_store: bool) -> Self { + self.target_failure_store = Some(target_failure_store); + self + } #[doc = "Explicit operation timeout"] pub fn timeout(mut self, timeout: &'b str) -> Self { self.timeout = Some(timeout); @@ -7312,7 +8298,7 @@ where #[doc = "Creates an asynchronous call to the Indices Rollover API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7324,9 +8310,11 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + lazy: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, + target_failure_store: Option, timeout: Option<&'b str>, wait_for_active_shards: Option<&'b str>, } @@ -7335,9 +8323,11 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + lazy: self.lazy, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + target_failure_store: self.target_failure_store, timeout: self.timeout, wait_for_active_shards: self.wait_for_active_shards, }; @@ -7377,7 +8367,7 @@ impl<'b> IndicesSegmentsParts<'b> { } } } -#[doc = "Builder for the [Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] +#[doc = "Builder for the [Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] #[derive(Clone, Debug)] pub struct IndicesSegments<'a, 'b> { transport: &'a Transport, @@ -7472,7 +8462,7 @@ impl<'a, 'b> IndicesSegments<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Segments API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7538,7 +8528,7 @@ impl<'b> IndicesShardStoresParts<'b> { } } } -#[doc = "Builder for the [Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] +#[doc = "Builder for the [Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] #[derive(Clone, Debug)] pub struct IndicesShardStores<'a, 'b> { transport: &'a Transport, @@ -7633,7 +8623,7 @@ impl<'a, 'b> IndicesShardStores<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Shard Stores API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7700,7 +8690,7 @@ impl<'b> IndicesShrinkParts<'b> { } } } -#[doc = "Builder for the [Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] +#[doc = "Builder for the [Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] #[derive(Clone, Debug)] pub struct IndicesShrink<'a, 'b, B> { transport: &'a Transport, @@ -7814,7 +8804,7 @@ where #[doc = "Creates an asynchronous call to the Indices Shrink API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7871,7 +8861,7 @@ impl<'b> IndicesSimulateIndexTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Simulate Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nSimulate matching the given index name against the index templates in the system"] +#[doc = "Builder for the [Indices Simulate Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-simulate-index.html)\n\nSimulate matching the given index name against the index templates in the system"] #[derive(Clone, Debug)] pub struct IndicesSimulateIndexTemplate<'a, 'b, B> { transport: &'a Transport, @@ -7883,6 +8873,7 @@ pub struct IndicesSimulateIndexTemplate<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + include_defaults: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, @@ -7905,6 +8896,7 @@ where error_trace: None, filter_path: None, human: None, + include_defaults: None, master_timeout: None, pretty: None, request_timeout: None, @@ -7926,6 +8918,7 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, + include_defaults: self.include_defaults, master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, @@ -7962,6 +8955,11 @@ where self.human = Some(human); self } + #[doc = "Return all relevant default configurations for this index template simulation (default: false)"] + pub fn include_defaults(mut self, include_defaults: bool) -> Self { + 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); @@ -7985,7 +8983,7 @@ where #[doc = "Creates an asynchronous call to the Indices Simulate Index Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7998,6 +8996,7 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + include_defaults: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, @@ -8008,6 +9007,7 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + include_defaults: self.include_defaults, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, @@ -8045,7 +9045,7 @@ impl<'b> IndicesSimulateTemplateParts<'b> { } } } -#[doc = "Builder for the [Indices Simulate Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nSimulate resolving the given template name or body"] +#[doc = "Builder for the [Indices Simulate Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-simulate-template.html)\n\nSimulate resolving the given template name or body"] #[derive(Clone, Debug)] pub struct IndicesSimulateTemplate<'a, 'b, B> { transport: &'a Transport, @@ -8057,6 +9057,7 @@ pub struct IndicesSimulateTemplate<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + include_defaults: Option, master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, @@ -8079,6 +9080,7 @@ where error_trace: None, filter_path: None, human: None, + include_defaults: None, master_timeout: None, pretty: None, request_timeout: None, @@ -8100,6 +9102,7 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, + include_defaults: self.include_defaults, master_timeout: self.master_timeout, pretty: self.pretty, request_timeout: self.request_timeout, @@ -8136,6 +9139,11 @@ where self.human = Some(human); self } + #[doc = "Return all relevant default configurations for this template simulation (default: false)"] + pub fn include_defaults(mut self, include_defaults: bool) -> Self { + 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); @@ -8159,7 +9167,7 @@ where #[doc = "Creates an asynchronous call to the Indices Simulate Template API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8172,6 +9180,7 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + include_defaults: Option, master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, @@ -8182,6 +9191,7 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + include_defaults: self.include_defaults, master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, @@ -8222,7 +9232,7 @@ impl<'b> IndicesSplitParts<'b> { } } } -#[doc = "Builder for the [Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] +#[doc = "Builder for the [Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] #[derive(Clone, Debug)] pub struct IndicesSplit<'a, 'b, B> { transport: &'a Transport, @@ -8336,7 +9346,7 @@ where #[doc = "Creates an asynchronous call to the Indices Split API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8427,7 +9437,7 @@ impl<'b> IndicesStatsParts<'b> { } } } -#[doc = "Builder for the [Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-stats.html)\n\nProvides statistics on operations happening in an index."] +#[doc = "Builder for the [Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-stats.html)\n\nProvides statistics on operations happening in an index."] #[derive(Clone, Debug)] pub struct IndicesStats<'a, 'b> { transport: &'a Transport, @@ -8557,7 +9567,7 @@ impl<'a, 'b> IndicesStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Indices Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8633,7 +9643,7 @@ impl<'b> IndicesUnfreezeParts<'b> { } } } -#[doc = "Builder for the [Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] +#[doc = "Builder for the [Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] #[derive(Clone, Debug)] pub struct IndicesUnfreeze<'a, 'b, B> { transport: &'a Transport, @@ -8771,7 +9781,7 @@ where #[doc = "Creates an asynchronous call to the Indices Unfreeze API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8829,7 +9839,7 @@ impl IndicesUpdateAliasesParts { } } } -#[doc = "Builder for the [Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nUpdates index aliases."] +#[doc = "Builder for the [Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nUpdates index aliases."] #[derive(Clone, Debug)] pub struct IndicesUpdateAliases<'a, 'b, B> { transport: &'a Transport, @@ -8935,7 +9945,7 @@ where #[doc = "Creates an asynchronous call to the Indices Update Aliases API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8996,7 +10006,7 @@ impl<'b> IndicesValidateQueryParts<'b> { } } } -#[doc = "Builder for the [Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] +#[doc = "Builder for the [Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] #[derive(Clone, Debug)] pub struct IndicesValidateQuery<'a, 'b, B> { transport: &'a Transport, @@ -9183,8 +10193,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -9253,80 +10263,89 @@ impl<'a> Indices<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/index-modules-blocks.html)\n\nAdds a block to an index."] + #[doc = "[Indices Add Block API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index-modules-blocks.html)\n\nAdds a block to an index."] pub fn add_block<'b>(&'a self, parts: IndicesAddBlockParts<'b>) -> IndicesAddBlock<'a, 'b, ()> { IndicesAddBlock::new(self.transport(), parts) } - #[doc = "[Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] + #[doc = "[Indices Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-analyze.html)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."] pub fn analyze<'b>(&'a self, parts: IndicesAnalyzeParts<'b>) -> IndicesAnalyze<'a, 'b, ()> { IndicesAnalyze::new(self.transport(), parts) } - #[doc = "[Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] + #[doc = "[Indices Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-clearcache.html)\n\nClears all or specific caches for one or more indices."] pub fn clear_cache<'b>( &'a self, parts: IndicesClearCacheParts<'b>, ) -> IndicesClearCache<'a, 'b, ()> { IndicesClearCache::new(self.transport(), parts) } - #[doc = "[Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-clone-index.html)\n\nClones an index"] + #[doc = "[Indices Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-clone-index.html)\n\nClones an index"] pub fn clone<'b>(&'a self, parts: IndicesCloneParts<'b>) -> IndicesClone<'a, 'b, ()> { IndicesClone::new(self.transport(), parts) } - #[doc = "[Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-open-close.html)\n\nCloses an index."] + #[doc = "[Indices Close API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-open-close.html)\n\nCloses an index."] pub fn close<'b>(&'a self, parts: IndicesCloseParts<'b>) -> IndicesClose<'a, 'b, ()> { IndicesClose::new(self.transport(), parts) } - #[doc = "[Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-create-index.html)\n\nCreates an index with optional settings and mappings.\n\n# Examples\n\nCreate an index with a mapping\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesCreateParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .create(IndicesCreateParts::Index(\"test_index\"))\n .body(json!({\n \"mappings\" : {\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] + #[doc = "[Indices Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-create-index.html)\n\nCreates an index with optional settings and mappings.\n\n# Examples\n\nCreate an index with a mapping\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesCreateParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .create(IndicesCreateParts::Index(\"test_index\"))\n .body(json!({\n \"mappings\" : {\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] pub fn create<'b>(&'a self, parts: IndicesCreateParts<'b>) -> IndicesCreate<'a, 'b, ()> { IndicesCreate::new(self.transport(), parts) } - #[doc = "[Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nCreates a data stream"] + #[doc = "[Indices Create Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nCreates a data stream"] pub fn create_data_stream<'b>( &'a self, parts: IndicesCreateDataStreamParts<'b>, ) -> IndicesCreateDataStream<'a, 'b, ()> { IndicesCreateDataStream::new(self.transport(), parts) } - #[doc = "[Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] + #[doc = "[Indices Data Streams Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nProvides statistics on operations happening in a data stream."] pub fn data_streams_stats<'b>( &'a self, parts: IndicesDataStreamsStatsParts<'b>, ) -> IndicesDataStreamsStats<'a, 'b> { IndicesDataStreamsStats::new(self.transport(), parts) } - #[doc = "[Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-delete-index.html)\n\nDeletes an index."] + #[doc = "[Indices Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-delete-index.html)\n\nDeletes an index."] pub fn delete<'b>(&'a self, parts: IndicesDeleteParts<'b>) -> IndicesDelete<'a, 'b> { IndicesDelete::new(self.transport(), parts) } - #[doc = "[Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nDeletes an alias."] + #[doc = "[Indices Delete Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nDeletes an alias."] pub fn delete_alias<'b>( &'a self, parts: IndicesDeleteAliasParts<'b>, ) -> IndicesDeleteAlias<'a, 'b> { IndicesDeleteAlias::new(self.transport(), parts) } - #[doc = "[Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nDeletes a data stream."] + #[doc = "[Indices Delete Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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>, + ) -> IndicesDeleteDataLifecycle<'a, 'b> { + IndicesDeleteDataLifecycle::new(self.transport(), parts) + } + #[doc = "[Indices Delete Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nDeletes a data stream."] pub fn delete_data_stream<'b>( &'a self, parts: IndicesDeleteDataStreamParts<'b>, ) -> IndicesDeleteDataStream<'a, 'b> { IndicesDeleteDataStream::new(self.transport(), parts) } - #[doc = "[Indices Delete Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nDeletes an index template."] + #[doc = "[Indices Delete Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-delete-template.html)\n\nDeletes an index template."] pub fn delete_index_template<'b>( &'a self, parts: IndicesDeleteIndexTemplateParts<'b>, ) -> IndicesDeleteIndexTemplate<'a, 'b> { IndicesDeleteIndexTemplate::new(self.transport(), parts) } - #[doc = "[Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nDeletes an index template."] + #[doc = "[Indices Delete Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-delete-template-v1.html)\n\nDeletes an index template."] pub fn delete_template<'b>( &'a self, parts: IndicesDeleteTemplateParts<'b>, ) -> IndicesDeleteTemplate<'a, 'b> { IndicesDeleteTemplate::new(self.transport(), parts) } - #[doc = "[Indices Disk Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-disk-usage.html)\n\nAnalyzes the disk usage of each field of an index or data stream"] + #[doc = "[Indices Disk Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-disk-usage.html)\n\nAnalyzes the disk usage of each field of an index or data stream"] #[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 disk_usage<'b>( @@ -9335,32 +10354,50 @@ impl<'a> Indices<'a> { ) -> IndicesDiskUsage<'a, 'b, ()> { IndicesDiskUsage::new(self.transport(), parts) } - #[doc = "[Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-exists.html)\n\nReturns information about whether a particular index exists."] + #[doc = "[Indices Downsample API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/xpack-rollup.html)\n\nDownsample an index"] + #[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 downsample<'b>( + &'a self, + parts: IndicesDownsampleParts<'b>, + ) -> IndicesDownsample<'a, 'b, ()> { + IndicesDownsample::new(self.transport(), parts) + } + #[doc = "[Indices Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-exists.html)\n\nReturns information about whether a particular index exists."] pub fn exists<'b>(&'a self, parts: IndicesExistsParts<'b>) -> IndicesExists<'a, 'b> { IndicesExists::new(self.transport(), parts) } - #[doc = "[Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] + #[doc = "[Indices Exists Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nReturns information about whether a particular alias exists."] pub fn exists_alias<'b>( &'a self, parts: IndicesExistsAliasParts<'b>, ) -> IndicesExistsAlias<'a, 'b> { IndicesExistsAlias::new(self.transport(), parts) } - #[doc = "[Indices Exists Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns information about whether a particular index template exists."] + #[doc = "[Indices Exists Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index-templates.html)\n\nReturns information about whether a particular index template exists."] pub fn exists_index_template<'b>( &'a self, parts: IndicesExistsIndexTemplateParts<'b>, ) -> IndicesExistsIndexTemplate<'a, 'b> { IndicesExistsIndexTemplate::new(self.transport(), parts) } - #[doc = "[Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns information about whether a particular index template exists."] + #[doc = "[Indices Exists Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-template-exists-v1.html)\n\nReturns information about whether a particular index template exists."] pub fn exists_template<'b>( &'a self, parts: IndicesExistsTemplateParts<'b>, ) -> IndicesExistsTemplate<'a, 'b> { IndicesExistsTemplate::new(self.transport(), parts) } - #[doc = "[Indices Field Usage Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/field-usage-stats.html)\n\nReturns the field usage stats for each field of an index"] + #[doc = "[Indices Explain Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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>, + ) -> IndicesExplainDataLifecycle<'a, 'b> { + IndicesExplainDataLifecycle::new(self.transport(), parts) + } + #[doc = "[Indices Field Usage Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/field-usage-stats.html)\n\nReturns the field usage stats for each field of an index"] #[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 field_usage_stats<'b>( @@ -9369,193 +10406,218 @@ impl<'a> Indices<'a> { ) -> IndicesFieldUsageStats<'a, 'b> { IndicesFieldUsageStats::new(self.transport(), parts) } - #[doc = "[Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] + #[doc = "[Indices Flush API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-flush.html)\n\nPerforms the flush operation on one or more indices."] pub fn flush<'b>(&'a self, parts: IndicesFlushParts<'b>) -> IndicesFlush<'a, 'b, ()> { IndicesFlush::new(self.transport(), parts) } - #[doc = "[Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] + #[doc = "[Indices Forcemerge API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-forcemerge.html)\n\nPerforms the force merge operation on one or more indices."] pub fn forcemerge<'b>( &'a self, parts: IndicesForcemergeParts<'b>, ) -> IndicesForcemerge<'a, 'b, ()> { IndicesForcemerge::new(self.transport(), parts) } - #[doc = "[Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-index.html)\n\nReturns information about one or more indices."] + #[doc = "[Indices Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-index.html)\n\nReturns information about one or more indices."] pub fn get<'b>(&'a self, parts: IndicesGetParts<'b>) -> IndicesGet<'a, 'b> { IndicesGet::new(self.transport(), parts) } - #[doc = "[Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nReturns an alias."] + #[doc = "[Indices Get Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nReturns an alias."] pub fn get_alias<'b>(&'a self, parts: IndicesGetAliasParts<'b>) -> IndicesGetAlias<'a, 'b> { IndicesGetAlias::new(self.transport(), parts) } - #[doc = "[Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nReturns data streams."] + #[doc = "[Indices Get Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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>, + ) -> IndicesGetDataLifecycle<'a, 'b> { + IndicesGetDataLifecycle::new(self.transport(), parts) + } + #[doc = "[Indices Get Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nReturns data streams."] pub fn get_data_stream<'b>( &'a self, parts: IndicesGetDataStreamParts<'b>, ) -> IndicesGetDataStream<'a, 'b> { IndicesGetDataStream::new(self.transport(), parts) } - #[doc = "[Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] + #[doc = "[Indices Get Field Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-field-mapping.html)\n\nReturns mapping for one or more fields."] pub fn get_field_mapping<'b>( &'a self, parts: IndicesGetFieldMappingParts<'b>, ) -> IndicesGetFieldMapping<'a, 'b> { IndicesGetFieldMapping::new(self.transport(), parts) } - #[doc = "[Indices Get Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns an index template."] + #[doc = "[Indices Get Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-template.html)\n\nReturns an index template."] pub fn get_index_template<'b>( &'a self, parts: IndicesGetIndexTemplateParts<'b>, ) -> IndicesGetIndexTemplate<'a, 'b> { IndicesGetIndexTemplate::new(self.transport(), parts) } - #[doc = "[Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] + #[doc = "[Indices Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-mapping.html)\n\nReturns mappings for one or more indices."] pub fn get_mapping<'b>( &'a self, parts: IndicesGetMappingParts<'b>, ) -> IndicesGetMapping<'a, 'b> { IndicesGetMapping::new(self.transport(), parts) } - #[doc = "[Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-get-settings.html)\n\nReturns settings for one or more indices."] + #[doc = "[Indices Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-settings.html)\n\nReturns settings for one or more indices."] pub fn get_settings<'b>( &'a self, parts: IndicesGetSettingsParts<'b>, ) -> IndicesGetSettings<'a, 'b> { IndicesGetSettings::new(self.transport(), parts) } - #[doc = "[Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nReturns an index template."] + #[doc = "[Indices Get Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-get-template-v1.html)\n\nReturns an index template."] pub fn get_template<'b>( &'a self, parts: IndicesGetTemplateParts<'b>, ) -> IndicesGetTemplate<'a, 'b> { IndicesGetTemplate::new(self.transport(), parts) } - #[doc = "[Indices Migrate To Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nMigrates an alias to a data stream"] + #[doc = "[Indices Migrate To Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nMigrates an alias to a data stream"] pub fn migrate_to_data_stream<'b>( &'a self, parts: IndicesMigrateToDataStreamParts<'b>, ) -> IndicesMigrateToDataStream<'a, 'b, ()> { IndicesMigrateToDataStream::new(self.transport(), parts) } - #[doc = "[Indices Modify Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nModifies a data stream"] + #[doc = "[Indices Modify Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nModifies a data stream"] pub fn modify_data_stream<'b>(&'a self) -> IndicesModifyDataStream<'a, 'b, ()> { IndicesModifyDataStream::new(self.transport()) } - #[doc = "[Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-open-close.html)\n\nOpens an index."] + #[doc = "[Indices Open API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-open-close.html)\n\nOpens an index."] pub fn open<'b>(&'a self, parts: IndicesOpenParts<'b>) -> IndicesOpen<'a, 'b, ()> { IndicesOpen::new(self.transport(), parts) } - #[doc = "[Indices Promote Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/data-streams.html)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"] + #[doc = "[Indices Promote Data Stream API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/data-streams.html)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"] pub fn promote_data_stream<'b>( &'a self, parts: IndicesPromoteDataStreamParts<'b>, ) -> IndicesPromoteDataStream<'a, 'b, ()> { IndicesPromoteDataStream::new(self.transport(), parts) } - #[doc = "[Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nCreates or updates an alias."] + #[doc = "[Indices Put Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nCreates or updates an alias."] pub fn put_alias<'b>(&'a self, parts: IndicesPutAliasParts<'b>) -> IndicesPutAlias<'a, 'b, ()> { IndicesPutAlias::new(self.transport(), parts) } - #[doc = "[Indices Put Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nCreates or updates an index template."] + #[doc = "[Indices Put Data Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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>, + ) -> IndicesPutDataLifecycle<'a, 'b, ()> { + IndicesPutDataLifecycle::new(self.transport(), parts) + } + #[doc = "[Indices Put Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-put-template.html)\n\nCreates or updates an index template."] pub fn put_index_template<'b>( &'a self, parts: IndicesPutIndexTemplateParts<'b>, ) -> IndicesPutIndexTemplate<'a, 'b, ()> { IndicesPutIndexTemplate::new(self.transport(), parts) } - #[doc = "[Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-put-mapping.html)\n\nUpdates the index mappings.\n\n# Examples\n\nPut a mapping into an existing index, assuming the index does not have a mapping, \nor that any properties specified do not conflict with existing properties\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesPutMappingParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .put_mapping(IndicesPutMappingParts::Index(&[\"test_index\"]))\n .body(json!({\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] + #[doc = "[Indices Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-put-mapping.html)\n\nUpdates the index mappings.\n\n# Examples\n\nPut a mapping into an existing index, assuming the index does not have a mapping, \nor that any properties specified do not conflict with existing properties\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, indices::IndicesPutMappingParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\nlet response = client\n .indices()\n .put_mapping(IndicesPutMappingParts::Index(&[\"test_index\"]))\n .body(json!({\n \"properties\" : {\n \"field1\" : { \"type\" : \"text\" }\n }\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] pub fn put_mapping<'b>( &'a self, parts: IndicesPutMappingParts<'b>, ) -> IndicesPutMapping<'a, 'b, ()> { IndicesPutMapping::new(self.transport(), parts) } - #[doc = "[Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-update-settings.html)\n\nUpdates the index settings."] + #[doc = "[Indices Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-update-settings.html)\n\nUpdates the index settings."] pub fn put_settings<'b>( &'a self, parts: IndicesPutSettingsParts<'b>, ) -> IndicesPutSettings<'a, 'b, ()> { IndicesPutSettings::new(self.transport(), parts) } - #[doc = "[Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nCreates or updates an index template."] + #[doc = "[Indices Put Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-templates-v1.html)\n\nCreates or updates an index template."] pub fn put_template<'b>( &'a self, parts: IndicesPutTemplateParts<'b>, ) -> IndicesPutTemplate<'a, 'b, ()> { IndicesPutTemplate::new(self.transport(), parts) } - #[doc = "[Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] + #[doc = "[Indices Recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-recovery.html)\n\nReturns information about ongoing index shard recoveries."] pub fn recovery<'b>(&'a self, parts: IndicesRecoveryParts<'b>) -> IndicesRecovery<'a, 'b> { IndicesRecovery::new(self.transport(), parts) } - #[doc = "[Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] + #[doc = "[Indices Refresh API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-refresh.html)\n\nPerforms the refresh operation in one or more indices."] pub fn refresh<'b>(&'a self, parts: IndicesRefreshParts<'b>) -> IndicesRefresh<'a, 'b, ()> { IndicesRefresh::new(self.transport(), parts) } - #[doc = "[Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] + #[doc = "[Indices Reload Search Analyzers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-reload-analyzers.html)\n\nReloads an index's search analyzers and their resources."] pub fn reload_search_analyzers<'b>( &'a self, parts: IndicesReloadSearchAnalyzersParts<'b>, ) -> IndicesReloadSearchAnalyzers<'a, 'b, ()> { IndicesReloadSearchAnalyzers::new(self.transport(), parts) } - #[doc = "[Indices Resolve Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-resolve-index-api.html)\n\nReturns information about any matching indices, aliases, and data streams"] + #[doc = "[Indices Resolve Cluster API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-resolve-cluster-api.html)\n\nResolves the specified index expressions to return information about each cluster, including the local cluster, if included."] + pub fn resolve_cluster<'b>( + &'a self, + parts: IndicesResolveClusterParts<'b>, + ) -> IndicesResolveCluster<'a, 'b> { + IndicesResolveCluster::new(self.transport(), parts) + } + #[doc = "[Indices Resolve Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-resolve-index-api.html)\n\nReturns information about any matching indices, aliases, and data streams"] pub fn resolve_index<'b>( &'a self, parts: IndicesResolveIndexParts<'b>, ) -> IndicesResolveIndex<'a, 'b> { IndicesResolveIndex::new(self.transport(), parts) } - #[doc = "[Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] + #[doc = "[Indices Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-rollover-index.html)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."] pub fn rollover<'b>(&'a self, parts: IndicesRolloverParts<'b>) -> IndicesRollover<'a, 'b, ()> { IndicesRollover::new(self.transport(), parts) } - #[doc = "[Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] + #[doc = "[Indices Segments API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-segments.html)\n\nProvides low-level information about segments in a Lucene index."] pub fn segments<'b>(&'a self, parts: IndicesSegmentsParts<'b>) -> IndicesSegments<'a, 'b> { IndicesSegments::new(self.transport(), parts) } - #[doc = "[Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] + #[doc = "[Indices Shard Stores API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-shards-stores.html)\n\nProvides store information for shard copies of indices."] pub fn shard_stores<'b>( &'a self, parts: IndicesShardStoresParts<'b>, ) -> IndicesShardStores<'a, 'b> { IndicesShardStores::new(self.transport(), parts) } - #[doc = "[Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] + #[doc = "[Indices Shrink API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-shrink-index.html)\n\nAllow to shrink an existing index into a new index with fewer primary shards."] pub fn shrink<'b>(&'a self, parts: IndicesShrinkParts<'b>) -> IndicesShrink<'a, 'b, ()> { IndicesShrink::new(self.transport(), parts) } - #[doc = "[Indices Simulate Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nSimulate matching the given index name against the index templates in the system"] + #[doc = "[Indices Simulate Index Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-simulate-index.html)\n\nSimulate matching the given index name against the index templates in the system"] pub fn simulate_index_template<'b>( &'a self, parts: IndicesSimulateIndexTemplateParts<'b>, ) -> IndicesSimulateIndexTemplate<'a, 'b, ()> { IndicesSimulateIndexTemplate::new(self.transport(), parts) } - #[doc = "[Indices Simulate Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-templates.html)\n\nSimulate resolving the given template name or body"] + #[doc = "[Indices Simulate Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-simulate-template.html)\n\nSimulate resolving the given template name or body"] pub fn simulate_template<'b>( &'a self, parts: IndicesSimulateTemplateParts<'b>, ) -> IndicesSimulateTemplate<'a, 'b, ()> { IndicesSimulateTemplate::new(self.transport(), parts) } - #[doc = "[Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] + #[doc = "[Indices Split API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-split-index.html)\n\nAllows you to split an existing index into a new index with more primary shards."] pub fn split<'b>(&'a self, parts: IndicesSplitParts<'b>) -> IndicesSplit<'a, 'b, ()> { IndicesSplit::new(self.transport(), parts) } - #[doc = "[Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-stats.html)\n\nProvides statistics on operations happening in an index."] + #[doc = "[Indices Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-stats.html)\n\nProvides statistics on operations happening in an index."] pub fn stats<'b>(&'a self, parts: IndicesStatsParts<'b>) -> IndicesStats<'a, 'b> { IndicesStats::new(self.transport(), parts) } - #[doc = "[Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] + #[doc = "[Indices Unfreeze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/unfreeze-index-api.html)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."] pub fn unfreeze<'b>(&'a self, parts: IndicesUnfreezeParts<'b>) -> IndicesUnfreeze<'a, 'b, ()> { IndicesUnfreeze::new(self.transport(), parts) } - #[doc = "[Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/indices-aliases.html)\n\nUpdates index aliases."] + #[doc = "[Indices Update Aliases API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/indices-aliases.html)\n\nUpdates index aliases."] pub fn update_aliases<'b>(&'a self) -> IndicesUpdateAliases<'a, 'b, ()> { IndicesUpdateAliases::new(self.transport()) } - #[doc = "[Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] + #[doc = "[Indices Validate Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-validate.html)\n\nAllows a user to validate a potentially expensive query without executing it."] pub fn validate_query<'b>( &'a self, parts: IndicesValidateQueryParts<'b>, diff --git a/elasticsearch/src/inference.rs b/elasticsearch/src/inference.rs new file mode 100644 index 00000000..b6f708b3 --- /dev/null +++ b/elasticsearch/src/inference.rs @@ -0,0 +1,721 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![cfg(feature = "experimental-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 "] +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Inference Delete API"] +pub enum InferenceDeleteParts<'b> { + #[doc = "InferenceId"] + InferenceId(&'b str), + #[doc = "TaskType and InferenceId"] + TaskTypeInferenceId(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> InferenceDeleteParts<'b> { + #[doc = "Builds a relative URL path to the Inference Delete API"] + pub fn url(self) -> Cow<'static, str> { + match self { + InferenceDeleteParts::InferenceId(ref inference_id) => { + let encoded_inference_id: Cow = + percent_encode(inference_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_inference_id.len()); + p.push_str("/_inference/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + InferenceDeleteParts::TaskTypeInferenceId(ref task_type, ref 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( + 13usize + encoded_task_type.len() + encoded_inference_id.len(), + ); + p.push_str("/_inference/"); + p.push_str(encoded_task_type.as_ref()); + p.push_str("/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Inference Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-inference-api.html)\n\nDelete an inference endpoint"] +#[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 InferenceDelete<'a, 'b> { + transport: &'a Transport, + parts: InferenceDeleteParts<'b>, + dry_run: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + force: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> InferenceDelete<'a, 'b> { + #[doc = "Creates a new instance of [InferenceDelete] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: InferenceDeleteParts<'b>) -> Self { + let headers = HeaderMap::new(); + InferenceDelete { + transport, + parts, + headers, + dry_run: None, + error_trace: None, + filter_path: None, + force: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "If true the endpoint will not be deleted and a list of ingest processors which reference this endpoint will be returned."] + pub fn dry_run(mut self, dry_run: bool) -> Self { + self.dry_run = Some(dry_run); + 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); + 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 = "If true the endpoint will be forcefully stopped (regardless of whether or not it is referenced by any ingest processors or semantic text fields)."] + pub fn force(mut self, force: bool) -> Self { + self.force = Some(force); + 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 Delete 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> { + dry_run: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + force: Option, + human: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + dry_run: self.dry_run, + error_trace: self.error_trace, + filter_path: self.filter_path, + force: self.force, + 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Inference Get API"] +pub enum InferenceGetParts<'b> { + #[doc = "No parts"] + None, + #[doc = "InferenceId"] + InferenceId(&'b str), + #[doc = "TaskType and InferenceId"] + TaskTypeInferenceId(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> InferenceGetParts<'b> { + #[doc = "Builds a relative URL path to the Inference Get API"] + pub fn url(self) -> Cow<'static, str> { + match self { + InferenceGetParts::None => "/_inference".into(), + InferenceGetParts::InferenceId(ref inference_id) => { + let encoded_inference_id: Cow = + percent_encode(inference_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_inference_id.len()); + p.push_str("/_inference/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + InferenceGetParts::TaskTypeInferenceId(ref task_type, ref 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( + 13usize + encoded_task_type.len() + encoded_inference_id.len(), + ); + p.push_str("/_inference/"); + p.push_str(encoded_task_type.as_ref()); + p.push_str("/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Inference Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-inference-api.html)\n\nGet an inference endpoint"] +#[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 InferenceGet<'a, 'b> { + transport: &'a Transport, + parts: InferenceGetParts<'b>, + 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> InferenceGet<'a, 'b> { + #[doc = "Creates a new instance of [InferenceGet] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: InferenceGetParts<'b>) -> Self { + let headers = HeaderMap::new(); + InferenceGet { + 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 Inference Get 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Inference Inference API"] +pub enum InferenceInferenceParts<'b> { + #[doc = "InferenceId"] + InferenceId(&'b str), + #[doc = "TaskType and InferenceId"] + TaskTypeInferenceId(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> InferenceInferenceParts<'b> { + #[doc = "Builds a relative URL path to the Inference Inference API"] + pub fn url(self) -> Cow<'static, str> { + match self { + InferenceInferenceParts::InferenceId(ref inference_id) => { + let encoded_inference_id: Cow = + percent_encode(inference_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_inference_id.len()); + p.push_str("/_inference/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + InferenceInferenceParts::TaskTypeInferenceId(ref task_type, ref 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( + 13usize + encoded_task_type.len() + encoded_inference_id.len(), + ); + p.push_str("/_inference/"); + p.push_str(encoded_task_type.as_ref()); + p.push_str("/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Inference Inference API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/post-inference-api.html)\n\nPerform 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 InferenceInference<'a, 'b, B> { + transport: &'a Transport, + parts: InferenceInferenceParts<'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> InferenceInference<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [InferenceInference] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: InferenceInferenceParts<'b>) -> Self { + let headers = HeaderMap::new(); + InferenceInference { + 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) -> InferenceInference<'a, 'b, JsonBody> + where + T: Serialize, + { + InferenceInference { + 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 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Inference Put API"] +pub enum InferencePutParts<'b> { + #[doc = "InferenceId"] + InferenceId(&'b str), + #[doc = "TaskType and InferenceId"] + TaskTypeInferenceId(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> InferencePutParts<'b> { + #[doc = "Builds a relative URL path to the Inference Put API"] + pub fn url(self) -> Cow<'static, str> { + match self { + InferencePutParts::InferenceId(ref inference_id) => { + let encoded_inference_id: Cow = + percent_encode(inference_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(12usize + encoded_inference_id.len()); + p.push_str("/_inference/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + InferencePutParts::TaskTypeInferenceId(ref task_type, ref 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( + 13usize + encoded_task_type.len() + encoded_inference_id.len(), + ); + p.push_str("/_inference/"); + p.push_str(encoded_task_type.as_ref()); + p.push_str("/"); + p.push_str(encoded_inference_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Inference Put API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-inference-api.html)\n\nConfigure an inference endpoint for use in the Inference API"] +#[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 InferencePut<'a, 'b, B> { + transport: &'a Transport, + parts: InferencePutParts<'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> InferencePut<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [InferencePut] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: InferencePutParts<'b>) -> Self { + let headers = HeaderMap::new(); + InferencePut { + 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) -> InferencePut<'a, 'b, JsonBody> + where + T: Serialize, + { + InferencePut { + 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 Put 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) + } +} +#[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")] +pub struct Inference<'a> { + transport: &'a Transport, +} +#[cfg(feature = "experimental-apis")] +impl<'a> Inference<'a> { + #[doc = "Creates a new instance of [Inference]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Inference Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-inference-api.html)\n\nDelete an inference endpoint"] + #[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<'b>(&'a self, parts: InferenceDeleteParts<'b>) -> InferenceDelete<'a, 'b> { + InferenceDelete::new(self.transport(), parts) + } + #[doc = "[Inference Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-inference-api.html)\n\nGet an inference endpoint"] + #[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<'b>(&'a self, parts: InferenceGetParts<'b>) -> InferenceGet<'a, 'b> { + InferenceGet::new(self.transport(), parts) + } + #[doc = "[Inference Inference API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/post-inference-api.html)\n\nPerform 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 inference<'b>( + &'a self, + parts: InferenceInferenceParts<'b>, + ) -> InferenceInference<'a, 'b, ()> { + InferenceInference::new(self.transport(), parts) + } + #[doc = "[Inference Put API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-inference-api.html)\n\nConfigure an inference endpoint for use in the Inference API"] + #[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<'b>(&'a self, parts: InferencePutParts<'b>) -> InferencePut<'a, 'b, ()> { + InferencePut::new(self.transport(), parts) + } +} +#[cfg(feature = "experimental-apis")] +impl Elasticsearch { + #[doc = "Creates a namespace client for Inference APIs"] + pub fn inference(&self) -> Inference { + Inference::new(self.transport()) + } +} diff --git a/elasticsearch/src/ingest.rs b/elasticsearch/src/ingest.rs index c113fcb2..1c37687c 100644 --- a/elasticsearch/src/ingest.rs +++ b/elasticsearch/src/ingest.rs @@ -47,11 +47,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -59,6 +59,125 @@ use percent_encoding::percent_encode; use serde::Serialize; use std::{borrow::Cow, time::Duration}; #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ingest Delete Geoip Database API"] +pub enum IngestDeleteGeoipDatabaseParts<'b> { + #[doc = "Id"] + Id(&'b [&'b str]), +} +impl<'b> IngestDeleteGeoipDatabaseParts<'b> { + #[doc = "Builds a relative URL path to the Ingest Delete Geoip Database API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IngestDeleteGeoipDatabaseParts::Id(ref 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(24usize + encoded_id.len()); + p.push_str("/_ingest/geoip/database/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ingest Delete Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/TODO.html)\n\nDeletes a geoip database configuration"] +#[derive(Clone, Debug)] +pub struct IngestDeleteGeoipDatabase<'a, 'b> { + transport: &'a Transport, + parts: IngestDeleteGeoipDatabaseParts<'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> IngestDeleteGeoipDatabase<'a, 'b> { + #[doc = "Creates a new instance of [IngestDeleteGeoipDatabase] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IngestDeleteGeoipDatabaseParts<'b>) -> Self { + let headers = HeaderMap::new(); + IngestDeleteGeoipDatabase { + 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 Geoip 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)] #[doc = "API parts for the Ingest Delete Pipeline API"] pub enum IngestDeletePipelineParts<'b> { #[doc = "Id"] @@ -78,7 +197,7 @@ impl<'b> IngestDeletePipelineParts<'b> { } } } -#[doc = "Builder for the [Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-pipeline-api.html)\n\nDeletes a pipeline."] +#[doc = "Builder for the [Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-pipeline-api.html)\n\nDeletes a pipeline."] #[derive(Clone, Debug)] pub struct IngestDeletePipeline<'a, 'b> { transport: &'a Transport, @@ -159,7 +278,7 @@ impl<'a, 'b> IngestDeletePipeline<'a, 'b> { #[doc = "Creates an asynchronous call to the Ingest Delete Pipeline API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -208,7 +327,7 @@ impl IngestGeoIpStatsParts { } } } -#[doc = "Builder for the [Ingest Geo Ip Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/geoip-stats-api.html)\n\nReturns statistical information about geoip databases"] +#[doc = "Builder for the [Ingest Geo Ip Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/geoip-stats-api.html)\n\nReturns statistical information about geoip databases"] #[derive(Clone, Debug)] pub struct IngestGeoIpStats<'a, 'b> { transport: &'a Transport, @@ -275,7 +394,129 @@ impl<'a, 'b> IngestGeoIpStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Ingest Geo Ip Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + 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)] +#[doc = "API parts for the Ingest Get Geoip Database API"] +pub enum IngestGetGeoipDatabaseParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Id"] + Id(&'b [&'b str]), +} +impl<'b> IngestGetGeoipDatabaseParts<'b> { + #[doc = "Builds a relative URL path to the Ingest Get Geoip Database API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IngestGetGeoipDatabaseParts::None => "/_ingest/geoip/database".into(), + IngestGetGeoipDatabaseParts::Id(ref 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(24usize + encoded_id.len()); + p.push_str("/_ingest/geoip/database/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ingest Get Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/TODO.html)\n\nReturns geoip database configuration."] +#[derive(Clone, Debug)] +pub struct IngestGetGeoipDatabase<'a, 'b> { + transport: &'a Transport, + parts: IngestGetGeoipDatabaseParts<'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> IngestGetGeoipDatabase<'a, 'b> { + #[doc = "Creates a new instance of [IngestGetGeoipDatabase] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IngestGetGeoipDatabaseParts<'b>) -> Self { + let headers = HeaderMap::new(); + IngestGetGeoipDatabase { + 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 Geoip 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 = { @@ -329,7 +570,7 @@ impl<'b> IngestGetPipelineParts<'b> { } } } -#[doc = "Builder for the [Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-pipeline-api.html)\n\nReturns a pipeline."] +#[doc = "Builder for the [Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-pipeline-api.html)\n\nReturns a pipeline."] #[derive(Clone, Debug)] pub struct IngestGetPipeline<'a, 'b> { transport: &'a Transport, @@ -410,7 +651,7 @@ impl<'a, 'b> IngestGetPipeline<'a, 'b> { #[doc = "Creates an asynchronous call to the Ingest Get Pipeline API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -459,7 +700,7 @@ impl IngestProcessorGrokParts { } } } -#[doc = "Builder for the [Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] +#[doc = "Builder for the [Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] #[derive(Clone, Debug)] pub struct IngestProcessorGrok<'a, 'b> { transport: &'a Transport, @@ -526,7 +767,7 @@ impl<'a, 'b> IngestProcessorGrok<'a, 'b> { #[doc = "Creates an asynchronous call to the Ingest Processor Grok API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -558,6 +799,147 @@ impl<'a, 'b> IngestProcessorGrok<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ingest Put Geoip Database API"] +pub enum IngestPutGeoipDatabaseParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> IngestPutGeoipDatabaseParts<'b> { + #[doc = "Builds a relative URL path to the Ingest Put Geoip Database API"] + pub fn url(self) -> Cow<'static, str> { + match self { + IngestPutGeoipDatabaseParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_id.len()); + p.push_str("/_ingest/geoip/database/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Ingest Put Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/TODO.html)\n\nPuts the configuration for a geoip database to be downloaded"] +#[derive(Clone, Debug)] +pub struct IngestPutGeoipDatabase<'a, 'b, B> { + transport: &'a Transport, + parts: IngestPutGeoipDatabaseParts<'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> IngestPutGeoipDatabase<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [IngestPutGeoipDatabase] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: IngestPutGeoipDatabaseParts<'b>) -> Self { + let headers = HeaderMap::new(); + IngestPutGeoipDatabase { + 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) -> IngestPutGeoipDatabase<'a, 'b, JsonBody> + where + T: Serialize, + { + IngestPutGeoipDatabase { + 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 Geoip 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)] #[doc = "API parts for the Ingest Put Pipeline API"] pub enum IngestPutPipelineParts<'b> { #[doc = "Id"] @@ -577,7 +959,7 @@ impl<'b> IngestPutPipelineParts<'b> { } } } -#[doc = "Builder for the [Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-pipeline-api.html)\n\nCreates or updates a pipeline."] +#[doc = "Builder for the [Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-pipeline-api.html)\n\nCreates or updates a pipeline."] #[derive(Clone, Debug)] pub struct IngestPutPipeline<'a, 'b, B> { transport: &'a Transport, @@ -691,7 +1073,7 @@ where #[doc = "Creates an asynchronous call to the Ingest Put Pipeline API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -752,7 +1134,7 @@ impl<'b> IngestSimulateParts<'b> { } } } -#[doc = "Builder for the [Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] +#[doc = "Builder for the [Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] #[derive(Clone, Debug)] pub struct IngestSimulate<'a, 'b, B> { transport: &'a Transport, @@ -851,8 +1233,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -898,36 +1280,57 @@ impl<'a> Ingest<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ingest Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-pipeline-api.html)\n\nDeletes a pipeline."] + #[doc = "[Ingest Delete Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/TODO.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 Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-pipeline-api.html)\n\nDeletes a pipeline."] pub fn delete_pipeline<'b>( &'a self, parts: IngestDeletePipelineParts<'b>, ) -> IngestDeletePipeline<'a, 'b> { IngestDeletePipeline::new(self.transport(), parts) } - #[doc = "[Ingest Geo Ip Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/geoip-stats-api.html)\n\nReturns statistical information about geoip databases"] + #[doc = "[Ingest Geo Ip Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/geoip-stats-api.html)\n\nReturns statistical information about geoip databases"] pub fn geo_ip_stats<'b>(&'a self) -> IngestGeoIpStats<'a, 'b> { IngestGeoIpStats::new(self.transport()) } - #[doc = "[Ingest Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-pipeline-api.html)\n\nReturns a pipeline."] + #[doc = "[Ingest Get Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/TODO.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 Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-pipeline-api.html)\n\nReturns a pipeline."] pub fn get_pipeline<'b>( &'a self, parts: IngestGetPipelineParts<'b>, ) -> IngestGetPipeline<'a, 'b> { IngestGetPipeline::new(self.transport(), parts) } - #[doc = "[Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] + #[doc = "[Ingest Processor Grok API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/grok-processor.html#grok-processor-rest-get)\n\nReturns a list of the built-in patterns."] pub fn processor_grok<'b>(&'a self) -> IngestProcessorGrok<'a, 'b> { IngestProcessorGrok::new(self.transport()) } - #[doc = "[Ingest Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-pipeline-api.html)\n\nCreates or updates a pipeline."] + #[doc = "[Ingest Put Geoip Database API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/TODO.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 Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-pipeline-api.html)\n\nCreates or updates a pipeline."] pub fn put_pipeline<'b>( &'a self, parts: IngestPutPipelineParts<'b>, ) -> IngestPutPipeline<'a, 'b, ()> { IngestPutPipeline::new(self.transport(), parts) } - #[doc = "[Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] + #[doc = "[Ingest Simulate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/simulate-pipeline-api.html)\n\nAllows to simulate a pipeline with example documents."] pub fn simulate<'b>(&'a self, parts: IngestSimulateParts<'b>) -> IngestSimulate<'a, 'b, ()> { IngestSimulate::new(self.transport(), parts) } diff --git a/elasticsearch/src/lib.rs b/elasticsearch/src/lib.rs index 92409b94..ef5f4c70 100644 --- a/elasticsearch/src/lib.rs +++ b/elasticsearch/src/lib.rs @@ -382,14 +382,17 @@ pub mod autoscaling; pub mod cat; pub mod ccr; pub mod cluster; +pub mod connector; pub mod dangling_indices; pub mod enrich; pub mod eql; +pub mod esql; pub mod features; pub mod fleet; pub mod graph; pub mod ilm; pub mod indices; +pub mod inference; pub mod ingest; pub mod license; pub mod logstash; @@ -397,14 +400,19 @@ pub mod migration; pub mod ml; pub mod monitoring; pub mod nodes; +pub mod profiling; +pub mod query_rules; pub mod rollup; +pub mod search_application; pub mod searchable_snapshots; pub mod security; pub mod shutdown; +pub mod simulate; pub mod slm; pub mod snapshot; pub mod sql; pub mod ssl; +pub mod synonyms; pub mod tasks; pub mod text_structure; pub mod transform; diff --git a/elasticsearch/src/license.rs b/elasticsearch/src/license.rs index c7777f6c..d8d30a77 100644 --- a/elasticsearch/src/license.rs +++ b/elasticsearch/src/license.rs @@ -38,11 +38,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -63,7 +63,7 @@ impl LicenseDeleteParts { } } } -#[doc = "Builder for the [License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-license.html)\n\nDeletes licensing information for the cluster"] +#[doc = "Builder for the [License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-license.html)\n\nDeletes licensing information for the cluster"] #[derive(Clone, Debug)] pub struct LicenseDelete<'a, 'b> { transport: &'a Transport, @@ -72,9 +72,11 @@ pub struct LicenseDelete<'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>, + timeout: Option<&'b str>, } impl<'a, 'b> LicenseDelete<'a, 'b> { #[doc = "Creates a new instance of [LicenseDelete]"] @@ -87,9 +89,11 @@ impl<'a, 'b> LicenseDelete<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "Include the stack trace of returned errors."] @@ -112,6 +116,11 @@ impl<'a, 'b> LicenseDelete<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -127,10 +136,15 @@ impl<'a, 'b> LicenseDelete<'a, 'b> { self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the License Delete API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -141,15 +155,19 @@ impl<'a, 'b> LicenseDelete<'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>, + 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) }; @@ -175,7 +193,7 @@ impl LicenseGetParts { } } } -#[doc = "Builder for the [License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-license.html)\n\nRetrieves licensing information for the cluster"] +#[doc = "Builder for the [License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-license.html)\n\nRetrieves licensing information for the cluster"] #[derive(Clone, Debug)] pub struct LicenseGet<'a, 'b> { transport: &'a Transport, @@ -256,7 +274,7 @@ impl<'a, 'b> LicenseGet<'a, 'b> { #[doc = "Creates an asynchronous call to the License Get API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -305,7 +323,7 @@ impl LicenseGetBasicStatusParts { } } } -#[doc = "Builder for the [License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] +#[doc = "Builder for the [License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] #[derive(Clone, Debug)] pub struct LicenseGetBasicStatus<'a, 'b> { transport: &'a Transport, @@ -372,7 +390,7 @@ impl<'a, 'b> LicenseGetBasicStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the License Get Basic Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -417,7 +435,7 @@ impl LicenseGetTrialStatusParts { } } } -#[doc = "Builder for the [License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] +#[doc = "Builder for the [License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] #[derive(Clone, Debug)] pub struct LicenseGetTrialStatus<'a, 'b> { transport: &'a Transport, @@ -484,7 +502,7 @@ impl<'a, 'b> LicenseGetTrialStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the License Get Trial Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -529,7 +547,7 @@ impl LicensePostParts { } } } -#[doc = "Builder for the [License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/update-license.html)\n\nUpdates the license for the cluster."] +#[doc = "Builder for the [License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-license.html)\n\nUpdates the license for the cluster."] #[derive(Clone, Debug)] pub struct LicensePost<'a, 'b, B> { transport: &'a Transport, @@ -540,9 +558,11 @@ pub struct LicensePost<'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> LicensePost<'a, 'b, B> where @@ -560,9 +580,11 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "whether the user has acknowledged acknowledge messages (default: false)"] @@ -584,9 +606,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."] @@ -609,6 +633,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -624,10 +653,15 @@ where self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the License Post API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -639,16 +673,20 @@ 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 { acknowledge: self.acknowledge, 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) }; @@ -674,7 +712,7 @@ impl LicensePostStartBasicParts { } } } -#[doc = "Builder for the [License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-basic.html)\n\nStarts an indefinite basic license."] +#[doc = "Builder for the [License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-basic.html)\n\nStarts an indefinite basic license."] #[derive(Clone, Debug)] pub struct LicensePostStartBasic<'a, 'b, B> { transport: &'a Transport, @@ -685,9 +723,11 @@ pub struct LicensePostStartBasic<'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> LicensePostStartBasic<'a, 'b, B> where @@ -705,9 +745,11 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, } } #[doc = "whether the user has acknowledged acknowledge messages (default: false)"] @@ -729,9 +771,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."] @@ -754,6 +798,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -769,10 +818,15 @@ where self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the License Post Start Basic API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -784,16 +838,20 @@ 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 { acknowledge: self.acknowledge, 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) }; @@ -819,7 +877,7 @@ impl LicensePostStartTrialParts { } } } -#[doc = "Builder for the [License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-trial.html)\n\nstarts a limited time trial license."] +#[doc = "Builder for the [License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-trial.html)\n\nstarts a limited time trial license."] #[derive(Clone, Debug)] pub struct LicensePostStartTrial<'a, 'b, B> { transport: &'a Transport, @@ -830,9 +888,11 @@ pub struct LicensePostStartTrial<'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>, ty: Option<&'b str>, } impl<'a, 'b, B> LicensePostStartTrial<'a, 'b, B> @@ -851,9 +911,11 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, + timeout: None, ty: None, } } @@ -876,9 +938,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, ty: self.ty, } } @@ -902,6 +966,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -917,6 +986,11 @@ where self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "The type of trial license to generate (default: \"trial\")"] pub fn ty(mut self, ty: &'b str) -> Self { self.ty = Some(ty); @@ -925,7 +999,7 @@ where #[doc = "Creates an asynchronous call to the License Post Start Trial API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -937,8 +1011,10 @@ 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>, #[serde(rename = "type")] ty: Option<&'b str>, } @@ -947,8 +1023,10 @@ 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, + timeout: self.timeout, ty: self.ty, }; Some(query_params) @@ -973,31 +1051,31 @@ impl<'a> License<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-license.html)\n\nDeletes licensing information for the cluster"] + #[doc = "[License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-license.html)\n\nDeletes licensing information for the cluster"] pub fn delete<'b>(&'a self) -> LicenseDelete<'a, 'b> { LicenseDelete::new(self.transport()) } - #[doc = "[License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-license.html)\n\nRetrieves licensing information for the cluster"] + #[doc = "[License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-license.html)\n\nRetrieves licensing information for the cluster"] pub fn get<'b>(&'a self) -> LicenseGet<'a, 'b> { LicenseGet::new(self.transport()) } - #[doc = "[License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] + #[doc = "[License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-basic-status.html)\n\nRetrieves information about the status of the basic license."] pub fn get_basic_status<'b>(&'a self) -> LicenseGetBasicStatus<'a, 'b> { LicenseGetBasicStatus::new(self.transport()) } - #[doc = "[License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] + #[doc = "[License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-trial-status.html)\n\nRetrieves information about the status of the trial license."] pub fn get_trial_status<'b>(&'a self) -> LicenseGetTrialStatus<'a, 'b> { LicenseGetTrialStatus::new(self.transport()) } - #[doc = "[License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/update-license.html)\n\nUpdates the license for the cluster."] + #[doc = "[License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-license.html)\n\nUpdates the license for the cluster."] pub fn post<'b>(&'a self) -> LicensePost<'a, 'b, ()> { LicensePost::new(self.transport()) } - #[doc = "[License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-basic.html)\n\nStarts an indefinite basic license."] + #[doc = "[License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-basic.html)\n\nStarts an indefinite basic license."] pub fn post_start_basic<'b>(&'a self) -> LicensePostStartBasic<'a, 'b, ()> { LicensePostStartBasic::new(self.transport()) } - #[doc = "[License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-trial.html)\n\nstarts a limited time trial license."] + #[doc = "[License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-trial.html)\n\nstarts a limited time trial license."] pub fn post_start_trial<'b>(&'a self) -> LicensePostStartTrial<'a, 'b, ()> { LicensePostStartTrial::new(self.transport()) } diff --git a/elasticsearch/src/logstash.rs b/elasticsearch/src/logstash.rs index 7a4c3a91..d4bdbe97 100644 --- a/elasticsearch/src/logstash.rs +++ b/elasticsearch/src/logstash.rs @@ -34,11 +34,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -65,7 +65,7 @@ impl<'b> LogstashDeletePipelineParts<'b> { } } } -#[doc = "Builder for the [Logstash Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/logstash-api-delete-pipeline.html)\n\nDeletes Logstash Pipelines used by Central Management"] +#[doc = "Builder for the [Logstash Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/logstash-api-delete-pipeline.html)\n\nDeletes Logstash Pipelines used by Central Management"] #[derive(Clone, Debug)] pub struct LogstashDeletePipeline<'a, 'b> { transport: &'a Transport, @@ -132,7 +132,7 @@ impl<'a, 'b> LogstashDeletePipeline<'a, 'b> { #[doc = "Creates an asynchronous call to the Logstash Delete Pipeline API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -166,6 +166,8 @@ impl<'a, 'b> LogstashDeletePipeline<'a, 'b> { #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Logstash Get Pipeline API"] pub enum LogstashGetPipelineParts<'b> { + #[doc = "No parts"] + None, #[doc = "Id"] Id(&'b str), } @@ -173,6 +175,7 @@ impl<'b> LogstashGetPipelineParts<'b> { #[doc = "Builds a relative URL path to the Logstash Get Pipeline API"] pub fn url(self) -> Cow<'static, str> { match self { + LogstashGetPipelineParts::None => "/_logstash/pipeline".into(), LogstashGetPipelineParts::Id(ref id) => { let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); let mut p = String::with_capacity(20usize + encoded_id.len()); @@ -183,7 +186,7 @@ impl<'b> LogstashGetPipelineParts<'b> { } } } -#[doc = "Builder for the [Logstash Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/logstash-api-get-pipeline.html)\n\nRetrieves Logstash Pipelines used by Central Management"] +#[doc = "Builder for the [Logstash Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/logstash-api-get-pipeline.html)\n\nRetrieves Logstash Pipelines used by Central Management"] #[derive(Clone, Debug)] pub struct LogstashGetPipeline<'a, 'b> { transport: &'a Transport, @@ -250,7 +253,7 @@ impl<'a, 'b> LogstashGetPipeline<'a, 'b> { #[doc = "Creates an asynchronous call to the Logstash Get Pipeline API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -301,7 +304,7 @@ impl<'b> LogstashPutPipelineParts<'b> { } } } -#[doc = "Builder for the [Logstash Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/logstash-api-put-pipeline.html)\n\nAdds and updates Logstash Pipelines used for Central Management"] +#[doc = "Builder for the [Logstash Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/logstash-api-put-pipeline.html)\n\nAdds and updates Logstash Pipelines used for Central Management"] #[derive(Clone, Debug)] pub struct LogstashPutPipeline<'a, 'b, B> { transport: &'a Transport, @@ -391,7 +394,7 @@ where #[doc = "Creates an asynchronous call to the Logstash Put Pipeline API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -434,21 +437,21 @@ impl<'a> Logstash<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Logstash Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/logstash-api-delete-pipeline.html)\n\nDeletes Logstash Pipelines used by Central Management"] + #[doc = "[Logstash Delete Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/logstash-api-delete-pipeline.html)\n\nDeletes Logstash Pipelines used by Central Management"] pub fn delete_pipeline<'b>( &'a self, parts: LogstashDeletePipelineParts<'b>, ) -> LogstashDeletePipeline<'a, 'b> { LogstashDeletePipeline::new(self.transport(), parts) } - #[doc = "[Logstash Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/logstash-api-get-pipeline.html)\n\nRetrieves Logstash Pipelines used by Central Management"] + #[doc = "[Logstash Get Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/logstash-api-get-pipeline.html)\n\nRetrieves Logstash Pipelines used by Central Management"] pub fn get_pipeline<'b>( &'a self, parts: LogstashGetPipelineParts<'b>, ) -> LogstashGetPipeline<'a, 'b> { LogstashGetPipeline::new(self.transport(), parts) } - #[doc = "[Logstash Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/logstash-api-put-pipeline.html)\n\nAdds and updates Logstash Pipelines used for Central Management"] + #[doc = "[Logstash Put Pipeline API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/logstash-api-put-pipeline.html)\n\nAdds and updates Logstash Pipelines used for Central Management"] pub fn put_pipeline<'b>( &'a self, parts: LogstashPutPipelineParts<'b>, diff --git a/elasticsearch/src/migration.rs b/elasticsearch/src/migration.rs index 906b648b..88e406df 100644 --- a/elasticsearch/src/migration.rs +++ b/elasticsearch/src/migration.rs @@ -33,11 +33,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -69,7 +69,7 @@ impl<'b> MigrationDeprecationsParts<'b> { } } } -#[doc = "Builder for the [Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] +#[doc = "Builder for the [Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] #[derive(Clone, Debug)] pub struct MigrationDeprecations<'a, 'b> { transport: &'a Transport, @@ -136,7 +136,7 @@ impl<'a, 'b> MigrationDeprecations<'a, 'b> { #[doc = "Creates an asynchronous call to the Migration Deprecations API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -181,7 +181,7 @@ impl MigrationGetFeatureUpgradeStatusParts { } } } -#[doc = "Builder for the [Migration Get Feature Upgrade Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/migration-api-feature-upgrade.html)\n\nFind out whether system features need to be upgraded or not"] +#[doc = "Builder for the [Migration Get Feature Upgrade Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/migration-api-feature-upgrade.html)\n\nFind out whether system features need to be upgraded or not"] #[derive(Clone, Debug)] pub struct MigrationGetFeatureUpgradeStatus<'a, 'b> { transport: &'a Transport, @@ -248,7 +248,7 @@ impl<'a, 'b> MigrationGetFeatureUpgradeStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the Migration Get Feature Upgrade Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -293,7 +293,7 @@ impl MigrationPostFeatureUpgradeParts { } } } -#[doc = "Builder for the [Migration Post Feature Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/migration-api-feature-upgrade.html)\n\nBegin upgrades for system features"] +#[doc = "Builder for the [Migration Post Feature Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/migration-api-feature-upgrade.html)\n\nBegin upgrades for system features"] #[derive(Clone, Debug)] pub struct MigrationPostFeatureUpgrade<'a, 'b, B> { transport: &'a Transport, @@ -383,7 +383,7 @@ where #[doc = "Creates an asynchronous call to the Migration Post Feature Upgrade API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -426,18 +426,18 @@ impl<'a> Migration<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] + #[doc = "[Migration Deprecations API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/migration-api-deprecation.html)\n\nRetrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version."] pub fn deprecations<'b>( &'a self, parts: MigrationDeprecationsParts<'b>, ) -> MigrationDeprecations<'a, 'b> { MigrationDeprecations::new(self.transport(), parts) } - #[doc = "[Migration Get Feature Upgrade Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/migration-api-feature-upgrade.html)\n\nFind out whether system features need to be upgraded or not"] + #[doc = "[Migration Get Feature Upgrade Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/migration-api-feature-upgrade.html)\n\nFind out whether system features need to be upgraded or not"] pub fn get_feature_upgrade_status<'b>(&'a self) -> MigrationGetFeatureUpgradeStatus<'a, 'b> { MigrationGetFeatureUpgradeStatus::new(self.transport()) } - #[doc = "[Migration Post Feature Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/migration-api-feature-upgrade.html)\n\nBegin upgrades for system features"] + #[doc = "[Migration Post Feature Upgrade API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/migration-api-feature-upgrade.html)\n\nBegin upgrades for system features"] pub fn post_feature_upgrade<'b>(&'a self) -> MigrationPostFeatureUpgrade<'a, 'b, ()> { MigrationPostFeatureUpgrade::new(self.transport()) } diff --git a/elasticsearch/src/ml.rs b/elasticsearch/src/ml.rs index 9515ddea..093768e0 100644 --- a/elasticsearch/src/ml.rs +++ b/elasticsearch/src/ml.rs @@ -33,11 +33,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -45,6 +45,152 @@ use percent_encoding::percent_encode; use serde::Serialize; use std::{borrow::Cow, time::Duration}; #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Clear Trained Model Deployment Cache API"] +pub enum MlClearTrainedModelDeploymentCacheParts<'b> { + #[doc = "ModelId"] + ModelId(&'b str), +} +impl<'b> MlClearTrainedModelDeploymentCacheParts<'b> { + #[doc = "Builds a relative URL path to the Ml Clear Trained Model Deployment Cache API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlClearTrainedModelDeploymentCacheParts::ModelId(ref model_id) => { + let encoded_model_id: Cow = + percent_encode(model_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(44usize + encoded_model_id.len()); + p.push_str("/_ml/trained_models/"); + p.push_str(encoded_model_id.as_ref()); + p.push_str("/deployment/cache/_clear"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Clear Trained Model Deployment Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-trained-model-deployment-cache.html)\n\nClear the cached results from a trained model deployment"] +#[derive(Clone, Debug)] +pub struct MlClearTrainedModelDeploymentCache<'a, 'b, B> { + transport: &'a Transport, + parts: MlClearTrainedModelDeploymentCacheParts<'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> MlClearTrainedModelDeploymentCache<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlClearTrainedModelDeploymentCache] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: MlClearTrainedModelDeploymentCacheParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + MlClearTrainedModelDeploymentCache { + 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) -> MlClearTrainedModelDeploymentCache<'a, 'b, JsonBody> + where + T: Serialize, + { + MlClearTrainedModelDeploymentCache { + 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 Ml Clear Trained Model Deployment Cache 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) + } +} +#[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Close Job API"] pub enum MlCloseJobParts<'b> { #[doc = "JobId"] @@ -66,7 +212,7 @@ impl<'b> MlCloseJobParts<'b> { } } } -#[doc = "Builder for the [Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] +#[doc = "Builder for the [Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] #[derive(Clone, Debug)] pub struct MlCloseJob<'a, 'b, B> { transport: &'a Transport, @@ -180,7 +326,7 @@ where #[doc = "Creates an asynchronous call to the Ml Close Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -238,7 +384,7 @@ impl<'b> MlDeleteCalendarParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-calendar.html)\n\nDeletes a calendar."] +#[doc = "Builder for the [Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-calendar.html)\n\nDeletes a calendar."] #[derive(Clone, Debug)] pub struct MlDeleteCalendar<'a, 'b> { transport: &'a Transport, @@ -305,7 +451,7 @@ impl<'a, 'b> MlDeleteCalendar<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Calendar API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -363,7 +509,7 @@ impl<'b> MlDeleteCalendarEventParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] +#[doc = "Builder for the [Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] #[derive(Clone, Debug)] pub struct MlDeleteCalendarEvent<'a, 'b> { transport: &'a Transport, @@ -430,7 +576,7 @@ impl<'a, 'b> MlDeleteCalendarEvent<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Calendar Event API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -488,7 +634,7 @@ impl<'b> MlDeleteCalendarJobParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] +#[doc = "Builder for the [Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] #[derive(Clone, Debug)] pub struct MlDeleteCalendarJob<'a, 'b> { transport: &'a Transport, @@ -555,7 +701,7 @@ impl<'a, 'b> MlDeleteCalendarJob<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Calendar Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -606,7 +752,7 @@ impl<'b> MlDeleteDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-dfanalytics.html)\n\nDeletes an existing data frame analytics job."] +#[doc = "Builder for the [Ml Delete Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-dfanalytics.html)\n\nDeletes an existing data frame analytics job."] #[derive(Clone, Debug)] pub struct MlDeleteDataFrameAnalytics<'a, 'b> { transport: &'a Transport, @@ -687,7 +833,7 @@ impl<'a, 'b> MlDeleteDataFrameAnalytics<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -743,7 +889,7 @@ impl<'b> MlDeleteDatafeedParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] +#[doc = "Builder for the [Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] #[derive(Clone, Debug)] pub struct MlDeleteDatafeed<'a, 'b> { transport: &'a Transport, @@ -817,7 +963,7 @@ impl<'a, 'b> MlDeleteDatafeed<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -874,7 +1020,7 @@ impl<'b> MlDeleteExpiredDataParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] +#[doc = "Builder for the [Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] #[derive(Clone, Debug)] pub struct MlDeleteExpiredData<'a, 'b, B> { transport: &'a Transport, @@ -980,7 +1126,7 @@ where #[doc = "Creates an asynchronous call to the Ml Delete Expired Data API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1036,7 +1182,7 @@ impl<'b> MlDeleteFilterParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-filter.html)\n\nDeletes a filter."] +#[doc = "Builder for the [Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-filter.html)\n\nDeletes a filter."] #[derive(Clone, Debug)] pub struct MlDeleteFilter<'a, 'b> { transport: &'a Transport, @@ -1103,7 +1249,7 @@ impl<'a, 'b> MlDeleteFilter<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Filter API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1172,7 +1318,7 @@ impl<'b> MlDeleteForecastParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] +#[doc = "Builder for the [Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] #[derive(Clone, Debug)] pub struct MlDeleteForecast<'a, 'b> { transport: &'a Transport, @@ -1253,7 +1399,7 @@ impl<'a, 'b> MlDeleteForecast<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Forecast API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1309,11 +1455,12 @@ impl<'b> MlDeleteJobParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] +#[doc = "Builder for the [Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] #[derive(Clone, Debug)] pub struct MlDeleteJob<'a, 'b> { transport: &'a Transport, parts: MlDeleteJobParts<'b>, + delete_user_annotations: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, force: Option, @@ -1332,6 +1479,7 @@ impl<'a, 'b> MlDeleteJob<'a, 'b> { transport, parts, headers, + delete_user_annotations: None, error_trace: None, filter_path: None, force: None, @@ -1342,6 +1490,11 @@ impl<'a, 'b> MlDeleteJob<'a, 'b> { wait_for_completion: None, } } + #[doc = "Should annotations added by the user be deleted"] + pub fn delete_user_annotations(mut self, delete_user_annotations: bool) -> Self { + self.delete_user_annotations = Some(delete_user_annotations); + 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); @@ -1390,13 +1543,14 @@ impl<'a, 'b> MlDeleteJob<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + 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> { + delete_user_annotations: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -1407,6 +1561,7 @@ impl<'a, 'b> MlDeleteJob<'a, 'b> { wait_for_completion: Option, } let query_params = QueryParams { + delete_user_annotations: self.delete_user_annotations, error_trace: self.error_trace, filter_path: self.filter_path, force: self.force, @@ -1452,7 +1607,7 @@ impl<'b> MlDeleteModelSnapshotParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] +#[doc = "Builder for the [Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] #[derive(Clone, Debug)] pub struct MlDeleteModelSnapshot<'a, 'b> { transport: &'a Transport, @@ -1519,7 +1674,7 @@ impl<'a, 'b> MlDeleteModelSnapshot<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Model Snapshot API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1571,7 +1726,7 @@ impl<'b> MlDeleteTrainedModelParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-trained-models.html)\n\nDeletes an existing trained inference model that is currently not referenced by an ingest pipeline."] +#[doc = "Builder for the [Ml Delete Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-trained-models.html)\n\nDeletes an existing trained inference model that is currently not referenced by an ingest pipeline."] #[derive(Clone, Debug)] pub struct MlDeleteTrainedModel<'a, 'b> { transport: &'a Transport, @@ -1652,7 +1807,7 @@ impl<'a, 'b> MlDeleteTrainedModel<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Trained Model API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1714,7 +1869,7 @@ impl<'b> MlDeleteTrainedModelAliasParts<'b> { } } } -#[doc = "Builder for the [Ml Delete Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-trained-models-aliases.html)\n\nDeletes a model alias that refers to the trained model"] +#[doc = "Builder for the [Ml Delete Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-trained-models-aliases.html)\n\nDeletes a model alias that refers to the trained model"] #[derive(Clone, Debug)] pub struct MlDeleteTrainedModelAlias<'a, 'b> { transport: &'a Transport, @@ -1781,7 +1936,7 @@ impl<'a, 'b> MlDeleteTrainedModelAlias<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Delete Trained Model Alias API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1828,7 +1983,7 @@ impl MlEstimateModelMemoryParts { } } } -#[doc = "Builder for the [Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-apis.html)\n\nEstimates the model memory"] +#[doc = "Builder for the [Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-apis.html)\n\nEstimates the model memory"] #[derive(Clone, Debug)] pub struct MlEstimateModelMemory<'a, 'b, B> { transport: &'a Transport, @@ -1918,7 +2073,7 @@ where #[doc = "Creates an asynchronous call to the Ml Estimate Model Memory API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1963,7 +2118,7 @@ impl MlEvaluateDataFrameParts { } } } -#[doc = "Builder for the [Ml Evaluate Data Frame API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/evaluate-dfanalytics.html)\n\nEvaluates the data frame analytics for an annotated index."] +#[doc = "Builder for the [Ml Evaluate Data Frame API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/evaluate-dfanalytics.html)\n\nEvaluates the data frame analytics for an annotated index."] #[derive(Clone, Debug)] pub struct MlEvaluateDataFrame<'a, 'b, B> { transport: &'a Transport, @@ -2053,7 +2208,7 @@ where #[doc = "Creates an asynchronous call to the Ml Evaluate Data Frame API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2108,7 +2263,7 @@ impl<'b> MlExplainDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Explain Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/explain-dfanalytics.html)\n\nExplains a data frame analytics config."] +#[doc = "Builder for the [Ml Explain Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/explain-dfanalytics.html)\n\nExplains a data frame analytics config."] #[derive(Clone, Debug)] pub struct MlExplainDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, @@ -2199,8 +2354,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -2254,7 +2409,7 @@ impl<'b> MlFlushJobParts<'b> { } } } -#[doc = "Builder for the [Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] +#[doc = "Builder for the [Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] #[derive(Clone, Debug)] pub struct MlFlushJob<'a, 'b, B> { transport: &'a Transport, @@ -2384,7 +2539,7 @@ where #[doc = "Creates an asynchronous call to the Ml Flush Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2447,7 +2602,7 @@ impl<'b> MlForecastParts<'b> { } } } -#[doc = "Builder for the [Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] +#[doc = "Builder for the [Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] #[derive(Clone, Debug)] pub struct MlForecast<'a, 'b, B> { transport: &'a Transport, @@ -2561,7 +2716,7 @@ where #[doc = "Creates an asynchronous call to the Ml Forecast API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2635,7 +2790,7 @@ impl<'b> MlGetBucketsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] +#[doc = "Builder for the [Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] #[derive(Clone, Debug)] pub struct MlGetBuckets<'a, 'b, B> { transport: &'a Transport, @@ -2798,8 +2953,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -2871,7 +3026,7 @@ impl<'b> MlGetCalendarEventsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] +#[doc = "Builder for the [Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] #[derive(Clone, Debug)] pub struct MlGetCalendarEvents<'a, 'b> { transport: &'a Transport, @@ -2973,7 +3128,7 @@ impl<'a, 'b> MlGetCalendarEvents<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Calendar Events API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3038,7 +3193,7 @@ impl<'b> MlGetCalendarsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] +#[doc = "Builder for the [Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] #[derive(Clone, Debug)] pub struct MlGetCalendars<'a, 'b, B> { transport: &'a Transport, @@ -3145,8 +3300,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -3212,16 +3367,16 @@ impl<'b> MlGetCategoriesParts<'b> { MlGetCategoriesParts::JobId(ref job_id) => { let encoded_job_id: Cow = percent_encode(job_id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(43usize + encoded_job_id.len()); + let mut p = String::with_capacity(42usize + encoded_job_id.len()); p.push_str("/_ml/anomaly_detectors/"); p.push_str(encoded_job_id.as_ref()); - p.push_str("/results/categories/"); + p.push_str("/results/categories"); p.into() } } } } -#[doc = "Builder for the [Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] +#[doc = "Builder for the [Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] #[derive(Clone, Debug)] pub struct MlGetCategories<'a, 'b, B> { transport: &'a Transport, @@ -3336,8 +3491,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -3398,7 +3553,7 @@ impl<'b> MlGetDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-dfanalytics.html)\n\nRetrieves configuration information for data frame analytics jobs."] +#[doc = "Builder for the [Ml Get Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-dfanalytics.html)\n\nRetrieves configuration information for data frame analytics jobs."] #[derive(Clone, Debug)] pub struct MlGetDataFrameAnalytics<'a, 'b> { transport: &'a Transport, @@ -3493,7 +3648,7 @@ impl<'a, 'b> MlGetDataFrameAnalytics<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3556,7 +3711,7 @@ impl<'b> MlGetDataFrameAnalyticsStatsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Data Frame Analytics Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-dfanalytics-stats.html)\n\nRetrieves usage information for data frame analytics jobs."] +#[doc = "Builder for the [Ml Get Data Frame Analytics Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-dfanalytics-stats.html)\n\nRetrieves usage information for data frame analytics jobs."] #[derive(Clone, Debug)] pub struct MlGetDataFrameAnalyticsStats<'a, 'b> { transport: &'a Transport, @@ -3651,7 +3806,7 @@ impl<'a, 'b> MlGetDataFrameAnalyticsStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Data Frame Analytics Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3715,7 +3870,7 @@ impl<'b> MlGetDatafeedStatsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] +#[doc = "Builder for the [Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] #[derive(Clone, Debug)] pub struct MlGetDatafeedStats<'a, 'b> { transport: &'a Transport, @@ -3789,7 +3944,7 @@ impl<'a, 'b> MlGetDatafeedStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Datafeed Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3846,7 +4001,7 @@ impl<'b> MlGetDatafeedsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] +#[doc = "Builder for the [Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] #[derive(Clone, Debug)] pub struct MlGetDatafeeds<'a, 'b> { transport: &'a Transport, @@ -3927,7 +4082,7 @@ impl<'a, 'b> MlGetDatafeeds<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Datafeeds API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3986,7 +4141,7 @@ impl<'b> MlGetFiltersParts<'b> { } } } -#[doc = "Builder for the [Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-filter.html)\n\nRetrieves filters."] +#[doc = "Builder for the [Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-filter.html)\n\nRetrieves filters."] #[derive(Clone, Debug)] pub struct MlGetFilters<'a, 'b> { transport: &'a Transport, @@ -4067,7 +4222,7 @@ impl<'a, 'b> MlGetFilters<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Filters API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4124,7 +4279,7 @@ impl<'b> MlGetInfluencersParts<'b> { } } } -#[doc = "Builder for the [Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] +#[doc = "Builder for the [Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] #[derive(Clone, Debug)] pub struct MlGetInfluencers<'a, 'b, B> { transport: &'a Transport, @@ -4279,8 +4434,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -4353,7 +4508,7 @@ impl<'b> MlGetJobStatsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] +#[doc = "Builder for the [Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] #[derive(Clone, Debug)] pub struct MlGetJobStats<'a, 'b> { transport: &'a Transport, @@ -4427,7 +4582,7 @@ impl<'a, 'b> MlGetJobStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Job Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4484,7 +4639,7 @@ impl<'b> MlGetJobsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] +#[doc = "Builder for the [Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] #[derive(Clone, Debug)] pub struct MlGetJobs<'a, 'b> { transport: &'a Transport, @@ -4565,7 +4720,7 @@ impl<'a, 'b> MlGetJobs<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Jobs API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4625,7 +4780,7 @@ impl<'b> MlGetMemoryStatsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Memory Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-ml-memory.html)\n\nReturns information on how ML is using memory."] +#[doc = "Builder for the [Ml Get Memory Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-ml-memory.html)\n\nReturns information on how ML is using memory."] #[derive(Clone, Debug)] pub struct MlGetMemoryStats<'a, 'b> { transport: &'a Transport, @@ -4706,7 +4861,7 @@ impl<'a, 'b> MlGetMemoryStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Memory Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4769,7 +4924,7 @@ impl<'b> MlGetModelSnapshotUpgradeStatsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Model Snapshot Upgrade Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-job-model-snapshot-upgrade-stats.html)\n\nGets stats for anomaly detection job model snapshot upgrades that are in progress."] +#[doc = "Builder for the [Ml Get Model Snapshot Upgrade Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-job-model-snapshot-upgrade-stats.html)\n\nGets stats for anomaly detection job model snapshot upgrades that are in progress."] #[derive(Clone, Debug)] pub struct MlGetModelSnapshotUpgradeStats<'a, 'b> { transport: &'a Transport, @@ -4843,7 +4998,7 @@ impl<'a, 'b> MlGetModelSnapshotUpgradeStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Model Snapshot Upgrade Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4914,7 +5069,7 @@ impl<'b> MlGetModelSnapshotsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] +#[doc = "Builder for the [Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] #[derive(Clone, Debug)] pub struct MlGetModelSnapshots<'a, 'b, B> { transport: &'a Transport, @@ -5053,8 +5208,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -5120,7 +5275,7 @@ impl<'b> MlGetOverallBucketsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] +#[doc = "Builder for the [Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] #[derive(Clone, Debug)] pub struct MlGetOverallBuckets<'a, 'b, B> { transport: &'a Transport, @@ -5267,8 +5422,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -5336,7 +5491,7 @@ impl<'b> MlGetRecordsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] +#[doc = "Builder for the [Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] #[derive(Clone, Debug)] pub struct MlGetRecords<'a, 'b, B> { transport: &'a Transport, @@ -5491,8 +5646,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -5564,7 +5719,7 @@ impl<'b> MlGetTrainedModelsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-trained-models.html)\n\nRetrieves configuration information for a trained inference model."] +#[doc = "Builder for the [Ml Get Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-trained-models.html)\n\nRetrieves configuration information for a trained inference model."] #[derive(Clone, Debug)] pub struct MlGetTrainedModels<'a, 'b> { transport: &'a Transport, @@ -5687,7 +5842,7 @@ impl<'a, 'b> MlGetTrainedModels<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Trained Models API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5760,7 +5915,7 @@ impl<'b> MlGetTrainedModelsStatsParts<'b> { } } } -#[doc = "Builder for the [Ml Get Trained Models Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-trained-models-stats.html)\n\nRetrieves usage information for trained inference models."] +#[doc = "Builder for the [Ml Get Trained Models Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-trained-models-stats.html)\n\nRetrieves usage information for trained inference models."] #[derive(Clone, Debug)] pub struct MlGetTrainedModelsStats<'a, 'b> { transport: &'a Transport, @@ -5848,7 +6003,7 @@ impl<'a, 'b> MlGetTrainedModelsStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Get Trained Models Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5885,14 +6040,12 @@ impl<'a, 'b> MlGetTrainedModelsStats<'a, 'b> { Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Infer Trained Model API"] pub enum MlInferTrainedModelParts<'b> { #[doc = "ModelId"] ModelId(&'b str), } -#[cfg(feature = "experimental-apis")] impl<'b> MlInferTrainedModelParts<'b> { #[doc = "Builds a relative URL path to the Ml Infer Trained Model API"] pub fn url(self) -> Cow<'static, str> { @@ -5909,9 +6062,7 @@ impl<'b> MlInferTrainedModelParts<'b> { } } } -#[doc = "Builder for the [Ml Infer Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/infer-trained-model.html)\n\nEvaluate a trained model."] -#[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")] +#[doc = "Builder for the [Ml Infer Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/infer-trained-model.html)\n\nEvaluate a trained model."] #[derive(Clone, Debug)] pub struct MlInferTrainedModel<'a, 'b, B> { transport: &'a Transport, @@ -5926,7 +6077,6 @@ pub struct MlInferTrainedModel<'a, 'b, B> { source: Option<&'b str>, timeout: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> MlInferTrainedModel<'a, 'b, B> where B: Body, @@ -6010,7 +6160,7 @@ where #[doc = "Creates an asynchronous call to the Ml Infer Trained Model API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6057,7 +6207,7 @@ impl MlInfoParts { } } } -#[doc = "Builder for the [Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] +#[doc = "Builder for the [Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] #[derive(Clone, Debug)] pub struct MlInfo<'a, 'b> { transport: &'a Transport, @@ -6124,7 +6274,7 @@ impl<'a, 'b> MlInfo<'a, 'b> { #[doc = "Creates an asynchronous call to the Ml Info API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6177,7 +6327,7 @@ impl<'b> MlOpenJobParts<'b> { } } } -#[doc = "Builder for the [Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] +#[doc = "Builder for the [Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] #[derive(Clone, Debug)] pub struct MlOpenJob<'a, 'b, B> { transport: &'a Transport, @@ -6267,7 +6417,7 @@ where #[doc = "Creates an asynchronous call to the Ml Open Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6320,7 +6470,7 @@ impl<'b> MlPostCalendarEventsParts<'b> { } } } -#[doc = "Builder for the [Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] +#[doc = "Builder for the [Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] #[derive(Clone, Debug)] pub struct MlPostCalendarEvents<'a, 'b, B> { transport: &'a Transport, @@ -6410,7 +6560,7 @@ where #[doc = "Creates an asynchronous call to the Ml Post Calendar Events API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6463,7 +6613,7 @@ impl<'b> MlPostDataParts<'b> { } } } -#[doc = "Builder for the [Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] +#[doc = "Builder for the [Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] #[derive(Clone, Debug)] pub struct MlPostData<'a, 'b, B> { transport: &'a Transport, @@ -6569,7 +6719,7 @@ where #[doc = "Creates an asynchronous call to the Ml Post Data API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6628,7 +6778,7 @@ impl<'b> MlPreviewDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Preview Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/preview-dfanalytics.html)\n\nPreviews that will be analyzed given a data frame analytics config."] +#[doc = "Builder for the [Ml Preview Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/preview-dfanalytics.html)\n\nPreviews that will be analyzed given a data frame analytics config."] #[derive(Clone, Debug)] pub struct MlPreviewDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, @@ -6719,8 +6869,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -6777,7 +6927,7 @@ impl<'b> MlPreviewDatafeedParts<'b> { } } } -#[doc = "Builder for the [Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-preview-datafeed.html)\n\nPreviews a datafeed."] +#[doc = "Builder for the [Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-preview-datafeed.html)\n\nPreviews a datafeed."] #[derive(Clone, Debug)] pub struct MlPreviewDatafeed<'a, 'b, B> { transport: &'a Transport, @@ -6884,8 +7034,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -6942,7 +7092,7 @@ impl<'b> MlPutCalendarParts<'b> { } } } -#[doc = "Builder for the [Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-calendar.html)\n\nInstantiates a calendar."] +#[doc = "Builder for the [Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-calendar.html)\n\nInstantiates a calendar."] #[derive(Clone, Debug)] pub struct MlPutCalendar<'a, 'b, B> { transport: &'a Transport, @@ -7032,7 +7182,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Calendar API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7090,7 +7240,7 @@ impl<'b> MlPutCalendarJobParts<'b> { } } } -#[doc = "Builder for the [Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] +#[doc = "Builder for the [Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] #[derive(Clone, Debug)] pub struct MlPutCalendarJob<'a, 'b, B> { transport: &'a Transport, @@ -7180,7 +7330,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Calendar Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7231,7 +7381,7 @@ impl<'b> MlPutDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Put Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-dfanalytics.html)\n\nInstantiates a data frame analytics job."] +#[doc = "Builder for the [Ml Put Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-dfanalytics.html)\n\nInstantiates a data frame analytics job."] #[derive(Clone, Debug)] pub struct MlPutDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, @@ -7321,7 +7471,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7373,7 +7523,7 @@ impl<'b> MlPutDatafeedParts<'b> { } } } -#[doc = "Builder for the [Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-datafeed.html)\n\nInstantiates a datafeed."] +#[doc = "Builder for the [Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-datafeed.html)\n\nInstantiates a datafeed."] #[derive(Clone, Debug)] pub struct MlPutDatafeed<'a, 'b, B> { transport: &'a Transport, @@ -7495,7 +7645,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7556,7 +7706,7 @@ impl<'b> MlPutFilterParts<'b> { } } } -#[doc = "Builder for the [Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-filter.html)\n\nInstantiates a filter."] +#[doc = "Builder for the [Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-filter.html)\n\nInstantiates a filter."] #[derive(Clone, Debug)] pub struct MlPutFilter<'a, 'b, B> { transport: &'a Transport, @@ -7646,7 +7796,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Filter API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7698,7 +7848,7 @@ impl<'b> MlPutJobParts<'b> { } } } -#[doc = "Builder for the [Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-job.html)\n\nInstantiates an anomaly detection job."] +#[doc = "Builder for the [Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-job.html)\n\nInstantiates an anomaly detection job."] #[derive(Clone, Debug)] pub struct MlPutJob<'a, 'b, B> { transport: &'a Transport, @@ -7820,7 +7970,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7881,7 +8031,7 @@ impl<'b> MlPutTrainedModelParts<'b> { } } } -#[doc = "Builder for the [Ml Put Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-models.html)\n\nCreates an inference trained model."] +#[doc = "Builder for the [Ml Put Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-models.html)\n\nCreates an inference trained model."] #[derive(Clone, Debug)] pub struct MlPutTrainedModel<'a, 'b, B> { transport: &'a Transport, @@ -7895,6 +8045,7 @@ pub struct MlPutTrainedModel<'a, 'b, B> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + wait_for_completion: Option, } impl<'a, 'b, B> MlPutTrainedModel<'a, 'b, B> where @@ -7915,6 +8066,7 @@ where pretty: None, request_timeout: None, source: None, + wait_for_completion: None, } } #[doc = "The body for the API call"] @@ -7934,6 +8086,7 @@ where pretty: self.pretty, request_timeout: self.request_timeout, source: self.source, + wait_for_completion: self.wait_for_completion, } } #[doc = "If set to `true` and a `compressed_definition` is provided, the request defers definition decompression and skips relevant validations."] @@ -7976,10 +8129,15 @@ where self.source = Some(source); self } + #[doc = "Whether to wait for all child operations(e.g. model download) to complete, before returning or not. Default to false"] + pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self { + self.wait_for_completion = Some(wait_for_completion); + self + } #[doc = "Creates an asynchronous call to the Ml Put Trained Model API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7993,6 +8151,7 @@ where human: Option, pretty: Option, source: Option<&'b str>, + wait_for_completion: Option, } let query_params = QueryParams { defer_definition_decompression: self.defer_definition_decompression, @@ -8001,6 +8160,7 @@ where human: self.human, pretty: self.pretty, source: self.source, + wait_for_completion: self.wait_for_completion, }; Some(query_params) }; @@ -8039,7 +8199,7 @@ impl<'b> MlPutTrainedModelAliasParts<'b> { } } } -#[doc = "Builder for the [Ml Put Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-models-aliases.html)\n\nCreates a new model alias (or reassigns an existing one) to refer to the trained model"] +#[doc = "Builder for the [Ml Put Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-models-aliases.html)\n\nCreates a new model alias (or reassigns an existing one) to refer to the trained model"] #[derive(Clone, Debug)] pub struct MlPutTrainedModelAlias<'a, 'b, B> { transport: &'a Transport, @@ -8137,7 +8297,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Trained Model Alias API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8170,14 +8330,12 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Put Trained Model Definition Part API"] pub enum MlPutTrainedModelDefinitionPartParts<'b> { #[doc = "ModelId and Part"] ModelIdPart(&'b str, i32), } -#[cfg(feature = "experimental-apis")] impl<'b> MlPutTrainedModelDefinitionPartParts<'b> { #[doc = "Builds a relative URL path to the Ml Put Trained Model Definition Part API"] pub fn url(self) -> Cow<'static, str> { @@ -8199,9 +8357,7 @@ impl<'b> MlPutTrainedModelDefinitionPartParts<'b> { } } } -#[doc = "Builder for the [Ml Put Trained Model Definition Part API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-model-definition-part.html)\n\nCreates part of a trained model definition"] -#[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")] +#[doc = "Builder for the [Ml Put Trained Model Definition Part API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-model-definition-part.html)\n\nCreates part of a trained model definition"] #[derive(Clone, Debug)] pub struct MlPutTrainedModelDefinitionPart<'a, 'b, B> { transport: &'a Transport, @@ -8215,7 +8371,6 @@ pub struct MlPutTrainedModelDefinitionPart<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> MlPutTrainedModelDefinitionPart<'a, 'b, B> where B: Body, @@ -8292,7 +8447,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Trained Model Definition Part API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8323,14 +8478,12 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Put Trained Model Vocabulary API"] pub enum MlPutTrainedModelVocabularyParts<'b> { #[doc = "ModelId"] ModelId(&'b str), } -#[cfg(feature = "experimental-apis")] impl<'b> MlPutTrainedModelVocabularyParts<'b> { #[doc = "Builds a relative URL path to the Ml Put Trained Model Vocabulary API"] pub fn url(self) -> Cow<'static, str> { @@ -8347,9 +8500,7 @@ impl<'b> MlPutTrainedModelVocabularyParts<'b> { } } } -#[doc = "Builder for the [Ml Put Trained Model Vocabulary API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-model-vocabulary.html)\n\nCreates a trained model vocabulary"] -#[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")] +#[doc = "Builder for the [Ml Put Trained Model Vocabulary API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-model-vocabulary.html)\n\nCreates a trained model vocabulary"] #[derive(Clone, Debug)] pub struct MlPutTrainedModelVocabulary<'a, 'b, B> { transport: &'a Transport, @@ -8363,7 +8514,6 @@ pub struct MlPutTrainedModelVocabulary<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> MlPutTrainedModelVocabulary<'a, 'b, B> where B: Body, @@ -8440,7 +8590,7 @@ where #[doc = "Creates an asynchronous call to the Ml Put Trained Model Vocabulary API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8493,12 +8643,13 @@ impl<'b> MlResetJobParts<'b> { } } } -#[doc = "Builder for the [Ml Reset Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-reset-job.html)\n\nResets an existing anomaly detection job."] +#[doc = "Builder for the [Ml Reset Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-reset-job.html)\n\nResets an existing anomaly detection job."] #[derive(Clone, Debug)] pub struct MlResetJob<'a, 'b, B> { transport: &'a Transport, parts: MlResetJobParts<'b>, body: Option, + delete_user_annotations: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -8520,6 +8671,7 @@ where parts, headers, body: None, + delete_user_annotations: None, error_trace: None, filter_path: None, human: None, @@ -8538,6 +8690,7 @@ where transport: self.transport, parts: self.parts, body: Some(body.into()), + delete_user_annotations: self.delete_user_annotations, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, @@ -8548,6 +8701,11 @@ where wait_for_completion: self.wait_for_completion, } } + #[doc = "Should annotations added by the user be deleted"] + pub fn delete_user_annotations(mut self, delete_user_annotations: bool) -> Self { + self.delete_user_annotations = Some(delete_user_annotations); + 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); @@ -8591,13 +8749,14 @@ where #[doc = "Creates an asynchronous call to the Ml Reset Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + 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> { + delete_user_annotations: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -8607,6 +8766,7 @@ where wait_for_completion: Option, } let query_params = QueryParams { + delete_user_annotations: self.delete_user_annotations, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, @@ -8652,7 +8812,7 @@ impl<'b> MlRevertModelSnapshotParts<'b> { } } } -#[doc = "Builder for the [Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] +#[doc = "Builder for the [Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] #[derive(Clone, Debug)] pub struct MlRevertModelSnapshot<'a, 'b, B> { transport: &'a Transport, @@ -8750,7 +8910,7 @@ where #[doc = "Creates an asynchronous call to the Ml Revert Model Snapshot API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8797,7 +8957,7 @@ impl MlSetUpgradeModeParts { } } } -#[doc = "Builder for the [Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] +#[doc = "Builder for the [Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] #[derive(Clone, Debug)] pub struct MlSetUpgradeMode<'a, 'b, B> { transport: &'a Transport, @@ -8903,7 +9063,7 @@ where #[doc = "Creates an asynchronous call to the Ml Set Upgrade Mode API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8959,7 +9119,7 @@ impl<'b> MlStartDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Start Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-dfanalytics.html)\n\nStarts a data frame analytics job."] +#[doc = "Builder for the [Ml Start Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-dfanalytics.html)\n\nStarts a data frame analytics job."] #[derive(Clone, Debug)] pub struct MlStartDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, @@ -9057,7 +9217,7 @@ where #[doc = "Creates an asynchronous call to the Ml Start Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -9112,7 +9272,7 @@ impl<'b> MlStartDatafeedParts<'b> { } } } -#[doc = "Builder for the [Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] +#[doc = "Builder for the [Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] #[derive(Clone, Debug)] pub struct MlStartDatafeed<'a, 'b, B> { transport: &'a Transport, @@ -9226,7 +9386,7 @@ where #[doc = "Creates an asynchronous call to the Ml Start Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -9263,14 +9423,12 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Start Trained Model Deployment API"] pub enum MlStartTrainedModelDeploymentParts<'b> { #[doc = "ModelId"] ModelId(&'b str), } -#[cfg(feature = "experimental-apis")] impl<'b> MlStartTrainedModelDeploymentParts<'b> { #[doc = "Builds a relative URL path to the Ml Start Trained Model Deployment API"] pub fn url(self) -> Cow<'static, str> { @@ -9287,21 +9445,21 @@ impl<'b> MlStartTrainedModelDeploymentParts<'b> { } } } -#[doc = "Builder for the [Ml Start Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-trained-model-deployment.html)\n\nStart a trained model deployment."] -#[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")] +#[doc = "Builder for the [Ml Start Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-trained-model-deployment.html)\n\nStart a trained model deployment."] #[derive(Clone, Debug)] pub struct MlStartTrainedModelDeployment<'a, 'b, B> { transport: &'a Transport, parts: MlStartTrainedModelDeploymentParts<'b>, body: Option, cache_size: Option<&'b str>, + deployment_id: Option<&'b str>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, number_of_allocations: Option, pretty: Option, + priority: Option<&'b str>, queue_capacity: Option, request_timeout: Option, source: Option<&'b str>, @@ -9309,7 +9467,6 @@ pub struct MlStartTrainedModelDeployment<'a, 'b, B> { timeout: Option<&'b str>, wait_for: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> MlStartTrainedModelDeployment<'a, 'b, B> where B: Body, @@ -9323,11 +9480,13 @@ where headers, body: None, cache_size: None, + deployment_id: None, error_trace: None, filter_path: None, human: None, number_of_allocations: None, pretty: None, + priority: None, queue_capacity: None, request_timeout: None, source: None, @@ -9346,12 +9505,14 @@ where parts: self.parts, body: Some(body.into()), cache_size: self.cache_size, + deployment_id: self.deployment_id, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, human: self.human, number_of_allocations: self.number_of_allocations, pretty: self.pretty, + priority: self.priority, queue_capacity: self.queue_capacity, request_timeout: self.request_timeout, source: self.source, @@ -9365,6 +9526,11 @@ where self.cache_size = Some(cache_size); self } + #[doc = "The Id of the new deployment. Defaults to the model_id if not set."] + pub fn deployment_id(mut self, deployment_id: &'b str) -> Self { + self.deployment_id = Some(deployment_id); + 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); @@ -9385,7 +9551,7 @@ where self.human = Some(human); self } - #[doc = "The number of model allocations on each node where the model is deployed."] + #[doc = "The total number of allocations this model is assigned across machine learning nodes."] pub fn number_of_allocations(mut self, number_of_allocations: i32) -> Self { self.number_of_allocations = Some(number_of_allocations); self @@ -9395,6 +9561,11 @@ where self.pretty = Some(pretty); self } + #[doc = "The deployment priority."] + pub fn priority(mut self, priority: &'b str) -> Self { + self.priority = Some(priority); + self + } #[doc = "Controls how many inference requests are allowed in the queue at a time."] pub fn queue_capacity(mut self, queue_capacity: i32) -> Self { self.queue_capacity = Some(queue_capacity); @@ -9428,7 +9599,7 @@ where #[doc = "Creates an asynchronous call to the Ml Start Trained Model Deployment API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -9436,12 +9607,14 @@ where #[derive(Serialize)] struct QueryParams<'b> { cache_size: Option<&'b str>, + deployment_id: Option<&'b str>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, number_of_allocations: Option, pretty: Option, + priority: Option<&'b str>, queue_capacity: Option, source: Option<&'b str>, threads_per_allocation: Option, @@ -9450,11 +9623,13 @@ where } let query_params = QueryParams { cache_size: self.cache_size, + deployment_id: self.deployment_id, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, number_of_allocations: self.number_of_allocations, pretty: self.pretty, + priority: self.priority, queue_capacity: self.queue_capacity, source: self.source, threads_per_allocation: self.threads_per_allocation, @@ -9492,7 +9667,7 @@ impl<'b> MlStopDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Stop Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/stop-dfanalytics.html)\n\nStops one or more data frame analytics jobs."] +#[doc = "Builder for the [Ml Stop Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/stop-dfanalytics.html)\n\nStops one or more data frame analytics jobs."] #[derive(Clone, Debug)] pub struct MlStopDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, @@ -9606,7 +9781,7 @@ where #[doc = "Creates an asynchronous call to the Ml Stop Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -9665,7 +9840,7 @@ impl<'b> MlStopDatafeedParts<'b> { } } } -#[doc = "Builder for the [Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] +#[doc = "Builder for the [Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] #[derive(Clone, Debug)] pub struct MlStopDatafeed<'a, 'b, B> { transport: &'a Transport, @@ -9787,7 +9962,7 @@ where #[doc = "Creates an asynchronous call to the Ml Stop Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -9826,14 +10001,12 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Ml Stop Trained Model Deployment API"] pub enum MlStopTrainedModelDeploymentParts<'b> { #[doc = "ModelId"] ModelId(&'b str), } -#[cfg(feature = "experimental-apis")] impl<'b> MlStopTrainedModelDeploymentParts<'b> { #[doc = "Builds a relative URL path to the Ml Stop Trained Model Deployment API"] pub fn url(self) -> Cow<'static, str> { @@ -9850,9 +10023,7 @@ impl<'b> MlStopTrainedModelDeploymentParts<'b> { } } } -#[doc = "Builder for the [Ml Stop Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/stop-trained-model-deployment.html)\n\nStop a trained model deployment."] -#[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")] +#[doc = "Builder for the [Ml Stop Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/stop-trained-model-deployment.html)\n\nStop a trained model deployment."] #[derive(Clone, Debug)] pub struct MlStopTrainedModelDeployment<'a, 'b, B> { transport: &'a Transport, @@ -9868,7 +10039,6 @@ pub struct MlStopTrainedModelDeployment<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> MlStopTrainedModelDeployment<'a, 'b, B> where B: Body, @@ -9959,7 +10129,7 @@ where #[doc = "Creates an asynchronous call to the Ml Stop Trained Model Deployment API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -10015,7 +10185,7 @@ impl<'b> MlUpdateDataFrameAnalyticsParts<'b> { } } } -#[doc = "Builder for the [Ml Update Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/update-dfanalytics.html)\n\nUpdates certain properties of a data frame analytics job."] +#[doc = "Builder for the [Ml Update Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-dfanalytics.html)\n\nUpdates certain properties of a data frame analytics job."] #[derive(Clone, Debug)] pub struct MlUpdateDataFrameAnalytics<'a, 'b, B> { transport: &'a Transport, @@ -10105,7 +10275,7 @@ where #[doc = "Creates an asynchronous call to the Ml Update Data Frame Analytics API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -10158,7 +10328,7 @@ impl<'b> MlUpdateDatafeedParts<'b> { } } } -#[doc = "Builder for the [Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] +#[doc = "Builder for the [Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] #[derive(Clone, Debug)] pub struct MlUpdateDatafeed<'a, 'b, B> { transport: &'a Transport, @@ -10280,7 +10450,7 @@ where #[doc = "Creates an asynchronous call to the Ml Update Datafeed API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -10342,7 +10512,7 @@ impl<'b> MlUpdateFilterParts<'b> { } } } -#[doc = "Builder for the [Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] +#[doc = "Builder for the [Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] #[derive(Clone, Debug)] pub struct MlUpdateFilter<'a, 'b, B> { transport: &'a Transport, @@ -10432,7 +10602,7 @@ where #[doc = "Creates an asynchronous call to the Ml Update Filter API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -10485,7 +10655,7 @@ impl<'b> MlUpdateJobParts<'b> { } } } -#[doc = "Builder for the [Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] +#[doc = "Builder for the [Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] #[derive(Clone, Debug)] pub struct MlUpdateJob<'a, 'b, B> { transport: &'a Transport, @@ -10575,7 +10745,7 @@ where #[doc = "Creates an asynchronous call to the Ml Update Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -10634,7 +10804,7 @@ impl<'b> MlUpdateModelSnapshotParts<'b> { } } } -#[doc = "Builder for the [Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] +#[doc = "Builder for the [Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] #[derive(Clone, Debug)] pub struct MlUpdateModelSnapshot<'a, 'b, B> { transport: &'a Transport, @@ -10724,7 +10894,7 @@ where #[doc = "Creates an asynchronous call to the Ml Update Model Snapshot API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -10756,6 +10926,159 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Ml Update Trained Model Deployment API"] +pub enum MlUpdateTrainedModelDeploymentParts<'b> { + #[doc = "ModelId"] + ModelId(&'b str), +} +impl<'b> MlUpdateTrainedModelDeploymentParts<'b> { + #[doc = "Builds a relative URL path to the Ml Update Trained Model Deployment API"] + pub fn url(self) -> Cow<'static, str> { + match self { + MlUpdateTrainedModelDeploymentParts::ModelId(ref model_id) => { + let encoded_model_id: Cow = + percent_encode(model_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(39usize + encoded_model_id.len()); + p.push_str("/_ml/trained_models/"); + p.push_str(encoded_model_id.as_ref()); + p.push_str("/deployment/_update"); + p.into() + } + } + } +} +#[doc = "Builder for the [Ml Update Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-trained-model-deployment.html)\n\nUpdates certain properties of trained model deployment."] +#[derive(Clone, Debug)] +pub struct MlUpdateTrainedModelDeployment<'a, 'b, B> { + transport: &'a Transport, + parts: MlUpdateTrainedModelDeploymentParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + number_of_allocations: Option, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> MlUpdateTrainedModelDeployment<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [MlUpdateTrainedModelDeployment] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: MlUpdateTrainedModelDeploymentParts<'b>) -> Self { + let headers = HeaderMap::new(); + MlUpdateTrainedModelDeployment { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + number_of_allocations: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> MlUpdateTrainedModelDeployment<'a, 'b, JsonBody> + where + T: Serialize, + { + MlUpdateTrainedModelDeployment { + 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, + number_of_allocations: self.number_of_allocations, + 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 = "Update the model deployment to this number of allocations."] + pub fn number_of_allocations(mut self, number_of_allocations: i32) -> Self { + self.number_of_allocations = Some(number_of_allocations); + 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 Ml Update Trained Model Deployment 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, + number_of_allocations: Option, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + number_of_allocations: self.number_of_allocations, + 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)] #[doc = "API parts for the Ml Upgrade Job Snapshot API"] pub enum MlUpgradeJobSnapshotParts<'b> { #[doc = "JobId and SnapshotId"] @@ -10783,7 +11106,7 @@ impl<'b> MlUpgradeJobSnapshotParts<'b> { } } } -#[doc = "Builder for the [Ml Upgrade Job Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-upgrade-job-model-snapshot.html)\n\nUpgrades a given job snapshot to the current major version."] +#[doc = "Builder for the [Ml Upgrade Job Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-upgrade-job-model-snapshot.html)\n\nUpgrades a given job snapshot to the current major version."] #[derive(Clone, Debug)] pub struct MlUpgradeJobSnapshot<'a, 'b, B> { transport: &'a Transport, @@ -10889,7 +11212,7 @@ where #[doc = "Creates an asynchronous call to the Ml Upgrade Job Snapshot API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -10938,7 +11261,7 @@ impl MlValidateParts { } } } -#[doc = "Builder for the [Ml Validate API](https://www.elastic.co/guide/en/machine-learning/8.3/ml-jobs.html)\n\nValidates an anomaly detection job."] +#[doc = "Builder for the [Ml Validate API](https://www.elastic.co/guide/en/machine-learning/8.7/ml-jobs.html)\n\nValidates an anomaly detection job."] #[derive(Clone, Debug)] pub struct MlValidate<'a, 'b, B> { transport: &'a Transport, @@ -11028,7 +11351,7 @@ where #[doc = "Creates an asynchronous call to the Ml Validate API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -11073,7 +11396,7 @@ impl MlValidateDetectorParts { } } } -#[doc = "Builder for the [Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/8.3/ml-jobs.html)\n\nValidates an anomaly detection detector."] +#[doc = "Builder for the [Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/8.7/ml-jobs.html)\n\nValidates an anomaly detection detector."] #[derive(Clone, Debug)] pub struct MlValidateDetector<'a, 'b, B> { transport: &'a Transport, @@ -11163,7 +11486,7 @@ where #[doc = "Creates an asynchronous call to the Ml Validate Detector API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -11206,435 +11529,439 @@ impl<'a> Ml<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] + #[doc = "[Ml Clear Trained Model Deployment Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-trained-model-deployment-cache.html)\n\nClear the cached results from a trained model deployment"] + pub fn clear_trained_model_deployment_cache<'b>( + &'a self, + parts: MlClearTrainedModelDeploymentCacheParts<'b>, + ) -> MlClearTrainedModelDeploymentCache<'a, 'b, ()> { + MlClearTrainedModelDeploymentCache::new(self.transport(), parts) + } + #[doc = "[Ml Close Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-close-job.html)\n\nCloses one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle."] pub fn close_job<'b>(&'a self, parts: MlCloseJobParts<'b>) -> MlCloseJob<'a, 'b, ()> { MlCloseJob::new(self.transport(), parts) } - #[doc = "[Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-calendar.html)\n\nDeletes a calendar."] + #[doc = "[Ml Delete Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-calendar.html)\n\nDeletes a calendar."] pub fn delete_calendar<'b>( &'a self, parts: MlDeleteCalendarParts<'b>, ) -> MlDeleteCalendar<'a, 'b> { MlDeleteCalendar::new(self.transport(), parts) } - #[doc = "[Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] + #[doc = "[Ml Delete Calendar Event API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-calendar-event.html)\n\nDeletes scheduled events from a calendar."] pub fn delete_calendar_event<'b>( &'a self, parts: MlDeleteCalendarEventParts<'b>, ) -> MlDeleteCalendarEvent<'a, 'b> { MlDeleteCalendarEvent::new(self.transport(), parts) } - #[doc = "[Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] + #[doc = "[Ml Delete Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-calendar-job.html)\n\nDeletes anomaly detection jobs from a calendar."] pub fn delete_calendar_job<'b>( &'a self, parts: MlDeleteCalendarJobParts<'b>, ) -> MlDeleteCalendarJob<'a, 'b> { MlDeleteCalendarJob::new(self.transport(), parts) } - #[doc = "[Ml Delete Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-dfanalytics.html)\n\nDeletes an existing data frame analytics job."] + #[doc = "[Ml Delete Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-dfanalytics.html)\n\nDeletes an existing data frame analytics job."] pub fn delete_data_frame_analytics<'b>( &'a self, parts: MlDeleteDataFrameAnalyticsParts<'b>, ) -> MlDeleteDataFrameAnalytics<'a, 'b> { MlDeleteDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] + #[doc = "[Ml Delete Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-datafeed.html)\n\nDeletes an existing datafeed."] pub fn delete_datafeed<'b>( &'a self, parts: MlDeleteDatafeedParts<'b>, ) -> MlDeleteDatafeed<'a, 'b> { MlDeleteDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] + #[doc = "[Ml Delete Expired Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-expired-data.html)\n\nDeletes expired and unused machine learning data."] pub fn delete_expired_data<'b>( &'a self, parts: MlDeleteExpiredDataParts<'b>, ) -> MlDeleteExpiredData<'a, 'b, ()> { MlDeleteExpiredData::new(self.transport(), parts) } - #[doc = "[Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-filter.html)\n\nDeletes a filter."] + #[doc = "[Ml Delete Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-filter.html)\n\nDeletes a filter."] pub fn delete_filter<'b>(&'a self, parts: MlDeleteFilterParts<'b>) -> MlDeleteFilter<'a, 'b> { MlDeleteFilter::new(self.transport(), parts) } - #[doc = "[Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] + #[doc = "[Ml Delete Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-forecast.html)\n\nDeletes forecasts from a machine learning job."] pub fn delete_forecast<'b>( &'a self, parts: MlDeleteForecastParts<'b>, ) -> MlDeleteForecast<'a, 'b> { MlDeleteForecast::new(self.transport(), parts) } - #[doc = "[Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] + #[doc = "[Ml Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-job.html)\n\nDeletes an existing anomaly detection job."] pub fn delete_job<'b>(&'a self, parts: MlDeleteJobParts<'b>) -> MlDeleteJob<'a, 'b> { MlDeleteJob::new(self.transport(), parts) } - #[doc = "[Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] + #[doc = "[Ml Delete Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-delete-snapshot.html)\n\nDeletes an existing model snapshot."] pub fn delete_model_snapshot<'b>( &'a self, parts: MlDeleteModelSnapshotParts<'b>, ) -> MlDeleteModelSnapshot<'a, 'b> { MlDeleteModelSnapshot::new(self.transport(), parts) } - #[doc = "[Ml Delete Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-trained-models.html)\n\nDeletes an existing trained inference model that is currently not referenced by an ingest pipeline."] + #[doc = "[Ml Delete Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-trained-models.html)\n\nDeletes an existing trained inference model that is currently not referenced by an ingest pipeline."] pub fn delete_trained_model<'b>( &'a self, parts: MlDeleteTrainedModelParts<'b>, ) -> MlDeleteTrainedModel<'a, 'b> { MlDeleteTrainedModel::new(self.transport(), parts) } - #[doc = "[Ml Delete Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-trained-models-aliases.html)\n\nDeletes a model alias that refers to the trained model"] + #[doc = "[Ml Delete Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-trained-models-aliases.html)\n\nDeletes a model alias that refers to the trained model"] pub fn delete_trained_model_alias<'b>( &'a self, parts: MlDeleteTrainedModelAliasParts<'b>, ) -> MlDeleteTrainedModelAlias<'a, 'b> { MlDeleteTrainedModelAlias::new(self.transport(), parts) } - #[doc = "[Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-apis.html)\n\nEstimates the model memory"] + #[doc = "[Ml Estimate Model Memory API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-apis.html)\n\nEstimates the model memory"] pub fn estimate_model_memory<'b>(&'a self) -> MlEstimateModelMemory<'a, 'b, ()> { MlEstimateModelMemory::new(self.transport()) } - #[doc = "[Ml Evaluate Data Frame API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/evaluate-dfanalytics.html)\n\nEvaluates the data frame analytics for an annotated index."] + #[doc = "[Ml Evaluate Data Frame API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/evaluate-dfanalytics.html)\n\nEvaluates the data frame analytics for an annotated index."] pub fn evaluate_data_frame<'b>(&'a self) -> MlEvaluateDataFrame<'a, 'b, ()> { MlEvaluateDataFrame::new(self.transport()) } - #[doc = "[Ml Explain Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/explain-dfanalytics.html)\n\nExplains a data frame analytics config."] + #[doc = "[Ml Explain Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/explain-dfanalytics.html)\n\nExplains a data frame analytics config."] pub fn explain_data_frame_analytics<'b>( &'a self, parts: MlExplainDataFrameAnalyticsParts<'b>, ) -> MlExplainDataFrameAnalytics<'a, 'b, ()> { MlExplainDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] + #[doc = "[Ml Flush Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-flush-job.html)\n\nForces any buffered data to be processed by the job."] pub fn flush_job<'b>(&'a self, parts: MlFlushJobParts<'b>) -> MlFlushJob<'a, 'b, ()> { MlFlushJob::new(self.transport(), parts) } - #[doc = "[Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] + #[doc = "[Ml Forecast API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-forecast.html)\n\nPredicts the future behavior of a time series by using its historical behavior."] pub fn forecast<'b>(&'a self, parts: MlForecastParts<'b>) -> MlForecast<'a, 'b, ()> { MlForecast::new(self.transport(), parts) } - #[doc = "[Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] + #[doc = "[Ml Get Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-bucket.html)\n\nRetrieves anomaly detection job results for one or more buckets."] pub fn get_buckets<'b>(&'a self, parts: MlGetBucketsParts<'b>) -> MlGetBuckets<'a, 'b, ()> { MlGetBuckets::new(self.transport(), parts) } - #[doc = "[Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] + #[doc = "[Ml Get Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-calendar-event.html)\n\nRetrieves information about the scheduled events in calendars."] pub fn get_calendar_events<'b>( &'a self, parts: MlGetCalendarEventsParts<'b>, ) -> MlGetCalendarEvents<'a, 'b> { MlGetCalendarEvents::new(self.transport(), parts) } - #[doc = "[Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] + #[doc = "[Ml Get Calendars API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-calendar.html)\n\nRetrieves configuration information for calendars."] pub fn get_calendars<'b>( &'a self, parts: MlGetCalendarsParts<'b>, ) -> MlGetCalendars<'a, 'b, ()> { MlGetCalendars::new(self.transport(), parts) } - #[doc = "[Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] + #[doc = "[Ml Get Categories API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-category.html)\n\nRetrieves anomaly detection job results for one or more categories."] pub fn get_categories<'b>( &'a self, parts: MlGetCategoriesParts<'b>, ) -> MlGetCategories<'a, 'b, ()> { MlGetCategories::new(self.transport(), parts) } - #[doc = "[Ml Get Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-dfanalytics.html)\n\nRetrieves configuration information for data frame analytics jobs."] + #[doc = "[Ml Get Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-dfanalytics.html)\n\nRetrieves configuration information for data frame analytics jobs."] pub fn get_data_frame_analytics<'b>( &'a self, parts: MlGetDataFrameAnalyticsParts<'b>, ) -> MlGetDataFrameAnalytics<'a, 'b> { MlGetDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Get Data Frame Analytics Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-dfanalytics-stats.html)\n\nRetrieves usage information for data frame analytics jobs."] + #[doc = "[Ml Get Data Frame Analytics Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-dfanalytics-stats.html)\n\nRetrieves usage information for data frame analytics jobs."] pub fn get_data_frame_analytics_stats<'b>( &'a self, parts: MlGetDataFrameAnalyticsStatsParts<'b>, ) -> MlGetDataFrameAnalyticsStats<'a, 'b> { MlGetDataFrameAnalyticsStats::new(self.transport(), parts) } - #[doc = "[Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] + #[doc = "[Ml Get Datafeed Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-datafeed-stats.html)\n\nRetrieves usage information for datafeeds."] pub fn get_datafeed_stats<'b>( &'a self, parts: MlGetDatafeedStatsParts<'b>, ) -> MlGetDatafeedStats<'a, 'b> { MlGetDatafeedStats::new(self.transport(), parts) } - #[doc = "[Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] + #[doc = "[Ml Get Datafeeds API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-datafeed.html)\n\nRetrieves configuration information for datafeeds."] pub fn get_datafeeds<'b>(&'a self, parts: MlGetDatafeedsParts<'b>) -> MlGetDatafeeds<'a, 'b> { MlGetDatafeeds::new(self.transport(), parts) } - #[doc = "[Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-filter.html)\n\nRetrieves filters."] + #[doc = "[Ml Get Filters API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-filter.html)\n\nRetrieves filters."] pub fn get_filters<'b>(&'a self, parts: MlGetFiltersParts<'b>) -> MlGetFilters<'a, 'b> { MlGetFilters::new(self.transport(), parts) } - #[doc = "[Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] + #[doc = "[Ml Get Influencers API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-influencer.html)\n\nRetrieves anomaly detection job results for one or more influencers."] pub fn get_influencers<'b>( &'a self, parts: MlGetInfluencersParts<'b>, ) -> MlGetInfluencers<'a, 'b, ()> { MlGetInfluencers::new(self.transport(), parts) } - #[doc = "[Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] + #[doc = "[Ml Get Job Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-job-stats.html)\n\nRetrieves usage information for anomaly detection jobs."] pub fn get_job_stats<'b>(&'a self, parts: MlGetJobStatsParts<'b>) -> MlGetJobStats<'a, 'b> { MlGetJobStats::new(self.transport(), parts) } - #[doc = "[Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] + #[doc = "[Ml Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-job.html)\n\nRetrieves configuration information for anomaly detection jobs."] pub fn get_jobs<'b>(&'a self, parts: MlGetJobsParts<'b>) -> MlGetJobs<'a, 'b> { MlGetJobs::new(self.transport(), parts) } - #[doc = "[Ml Get Memory Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-ml-memory.html)\n\nReturns information on how ML is using memory."] + #[doc = "[Ml Get Memory Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-ml-memory.html)\n\nReturns information on how ML is using memory."] pub fn get_memory_stats<'b>( &'a self, parts: MlGetMemoryStatsParts<'b>, ) -> MlGetMemoryStats<'a, 'b> { MlGetMemoryStats::new(self.transport(), parts) } - #[doc = "[Ml Get Model Snapshot Upgrade Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-job-model-snapshot-upgrade-stats.html)\n\nGets stats for anomaly detection job model snapshot upgrades that are in progress."] + #[doc = "[Ml Get Model Snapshot Upgrade Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-job-model-snapshot-upgrade-stats.html)\n\nGets stats for anomaly detection job model snapshot upgrades that are in progress."] pub fn get_model_snapshot_upgrade_stats<'b>( &'a self, parts: MlGetModelSnapshotUpgradeStatsParts<'b>, ) -> MlGetModelSnapshotUpgradeStats<'a, 'b> { MlGetModelSnapshotUpgradeStats::new(self.transport(), parts) } - #[doc = "[Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] + #[doc = "[Ml Get Model Snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-snapshot.html)\n\nRetrieves information about model snapshots."] pub fn get_model_snapshots<'b>( &'a self, parts: MlGetModelSnapshotsParts<'b>, ) -> MlGetModelSnapshots<'a, 'b, ()> { MlGetModelSnapshots::new(self.transport(), parts) } - #[doc = "[Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] + #[doc = "[Ml Get Overall Buckets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-overall-buckets.html)\n\nRetrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs."] pub fn get_overall_buckets<'b>( &'a self, parts: MlGetOverallBucketsParts<'b>, ) -> MlGetOverallBuckets<'a, 'b, ()> { MlGetOverallBuckets::new(self.transport(), parts) } - #[doc = "[Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] + #[doc = "[Ml Get Records API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-get-record.html)\n\nRetrieves anomaly records for an anomaly detection job."] pub fn get_records<'b>(&'a self, parts: MlGetRecordsParts<'b>) -> MlGetRecords<'a, 'b, ()> { MlGetRecords::new(self.transport(), parts) } - #[doc = "[Ml Get Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-trained-models.html)\n\nRetrieves configuration information for a trained inference model."] + #[doc = "[Ml Get Trained Models API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-trained-models.html)\n\nRetrieves configuration information for a trained inference model."] pub fn get_trained_models<'b>( &'a self, parts: MlGetTrainedModelsParts<'b>, ) -> MlGetTrainedModels<'a, 'b> { MlGetTrainedModels::new(self.transport(), parts) } - #[doc = "[Ml Get Trained Models Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-trained-models-stats.html)\n\nRetrieves usage information for trained inference models."] + #[doc = "[Ml Get Trained Models Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-trained-models-stats.html)\n\nRetrieves usage information for trained inference models."] pub fn get_trained_models_stats<'b>( &'a self, parts: MlGetTrainedModelsStatsParts<'b>, ) -> MlGetTrainedModelsStats<'a, 'b> { MlGetTrainedModelsStats::new(self.transport(), parts) } - #[doc = "[Ml Infer Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/infer-trained-model.html)\n\nEvaluate a trained model."] - #[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")] + #[doc = "[Ml Infer Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/infer-trained-model.html)\n\nEvaluate a trained model."] pub fn infer_trained_model<'b>( &'a self, parts: MlInferTrainedModelParts<'b>, ) -> MlInferTrainedModel<'a, 'b, ()> { MlInferTrainedModel::new(self.transport(), parts) } - #[doc = "[Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] + #[doc = "[Ml Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-ml-info.html)\n\nReturns defaults and limits used by machine learning."] pub fn info<'b>(&'a self) -> MlInfo<'a, 'b> { MlInfo::new(self.transport()) } - #[doc = "[Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] + #[doc = "[Ml Open Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-open-job.html)\n\nOpens one or more anomaly detection jobs."] pub fn open_job<'b>(&'a self, parts: MlOpenJobParts<'b>) -> MlOpenJob<'a, 'b, ()> { MlOpenJob::new(self.transport(), parts) } - #[doc = "[Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] + #[doc = "[Ml Post Calendar Events API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-post-calendar-event.html)\n\nPosts scheduled events in a calendar."] pub fn post_calendar_events<'b>( &'a self, parts: MlPostCalendarEventsParts<'b>, ) -> MlPostCalendarEvents<'a, 'b, ()> { MlPostCalendarEvents::new(self.transport(), parts) } - #[doc = "[Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] + #[doc = "[Ml Post Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-post-data.html)\n\nSends data to an anomaly detection job for analysis."] pub fn post_data<'b>(&'a self, parts: MlPostDataParts<'b>) -> MlPostData<'a, 'b, ()> { MlPostData::new(self.transport(), parts) } - #[doc = "[Ml Preview Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.3/preview-dfanalytics.html)\n\nPreviews that will be analyzed given a data frame analytics config."] + #[doc = "[Ml Preview Data Frame Analytics API](http://www.elastic.co/guide/en/elasticsearch/reference/8.7/preview-dfanalytics.html)\n\nPreviews that will be analyzed given a data frame analytics config."] pub fn preview_data_frame_analytics<'b>( &'a self, parts: MlPreviewDataFrameAnalyticsParts<'b>, ) -> MlPreviewDataFrameAnalytics<'a, 'b, ()> { MlPreviewDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-preview-datafeed.html)\n\nPreviews a datafeed."] + #[doc = "[Ml Preview Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-preview-datafeed.html)\n\nPreviews a datafeed."] pub fn preview_datafeed<'b>( &'a self, parts: MlPreviewDatafeedParts<'b>, ) -> MlPreviewDatafeed<'a, 'b, ()> { MlPreviewDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-calendar.html)\n\nInstantiates a calendar."] + #[doc = "[Ml Put Calendar API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-calendar.html)\n\nInstantiates a calendar."] pub fn put_calendar<'b>(&'a self, parts: MlPutCalendarParts<'b>) -> MlPutCalendar<'a, 'b, ()> { MlPutCalendar::new(self.transport(), parts) } - #[doc = "[Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] + #[doc = "[Ml Put Calendar Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-calendar-job.html)\n\nAdds an anomaly detection job to a calendar."] pub fn put_calendar_job<'b>( &'a self, parts: MlPutCalendarJobParts<'b>, ) -> MlPutCalendarJob<'a, 'b, ()> { MlPutCalendarJob::new(self.transport(), parts) } - #[doc = "[Ml Put Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-dfanalytics.html)\n\nInstantiates a data frame analytics job."] + #[doc = "[Ml Put Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-dfanalytics.html)\n\nInstantiates a data frame analytics job."] pub fn put_data_frame_analytics<'b>( &'a self, parts: MlPutDataFrameAnalyticsParts<'b>, ) -> MlPutDataFrameAnalytics<'a, 'b, ()> { MlPutDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-datafeed.html)\n\nInstantiates a datafeed."] + #[doc = "[Ml Put Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-datafeed.html)\n\nInstantiates a datafeed."] pub fn put_datafeed<'b>(&'a self, parts: MlPutDatafeedParts<'b>) -> MlPutDatafeed<'a, 'b, ()> { MlPutDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-filter.html)\n\nInstantiates a filter."] + #[doc = "[Ml Put Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-filter.html)\n\nInstantiates a filter."] pub fn put_filter<'b>(&'a self, parts: MlPutFilterParts<'b>) -> MlPutFilter<'a, 'b, ()> { MlPutFilter::new(self.transport(), parts) } - #[doc = "[Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-put-job.html)\n\nInstantiates an anomaly detection job."] + #[doc = "[Ml Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-put-job.html)\n\nInstantiates an anomaly detection job."] pub fn put_job<'b>(&'a self, parts: MlPutJobParts<'b>) -> MlPutJob<'a, 'b, ()> { MlPutJob::new(self.transport(), parts) } - #[doc = "[Ml Put Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-models.html)\n\nCreates an inference trained model."] + #[doc = "[Ml Put Trained Model API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-models.html)\n\nCreates an inference trained model."] pub fn put_trained_model<'b>( &'a self, parts: MlPutTrainedModelParts<'b>, ) -> MlPutTrainedModel<'a, 'b, ()> { MlPutTrainedModel::new(self.transport(), parts) } - #[doc = "[Ml Put Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-models-aliases.html)\n\nCreates a new model alias (or reassigns an existing one) to refer to the trained model"] + #[doc = "[Ml Put Trained Model Alias API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-models-aliases.html)\n\nCreates a new model alias (or reassigns an existing one) to refer to the trained model"] pub fn put_trained_model_alias<'b>( &'a self, parts: MlPutTrainedModelAliasParts<'b>, ) -> MlPutTrainedModelAlias<'a, 'b, ()> { MlPutTrainedModelAlias::new(self.transport(), parts) } - #[doc = "[Ml Put Trained Model Definition Part API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-model-definition-part.html)\n\nCreates part of a trained model definition"] - #[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")] + #[doc = "[Ml Put Trained Model Definition Part API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-model-definition-part.html)\n\nCreates part of a trained model definition"] pub fn put_trained_model_definition_part<'b>( &'a self, parts: MlPutTrainedModelDefinitionPartParts<'b>, ) -> MlPutTrainedModelDefinitionPart<'a, 'b, ()> { MlPutTrainedModelDefinitionPart::new(self.transport(), parts) } - #[doc = "[Ml Put Trained Model Vocabulary API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-trained-model-vocabulary.html)\n\nCreates a trained model vocabulary"] - #[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")] + #[doc = "[Ml Put Trained Model Vocabulary API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-trained-model-vocabulary.html)\n\nCreates a trained model vocabulary"] pub fn put_trained_model_vocabulary<'b>( &'a self, parts: MlPutTrainedModelVocabularyParts<'b>, ) -> MlPutTrainedModelVocabulary<'a, 'b, ()> { MlPutTrainedModelVocabulary::new(self.transport(), parts) } - #[doc = "[Ml Reset Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-reset-job.html)\n\nResets an existing anomaly detection job."] + #[doc = "[Ml Reset Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-reset-job.html)\n\nResets an existing anomaly detection job."] pub fn reset_job<'b>(&'a self, parts: MlResetJobParts<'b>) -> MlResetJob<'a, 'b, ()> { MlResetJob::new(self.transport(), parts) } - #[doc = "[Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] + #[doc = "[Ml Revert Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-revert-snapshot.html)\n\nReverts to a specific snapshot."] pub fn revert_model_snapshot<'b>( &'a self, parts: MlRevertModelSnapshotParts<'b>, ) -> MlRevertModelSnapshot<'a, 'b, ()> { MlRevertModelSnapshot::new(self.transport(), parts) } - #[doc = "[Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] + #[doc = "[Ml Set Upgrade Mode API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-set-upgrade-mode.html)\n\nSets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade."] pub fn set_upgrade_mode<'b>(&'a self) -> MlSetUpgradeMode<'a, 'b, ()> { MlSetUpgradeMode::new(self.transport()) } - #[doc = "[Ml Start Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-dfanalytics.html)\n\nStarts a data frame analytics job."] + #[doc = "[Ml Start Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-dfanalytics.html)\n\nStarts a data frame analytics job."] pub fn start_data_frame_analytics<'b>( &'a self, parts: MlStartDataFrameAnalyticsParts<'b>, ) -> MlStartDataFrameAnalytics<'a, 'b, ()> { MlStartDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] + #[doc = "[Ml Start Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-start-datafeed.html)\n\nStarts one or more datafeeds."] pub fn start_datafeed<'b>( &'a self, parts: MlStartDatafeedParts<'b>, ) -> MlStartDatafeed<'a, 'b, ()> { MlStartDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Start Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-trained-model-deployment.html)\n\nStart a trained model deployment."] - #[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")] + #[doc = "[Ml Start Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-trained-model-deployment.html)\n\nStart a trained model deployment."] pub fn start_trained_model_deployment<'b>( &'a self, parts: MlStartTrainedModelDeploymentParts<'b>, ) -> MlStartTrainedModelDeployment<'a, 'b, ()> { MlStartTrainedModelDeployment::new(self.transport(), parts) } - #[doc = "[Ml Stop Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/stop-dfanalytics.html)\n\nStops one or more data frame analytics jobs."] + #[doc = "[Ml Stop Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/stop-dfanalytics.html)\n\nStops one or more data frame analytics jobs."] pub fn stop_data_frame_analytics<'b>( &'a self, parts: MlStopDataFrameAnalyticsParts<'b>, ) -> MlStopDataFrameAnalytics<'a, 'b, ()> { MlStopDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] + #[doc = "[Ml Stop Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-stop-datafeed.html)\n\nStops one or more datafeeds."] pub fn stop_datafeed<'b>( &'a self, parts: MlStopDatafeedParts<'b>, ) -> MlStopDatafeed<'a, 'b, ()> { MlStopDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Stop Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/stop-trained-model-deployment.html)\n\nStop a trained model deployment."] - #[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")] + #[doc = "[Ml Stop Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/stop-trained-model-deployment.html)\n\nStop a trained model deployment."] pub fn stop_trained_model_deployment<'b>( &'a self, parts: MlStopTrainedModelDeploymentParts<'b>, ) -> MlStopTrainedModelDeployment<'a, 'b, ()> { MlStopTrainedModelDeployment::new(self.transport(), parts) } - #[doc = "[Ml Update Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/update-dfanalytics.html)\n\nUpdates certain properties of a data frame analytics job."] + #[doc = "[Ml Update Data Frame Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-dfanalytics.html)\n\nUpdates certain properties of a data frame analytics job."] pub fn update_data_frame_analytics<'b>( &'a self, parts: MlUpdateDataFrameAnalyticsParts<'b>, ) -> MlUpdateDataFrameAnalytics<'a, 'b, ()> { MlUpdateDataFrameAnalytics::new(self.transport(), parts) } - #[doc = "[Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] + #[doc = "[Ml Update Datafeed API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-datafeed.html)\n\nUpdates certain properties of a datafeed."] pub fn update_datafeed<'b>( &'a self, parts: MlUpdateDatafeedParts<'b>, ) -> MlUpdateDatafeed<'a, 'b, ()> { MlUpdateDatafeed::new(self.transport(), parts) } - #[doc = "[Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] + #[doc = "[Ml Update Filter API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-filter.html)\n\nUpdates the description of a filter, adds items, or removes items."] pub fn update_filter<'b>( &'a self, parts: MlUpdateFilterParts<'b>, ) -> MlUpdateFilter<'a, 'b, ()> { MlUpdateFilter::new(self.transport(), parts) } - #[doc = "[Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] + #[doc = "[Ml Update Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-job.html)\n\nUpdates certain properties of an anomaly detection job."] pub fn update_job<'b>(&'a self, parts: MlUpdateJobParts<'b>) -> MlUpdateJob<'a, 'b, ()> { MlUpdateJob::new(self.transport(), parts) } - #[doc = "[Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] + #[doc = "[Ml Update Model Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-update-snapshot.html)\n\nUpdates certain properties of a snapshot."] pub fn update_model_snapshot<'b>( &'a self, parts: MlUpdateModelSnapshotParts<'b>, ) -> MlUpdateModelSnapshot<'a, 'b, ()> { MlUpdateModelSnapshot::new(self.transport(), parts) } - #[doc = "[Ml Upgrade Job Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/ml-upgrade-job-model-snapshot.html)\n\nUpgrades a given job snapshot to the current major version."] + #[doc = "[Ml Update Trained Model Deployment API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-trained-model-deployment.html)\n\nUpdates certain properties of trained model deployment."] + pub fn update_trained_model_deployment<'b>( + &'a self, + parts: MlUpdateTrainedModelDeploymentParts<'b>, + ) -> MlUpdateTrainedModelDeployment<'a, 'b, ()> { + MlUpdateTrainedModelDeployment::new(self.transport(), parts) + } + #[doc = "[Ml Upgrade Job Snapshot API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ml-upgrade-job-model-snapshot.html)\n\nUpgrades a given job snapshot to the current major version."] pub fn upgrade_job_snapshot<'b>( &'a self, parts: MlUpgradeJobSnapshotParts<'b>, ) -> MlUpgradeJobSnapshot<'a, 'b, ()> { MlUpgradeJobSnapshot::new(self.transport(), parts) } - #[doc = "[Ml Validate API](https://www.elastic.co/guide/en/machine-learning/8.3/ml-jobs.html)\n\nValidates an anomaly detection job."] + #[doc = "[Ml Validate API](https://www.elastic.co/guide/en/machine-learning/8.7/ml-jobs.html)\n\nValidates an anomaly detection job."] pub fn validate<'b>(&'a self) -> MlValidate<'a, 'b, ()> { MlValidate::new(self.transport()) } - #[doc = "[Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/8.3/ml-jobs.html)\n\nValidates an anomaly detection detector."] + #[doc = "[Ml Validate Detector API](https://www.elastic.co/guide/en/machine-learning/8.7/ml-jobs.html)\n\nValidates an anomaly detection detector."] pub fn validate_detector<'b>(&'a self) -> MlValidateDetector<'a, 'b, ()> { MlValidateDetector::new(self.transport()) } diff --git a/elasticsearch/src/monitoring.rs b/elasticsearch/src/monitoring.rs index f73938ac..608d8ed9 100644 --- a/elasticsearch/src/monitoring.rs +++ b/elasticsearch/src/monitoring.rs @@ -34,11 +34,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -69,7 +69,7 @@ impl<'b> MonitoringBulkParts<'b> { } } } -#[doc = "Builder for the [Monitoring Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/monitor-elasticsearch-cluster.html)\n\nUsed by the monitoring features to send monitoring data."] +#[doc = "Builder for the [Monitoring Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/monitor-elasticsearch-cluster.html)\n\nUsed by the monitoring features to send monitoring data."] #[derive(Clone, Debug)] pub struct MonitoringBulk<'a, 'b, B> { transport: &'a Transport, @@ -183,7 +183,7 @@ where #[doc = "Creates an asynchronous call to the Monitoring Bulk API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -232,7 +232,7 @@ impl<'a> Monitoring<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Monitoring Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/monitor-elasticsearch-cluster.html)\n\nUsed by the monitoring features to send monitoring data."] + #[doc = "[Monitoring Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/monitor-elasticsearch-cluster.html)\n\nUsed by the monitoring features to send monitoring data."] pub fn bulk<'b>(&'a self, parts: MonitoringBulkParts<'b>) -> MonitoringBulk<'a, 'b, ()> { MonitoringBulk::new(self.transport(), parts) } diff --git a/elasticsearch/src/nodes.rs b/elasticsearch/src/nodes.rs index 63e8d8b9..b0154b1e 100644 --- a/elasticsearch/src/nodes.rs +++ b/elasticsearch/src/nodes.rs @@ -34,11 +34,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -79,7 +79,7 @@ impl<'b> NodesClearRepositoriesMeteringArchiveParts<'b> { } } } -#[doc = "Builder for the [Nodes Clear Repositories Metering Archive API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clear-repositories-metering-archive-api.html)\n\nRemoves the archived repositories metering information present in the cluster."] +#[doc = "Builder for the [Nodes Clear Repositories Metering Archive API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-repositories-metering-archive-api.html)\n\nRemoves the archived repositories metering information present in the cluster."] #[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)] @@ -152,7 +152,7 @@ impl<'a, 'b> NodesClearRepositoriesMeteringArchive<'a, 'b> { #[doc = "Creates an asynchronous call to the Nodes Clear Repositories Metering Archive API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -208,7 +208,7 @@ impl<'b> NodesGetRepositoriesMeteringInfoParts<'b> { } } } -#[doc = "Builder for the [Nodes Get Repositories Metering Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-repositories-metering-api.html)\n\nReturns cluster repositories metering information."] +#[doc = "Builder for the [Nodes Get Repositories Metering Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-repositories-metering-api.html)\n\nReturns cluster repositories metering information."] #[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)] @@ -278,7 +278,7 @@ impl<'a, 'b> NodesGetRepositoriesMeteringInfo<'a, 'b> { #[doc = "Creates an asynchronous call to the Nodes Get Repositories Metering Info API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -335,7 +335,7 @@ impl<'b> NodesHotThreadsParts<'b> { } } } -#[doc = "Builder for the [Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] +#[doc = "Builder for the [Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] #[derive(Clone, Debug)] pub struct NodesHotThreads<'a, 'b> { transport: &'a Transport, @@ -451,7 +451,7 @@ impl<'a, 'b> NodesHotThreads<'a, 'b> { #[doc = "Creates an asynchronous call to the Nodes Hot Threads API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -550,7 +550,7 @@ impl<'b> NodesInfoParts<'b> { } } } -#[doc = "Builder for the [Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] +#[doc = "Builder for the [Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] #[derive(Clone, Debug)] pub struct NodesInfo<'a, 'b> { transport: &'a Transport, @@ -631,7 +631,7 @@ impl<'a, 'b> NodesInfo<'a, 'b> { #[doc = "Creates an asynchronous call to the Nodes Info API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -692,7 +692,7 @@ impl<'b> NodesReloadSecureSettingsParts<'b> { } } } -#[doc = "Builder for the [Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] +#[doc = "Builder for the [Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] #[derive(Clone, Debug)] pub struct NodesReloadSecureSettings<'a, 'b, B> { transport: &'a Transport, @@ -790,7 +790,7 @@ where #[doc = "Creates an asynchronous call to the Nodes Reload Secure Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -921,7 +921,7 @@ impl<'b> NodesStatsParts<'b> { } } } -#[doc = "Builder for the [Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] +#[doc = "Builder for the [Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] #[derive(Clone, Debug)] pub struct NodesStats<'a, 'b> { transport: &'a Transport, @@ -1051,7 +1051,7 @@ impl<'a, 'b> NodesStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Nodes Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1158,7 +1158,7 @@ impl<'b> NodesUsageParts<'b> { } } } -#[doc = "Builder for the [Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] +#[doc = "Builder for the [Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] #[derive(Clone, Debug)] pub struct NodesUsage<'a, 'b> { transport: &'a Transport, @@ -1232,7 +1232,7 @@ impl<'a, 'b> NodesUsage<'a, 'b> { #[doc = "Creates an asynchronous call to the Nodes Usage API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1277,7 +1277,7 @@ impl<'a> Nodes<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Nodes Clear Repositories Metering Archive API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clear-repositories-metering-archive-api.html)\n\nRemoves the archived repositories metering information present in the cluster."] + #[doc = "[Nodes Clear Repositories Metering Archive API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-repositories-metering-archive-api.html)\n\nRemoves the archived repositories metering information present in the cluster."] #[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 clear_repositories_metering_archive<'b>( @@ -1286,7 +1286,7 @@ impl<'a> Nodes<'a> { ) -> NodesClearRepositoriesMeteringArchive<'a, 'b> { NodesClearRepositoriesMeteringArchive::new(self.transport(), parts) } - #[doc = "[Nodes Get Repositories Metering Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-repositories-metering-api.html)\n\nReturns cluster repositories metering information."] + #[doc = "[Nodes Get Repositories Metering Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-repositories-metering-api.html)\n\nReturns cluster repositories metering information."] #[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_repositories_metering_info<'b>( @@ -1295,26 +1295,26 @@ impl<'a> Nodes<'a> { ) -> NodesGetRepositoriesMeteringInfo<'a, 'b> { NodesGetRepositoriesMeteringInfo::new(self.transport(), parts) } - #[doc = "[Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] + #[doc = "[Nodes Hot Threads API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-hot-threads.html)\n\nReturns information about hot threads on each node in the cluster."] pub fn hot_threads<'b>(&'a self, parts: NodesHotThreadsParts<'b>) -> NodesHotThreads<'a, 'b> { NodesHotThreads::new(self.transport(), parts) } - #[doc = "[Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] + #[doc = "[Nodes Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-info.html)\n\nReturns information about nodes in the cluster."] pub fn info<'b>(&'a self, parts: NodesInfoParts<'b>) -> NodesInfo<'a, 'b> { NodesInfo::new(self.transport(), parts) } - #[doc = "[Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] + #[doc = "[Nodes Reload Secure Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/secure-settings.html#reloadable-secure-settings)\n\nReloads secure settings."] pub fn reload_secure_settings<'b>( &'a self, parts: NodesReloadSecureSettingsParts<'b>, ) -> NodesReloadSecureSettings<'a, 'b, ()> { NodesReloadSecureSettings::new(self.transport(), parts) } - #[doc = "[Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] + #[doc = "[Nodes Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-stats.html)\n\nReturns statistical information about nodes in the cluster."] pub fn stats<'b>(&'a self, parts: NodesStatsParts<'b>) -> NodesStats<'a, 'b> { NodesStats::new(self.transport(), parts) } - #[doc = "[Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] + #[doc = "[Nodes Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/cluster-nodes-usage.html)\n\nReturns low-level information about REST actions usage on nodes."] pub fn usage<'b>(&'a self, parts: NodesUsageParts<'b>) -> NodesUsage<'a, 'b> { NodesUsage::new(self.transport(), parts) } diff --git a/elasticsearch/src/params.rs b/elasticsearch/src/params.rs index 1054ef1d..6ce6a407 100644 --- a/elasticsearch/src/params.rs +++ b/elasticsearch/src/params.rs @@ -147,6 +147,22 @@ pub enum Level { #[serde(rename = "shards")] Shards, } +#[doc = "REST method to check"] +#[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(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] +pub enum Method { + #[serde(rename = "GET")] + Get, + #[serde(rename = "HEAD")] + Head, + #[serde(rename = "POST")] + Post, + #[serde(rename = "PUT")] + Put, + #[serde(rename = "DELETE")] + Delete, +} #[doc = "Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID"] #[derive(Debug, PartialEq, Deserialize, Serialize, Clone, Copy)] pub enum OpType { diff --git a/elasticsearch/src/profiling.rs b/elasticsearch/src/profiling.rs new file mode 100644 index 00000000..ad9bfd37 --- /dev/null +++ b/elasticsearch/src/profiling.rs @@ -0,0 +1,621 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Profiling Flamegraph API"] +pub enum ProfilingFlamegraphParts { + #[doc = "No parts"] + None, +} +impl ProfilingFlamegraphParts { + #[doc = "Builds a relative URL path to the Profiling Flamegraph API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ProfilingFlamegraphParts::None => "/_profiling/flamegraph".into(), + } + } +} +#[doc = "Builder for the [Profiling Flamegraph API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nExtracts a UI-optimized structure to render flamegraphs from Universal Profiling."] +#[derive(Clone, Debug)] +pub struct ProfilingFlamegraph<'a, 'b, B> { + transport: &'a Transport, + parts: ProfilingFlamegraphParts, + 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> ProfilingFlamegraph<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ProfilingFlamegraph]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ProfilingFlamegraph { + transport, + parts: ProfilingFlamegraphParts::None, + 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) -> ProfilingFlamegraph<'a, 'b, JsonBody> + where + T: Serialize, + { + ProfilingFlamegraph { + 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 Profiling Flamegraph 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) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Profiling Stacktraces API"] +pub enum ProfilingStacktracesParts { + #[doc = "No parts"] + None, +} +impl ProfilingStacktracesParts { + #[doc = "Builds a relative URL path to the Profiling Stacktraces API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ProfilingStacktracesParts::None => "/_profiling/stacktraces".into(), + } + } +} +#[doc = "Builder for the [Profiling Stacktraces API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nExtracts raw stacktrace information from Universal Profiling."] +#[derive(Clone, Debug)] +pub struct ProfilingStacktraces<'a, 'b, B> { + transport: &'a Transport, + parts: ProfilingStacktracesParts, + 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> ProfilingStacktraces<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ProfilingStacktraces]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ProfilingStacktraces { + transport, + parts: ProfilingStacktracesParts::None, + 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) -> ProfilingStacktraces<'a, 'b, JsonBody> + where + T: Serialize, + { + ProfilingStacktraces { + 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 Profiling Stacktraces 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) + } +} +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Profiling Status API"] +pub enum ProfilingStatusParts { + #[doc = "No parts"] + None, +} +impl ProfilingStatusParts { + #[doc = "Builds a relative URL path to the Profiling Status API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ProfilingStatusParts::None => "/_profiling/status".into(), + } + } +} +#[doc = "Builder for the [Profiling Status API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nReturns basic information about the status of Universal Profiling."] +#[derive(Clone, Debug)] +pub struct ProfilingStatus<'a, 'b> { + transport: &'a Transport, + parts: ProfilingStatusParts, + error_trace: Option, + 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>, + wait_for_resources_created: Option, +} +impl<'a, 'b> ProfilingStatus<'a, 'b> { + #[doc = "Creates a new instance of [ProfilingStatus]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ProfilingStatus { + transport, + parts: ProfilingStatusParts::None, + headers, + error_trace: None, + filter_path: None, + human: None, + master_timeout: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + wait_for_resources_created: 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 = "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 = "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 = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Whether to return immediately or wait until resources have been created"] + pub fn wait_for_resources_created(mut self, wait_for_resources_created: bool) -> Self { + self.wait_for_resources_created = Some(wait_for_resources_created); + self + } + #[doc = "Creates an asynchronous call to the Profiling Status 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, + master_timeout: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + wait_for_resources_created: Option, + } + 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, + wait_for_resources_created: self.wait_for_resources_created, + }; + 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)] +#[doc = "API parts for the Profiling Topn Functions API"] +pub enum ProfilingTopnFunctionsParts { + #[doc = "No parts"] + None, +} +impl ProfilingTopnFunctionsParts { + #[doc = "Builds a relative URL path to the Profiling Topn Functions API"] + pub fn url(self) -> Cow<'static, str> { + match self { + ProfilingTopnFunctionsParts::None => "/_profiling/topn/functions".into(), + } + } +} +#[doc = "Builder for the [Profiling Topn Functions API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nExtracts a list of topN functions from Universal Profiling."] +#[derive(Clone, Debug)] +pub struct ProfilingTopnFunctions<'a, 'b, B> { + transport: &'a Transport, + parts: ProfilingTopnFunctionsParts, + 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> ProfilingTopnFunctions<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [ProfilingTopnFunctions]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + ProfilingTopnFunctions { + transport, + parts: ProfilingTopnFunctionsParts::None, + 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) -> ProfilingTopnFunctions<'a, 'b, JsonBody> + where + T: Serialize, + { + ProfilingTopnFunctions { + 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 Profiling Topn Functions 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 Profiling APIs"] +pub struct Profiling<'a> { + transport: &'a Transport, +} +impl<'a> Profiling<'a> { + #[doc = "Creates a new instance of [Profiling]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Profiling Flamegraph API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nExtracts a UI-optimized structure to render flamegraphs from Universal Profiling."] + pub fn flamegraph<'b>(&'a self) -> ProfilingFlamegraph<'a, 'b, ()> { + ProfilingFlamegraph::new(self.transport()) + } + #[doc = "[Profiling Stacktraces API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nExtracts raw stacktrace information from Universal Profiling."] + pub fn stacktraces<'b>(&'a self) -> ProfilingStacktraces<'a, 'b, ()> { + ProfilingStacktraces::new(self.transport()) + } + #[doc = "[Profiling Status API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nReturns basic information about the status of Universal Profiling."] + pub fn status<'b>(&'a self) -> ProfilingStatus<'a, 'b> { + ProfilingStatus::new(self.transport()) + } + #[doc = "[Profiling Topn Functions API](https://www.elastic.co/guide/en/observability/8.7/universal-profiling.html)\n\nExtracts a list of topN functions from Universal Profiling."] + pub fn topn_functions<'b>(&'a self) -> ProfilingTopnFunctions<'a, 'b, ()> { + ProfilingTopnFunctions::new(self.transport()) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for Profiling APIs"] + pub fn profiling(&self) -> Profiling { + Profiling::new(self.transport()) + } +} diff --git a/elasticsearch/src/query_rules.rs b/elasticsearch/src/query_rules.rs new file mode 100644 index 00000000..e877ef44 --- /dev/null +++ b/elasticsearch/src/query_rules.rs @@ -0,0 +1,1012 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Query Rules Delete Rule API"] +pub enum QueryRulesDeleteRuleParts<'b> { + #[doc = "RulesetId and RuleId"] + RulesetIdRuleId(&'b str, &'b str), +} +impl<'b> QueryRulesDeleteRuleParts<'b> { + #[doc = "Builds a relative URL path to the Query Rules Delete Rule API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesDeleteRuleParts::RulesetIdRuleId(ref ruleset_id, ref rule_id) => { + let encoded_ruleset_id: Cow = + percent_encode(ruleset_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_rule_id: Cow = + percent_encode(rule_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 21usize + encoded_ruleset_id.len() + encoded_rule_id.len(), + ); + p.push_str("/_query_rules/"); + p.push_str(encoded_ruleset_id.as_ref()); + p.push_str("/_rule/"); + p.push_str(encoded_rule_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Query Rules Delete Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-query-rule.html)\n\nDeletes an individual query rule within a ruleset."] +#[derive(Clone, Debug)] +pub struct QueryRulesDeleteRule<'a, 'b> { + transport: &'a Transport, + parts: QueryRulesDeleteRuleParts<'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> QueryRulesDeleteRule<'a, 'b> { + #[doc = "Creates a new instance of [QueryRulesDeleteRule] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: QueryRulesDeleteRuleParts<'b>) -> Self { + let headers = HeaderMap::new(); + QueryRulesDeleteRule { + 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 Query Rules Delete Rule 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)] +#[doc = "API parts for the Query Rules Delete Ruleset API"] +pub enum QueryRulesDeleteRulesetParts<'b> { + #[doc = "RulesetId"] + RulesetId(&'b str), +} +impl<'b> QueryRulesDeleteRulesetParts<'b> { + #[doc = "Builds a relative URL path to the Query Rules Delete Ruleset API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesDeleteRulesetParts::RulesetId(ref ruleset_id) => { + let encoded_ruleset_id: Cow = + percent_encode(ruleset_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(14usize + encoded_ruleset_id.len()); + p.push_str("/_query_rules/"); + p.push_str(encoded_ruleset_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Query Rules Delete Ruleset API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-query-ruleset.html)\n\nDeletes a query ruleset."] +#[derive(Clone, Debug)] +pub struct QueryRulesDeleteRuleset<'a, 'b> { + transport: &'a Transport, + parts: QueryRulesDeleteRulesetParts<'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> QueryRulesDeleteRuleset<'a, 'b> { + #[doc = "Creates a new instance of [QueryRulesDeleteRuleset] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: QueryRulesDeleteRulesetParts<'b>) -> Self { + let headers = HeaderMap::new(); + QueryRulesDeleteRuleset { + 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 Query Rules Delete Ruleset 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)] +#[doc = "API parts for the Query Rules Get Rule API"] +pub enum QueryRulesGetRuleParts<'b> { + #[doc = "RulesetId and RuleId"] + RulesetIdRuleId(&'b str, &'b str), +} +impl<'b> QueryRulesGetRuleParts<'b> { + #[doc = "Builds a relative URL path to the Query Rules Get Rule API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesGetRuleParts::RulesetIdRuleId(ref ruleset_id, ref rule_id) => { + let encoded_ruleset_id: Cow = + percent_encode(ruleset_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_rule_id: Cow = + percent_encode(rule_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 21usize + encoded_ruleset_id.len() + encoded_rule_id.len(), + ); + p.push_str("/_query_rules/"); + p.push_str(encoded_ruleset_id.as_ref()); + p.push_str("/_rule/"); + p.push_str(encoded_rule_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Query Rules Get Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-query-rule.html)\n\nReturns the details about an individual query rule within a ruleset."] +#[derive(Clone, Debug)] +pub struct QueryRulesGetRule<'a, 'b> { + transport: &'a Transport, + parts: QueryRulesGetRuleParts<'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> QueryRulesGetRule<'a, 'b> { + #[doc = "Creates a new instance of [QueryRulesGetRule] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: QueryRulesGetRuleParts<'b>) -> Self { + let headers = HeaderMap::new(); + QueryRulesGetRule { + 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 Query Rules Get Rule 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)] +#[doc = "API parts for the Query Rules Get Ruleset API"] +pub enum QueryRulesGetRulesetParts<'b> { + #[doc = "RulesetId"] + RulesetId(&'b str), +} +impl<'b> QueryRulesGetRulesetParts<'b> { + #[doc = "Builds a relative URL path to the Query Rules Get Ruleset API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesGetRulesetParts::RulesetId(ref ruleset_id) => { + let encoded_ruleset_id: Cow = + percent_encode(ruleset_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(14usize + encoded_ruleset_id.len()); + p.push_str("/_query_rules/"); + p.push_str(encoded_ruleset_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Query Rules Get Ruleset API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-query-ruleset.html)\n\nReturns the details about a query ruleset."] +#[derive(Clone, Debug)] +pub struct QueryRulesGetRuleset<'a, 'b> { + transport: &'a Transport, + parts: QueryRulesGetRulesetParts<'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> QueryRulesGetRuleset<'a, 'b> { + #[doc = "Creates a new instance of [QueryRulesGetRuleset] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: QueryRulesGetRulesetParts<'b>) -> Self { + let headers = HeaderMap::new(); + QueryRulesGetRuleset { + 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 Query Rules Get Ruleset 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)] +#[doc = "API parts for the Query Rules List Rulesets API"] +pub enum QueryRulesListRulesetsParts { + #[doc = "No parts"] + None, +} +impl QueryRulesListRulesetsParts { + #[doc = "Builds a relative URL path to the Query Rules List Rulesets API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesListRulesetsParts::None => "/_query_rules".into(), + } + } +} +#[doc = "Builder for the [Query Rules List Rulesets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-query-rulesets.html)\n\nLists query rulesets."] +#[derive(Clone, Debug)] +pub struct QueryRulesListRulesets<'a, 'b> { + transport: &'a Transport, + parts: QueryRulesListRulesetsParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + size: Option, + source: Option<&'b str>, +} +impl<'a, 'b> QueryRulesListRulesets<'a, 'b> { + #[doc = "Creates a new instance of [QueryRulesListRulesets]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + QueryRulesListRulesets { + transport, + parts: QueryRulesListRulesetsParts::None, + headers, + error_trace: None, + filter_path: None, + from: None, + human: None, + pretty: None, + request_timeout: None, + size: 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 = "Starting offset (default: 0)"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + 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 = "specifies a max number of results to get (default: 100)"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + 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 List Rulesets 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]>, + from: Option, + human: Option, + pretty: Option, + size: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + pretty: self.pretty, + size: self.size, + 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)] +#[doc = "API parts for the Query Rules Put Rule API"] +pub enum QueryRulesPutRuleParts<'b> { + #[doc = "RulesetId and RuleId"] + RulesetIdRuleId(&'b str, &'b str), +} +impl<'b> QueryRulesPutRuleParts<'b> { + #[doc = "Builds a relative URL path to the Query Rules Put Rule API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesPutRuleParts::RulesetIdRuleId(ref ruleset_id, ref rule_id) => { + let encoded_ruleset_id: Cow = + percent_encode(ruleset_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_rule_id: Cow = + percent_encode(rule_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 21usize + encoded_ruleset_id.len() + encoded_rule_id.len(), + ); + p.push_str("/_query_rules/"); + p.push_str(encoded_ruleset_id.as_ref()); + p.push_str("/_rule/"); + p.push_str(encoded_rule_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Query Rules Put Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-query-rule.html)\n\nCreates or updates a query rule within a ruleset."] +#[derive(Clone, Debug)] +pub struct QueryRulesPutRule<'a, 'b, B> { + transport: &'a Transport, + parts: QueryRulesPutRuleParts<'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> QueryRulesPutRule<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [QueryRulesPutRule] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: QueryRulesPutRuleParts<'b>) -> Self { + let headers = HeaderMap::new(); + QueryRulesPutRule { + 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) -> QueryRulesPutRule<'a, 'b, JsonBody> + where + T: Serialize, + { + QueryRulesPutRule { + 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 Put Rule 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)] +#[doc = "API parts for the Query Rules Put Ruleset API"] +pub enum QueryRulesPutRulesetParts<'b> { + #[doc = "RulesetId"] + RulesetId(&'b str), +} +impl<'b> QueryRulesPutRulesetParts<'b> { + #[doc = "Builds a relative URL path to the Query Rules Put Ruleset API"] + pub fn url(self) -> Cow<'static, str> { + match self { + QueryRulesPutRulesetParts::RulesetId(ref ruleset_id) => { + let encoded_ruleset_id: Cow = + percent_encode(ruleset_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(14usize + encoded_ruleset_id.len()); + p.push_str("/_query_rules/"); + p.push_str(encoded_ruleset_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Query Rules Put Ruleset API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-query-ruleset.html)\n\nCreates or updates a query ruleset."] +#[derive(Clone, Debug)] +pub struct QueryRulesPutRuleset<'a, 'b, B> { + transport: &'a Transport, + parts: QueryRulesPutRulesetParts<'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> QueryRulesPutRuleset<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [QueryRulesPutRuleset] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: QueryRulesPutRulesetParts<'b>) -> Self { + let headers = HeaderMap::new(); + QueryRulesPutRuleset { + 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) -> QueryRulesPutRuleset<'a, 'b, JsonBody> + where + T: Serialize, + { + QueryRulesPutRuleset { + 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 Put Ruleset 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) + } +} +#[doc = "Namespace client for QueryRules APIs"] +pub struct QueryRules<'a> { + transport: &'a Transport, +} +impl<'a> QueryRules<'a> { + #[doc = "Creates a new instance of [QueryRules]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Query Rules Delete Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-query-rule.html)\n\nDeletes an individual query rule within a ruleset."] + pub fn delete_rule<'b>( + &'a self, + parts: QueryRulesDeleteRuleParts<'b>, + ) -> QueryRulesDeleteRule<'a, 'b> { + QueryRulesDeleteRule::new(self.transport(), parts) + } + #[doc = "[Query Rules Delete Ruleset API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-query-ruleset.html)\n\nDeletes a query ruleset."] + pub fn delete_ruleset<'b>( + &'a self, + parts: QueryRulesDeleteRulesetParts<'b>, + ) -> QueryRulesDeleteRuleset<'a, 'b> { + QueryRulesDeleteRuleset::new(self.transport(), parts) + } + #[doc = "[Query Rules Get Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-query-rule.html)\n\nReturns the details about an individual query rule within a ruleset."] + pub fn get_rule<'b>(&'a self, parts: QueryRulesGetRuleParts<'b>) -> QueryRulesGetRule<'a, 'b> { + QueryRulesGetRule::new(self.transport(), parts) + } + #[doc = "[Query Rules Get Ruleset API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-query-ruleset.html)\n\nReturns the details about a query ruleset."] + pub fn get_ruleset<'b>( + &'a self, + parts: QueryRulesGetRulesetParts<'b>, + ) -> QueryRulesGetRuleset<'a, 'b> { + QueryRulesGetRuleset::new(self.transport(), parts) + } + #[doc = "[Query Rules List Rulesets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-query-rulesets.html)\n\nLists query rulesets."] + pub fn list_rulesets<'b>(&'a self) -> QueryRulesListRulesets<'a, 'b> { + QueryRulesListRulesets::new(self.transport()) + } + #[doc = "[Query Rules Put Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-query-rule.html)\n\nCreates or updates a query rule within a ruleset."] + pub fn put_rule<'b>( + &'a self, + parts: QueryRulesPutRuleParts<'b>, + ) -> QueryRulesPutRule<'a, 'b, ()> { + QueryRulesPutRule::new(self.transport(), parts) + } + #[doc = "[Query Rules Put Ruleset API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-query-ruleset.html)\n\nCreates or updates a query ruleset."] + pub fn put_ruleset<'b>( + &'a self, + parts: QueryRulesPutRulesetParts<'b>, + ) -> QueryRulesPutRuleset<'a, 'b, ()> { + QueryRulesPutRuleset::new(self.transport(), parts) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for QueryRules APIs"] + pub fn query_rules(&self) -> QueryRules { + QueryRules::new(self.transport()) + } +} diff --git a/elasticsearch/src/rollup.rs b/elasticsearch/src/rollup.rs index 9f35825b..ac0fad96 100644 --- a/elasticsearch/src/rollup.rs +++ b/elasticsearch/src/rollup.rs @@ -37,11 +37,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -70,7 +70,7 @@ impl<'b> RollupDeleteJobParts<'b> { } } } -#[doc = "Builder for the [Rollup Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-delete-job.html)\n\nDeletes an existing rollup job."] +#[doc = "Builder for the [Rollup Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-delete-job.html)\n\nDeletes an existing rollup job."] #[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)] @@ -140,7 +140,7 @@ impl<'a, 'b> RollupDeleteJob<'a, 'b> { #[doc = "Creates an asynchronous call to the Rollup Delete Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -192,11 +192,11 @@ impl<'b> RollupGetJobsParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - RollupGetJobsParts::None => "/_rollup/job/".into(), + RollupGetJobsParts::None => "/_rollup/job".into(), } } } -#[doc = "Builder for the [Rollup Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-get-job.html)\n\nRetrieves the configuration, stats, and status of rollup jobs."] +#[doc = "Builder for the [Rollup Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-get-job.html)\n\nRetrieves the configuration, stats, and status of rollup jobs."] #[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)] @@ -266,7 +266,7 @@ impl<'a, 'b> RollupGetJobs<'a, 'b> { #[doc = "Creates an asynchronous call to the Rollup Get Jobs API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -318,11 +318,11 @@ impl<'b> RollupGetRollupCapsParts<'b> { p.push_str(encoded_id.as_ref()); p.into() } - RollupGetRollupCapsParts::None => "/_rollup/data/".into(), + RollupGetRollupCapsParts::None => "/_rollup/data".into(), } } } -#[doc = "Builder for the [Rollup Get Rollup Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-get-rollup-caps.html)\n\nReturns the capabilities of any rollup jobs that have been configured for a specific index or index pattern."] +#[doc = "Builder for the [Rollup Get Rollup Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-get-rollup-caps.html)\n\nReturns the capabilities of any rollup jobs that have been configured for a specific index or index pattern."] #[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)] @@ -392,7 +392,7 @@ impl<'a, 'b> RollupGetRollupCaps<'a, 'b> { #[doc = "Creates an asynchronous call to the Rollup Get Rollup Caps API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -447,7 +447,7 @@ impl<'b> RollupGetRollupIndexCapsParts<'b> { } } } -#[doc = "Builder for the [Rollup Get Rollup Index Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-get-rollup-index-caps.html)\n\nReturns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored)."] +#[doc = "Builder for the [Rollup Get Rollup Index Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-get-rollup-index-caps.html)\n\nReturns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored)."] #[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)] @@ -517,7 +517,7 @@ impl<'a, 'b> RollupGetRollupIndexCaps<'a, 'b> { #[doc = "Creates an asynchronous call to the Rollup Get Rollup Index Caps API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -570,7 +570,7 @@ impl<'b> RollupPutJobParts<'b> { } } } -#[doc = "Builder for the [Rollup Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-put-job.html)\n\nCreates a rollup job."] +#[doc = "Builder for the [Rollup Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-put-job.html)\n\nCreates a rollup job."] #[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)] @@ -663,160 +663,7 @@ where #[doc = "Creates an asynchronous call to the Rollup Put Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = 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) - } -} -#[cfg(feature = "experimental-apis")] -#[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Rollup Rollup API"] -pub enum RollupRollupParts<'b> { - #[doc = "Index and RollupIndex"] - IndexRollupIndex(&'b str, &'b str), -} -#[cfg(feature = "experimental-apis")] -impl<'b> RollupRollupParts<'b> { - #[doc = "Builds a relative URL path to the Rollup Rollup API"] - pub fn url(self) -> Cow<'static, str> { - match self { - RollupRollupParts::IndexRollupIndex(ref index, ref rollup_index) => { - let encoded_index: Cow = - percent_encode(index.as_bytes(), PARTS_ENCODED).into(); - let encoded_rollup_index: Cow = - percent_encode(rollup_index.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 10usize + encoded_index.len() + encoded_rollup_index.len(), - ); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_rollup/"); - p.push_str(encoded_rollup_index.as_ref()); - p.into() - } - } - } -} -#[doc = "Builder for the [Rollup Rollup API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/xpack-rollup.html)\n\nRollup an index"] -#[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 RollupRollup<'a, 'b, B> { - transport: &'a Transport, - parts: RollupRollupParts<'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> RollupRollup<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [RollupRollup] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: RollupRollupParts<'b>) -> Self { - let headers = HeaderMap::new(); - RollupRollup { - 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) -> RollupRollup<'a, 'b, JsonBody> - where - T: Serialize, - { - RollupRollup { - 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 Rollup Rollup API that can be awaited"] - pub async fn send(self) -> Result { - let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -872,7 +719,7 @@ impl<'b> RollupRollupSearchParts<'b> { } } } -#[doc = "Builder for the [Rollup Rollup Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-search.html)\n\nEnables searching rolled-up data using the standard query DSL."] +#[doc = "Builder for the [Rollup Rollup Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-search.html)\n\nEnables searching rolled-up data using the standard query DSL."] #[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)] @@ -982,8 +829,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -1042,7 +889,7 @@ impl<'b> RollupStartJobParts<'b> { } } } -#[doc = "Builder for the [Rollup Start Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-start-job.html)\n\nStarts an existing, stopped rollup job."] +#[doc = "Builder for the [Rollup Start Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-start-job.html)\n\nStarts an existing, stopped rollup job."] #[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)] @@ -1135,7 +982,7 @@ where #[doc = "Creates an asynchronous call to the Rollup Start Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1189,7 +1036,7 @@ impl<'b> RollupStopJobParts<'b> { } } } -#[doc = "Builder for the [Rollup Stop Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-stop-job.html)\n\nStops an existing, started rollup job."] +#[doc = "Builder for the [Rollup Stop Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-stop-job.html)\n\nStops an existing, started rollup job."] #[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)] @@ -1298,7 +1145,7 @@ where #[doc = "Creates an asynchronous call to the Rollup Stop Job API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1348,19 +1195,19 @@ impl<'a> Rollup<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Rollup Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-delete-job.html)\n\nDeletes an existing rollup job."] + #[doc = "[Rollup Delete Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-delete-job.html)\n\nDeletes an existing rollup job."] #[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_job<'b>(&'a self, parts: RollupDeleteJobParts<'b>) -> RollupDeleteJob<'a, 'b> { RollupDeleteJob::new(self.transport(), parts) } - #[doc = "[Rollup Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-get-job.html)\n\nRetrieves the configuration, stats, and status of rollup jobs."] + #[doc = "[Rollup Get Jobs API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-get-job.html)\n\nRetrieves the configuration, stats, and status of rollup jobs."] #[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_jobs<'b>(&'a self, parts: RollupGetJobsParts<'b>) -> RollupGetJobs<'a, 'b> { RollupGetJobs::new(self.transport(), parts) } - #[doc = "[Rollup Get Rollup Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-get-rollup-caps.html)\n\nReturns the capabilities of any rollup jobs that have been configured for a specific index or index pattern."] + #[doc = "[Rollup Get Rollup Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-get-rollup-caps.html)\n\nReturns the capabilities of any rollup jobs that have been configured for a specific index or index pattern."] #[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_rollup_caps<'b>( @@ -1369,7 +1216,7 @@ impl<'a> Rollup<'a> { ) -> RollupGetRollupCaps<'a, 'b> { RollupGetRollupCaps::new(self.transport(), parts) } - #[doc = "[Rollup Get Rollup Index Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-get-rollup-index-caps.html)\n\nReturns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored)."] + #[doc = "[Rollup Get Rollup Index Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-get-rollup-index-caps.html)\n\nReturns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored)."] #[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_rollup_index_caps<'b>( @@ -1378,19 +1225,13 @@ impl<'a> Rollup<'a> { ) -> RollupGetRollupIndexCaps<'a, 'b> { RollupGetRollupIndexCaps::new(self.transport(), parts) } - #[doc = "[Rollup Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-put-job.html)\n\nCreates a rollup job."] + #[doc = "[Rollup Put Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-put-job.html)\n\nCreates a rollup job."] #[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_job<'b>(&'a self, parts: RollupPutJobParts<'b>) -> RollupPutJob<'a, 'b, ()> { RollupPutJob::new(self.transport(), parts) } - #[doc = "[Rollup Rollup API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/xpack-rollup.html)\n\nRollup an index"] - #[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 rollup<'b>(&'a self, parts: RollupRollupParts<'b>) -> RollupRollup<'a, 'b, ()> { - RollupRollup::new(self.transport(), parts) - } - #[doc = "[Rollup Rollup Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-search.html)\n\nEnables searching rolled-up data using the standard query DSL."] + #[doc = "[Rollup Rollup Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-search.html)\n\nEnables searching rolled-up data using the standard query DSL."] #[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 rollup_search<'b>( @@ -1399,13 +1240,13 @@ impl<'a> Rollup<'a> { ) -> RollupRollupSearch<'a, 'b, ()> { RollupRollupSearch::new(self.transport(), parts) } - #[doc = "[Rollup Start Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-start-job.html)\n\nStarts an existing, stopped rollup job."] + #[doc = "[Rollup Start Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-start-job.html)\n\nStarts an existing, stopped rollup job."] #[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 start_job<'b>(&'a self, parts: RollupStartJobParts<'b>) -> RollupStartJob<'a, 'b, ()> { RollupStartJob::new(self.transport(), parts) } - #[doc = "[Rollup Stop Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/rollup-stop-job.html)\n\nStops an existing, started rollup job."] + #[doc = "[Rollup Stop Job API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/rollup-stop-job.html)\n\nStops an existing, started rollup job."] #[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 stop_job<'b>(&'a self, parts: RollupStopJobParts<'b>) -> RollupStopJob<'a, 'b, ()> { diff --git a/elasticsearch/src/root/mod.rs b/elasticsearch/src/root/mod.rs index 06abe65e..2c66f928 100644 --- a/elasticsearch/src/root/mod.rs +++ b/elasticsearch/src/root/mod.rs @@ -29,11 +29,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -65,7 +65,7 @@ impl<'b> BulkParts<'b> { } } } -#[doc = "Builder for the [Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] +#[doc = "Builder for the [Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] #[derive(Clone, Debug)] pub struct Bulk<'a, 'b, B> { transport: &'a Transport, @@ -78,11 +78,13 @@ pub struct Bulk<'a, 'b, B> { filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + list_executed_pipelines: Option, pipeline: Option<&'b str>, pretty: Option, refresh: Option, request_timeout: Option, require_alias: Option, + require_data_stream: Option, routing: Option<&'b str>, source: Option<&'b str>, timeout: Option<&'b str>, @@ -107,11 +109,13 @@ where error_trace: None, filter_path: None, human: None, + list_executed_pipelines: None, pipeline: None, pretty: None, refresh: None, request_timeout: None, require_alias: None, + require_data_stream: None, routing: None, source: None, timeout: None, @@ -150,11 +154,13 @@ where filter_path: self.filter_path, headers: self.headers, human: self.human, + list_executed_pipelines: self.list_executed_pipelines, pipeline: self.pipeline, pretty: self.pretty, refresh: self.refresh, request_timeout: self.request_timeout, require_alias: self.require_alias, + require_data_stream: self.require_data_stream, routing: self.routing, source: self.source, timeout: self.timeout, @@ -182,6 +188,11 @@ where self.human = Some(human); self } + #[doc = "Sets list_executed_pipelines for all incoming documents. Defaults to unset (false)"] + pub fn list_executed_pipelines(mut self, list_executed_pipelines: bool) -> Self { + self.list_executed_pipelines = Some(list_executed_pipelines); + self + } #[doc = "The pipeline id to preprocess incoming documents with"] pub fn pipeline(mut self, pipeline: &'b str) -> Self { self.pipeline = Some(pipeline); @@ -207,6 +218,11 @@ where self.require_alias = Some(require_alias); self } + #[doc = "When true, requires the destination to be a data stream (existing or to-be-created). Default is false"] + pub fn require_data_stream(mut self, require_data_stream: bool) -> Self { + self.require_data_stream = Some(require_data_stream); + self + } #[doc = "Specific routing value"] pub fn routing(mut self, routing: &'b str) -> Self { self.routing = Some(routing); @@ -235,7 +251,7 @@ where #[doc = "Creates an asynchronous call to the Bulk API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -252,10 +268,12 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, + list_executed_pipelines: Option, pipeline: Option<&'b str>, pretty: Option, refresh: Option, require_alias: Option, + require_data_stream: Option, routing: Option<&'b str>, source: Option<&'b str>, timeout: Option<&'b str>, @@ -270,10 +288,12 @@ where error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + list_executed_pipelines: self.list_executed_pipelines, pipeline: self.pipeline, pretty: self.pretty, refresh: self.refresh, require_alias: self.require_alias, + require_data_stream: self.require_data_stream, routing: self.routing, source: self.source, timeout: self.timeout, @@ -290,6 +310,159 @@ where Ok(response) } } +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Capabilities API"] +pub enum CapabilitiesParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl CapabilitiesParts { + #[doc = "Builds a relative URL path to the Capabilities API"] + pub fn url(self) -> Cow<'static, str> { + match self { + CapabilitiesParts::None => "/_capabilities".into(), + } + } +} +#[doc = "Builder for the [Capabilities API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/capabilities.html)\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)] +pub struct Capabilities<'a, 'b> { + transport: &'a Transport, + parts: CapabilitiesParts, + capabilities: Option<&'b str>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + method: Option, + parameters: Option<&'b str>, + path: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> Capabilities<'a, 'b> { + #[doc = "Creates a new instance of [Capabilities]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + Capabilities { + transport, + parts: CapabilitiesParts::None, + headers, + capabilities: None, + error_trace: None, + filter_path: None, + human: None, + method: None, + parameters: None, + path: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "Comma-separated list of arbitrary API capabilities to check"] + pub fn capabilities(mut self, capabilities: &'b str) -> Self { + self.capabilities = Some(capabilities); + 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); + 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 = "REST method to check"] + pub fn method(mut self, method: Method) -> Self { + self.method = Some(method); + self + } + #[doc = "Comma-separated list of API parameters to check"] + pub fn parameters(mut self, parameters: &'b str) -> Self { + self.parameters = Some(parameters); + self + } + #[doc = "API path to check"] + pub fn path(mut self, path: &'b str) -> Self { + self.path = Some(path); + 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 Capabilities 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> { + capabilities: Option<&'b str>, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + method: Option, + parameters: Option<&'b str>, + path: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + capabilities: self.capabilities, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + method: self.method, + parameters: self.parameters, + path: self.path, + 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)] #[doc = "API parts for the Clear Scroll API"] pub enum ClearScrollParts<'b> { @@ -315,7 +488,7 @@ impl<'b> ClearScrollParts<'b> { } } } -#[doc = "Builder for the [Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] +#[doc = "Builder for the [Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] #[derive(Clone, Debug)] pub struct ClearScroll<'a, 'b, B> { transport: &'a Transport, @@ -405,7 +578,7 @@ where #[doc = "Creates an asynchronous call to the Clear Scroll API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -450,7 +623,7 @@ impl ClosePointInTimeParts { } } } -#[doc = "Builder for the [Close Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/point-in-time-api.html)\n\nClose a point in time"] +#[doc = "Builder for the [Close Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/point-in-time-api.html)\n\nClose a point in time"] #[derive(Clone, Debug)] pub struct ClosePointInTime<'a, 'b, B> { transport: &'a Transport, @@ -540,7 +713,7 @@ where #[doc = "Creates an asynchronous call to the Close Point In Time API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -597,7 +770,7 @@ impl<'b> CountParts<'b> { } } } -#[doc = "Builder for the [Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-count.html)\n\nReturns number of documents matching a query."] +#[doc = "Builder for the [Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-count.html)\n\nReturns number of documents matching a query."] #[derive(Clone, Debug)] pub struct Count<'a, 'b, B> { transport: &'a Transport, @@ -800,8 +973,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -887,7 +1060,7 @@ impl<'b> CreateParts<'b> { } } } -#[doc = "Builder for the [Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] +#[doc = "Builder for the [Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] #[derive(Clone, Debug)] pub struct Create<'a, 'b, B> { transport: &'a Transport, @@ -1033,7 +1206,7 @@ where #[doc = "Creates an asynchronous call to the Create API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1102,7 +1275,7 @@ impl<'b> DeleteParts<'b> { } } } -#[doc = "Builder for the [Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-delete.html)\n\nRemoves a document from the index."] +#[doc = "Builder for the [Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-delete.html)\n\nRemoves a document from the index."] #[derive(Clone, Debug)] pub struct Delete<'a, 'b> { transport: &'a Transport, @@ -1225,7 +1398,7 @@ impl<'a, 'b> Delete<'a, 'b> { #[doc = "Creates an asynchronous call to the Delete API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1295,7 +1468,7 @@ impl<'b> DeleteByQueryParts<'b> { } } } -#[doc = "Builder for the [Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] +#[doc = "Builder for the [Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] #[derive(Clone, Debug)] pub struct DeleteByQuery<'a, 'b, B> { transport: &'a Transport, @@ -1617,7 +1790,7 @@ where #[doc = "Creates an asynchronous call to the Delete By Query API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1732,7 +1905,7 @@ impl<'b> DeleteByQueryRethrottleParts<'b> { } } } -#[doc = "Builder for the [Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] +#[doc = "Builder for the [Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] #[derive(Clone, Debug)] pub struct DeleteByQueryRethrottle<'a, 'b, B> { transport: &'a Transport, @@ -1830,7 +2003,7 @@ where #[doc = "Creates an asynchronous call to the Delete By Query Rethrottle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1883,7 +2056,7 @@ impl<'b> DeleteScriptParts<'b> { } } } -#[doc = "Builder for the [Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nDeletes a script."] +#[doc = "Builder for the [Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nDeletes a script."] #[derive(Clone, Debug)] pub struct DeleteScript<'a, 'b> { transport: &'a Transport, @@ -1964,7 +2137,7 @@ impl<'a, 'b> DeleteScript<'a, 'b> { #[doc = "Creates an asynchronous call to the Delete Script API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2023,7 +2196,7 @@ impl<'b> ExistsParts<'b> { } } } -#[doc = "Builder for the [Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns information about whether a document exists in an index."] +#[doc = "Builder for the [Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns information about whether a document exists in an index."] #[derive(Clone, Debug)] pub struct Exists<'a, 'b> { transport: &'a Transport, @@ -2160,7 +2333,7 @@ impl<'a, 'b> Exists<'a, 'b> { #[doc = "Creates an asynchronous call to the Exists API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Head; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2239,7 +2412,7 @@ impl<'b> ExistsSourceParts<'b> { } } } -#[doc = "Builder for the [Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns information about whether a document source exists in an index."] +#[doc = "Builder for the [Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns information about whether a document source exists in an index."] #[derive(Clone, Debug)] pub struct ExistsSource<'a, 'b> { transport: &'a Transport, @@ -2369,7 +2542,7 @@ impl<'a, 'b> ExistsSource<'a, 'b> { #[doc = "Creates an asynchronous call to the Exists Source API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Head; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2445,7 +2618,7 @@ impl<'b> ExplainParts<'b> { } } } -#[doc = "Builder for the [Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] +#[doc = "Builder for the [Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] #[derive(Clone, Debug)] pub struct Explain<'a, 'b, B> { transport: &'a Transport, @@ -2632,8 +2805,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -2719,7 +2892,7 @@ impl<'b> FieldCapsParts<'b> { } } } -#[doc = "Builder for the [Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] +#[doc = "Builder for the [Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] #[derive(Clone, Debug)] pub struct FieldCaps<'a, 'b, B> { transport: &'a Transport, @@ -2734,6 +2907,7 @@ pub struct FieldCaps<'a, 'b, B> { headers: HeaderMap, human: Option, ignore_unavailable: Option, + include_empty_fields: Option, include_unmapped: Option, pretty: Option, request_timeout: Option, @@ -2760,6 +2934,7 @@ where filters: None, human: None, ignore_unavailable: None, + include_empty_fields: None, include_unmapped: None, pretty: None, request_timeout: None, @@ -2790,6 +2965,7 @@ where headers: self.headers, human: self.human, ignore_unavailable: self.ignore_unavailable, + include_empty_fields: self.include_empty_fields, include_unmapped: self.include_unmapped, pretty: self.pretty, request_timeout: self.request_timeout, @@ -2837,6 +3013,11 @@ where self.ignore_unavailable = Some(ignore_unavailable); self } + #[doc = "Include empty fields in result"] + pub fn include_empty_fields(mut self, include_empty_fields: bool) -> Self { + self.include_empty_fields = Some(include_empty_fields); + self + } #[doc = "Indicates whether unmapped fields should be included in the response."] pub fn include_unmapped(mut self, include_unmapped: bool) -> Self { self.include_unmapped = Some(include_unmapped); @@ -2866,8 +3047,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -2887,6 +3068,7 @@ where filters: Option<&'b [&'b str]>, human: Option, ignore_unavailable: Option, + include_empty_fields: Option, include_unmapped: Option, pretty: Option, source: Option<&'b str>, @@ -2902,6 +3084,7 @@ where filters: self.filters, human: self.human, ignore_unavailable: self.ignore_unavailable, + include_empty_fields: self.include_empty_fields, include_unmapped: self.include_unmapped, pretty: self.pretty, source: self.source, @@ -2941,7 +3124,7 @@ impl<'b> GetParts<'b> { } } } -#[doc = "Builder for the [Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns a document."] +#[doc = "Builder for the [Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns a document."] #[derive(Clone, Debug)] pub struct Get<'a, 'b> { transport: &'a Transport, @@ -3085,7 +3268,7 @@ impl<'a, 'b> Get<'a, 'b> { #[doc = "Creates an asynchronous call to the Get API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3162,7 +3345,7 @@ impl<'b> GetScriptParts<'b> { } } } -#[doc = "Builder for the [Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nReturns a script."] +#[doc = "Builder for the [Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nReturns a script."] #[derive(Clone, Debug)] pub struct GetScript<'a, 'b> { transport: &'a Transport, @@ -3236,7 +3419,7 @@ impl<'a, 'b> GetScript<'a, 'b> { #[doc = "Creates an asynchronous call to the Get Script API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3283,7 +3466,7 @@ impl GetScriptContextParts { } } } -#[doc = "Builder for the [Get Script Context API](https://www.elastic.co/guide/en/elasticsearch/painless/8.3/painless-contexts.html)\n\nReturns all script contexts."] +#[doc = "Builder for the [Get Script Context API](https://www.elastic.co/guide/en/elasticsearch/painless/8.7/painless-contexts.html)\n\nReturns all script contexts."] #[derive(Clone, Debug)] pub struct GetScriptContext<'a, 'b> { transport: &'a Transport, @@ -3350,7 +3533,7 @@ impl<'a, 'b> GetScriptContext<'a, 'b> { #[doc = "Creates an asynchronous call to the Get Script Context API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3395,7 +3578,7 @@ impl GetScriptLanguagesParts { } } } -#[doc = "Builder for the [Get Script Languages API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nReturns available script types, languages and contexts"] +#[doc = "Builder for the [Get Script Languages API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nReturns available script types, languages and contexts"] #[derive(Clone, Debug)] pub struct GetScriptLanguages<'a, 'b> { transport: &'a Transport, @@ -3462,7 +3645,7 @@ impl<'a, 'b> GetScriptLanguages<'a, 'b> { #[doc = "Creates an asynchronous call to the Get Script Languages API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3517,7 +3700,7 @@ impl<'b> GetSourceParts<'b> { } } } -#[doc = "Builder for the [Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns the source of a document."] +#[doc = "Builder for the [Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns the source of a document."] #[derive(Clone, Debug)] pub struct GetSource<'a, 'b> { transport: &'a Transport, @@ -3647,7 +3830,7 @@ impl<'a, 'b> GetSource<'a, 'b> { #[doc = "Creates an asynchronous call to the Get Source API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3700,6 +3883,155 @@ impl<'a, 'b> GetSource<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Health Report API"] +pub enum HealthReportParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Feature"] + Feature(&'b str), +} +impl<'b> HealthReportParts<'b> { + #[doc = "Builds a relative URL path to the Health Report API"] + pub fn url(self) -> Cow<'static, str> { + match self { + HealthReportParts::None => "/_health_report".into(), + HealthReportParts::Feature(ref feature) => { + let encoded_feature: Cow = + percent_encode(feature.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_feature.len()); + p.push_str("/_health_report/"); + p.push_str(encoded_feature.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Health Report API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/health-api.html)\n\nReturns the health of the cluster."] +#[derive(Clone, Debug)] +pub struct HealthReport<'a, 'b> { + transport: &'a Transport, + parts: HealthReportParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + size: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + verbose: Option, +} +impl<'a, 'b> HealthReport<'a, 'b> { + #[doc = "Creates a new instance of [HealthReport] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: HealthReportParts<'b>) -> Self { + let headers = HeaderMap::new(); + HealthReport { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + size: None, + source: None, + timeout: None, + verbose: 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 = "Limit the number of affected resources the health API returns"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + 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 = "Explicit operation timeout"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Opt in for more information about the health of the system"] + pub fn verbose(mut self, verbose: bool) -> Self { + self.verbose = Some(verbose); + self + } + #[doc = "Creates an asynchronous call to the Health Report 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, + size: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + verbose: Option, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + size: self.size, + source: self.source, + timeout: self.timeout, + verbose: self.verbose, + }; + 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)] #[doc = "API parts for the Index API"] pub enum IndexParts<'b> { #[doc = "Index and Id"] @@ -3734,7 +4066,7 @@ impl<'b> IndexParts<'b> { } } } -#[doc = "Builder for the [Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-index_.html)\n\nCreates or updates a document in an index."] +#[doc = "Builder for the [Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-index_.html)\n\nCreates or updates a document in an index."] #[derive(Clone, Debug)] pub struct Index<'a, 'b, B> { transport: &'a Transport, @@ -3752,6 +4084,7 @@ pub struct Index<'a, 'b, B> { refresh: Option, request_timeout: Option, require_alias: Option, + require_data_stream: Option, routing: Option<&'b str>, source: Option<&'b str>, timeout: Option<&'b str>, @@ -3782,6 +4115,7 @@ where refresh: None, request_timeout: None, require_alias: None, + require_data_stream: None, routing: None, source: None, timeout: None, @@ -3811,6 +4145,7 @@ where refresh: self.refresh, request_timeout: self.request_timeout, require_alias: self.require_alias, + require_data_stream: self.require_data_stream, routing: self.routing, source: self.source, timeout: self.timeout, @@ -3879,6 +4214,11 @@ where self.require_alias = Some(require_alias); self } + #[doc = "When true, requires the destination to be a data stream (existing or to-be-created). Default is false"] + pub fn require_data_stream(mut self, require_data_stream: bool) -> Self { + self.require_data_stream = Some(require_data_stream); + self + } #[doc = "Specific routing value"] pub fn routing(mut self, routing: &'b str) -> Self { self.routing = Some(routing); @@ -3912,7 +4252,7 @@ where #[doc = "Creates an asynchronous call to the Index API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3930,6 +4270,7 @@ where pretty: Option, refresh: Option, require_alias: Option, + require_data_stream: Option, routing: Option<&'b str>, source: Option<&'b str>, timeout: Option<&'b str>, @@ -3948,6 +4289,7 @@ where pretty: self.pretty, refresh: self.refresh, require_alias: self.require_alias, + require_data_stream: self.require_data_stream, routing: self.routing, source: self.source, timeout: self.timeout, @@ -3979,7 +4321,7 @@ impl InfoParts { } } } -#[doc = "Builder for the [Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/index.html)\n\nReturns basic information about the cluster."] +#[doc = "Builder for the [Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index.html)\n\nReturns basic information about the cluster."] #[derive(Clone, Debug)] pub struct Info<'a, 'b> { transport: &'a Transport, @@ -4046,7 +4388,7 @@ impl<'a, 'b> Info<'a, 'b> { #[doc = "Creates an asynchronous call to the Info API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4077,169 +4419,6 @@ impl<'a, 'b> Info<'a, 'b> { Ok(response) } } -#[cfg(feature = "experimental-apis")] -#[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Knn Search API"] -pub enum KnnSearchParts<'b> { - #[doc = "Index"] - Index(&'b [&'b str]), -} -#[cfg(feature = "experimental-apis")] -impl<'b> KnnSearchParts<'b> { - #[doc = "Builds a relative URL path to the Knn Search API"] - pub fn url(self) -> Cow<'static, str> { - match self { - KnnSearchParts::Index(ref index) => { - let index_str = index.join(","); - let encoded_index: Cow = - percent_encode(index_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(13usize + encoded_index.len()); - p.push_str("/"); - p.push_str(encoded_index.as_ref()); - p.push_str("/_knn_search"); - p.into() - } - } - } -} -#[doc = "Builder for the [Knn Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-search.html)\n\nPerforms a kNN search."] -#[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 KnnSearch<'a, 'b, B> { - transport: &'a Transport, - parts: KnnSearchParts<'b>, - body: Option, - error_trace: Option, - filter_path: Option<&'b [&'b str]>, - headers: HeaderMap, - human: Option, - pretty: Option, - request_timeout: Option, - routing: Option<&'b [&'b str]>, - source: Option<&'b str>, -} -#[cfg(feature = "experimental-apis")] -impl<'a, 'b, B> KnnSearch<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [KnnSearch] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: KnnSearchParts<'b>) -> Self { - let headers = HeaderMap::new(); - KnnSearch { - transport, - parts, - headers, - body: None, - error_trace: None, - filter_path: None, - human: None, - pretty: None, - request_timeout: None, - routing: None, - source: None, - } - } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> KnnSearch<'a, 'b, JsonBody> - where - T: Serialize, - { - KnnSearch { - 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, - routing: self.routing, - 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 = "A comma-separated list of specific routing values"] - pub fn routing(mut self, routing: &'b [&'b str]) -> Self { - self.routing = Some(routing); - 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 Knn Search API that can be awaited"] - pub async fn send(self) -> Result { - let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => 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, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - routing: Option<&'b [&'b str]>, - source: Option<&'b str>, - } - let query_params = QueryParams { - error_trace: self.error_trace, - filter_path: self.filter_path, - human: self.human, - pretty: self.pretty, - routing: self.routing, - 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)] #[doc = "API parts for the Mget API"] pub enum MgetParts<'b> { @@ -4265,7 +4444,7 @@ impl<'b> MgetParts<'b> { } } } -#[doc = "Builder for the [Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] +#[doc = "Builder for the [Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] #[derive(Clone, Debug)] pub struct Mget<'a, 'b, B> { transport: &'a Transport, @@ -4428,8 +4607,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -4509,7 +4688,7 @@ impl<'b> MsearchParts<'b> { } } } -#[doc = "Builder for the [Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-multi-search.html)\n\nAllows to execute several search operations in one request."] +#[doc = "Builder for the [Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-multi-search.html)\n\nAllows to execute several search operations in one request."] #[derive(Clone, Debug)] pub struct Msearch<'a, 'b, B> { transport: &'a Transport, @@ -4656,8 +4835,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -4729,7 +4908,7 @@ impl<'b> MsearchTemplateParts<'b> { } } } -#[doc = "Builder for the [Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] +#[doc = "Builder for the [Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] #[derive(Clone, Debug)] pub struct MsearchTemplate<'a, 'b, B> { transport: &'a Transport, @@ -4860,8 +5039,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -4928,7 +5107,7 @@ impl<'b> MtermvectorsParts<'b> { } } } -#[doc = "Builder for the [Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] +#[doc = "Builder for the [Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] #[derive(Clone, Debug)] pub struct Mtermvectors<'a, 'b, B> { transport: &'a Transport, @@ -5115,8 +5294,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -5197,7 +5376,7 @@ impl<'b> OpenPointInTimeParts<'b> { } } } -#[doc = "Builder for the [Open Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/point-in-time-api.html)\n\nOpen a point in time that can be used in subsequent searches"] +#[doc = "Builder for the [Open Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/point-in-time-api.html)\n\nOpen a point in time that can be used in subsequent searches"] #[derive(Clone, Debug)] pub struct OpenPointInTime<'a, 'b, B> { transport: &'a Transport, @@ -5327,7 +5506,7 @@ where #[doc = "Creates an asynchronous call to the Open Point In Time API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5383,7 +5562,7 @@ impl PingParts { } } } -#[doc = "Builder for the [Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/index.html)\n\nReturns whether the cluster is running."] +#[doc = "Builder for the [Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index.html)\n\nReturns whether the cluster is running."] #[derive(Clone, Debug)] pub struct Ping<'a, 'b> { transport: &'a Transport, @@ -5450,7 +5629,7 @@ impl<'a, 'b> Ping<'a, 'b> { #[doc = "Creates an asynchronous call to the Ping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Head; + let method = http::Method::Head; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5515,7 +5694,7 @@ impl<'b> PutScriptParts<'b> { } } } -#[doc = "Builder for the [Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nCreates or updates a script."] +#[doc = "Builder for the [Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nCreates or updates a script."] #[derive(Clone, Debug)] pub struct PutScript<'a, 'b, B> { transport: &'a Transport, @@ -5629,7 +5808,7 @@ where #[doc = "Creates an asynchronous call to the Put Script API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5692,7 +5871,7 @@ impl<'b> RankEvalParts<'b> { } } } -#[doc = "Builder for the [Rank Eval API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-rank-eval.html)\n\nAllows to evaluate the quality of ranked search results over a set of typical search queries"] +#[doc = "Builder for the [Rank Eval API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-rank-eval.html)\n\nAllows to evaluate the quality of ranked search results over a set of typical search queries"] #[derive(Clone, Debug)] pub struct RankEval<'a, 'b, B> { transport: &'a Transport, @@ -5815,8 +5994,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -5871,7 +6050,7 @@ impl ReindexParts { } } } -#[doc = "Builder for the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] +#[doc = "Builder for the [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] #[derive(Clone, Debug)] pub struct Reindex<'a, 'b, B> { transport: &'a Transport, @@ -6025,7 +6204,7 @@ where #[doc = "Creates an asynchronous call to the Reindex API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6094,7 +6273,7 @@ impl<'b> ReindexRethrottleParts<'b> { } } } -#[doc = "Builder for the [Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] +#[doc = "Builder for the [Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] #[derive(Clone, Debug)] pub struct ReindexRethrottle<'a, 'b, B> { transport: &'a Transport, @@ -6192,7 +6371,7 @@ where #[doc = "Creates an asynchronous call to the Reindex Rethrottle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6248,7 +6427,7 @@ impl<'b> RenderSearchTemplateParts<'b> { } } } -#[doc = "Builder for the [Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/render-search-template-api.html)\n\nAllows to use the Mustache language to pre-render a search definition."] +#[doc = "Builder for the [Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/render-search-template-api.html)\n\nAllows to use the Mustache language to pre-render a search definition."] #[derive(Clone, Debug)] pub struct RenderSearchTemplate<'a, 'b, B> { transport: &'a Transport, @@ -6339,8 +6518,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -6388,7 +6567,7 @@ impl ScriptsPainlessExecuteParts { } } } -#[doc = "Builder for the [Scripts Painless Execute API](https://www.elastic.co/guide/en/elasticsearch/painless/8.3/painless-execute-api.html)\n\nAllows an arbitrary script to be executed and a result to be returned"] +#[doc = "Builder for the [Scripts Painless Execute API](https://www.elastic.co/guide/en/elasticsearch/painless/8.7/painless-execute-api.html)\n\nAllows an arbitrary script to be executed and a result to be returned"] #[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)] @@ -6482,8 +6661,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -6539,7 +6718,7 @@ impl<'b> ScrollParts<'b> { } } } -#[doc = "Builder for the [Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request."] +#[doc = "Builder for the [Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request."] #[derive(Clone, Debug)] pub struct Scroll<'a, 'b, B> { transport: &'a Transport, @@ -6654,8 +6833,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -6719,7 +6898,7 @@ impl<'b> SearchParts<'b> { } } } -#[doc = "Builder for the [Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-search.html)\n\nReturns results matching a query."] +#[doc = "Builder for the [Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-search.html)\n\nReturns results matching a query."] #[derive(Clone, Debug)] pub struct Search<'a, 'b, B> { transport: &'a Transport, @@ -6747,6 +6926,7 @@ pub struct Search<'a, 'b, B> { human: Option, ignore_throttled: Option, ignore_unavailable: Option, + include_named_queries_score: Option, lenient: Option, max_concurrent_shard_requests: Option, min_compatible_shard_node: Option<&'b str>, @@ -6810,6 +6990,7 @@ where human: None, ignore_throttled: None, ignore_unavailable: None, + include_named_queries_score: None, lenient: None, max_concurrent_shard_requests: None, min_compatible_shard_node: None, @@ -6912,6 +7093,7 @@ where human: self.human, ignore_throttled: self.ignore_throttled, ignore_unavailable: self.ignore_unavailable, + include_named_queries_score: self.include_named_queries_score, lenient: self.lenient, max_concurrent_shard_requests: self.max_concurrent_shard_requests, min_compatible_shard_node: self.min_compatible_shard_node, @@ -7013,6 +7195,11 @@ where self.ignore_unavailable = Some(ignore_unavailable); self } + #[doc = "Indicates whether hit.matched_queries should be rendered as a map that includes the name of the matched query associated with its score (true) or as an array containing the name of the matched queries (false)"] + pub fn include_named_queries_score(mut self, include_named_queries_score: bool) -> Self { + self.include_named_queries_score = Some(include_named_queries_score); + self + } #[doc = "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored"] pub fn lenient(mut self, lenient: bool) -> Self { self.lenient = Some(lenient); @@ -7162,8 +7349,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -7198,6 +7385,7 @@ where human: Option, ignore_throttled: Option, ignore_unavailable: Option, + include_named_queries_score: Option, lenient: Option, max_concurrent_shard_requests: Option, min_compatible_shard_node: Option<&'b str>, @@ -7253,6 +7441,7 @@ where human: self.human, ignore_throttled: self.ignore_throttled, ignore_unavailable: self.ignore_unavailable, + include_named_queries_score: self.include_named_queries_score, lenient: self.lenient, max_concurrent_shard_requests: self.max_concurrent_shard_requests, min_compatible_shard_node: self.min_compatible_shard_node, @@ -7340,7 +7529,7 @@ impl<'b> SearchMvtParts<'b> { } } } -#[doc = "Builder for the [Search Mvt API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-vector-tile-api.html)\n\nSearches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile."] +#[doc = "Builder for the [Search Mvt API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-vector-tile-api.html)\n\nSearches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile."] #[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)] @@ -7490,8 +7679,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -7563,7 +7752,7 @@ impl<'b> SearchShardsParts<'b> { } } } -#[doc = "Builder for the [Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] +#[doc = "Builder for the [Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] #[derive(Clone, Debug)] pub struct SearchShards<'a, 'b, B> { transport: &'a Transport, @@ -7702,8 +7891,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -7774,7 +7963,7 @@ impl<'b> SearchTemplateParts<'b> { } } } -#[doc = "Builder for the [Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] +#[doc = "Builder for the [Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] #[derive(Clone, Debug)] pub struct SearchTemplate<'a, 'b, B> { transport: &'a Transport, @@ -7969,8 +8158,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -8053,7 +8242,7 @@ impl<'b> TermsEnumParts<'b> { } } } -#[doc = "Builder for the [Terms Enum API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-terms-enum.html)\n\nThe terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios."] +#[doc = "Builder for the [Terms Enum API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-terms-enum.html)\n\nThe terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios."] #[derive(Clone, Debug)] pub struct TermsEnum<'a, 'b, B> { transport: &'a Transport, @@ -8144,8 +8333,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -8212,7 +8401,7 @@ impl<'b> TermvectorsParts<'b> { } } } -#[doc = "Builder for the [Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] +#[doc = "Builder for the [Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] #[derive(Clone, Debug)] pub struct Termvectors<'a, 'b, B> { transport: &'a Transport, @@ -8391,8 +8580,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -8471,7 +8660,7 @@ impl<'b> UpdateParts<'b> { } } } -#[doc = "Builder for the [Update API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-update.html)\n\nUpdates a document with a script or partial document."] +#[doc = "Builder for the [Update API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-update.html)\n\nUpdates a document with a script or partial document."] #[derive(Clone, Debug)] pub struct Update<'a, 'b, B> { transport: &'a Transport, @@ -8657,7 +8846,7 @@ where #[doc = "Creates an asynchronous call to the Update API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -8738,7 +8927,7 @@ impl<'b> UpdateByQueryParts<'b> { } } } -#[doc = "Builder for the [Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] +#[doc = "Builder for the [Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] #[derive(Clone, Debug)] pub struct UpdateByQuery<'a, 'b, B> { transport: &'a Transport, @@ -9076,7 +9265,7 @@ where #[doc = "Creates an asynchronous call to the Update By Query API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -9195,7 +9384,7 @@ impl<'b> UpdateByQueryRethrottleParts<'b> { } } } -#[doc = "Builder for the [Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] +#[doc = "Builder for the [Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] #[derive(Clone, Debug)] pub struct UpdateByQueryRethrottle<'a, 'b, B> { transport: &'a Transport, @@ -9293,7 +9482,7 @@ where #[doc = "Creates an asynchronous call to the Update By Query Rethrottle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -9327,211 +9516,215 @@ where } } impl Elasticsearch { - #[doc = "[Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] + #[doc = "[Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-bulk.html)\n\nAllows to perform multiple index/update/delete operations in a single request."] pub fn bulk<'a, 'b>(&'a self, parts: BulkParts<'b>) -> Bulk<'a, 'b, ()> { Bulk::new(self.transport(), parts) } - #[doc = "[Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] + #[doc = "[Capabilities API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/capabilities.html)\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> { + Capabilities::new(self.transport()) + } + #[doc = "[Clear Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-scroll-api.html)\n\nExplicitly clears the search context for a scroll."] pub fn clear_scroll<'a, 'b>(&'a self, parts: ClearScrollParts<'b>) -> ClearScroll<'a, 'b, ()> { ClearScroll::new(self.transport(), parts) } - #[doc = "[Close Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/point-in-time-api.html)\n\nClose a point in time"] + #[doc = "[Close Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/point-in-time-api.html)\n\nClose a point in time"] pub fn close_point_in_time<'a, 'b>(&'a self) -> ClosePointInTime<'a, 'b, ()> { ClosePointInTime::new(self.transport()) } - #[doc = "[Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-count.html)\n\nReturns number of documents matching a query."] + #[doc = "[Count API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-count.html)\n\nReturns number of documents matching a query."] pub fn count<'a, 'b>(&'a self, parts: CountParts<'b>) -> Count<'a, 'b, ()> { Count::new(self.transport(), parts) } - #[doc = "[Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] + #[doc = "[Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-index_.html)\n\nCreates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index."] pub fn create<'a, 'b>(&'a self, parts: CreateParts<'b>) -> Create<'a, 'b, ()> { Create::new(self.transport(), parts) } - #[doc = "[Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-delete.html)\n\nRemoves a document from the index."] + #[doc = "[Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-delete.html)\n\nRemoves a document from the index."] pub fn delete<'a, 'b>(&'a self, parts: DeleteParts<'b>) -> Delete<'a, 'b> { Delete::new(self.transport(), parts) } - #[doc = "[Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] + #[doc = "[Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-delete-by-query.html)\n\nDeletes documents matching the provided query."] pub fn delete_by_query<'a, 'b>( &'a self, parts: DeleteByQueryParts<'b>, ) -> DeleteByQuery<'a, 'b, ()> { DeleteByQuery::new(self.transport(), parts) } - #[doc = "[Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] + #[doc = "[Delete By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-delete-by-query.html)\n\nChanges the number of requests per second for a particular Delete By Query operation."] pub fn delete_by_query_rethrottle<'a, 'b>( &'a self, parts: DeleteByQueryRethrottleParts<'b>, ) -> DeleteByQueryRethrottle<'a, 'b, ()> { DeleteByQueryRethrottle::new(self.transport(), parts) } - #[doc = "[Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nDeletes a script."] + #[doc = "[Delete Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nDeletes a script."] pub fn delete_script<'a, 'b>(&'a self, parts: DeleteScriptParts<'b>) -> DeleteScript<'a, 'b> { DeleteScript::new(self.transport(), parts) } - #[doc = "[Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns information about whether a document exists in an index."] + #[doc = "[Exists API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns information about whether a document exists in an index."] pub fn exists<'a, 'b>(&'a self, parts: ExistsParts<'b>) -> Exists<'a, 'b> { Exists::new(self.transport(), parts) } - #[doc = "[Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns information about whether a document source exists in an index."] + #[doc = "[Exists Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns information about whether a document source exists in an index."] pub fn exists_source<'a, 'b>(&'a self, parts: ExistsSourceParts<'b>) -> ExistsSource<'a, 'b> { ExistsSource::new(self.transport(), parts) } - #[doc = "[Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] + #[doc = "[Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-explain.html)\n\nReturns information about why a specific matches (or doesn't match) a query."] pub fn explain<'a, 'b>(&'a self, parts: ExplainParts<'b>) -> Explain<'a, 'b, ()> { Explain::new(self.transport(), parts) } - #[doc = "[Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] + #[doc = "[Field Caps API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-field-caps.html)\n\nReturns the information about the capabilities of fields among multiple indices."] pub fn field_caps<'a, 'b>(&'a self, parts: FieldCapsParts<'b>) -> FieldCaps<'a, 'b, ()> { FieldCaps::new(self.transport(), parts) } - #[doc = "[Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns a document."] + #[doc = "[Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns a document."] pub fn get<'a, 'b>(&'a self, parts: GetParts<'b>) -> Get<'a, 'b> { Get::new(self.transport(), parts) } - #[doc = "[Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nReturns a script."] + #[doc = "[Get Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nReturns a script."] pub fn get_script<'a, 'b>(&'a self, parts: GetScriptParts<'b>) -> GetScript<'a, 'b> { GetScript::new(self.transport(), parts) } - #[doc = "[Get Script Context API](https://www.elastic.co/guide/en/elasticsearch/painless/8.3/painless-contexts.html)\n\nReturns all script contexts."] + #[doc = "[Get Script Context API](https://www.elastic.co/guide/en/elasticsearch/painless/8.7/painless-contexts.html)\n\nReturns all script contexts."] pub fn get_script_context<'a, 'b>(&'a self) -> GetScriptContext<'a, 'b> { GetScriptContext::new(self.transport()) } - #[doc = "[Get Script Languages API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nReturns available script types, languages and contexts"] + #[doc = "[Get Script Languages API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nReturns available script types, languages and contexts"] pub fn get_script_languages<'a, 'b>(&'a self) -> GetScriptLanguages<'a, 'b> { GetScriptLanguages::new(self.transport()) } - #[doc = "[Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-get.html)\n\nReturns the source of a document."] + #[doc = "[Get Source API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-get.html)\n\nReturns the source of a document."] pub fn get_source<'a, 'b>(&'a self, parts: GetSourceParts<'b>) -> GetSource<'a, 'b> { GetSource::new(self.transport(), parts) } - #[doc = "[Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-index_.html)\n\nCreates or updates a document in an index."] + #[doc = "[Health Report API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/health-api.html)\n\nReturns the health of the cluster."] + pub fn health_report<'a, 'b>(&'a self, parts: HealthReportParts<'b>) -> HealthReport<'a, 'b> { + HealthReport::new(self.transport(), parts) + } + #[doc = "[Index API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-index_.html)\n\nCreates or updates a document in an index."] pub fn index<'a, 'b>(&'a self, parts: IndexParts<'b>) -> Index<'a, 'b, ()> { Index::new(self.transport(), parts) } - #[doc = "[Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/index.html)\n\nReturns basic information about the cluster."] + #[doc = "[Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index.html)\n\nReturns basic information about the cluster."] pub fn info<'a, 'b>(&'a self) -> Info<'a, 'b> { Info::new(self.transport()) } - #[doc = "[Knn Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-search.html)\n\nPerforms a kNN search."] - #[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 knn_search<'a, 'b>(&'a self, parts: KnnSearchParts<'b>) -> KnnSearch<'a, 'b, ()> { - KnnSearch::new(self.transport(), parts) - } - #[doc = "[Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] + #[doc = "[Mget API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-multi-get.html)\n\nAllows to get multiple documents in one request."] pub fn mget<'a, 'b>(&'a self, parts: MgetParts<'b>) -> Mget<'a, 'b, ()> { Mget::new(self.transport(), parts) } - #[doc = "[Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-multi-search.html)\n\nAllows to execute several search operations in one request."] + #[doc = "[Msearch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-multi-search.html)\n\nAllows to execute several search operations in one request."] pub fn msearch<'a, 'b>(&'a self, parts: MsearchParts<'b>) -> Msearch<'a, 'b, ()> { Msearch::new(self.transport(), parts) } - #[doc = "[Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] + #[doc = "[Msearch Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-multi-search.html)\n\nAllows to execute several search template operations in one request."] pub fn msearch_template<'a, 'b>( &'a self, parts: MsearchTemplateParts<'b>, ) -> MsearchTemplate<'a, 'b, ()> { MsearchTemplate::new(self.transport(), parts) } - #[doc = "[Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] + #[doc = "[Mtermvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-multi-termvectors.html)\n\nReturns multiple termvectors in one request."] pub fn mtermvectors<'a, 'b>( &'a self, parts: MtermvectorsParts<'b>, ) -> Mtermvectors<'a, 'b, ()> { Mtermvectors::new(self.transport(), parts) } - #[doc = "[Open Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/point-in-time-api.html)\n\nOpen a point in time that can be used in subsequent searches"] + #[doc = "[Open Point In Time API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/point-in-time-api.html)\n\nOpen a point in time that can be used in subsequent searches"] pub fn open_point_in_time<'a, 'b>( &'a self, parts: OpenPointInTimeParts<'b>, ) -> OpenPointInTime<'a, 'b, ()> { OpenPointInTime::new(self.transport(), parts) } - #[doc = "[Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/index.html)\n\nReturns whether the cluster is running."] + #[doc = "[Ping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/index.html)\n\nReturns whether the cluster is running."] pub fn ping<'a, 'b>(&'a self) -> Ping<'a, 'b> { Ping::new(self.transport()) } - #[doc = "[Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-scripting.html)\n\nCreates or updates a script."] + #[doc = "[Put Script API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-scripting.html)\n\nCreates or updates a script."] pub fn put_script<'a, 'b>(&'a self, parts: PutScriptParts<'b>) -> PutScript<'a, 'b, ()> { PutScript::new(self.transport(), parts) } - #[doc = "[Rank Eval API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-rank-eval.html)\n\nAllows to evaluate the quality of ranked search results over a set of typical search queries"] + #[doc = "[Rank Eval API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-rank-eval.html)\n\nAllows to evaluate the quality of ranked search results over a set of typical search queries"] pub fn rank_eval<'a, 'b>(&'a self, parts: RankEvalParts<'b>) -> RankEval<'a, 'b, ()> { RankEval::new(self.transport(), parts) } - #[doc = "[Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] + #[doc = "[Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-reindex.html)\n\nAllows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster."] pub fn reindex<'a, 'b>(&'a self) -> Reindex<'a, 'b, ()> { Reindex::new(self.transport()) } - #[doc = "[Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] + #[doc = "[Reindex Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-reindex.html)\n\nChanges the number of requests per second for a particular Reindex operation."] pub fn reindex_rethrottle<'a, 'b>( &'a self, parts: ReindexRethrottleParts<'b>, ) -> ReindexRethrottle<'a, 'b, ()> { ReindexRethrottle::new(self.transport(), parts) } - #[doc = "[Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/render-search-template-api.html)\n\nAllows to use the Mustache language to pre-render a search definition."] + #[doc = "[Render Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/render-search-template-api.html)\n\nAllows to use the Mustache language to pre-render a search definition."] pub fn render_search_template<'a, 'b>( &'a self, parts: RenderSearchTemplateParts<'b>, ) -> RenderSearchTemplate<'a, 'b, ()> { RenderSearchTemplate::new(self.transport(), parts) } - #[doc = "[Scripts Painless Execute API](https://www.elastic.co/guide/en/elasticsearch/painless/8.3/painless-execute-api.html)\n\nAllows an arbitrary script to be executed and a result to be returned"] + #[doc = "[Scripts Painless Execute API](https://www.elastic.co/guide/en/elasticsearch/painless/8.7/painless-execute-api.html)\n\nAllows an arbitrary script to be executed and a result to be returned"] #[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 scripts_painless_execute<'a, 'b>(&'a self) -> ScriptsPainlessExecute<'a, 'b, ()> { ScriptsPainlessExecute::new(self.transport()) } - #[doc = "[Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request.\n\n# Examples\n\nTo initiate a scroll, make search API call with a specified `scroll` timeout,\nthen fetch the next set of hits using the `_scroll_id` returned in\nthe response. Once no more hits are returned, clear the scroll.\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, SearchParts, ScrollParts, ClearScrollParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\n\nfn print_hits(hits: &[Value]) {\n for hit in hits {\n println!(\n \"id: '{}', source: '{}', score: '{}'\",\n hit[\"_id\"].as_str().unwrap(),\n hit[\"_source\"],\n hit[\"_score\"].as_f64().unwrap()\n );\n }\n}\n\nlet scroll = \"1m\";\nlet mut response = client\n .search(SearchParts::Index(&[\"tweets\"]))\n .scroll(scroll)\n .body(json!({\n \"query\": {\n \"match\": {\n \"body\": {\n \"query\": \"Elasticsearch rust\",\n \"operator\": \"AND\"\n }\n }\n }\n }))\n .send()\n .await?;\n\nlet mut response_body = response.json::().await?;\nlet mut scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\nlet mut hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n\nprint_hits(hits);\n\nwhile hits.len() > 0 {\n response = client\n .scroll(ScrollParts::None)\n .body(json!({\n \"scroll\": scroll,\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n\n response_body = response.json::().await?;\n scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\n hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n print_hits(hits);\n}\n\nresponse = client\n .clear_scroll(ClearScrollParts::None)\n .body(json!({\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] + #[doc = "[Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-request-body.html#request-body-search-scroll)\n\nAllows to retrieve a large numbers of results from a single search request.\n\n# Examples\n\nTo initiate a scroll, make search API call with a specified `scroll` timeout,\nthen fetch the next set of hits using the `_scroll_id` returned in\nthe response. Once no more hits are returned, clear the scroll.\n\n```rust,no_run\n# use elasticsearch::{Elasticsearch, Error, SearchParts, ScrollParts, ClearScrollParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box> {\nlet client = Elasticsearch::default();\n\nfn print_hits(hits: &[Value]) {\n for hit in hits {\n println!(\n \"id: '{}', source: '{}', score: '{}'\",\n hit[\"_id\"].as_str().unwrap(),\n hit[\"_source\"],\n hit[\"_score\"].as_f64().unwrap()\n );\n }\n}\n\nlet scroll = \"1m\";\nlet mut response = client\n .search(SearchParts::Index(&[\"tweets\"]))\n .scroll(scroll)\n .body(json!({\n \"query\": {\n \"match\": {\n \"body\": {\n \"query\": \"Elasticsearch rust\",\n \"operator\": \"AND\"\n }\n }\n }\n }))\n .send()\n .await?;\n\nlet mut response_body = response.json::().await?;\nlet mut scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\nlet mut hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n\nprint_hits(hits);\n\nwhile hits.len() > 0 {\n response = client\n .scroll(ScrollParts::None)\n .body(json!({\n \"scroll\": scroll,\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n\n response_body = response.json::().await?;\n scroll_id = response_body[\"_scroll_id\"].as_str().unwrap();\n hits = response_body[\"hits\"][\"hits\"].as_array().unwrap();\n print_hits(hits);\n}\n\nresponse = client\n .clear_scroll(ClearScrollParts::None)\n .body(json!({\n \"scroll_id\": scroll_id\n }))\n .send()\n .await?;\n \n# Ok(())\n# }\n```"] pub fn scroll<'a, 'b>(&'a self, parts: ScrollParts<'b>) -> Scroll<'a, 'b, ()> { Scroll::new(self.transport(), parts) } - #[doc = "[Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-search.html)\n\nReturns results matching a query."] + #[doc = "[Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-search.html)\n\nReturns results matching a query."] pub fn search<'a, 'b>(&'a self, parts: SearchParts<'b>) -> Search<'a, 'b, ()> { Search::new(self.transport(), parts) } - #[doc = "[Search Mvt API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-vector-tile-api.html)\n\nSearches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile."] + #[doc = "[Search Mvt API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-vector-tile-api.html)\n\nSearches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile."] #[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 search_mvt<'a, 'b>(&'a self, parts: SearchMvtParts<'b>) -> SearchMvt<'a, 'b, ()> { SearchMvt::new(self.transport(), parts) } - #[doc = "[Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] + #[doc = "[Search Shards API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-shards.html)\n\nReturns information about the indices and shards that a search request would be executed against."] pub fn search_shards<'a, 'b>( &'a self, parts: SearchShardsParts<'b>, ) -> SearchShards<'a, 'b, ()> { SearchShards::new(self.transport(), parts) } - #[doc = "[Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] + #[doc = "[Search Template API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-template.html)\n\nAllows to use the Mustache language to pre-render a search definition."] pub fn search_template<'a, 'b>( &'a self, parts: SearchTemplateParts<'b>, ) -> SearchTemplate<'a, 'b, ()> { SearchTemplate::new(self.transport(), parts) } - #[doc = "[Terms Enum API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/search-terms-enum.html)\n\nThe terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios."] + #[doc = "[Terms Enum API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-terms-enum.html)\n\nThe terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios."] pub fn terms_enum<'a, 'b>(&'a self, parts: TermsEnumParts<'b>) -> TermsEnum<'a, 'b, ()> { TermsEnum::new(self.transport(), parts) } - #[doc = "[Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] + #[doc = "[Termvectors API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-termvectors.html)\n\nReturns information and statistics about terms in the fields of a particular document."] pub fn termvectors<'a, 'b>(&'a self, parts: TermvectorsParts<'b>) -> Termvectors<'a, 'b, ()> { Termvectors::new(self.transport(), parts) } - #[doc = "[Update API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-update.html)\n\nUpdates a document with a script or partial document."] + #[doc = "[Update API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-update.html)\n\nUpdates a document with a script or partial document."] pub fn update<'a, 'b>(&'a self, parts: UpdateParts<'b>) -> Update<'a, 'b, ()> { Update::new(self.transport(), parts) } - #[doc = "[Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] + #[doc = "[Update By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-update-by-query.html)\n\nPerforms an update on every document in the index without changing the source,\nfor example to pick up a mapping change."] pub fn update_by_query<'a, 'b>( &'a self, parts: UpdateByQueryParts<'b>, ) -> UpdateByQuery<'a, 'b, ()> { UpdateByQuery::new(self.transport(), parts) } - #[doc = "[Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] + #[doc = "[Update By Query Rethrottle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/docs-update-by-query.html)\n\nChanges the number of requests per second for a particular Update By Query operation."] pub fn update_by_query_rethrottle<'a, 'b>( &'a self, parts: UpdateByQueryRethrottleParts<'b>, diff --git a/elasticsearch/src/search_application.rs b/elasticsearch/src/search_application.rs new file mode 100644 index 00000000..5c6c4f16 --- /dev/null +++ b/elasticsearch/src/search_application.rs @@ -0,0 +1,1582 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![cfg(feature = "experimental-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 "] +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Delete API"] +pub enum SearchApplicationDeleteParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationDeleteParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Delete API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationDeleteParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_name.len()); + p.push_str("/_application/search_application/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-search-application.html)\n\nDeletes a search application."] +#[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 SearchApplicationDelete<'a, 'b> { + transport: &'a Transport, + parts: SearchApplicationDeleteParts<'b>, + 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> SearchApplicationDelete<'a, 'b> { + #[doc = "Creates a new instance of [SearchApplicationDelete] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchApplicationDeleteParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchApplicationDelete { + 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 Search Application Delete 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Delete Behavioral Analytics API"] +pub enum SearchApplicationDeleteBehavioralAnalyticsParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationDeleteBehavioralAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Delete Behavioral Analytics API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationDeleteBehavioralAnalyticsParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_name.len()); + p.push_str("/_application/analytics/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Delete Behavioral Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-analytics-collection.html)\n\nDelete a behavioral analytics collection."] +#[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 SearchApplicationDeleteBehavioralAnalytics<'a, 'b> { + transport: &'a Transport, + parts: SearchApplicationDeleteBehavioralAnalyticsParts<'b>, + 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> SearchApplicationDeleteBehavioralAnalytics<'a, 'b> { + #[doc = "Creates a new instance of [SearchApplicationDeleteBehavioralAnalytics] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: SearchApplicationDeleteBehavioralAnalyticsParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + SearchApplicationDeleteBehavioralAnalytics { + 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 Search Application Delete Behavioral Analytics 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Get API"] +pub enum SearchApplicationGetParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationGetParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Get API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationGetParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_name.len()); + p.push_str("/_application/search_application/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-search-application.html)\n\nReturns the details about a search application."] +#[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 SearchApplicationGet<'a, 'b> { + transport: &'a Transport, + parts: SearchApplicationGetParts<'b>, + 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> SearchApplicationGet<'a, 'b> { + #[doc = "Creates a new instance of [SearchApplicationGet] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchApplicationGetParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchApplicationGet { + 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 Search Application Get 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Get Behavioral Analytics API"] +pub enum SearchApplicationGetBehavioralAnalyticsParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Name"] + Name(&'b [&'b str]), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationGetBehavioralAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Get Behavioral Analytics API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationGetBehavioralAnalyticsParts::None => "/_application/analytics".into(), + SearchApplicationGetBehavioralAnalyticsParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_name.len()); + p.push_str("/_application/analytics/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Get Behavioral Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-analytics-collection.html)\n\nReturns the existing behavioral analytics collections."] +#[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 SearchApplicationGetBehavioralAnalytics<'a, 'b> { + transport: &'a Transport, + parts: SearchApplicationGetBehavioralAnalyticsParts<'b>, + 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> SearchApplicationGetBehavioralAnalytics<'a, 'b> { + #[doc = "Creates a new instance of [SearchApplicationGetBehavioralAnalytics] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: SearchApplicationGetBehavioralAnalyticsParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + SearchApplicationGetBehavioralAnalytics { + 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 Search Application Get Behavioral Analytics 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application List API"] +pub enum SearchApplicationListParts { + #[doc = "No parts"] + None, +} +#[cfg(feature = "experimental-apis")] +impl SearchApplicationListParts { + #[doc = "Builds a relative URL path to the Search Application List API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationListParts::None => "/_application/search_application".into(), + } + } +} +#[doc = "Builder for the [Search Application List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-search-applications.html)\n\nReturns the existing search applications."] +#[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 SearchApplicationList<'a, 'b> { + transport: &'a Transport, + parts: SearchApplicationListParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + q: Option<&'b str>, + request_timeout: Option, + size: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b> SearchApplicationList<'a, 'b> { + #[doc = "Creates a new instance of [SearchApplicationList]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SearchApplicationList { + transport, + parts: SearchApplicationListParts::None, + headers, + error_trace: None, + filter_path: None, + from: None, + human: None, + pretty: None, + q: None, + request_timeout: None, + size: 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 = "Starting offset (default: 0)"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + 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 = "Query in the Lucene query string syntax"] + pub fn q(mut self, q: &'b str) -> Self { + self.q = Some(q); + 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 = "specifies a max number of results to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + 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 Search Application List 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]>, + from: Option, + human: Option, + pretty: Option, + q: Option<&'b str>, + size: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + pretty: self.pretty, + q: self.q, + size: self.size, + 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Post Behavioral Analytics Event API"] +pub enum SearchApplicationPostBehavioralAnalyticsEventParts<'b> { + #[doc = "CollectionName and EventType"] + CollectionNameEventType(&'b str, &'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationPostBehavioralAnalyticsEventParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Post Behavioral Analytics Event API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationPostBehavioralAnalyticsEventParts::CollectionNameEventType( + ref collection_name, + ref event_type, + ) => { + let encoded_collection_name: Cow = + percent_encode(collection_name.as_bytes(), PARTS_ENCODED).into(); + let encoded_event_type: Cow = + percent_encode(event_type.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 31usize + encoded_collection_name.len() + encoded_event_type.len(), + ); + p.push_str("/_application/analytics/"); + p.push_str(encoded_collection_name.as_ref()); + p.push_str("/event/"); + p.push_str(encoded_event_type.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Post Behavioral Analytics Event API](http://todo.com/tbd)\n\nCreates a behavioral analytics event for existing collection."] +#[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 SearchApplicationPostBehavioralAnalyticsEvent<'a, 'b, B> { + transport: &'a Transport, + parts: SearchApplicationPostBehavioralAnalyticsEventParts<'b>, + body: Option, + debug: 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> SearchApplicationPostBehavioralAnalyticsEvent<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SearchApplicationPostBehavioralAnalyticsEvent] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: SearchApplicationPostBehavioralAnalyticsEventParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + SearchApplicationPostBehavioralAnalyticsEvent { + transport, + parts, + headers, + body: None, + debug: 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, + ) -> SearchApplicationPostBehavioralAnalyticsEvent<'a, 'b, JsonBody> + where + T: Serialize, + { + SearchApplicationPostBehavioralAnalyticsEvent { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + debug: self.debug, + 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 = "If true, returns event information that will be stored"] + pub fn debug(mut self, debug: bool) -> Self { + self.debug = Some(debug); + 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); + 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 Search Application Post Behavioral Analytics Event 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> { + debug: Option, + 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 { + debug: self.debug, + 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Put API"] +pub enum SearchApplicationPutParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationPutParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Put API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationPutParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_name.len()); + p.push_str("/_application/search_application/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Put API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-search-application.html)\n\nCreates or updates a search application."] +#[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 SearchApplicationPut<'a, 'b, B> { + transport: &'a Transport, + parts: SearchApplicationPutParts<'b>, + body: Option, + create: 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> SearchApplicationPut<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SearchApplicationPut] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchApplicationPutParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchApplicationPut { + transport, + parts, + headers, + body: None, + create: 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) -> SearchApplicationPut<'a, 'b, JsonBody> + where + T: Serialize, + { + SearchApplicationPut { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + create: self.create, + 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 = "If true, requires that a search application with the specified resource_id does not already exist. (default: false)"] + pub fn create(mut self, create: bool) -> Self { + self.create = Some(create); + 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); + 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 Search Application Put 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> { + create: Option, + 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 { + create: self.create, + 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Put Behavioral Analytics API"] +pub enum SearchApplicationPutBehavioralAnalyticsParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationPutBehavioralAnalyticsParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Put Behavioral Analytics API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationPutBehavioralAnalyticsParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_name.len()); + p.push_str("/_application/analytics/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Put Behavioral Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-analytics-collection.html)\n\nCreates a behavioral analytics collection."] +#[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 SearchApplicationPutBehavioralAnalytics<'a, 'b, B> { + transport: &'a Transport, + parts: SearchApplicationPutBehavioralAnalyticsParts<'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> SearchApplicationPutBehavioralAnalytics<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SearchApplicationPutBehavioralAnalytics] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: SearchApplicationPutBehavioralAnalyticsParts<'b>, + ) -> Self { + let headers = HeaderMap::new(); + SearchApplicationPutBehavioralAnalytics { + 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) -> SearchApplicationPutBehavioralAnalytics<'a, 'b, JsonBody> + where + T: Serialize, + { + SearchApplicationPutBehavioralAnalytics { + 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 Search Application Put Behavioral Analytics 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Render Query API"] +pub enum SearchApplicationRenderQueryParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationRenderQueryParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Render Query API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationRenderQueryParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(47usize + encoded_name.len()); + p.push_str("/_application/search_application/"); + p.push_str(encoded_name.as_ref()); + p.push_str("/_render_query"); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Render Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-application-render-query.html)\n\nRenders a query for given search application search parameters"] +#[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 SearchApplicationRenderQuery<'a, 'b, B> { + transport: &'a Transport, + parts: SearchApplicationRenderQueryParts<'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> SearchApplicationRenderQuery<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SearchApplicationRenderQuery] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchApplicationRenderQueryParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchApplicationRenderQuery { + 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) -> SearchApplicationRenderQuery<'a, 'b, JsonBody> + where + T: Serialize, + { + SearchApplicationRenderQuery { + 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 Search Application Render Query 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) + } +} +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Search Application Search API"] +pub enum SearchApplicationSearchParts<'b> { + #[doc = "Name"] + Name(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SearchApplicationSearchParts<'b> { + #[doc = "Builds a relative URL path to the Search Application Search API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SearchApplicationSearchParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(41usize + encoded_name.len()); + p.push_str("/_application/search_application/"); + p.push_str(encoded_name.as_ref()); + p.push_str("/_search"); + p.into() + } + } + } +} +#[doc = "Builder for the [Search Application Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-application-search.html)\n\nPerform a search against a search application"] +#[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 SearchApplicationSearch<'a, 'b, B> { + transport: &'a Transport, + parts: SearchApplicationSearchParts<'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>, + typed_keys: Option, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> SearchApplicationSearch<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SearchApplicationSearch] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SearchApplicationSearchParts<'b>) -> Self { + let headers = HeaderMap::new(); + SearchApplicationSearch { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + typed_keys: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SearchApplicationSearch<'a, 'b, JsonBody> + where + T: Serialize, + { + SearchApplicationSearch { + 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, + typed_keys: self.typed_keys, + } + } + #[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 = "Specify whether aggregation and suggester names should be prefixed by their respective types in the response"] + pub fn typed_keys(mut self, typed_keys: bool) -> Self { + self.typed_keys = Some(typed_keys); + self + } + #[doc = "Creates an asynchronous call to the Search Application Search API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => http::Method::Post, + None => 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>, + typed_keys: Option, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pretty: self.pretty, + source: self.source, + typed_keys: self.typed_keys, + }; + 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 SearchApplication 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")] +pub struct SearchApplication<'a> { + transport: &'a Transport, +} +#[cfg(feature = "experimental-apis")] +impl<'a> SearchApplication<'a> { + #[doc = "Creates a new instance of [SearchApplication]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Search Application Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-search-application.html)\n\nDeletes a search application."] + #[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<'b>( + &'a self, + parts: SearchApplicationDeleteParts<'b>, + ) -> SearchApplicationDelete<'a, 'b> { + SearchApplicationDelete::new(self.transport(), parts) + } + #[doc = "[Search Application Delete Behavioral Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-analytics-collection.html)\n\nDelete a behavioral analytics collection."] + #[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_behavioral_analytics<'b>( + &'a self, + parts: SearchApplicationDeleteBehavioralAnalyticsParts<'b>, + ) -> SearchApplicationDeleteBehavioralAnalytics<'a, 'b> { + SearchApplicationDeleteBehavioralAnalytics::new(self.transport(), parts) + } + #[doc = "[Search Application Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-search-application.html)\n\nReturns the details about a search application."] + #[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<'b>(&'a self, parts: SearchApplicationGetParts<'b>) -> SearchApplicationGet<'a, 'b> { + SearchApplicationGet::new(self.transport(), parts) + } + #[doc = "[Search Application Get Behavioral Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-analytics-collection.html)\n\nReturns the existing behavioral analytics collections."] + #[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_behavioral_analytics<'b>( + &'a self, + parts: SearchApplicationGetBehavioralAnalyticsParts<'b>, + ) -> SearchApplicationGetBehavioralAnalytics<'a, 'b> { + SearchApplicationGetBehavioralAnalytics::new(self.transport(), parts) + } + #[doc = "[Search Application List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-search-applications.html)\n\nReturns the existing search applications."] + #[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 list<'b>(&'a self) -> SearchApplicationList<'a, 'b> { + SearchApplicationList::new(self.transport()) + } + #[doc = "[Search Application Post Behavioral Analytics Event API](http://todo.com/tbd)\n\nCreates a behavioral analytics event for existing collection."] + #[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 post_behavioral_analytics_event<'b>( + &'a self, + parts: SearchApplicationPostBehavioralAnalyticsEventParts<'b>, + ) -> SearchApplicationPostBehavioralAnalyticsEvent<'a, 'b, ()> { + SearchApplicationPostBehavioralAnalyticsEvent::new(self.transport(), parts) + } + #[doc = "[Search Application Put API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-search-application.html)\n\nCreates or updates a search application."] + #[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<'b>( + &'a self, + parts: SearchApplicationPutParts<'b>, + ) -> SearchApplicationPut<'a, 'b, ()> { + SearchApplicationPut::new(self.transport(), parts) + } + #[doc = "[Search Application Put Behavioral Analytics API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-analytics-collection.html)\n\nCreates a behavioral analytics collection."] + #[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_behavioral_analytics<'b>( + &'a self, + parts: SearchApplicationPutBehavioralAnalyticsParts<'b>, + ) -> SearchApplicationPutBehavioralAnalytics<'a, 'b, ()> { + SearchApplicationPutBehavioralAnalytics::new(self.transport(), parts) + } + #[doc = "[Search Application Render Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-application-render-query.html)\n\nRenders a query for given search application search parameters"] + #[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 render_query<'b>( + &'a self, + parts: SearchApplicationRenderQueryParts<'b>, + ) -> SearchApplicationRenderQuery<'a, 'b, ()> { + SearchApplicationRenderQuery::new(self.transport(), parts) + } + #[doc = "[Search Application Search API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/search-application-search.html)\n\nPerform a search against a search application"] + #[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 search<'b>( + &'a self, + parts: SearchApplicationSearchParts<'b>, + ) -> SearchApplicationSearch<'a, 'b, ()> { + SearchApplicationSearch::new(self.transport(), parts) + } +} +#[cfg(feature = "experimental-apis")] +impl Elasticsearch { + #[doc = "Creates a namespace client for SearchApplication APIs"] + pub fn search_application(&self) -> SearchApplication { + SearchApplication::new(self.transport()) + } +} diff --git a/elasticsearch/src/searchable_snapshots.rs b/elasticsearch/src/searchable_snapshots.rs index c2328346..308e8cb4 100644 --- a/elasticsearch/src/searchable_snapshots.rs +++ b/elasticsearch/src/searchable_snapshots.rs @@ -36,11 +36,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -75,7 +75,7 @@ impl<'b> SearchableSnapshotsCacheStatsParts<'b> { } } } -#[doc = "Builder for the [Searchable Snapshots Cache Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-apis.html)\n\nRetrieve node-level cache statistics about searchable snapshots."] +#[doc = "Builder for the [Searchable Snapshots Cache Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-apis.html)\n\nRetrieve node-level cache statistics about searchable snapshots."] #[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)] @@ -145,7 +145,7 @@ impl<'a, 'b> SearchableSnapshotsCacheStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Searchable Snapshots Cache Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -204,7 +204,7 @@ impl<'b> SearchableSnapshotsClearCacheParts<'b> { } } } -#[doc = "Builder for the [Searchable Snapshots Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-apis.html)\n\nClear the cache of searchable snapshots."] +#[doc = "Builder for the [Searchable Snapshots Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-apis.html)\n\nClear the cache of searchable snapshots."] #[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)] @@ -329,7 +329,7 @@ where #[doc = "Creates an asynchronous call to the Searchable Snapshots Clear Cache API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -398,7 +398,7 @@ impl<'b> SearchableSnapshotsMountParts<'b> { } } } -#[doc = "Builder for the [Searchable Snapshots Mount API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-api-mount-snapshot.html)\n\nMount a snapshot as a searchable index."] +#[doc = "Builder for the [Searchable Snapshots Mount API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-api-mount-snapshot.html)\n\nMount a snapshot as a searchable index."] #[derive(Clone, Debug)] pub struct SearchableSnapshotsMount<'a, 'b, B> { transport: &'a Transport, @@ -512,7 +512,7 @@ where #[doc = "Creates an asynchronous call to the Searchable Snapshots Mount API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -575,7 +575,7 @@ impl<'b> SearchableSnapshotsStatsParts<'b> { } } } -#[doc = "Builder for the [Searchable Snapshots Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-apis.html)\n\nRetrieve shard-level statistics about searchable snapshots."] +#[doc = "Builder for the [Searchable Snapshots Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-apis.html)\n\nRetrieve shard-level statistics about searchable snapshots."] #[derive(Clone, Debug)] pub struct SearchableSnapshotsStats<'a, 'b> { transport: &'a Transport, @@ -649,7 +649,7 @@ impl<'a, 'b> SearchableSnapshotsStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Searchable Snapshots Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -694,7 +694,7 @@ impl<'a> SearchableSnapshots<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Searchable Snapshots Cache Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-apis.html)\n\nRetrieve node-level cache statistics about searchable snapshots."] + #[doc = "[Searchable Snapshots Cache Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-apis.html)\n\nRetrieve node-level cache statistics about searchable snapshots."] #[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 cache_stats<'b>( @@ -703,7 +703,7 @@ impl<'a> SearchableSnapshots<'a> { ) -> SearchableSnapshotsCacheStats<'a, 'b> { SearchableSnapshotsCacheStats::new(self.transport(), parts) } - #[doc = "[Searchable Snapshots Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-apis.html)\n\nClear the cache of searchable snapshots."] + #[doc = "[Searchable Snapshots Clear Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-apis.html)\n\nClear the cache of searchable snapshots."] #[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 clear_cache<'b>( @@ -712,14 +712,14 @@ impl<'a> SearchableSnapshots<'a> { ) -> SearchableSnapshotsClearCache<'a, 'b, ()> { SearchableSnapshotsClearCache::new(self.transport(), parts) } - #[doc = "[Searchable Snapshots Mount API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-api-mount-snapshot.html)\n\nMount a snapshot as a searchable index."] + #[doc = "[Searchable Snapshots Mount API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-api-mount-snapshot.html)\n\nMount a snapshot as a searchable index."] pub fn mount<'b>( &'a self, parts: SearchableSnapshotsMountParts<'b>, ) -> SearchableSnapshotsMount<'a, 'b, ()> { SearchableSnapshotsMount::new(self.transport(), parts) } - #[doc = "[Searchable Snapshots Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/searchable-snapshots-apis.html)\n\nRetrieve shard-level statistics about searchable snapshots."] + #[doc = "[Searchable Snapshots Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/searchable-snapshots-apis.html)\n\nRetrieve shard-level statistics about searchable snapshots."] pub fn stats<'b>( &'a self, parts: SearchableSnapshotsStatsParts<'b>, diff --git a/elasticsearch/src/security.rs b/elasticsearch/src/security.rs index 81d01236..72be8988 100644 --- a/elasticsearch/src/security.rs +++ b/elasticsearch/src/security.rs @@ -42,25 +42,23 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; use percent_encoding::percent_encode; use serde::Serialize; use std::{borrow::Cow, time::Duration}; -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Security Activate User Profile API"] pub enum SecurityActivateUserProfileParts { #[doc = "No parts"] None, } -#[cfg(feature = "experimental-apis")] impl SecurityActivateUserProfileParts { #[doc = "Builds a relative URL path to the Security Activate User Profile API"] pub fn url(self) -> Cow<'static, str> { @@ -69,9 +67,7 @@ impl SecurityActivateUserProfileParts { } } } -#[doc = "Builder for the [Security Activate User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-activate-user-profile.html)\n\nCreates or updates the user profile on behalf of another user."] -#[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")] +#[doc = "Builder for the [Security Activate User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-activate-user-profile.html)\n\nCreates or updates the user profile on behalf of another user."] #[derive(Clone, Debug)] pub struct SecurityActivateUserProfile<'a, 'b, B> { transport: &'a Transport, @@ -85,7 +81,6 @@ pub struct SecurityActivateUserProfile<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> SecurityActivateUserProfile<'a, 'b, B> where B: Body, @@ -162,7 +157,7 @@ where #[doc = "Creates an asynchronous call to the Security Activate User Profile API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -207,7 +202,7 @@ impl SecurityAuthenticateParts { } } } -#[doc = "Builder for the [Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] +#[doc = "Builder for the [Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] #[derive(Clone, Debug)] pub struct SecurityAuthenticate<'a, 'b> { transport: &'a Transport, @@ -274,7 +269,7 @@ impl<'a, 'b> SecurityAuthenticate<'a, 'b> { #[doc = "Creates an asynchronous call to the Security Authenticate API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -306,35 +301,24 @@ impl<'a, 'b> SecurityAuthenticate<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Change Password API"] -pub enum SecurityChangePasswordParts<'b> { - #[doc = "Username"] - Username(&'b str), +#[doc = "API parts for the Security Bulk Delete Role API"] +pub enum SecurityBulkDeleteRoleParts { #[doc = "No parts"] None, } -impl<'b> SecurityChangePasswordParts<'b> { - #[doc = "Builds a relative URL path to the Security Change Password API"] +impl SecurityBulkDeleteRoleParts { + #[doc = "Builds a relative URL path to the Security Bulk Delete Role API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityChangePasswordParts::Username(ref username) => { - let encoded_username: Cow = - percent_encode(username.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(26usize + encoded_username.len()); - p.push_str("/_security/user/"); - p.push_str(encoded_username.as_ref()); - p.push_str("/_password"); - p.into() - } - SecurityChangePasswordParts::None => "/_security/user/_password".into(), + SecurityBulkDeleteRoleParts::None => "/_security/role".into(), } } } -#[doc = "Builder for the [Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] +#[doc = "Builder for the [Security Bulk Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-bulk-delete-role.html)\n\nBulk delete roles in the native realm."] #[derive(Clone, Debug)] -pub struct SecurityChangePassword<'a, 'b, B> { +pub struct SecurityBulkDeleteRole<'a, 'b, B> { transport: &'a Transport, - parts: SecurityChangePasswordParts<'b>, + parts: SecurityBulkDeleteRoleParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -345,16 +329,16 @@ pub struct SecurityChangePassword<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityChangePassword<'a, 'b, B> +impl<'a, 'b, B> SecurityBulkDeleteRole<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityChangePassword] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityChangePasswordParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityBulkDeleteRole]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityChangePassword { + SecurityBulkDeleteRole { transport, - parts, + parts: SecurityBulkDeleteRoleParts::None, headers, body: None, error_trace: None, @@ -367,11 +351,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityChangePassword<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityBulkDeleteRole<'a, 'b, JsonBody> where T: Serialize, { - SecurityChangePassword { + SecurityBulkDeleteRole { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -425,10 +409,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Change Password API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Bulk Delete Role API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -462,68 +446,61 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Clear Api Key Cache API"] -pub enum SecurityClearApiKeyCacheParts<'b> { - #[doc = "Ids"] - Ids(&'b [&'b str]), +#[doc = "API parts for the Security Bulk Put Role API"] +pub enum SecurityBulkPutRoleParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityClearApiKeyCacheParts<'b> { - #[doc = "Builds a relative URL path to the Security Clear Api Key Cache API"] +impl SecurityBulkPutRoleParts { + #[doc = "Builds a relative URL path to the Security Bulk Put Role API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityClearApiKeyCacheParts::Ids(ref ids) => { - let ids_str = ids.join(","); - let encoded_ids: Cow = - percent_encode(ids_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(32usize + encoded_ids.len()); - p.push_str("/_security/api_key/"); - p.push_str(encoded_ids.as_ref()); - p.push_str("/_clear_cache"); - p.into() - } + SecurityBulkPutRoleParts::None => "/_security/role".into(), } } } -#[doc = "Builder for the [Security Clear Api Key Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-api-key-cache.html)\n\nClear a subset or all entries from the API key cache."] +#[doc = "Builder for the [Security Bulk Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-bulk-put-role.html)\n\nBulk adds and updates roles in the native realm."] #[derive(Clone, Debug)] -pub struct SecurityClearApiKeyCache<'a, 'b, B> { +pub struct SecurityBulkPutRole<'a, 'b, B> { transport: &'a Transport, - parts: SecurityClearApiKeyCacheParts<'b>, + parts: SecurityBulkPutRoleParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, + refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityClearApiKeyCache<'a, 'b, B> +impl<'a, 'b, B> SecurityBulkPutRole<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityClearApiKeyCache] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityClearApiKeyCacheParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityBulkPutRole]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityClearApiKeyCache { + SecurityBulkPutRole { transport, - parts, + parts: SecurityBulkPutRoleParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, + refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityClearApiKeyCache<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityBulkPutRole<'a, 'b, JsonBody> where T: Serialize, { - SecurityClearApiKeyCache { + SecurityBulkPutRole { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -532,6 +509,7 @@ where headers: self.headers, human: self.human, pretty: self.pretty, + refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -561,6 +539,11 @@ where self.pretty = Some(pretty); self } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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); @@ -571,10 +554,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Clear Api Key Cache API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Bulk Put Role API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -586,6 +569,7 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, + refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -593,6 +577,7 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, + refresh: self.refresh, source: self.source, }; Some(query_params) @@ -606,33 +591,24 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Clear Cached Privileges API"] -pub enum SecurityClearCachedPrivilegesParts<'b> { - #[doc = "Application"] - Application(&'b [&'b str]), +#[doc = "API parts for the Security Bulk Update Api Keys API"] +pub enum SecurityBulkUpdateApiKeysParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityClearCachedPrivilegesParts<'b> { - #[doc = "Builds a relative URL path to the Security Clear Cached Privileges API"] +impl SecurityBulkUpdateApiKeysParts { + #[doc = "Builds a relative URL path to the Security Bulk Update Api Keys API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityClearCachedPrivilegesParts::Application(ref application) => { - let application_str = application.join(","); - let encoded_application: Cow = - percent_encode(application_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(34usize + encoded_application.len()); - p.push_str("/_security/privilege/"); - p.push_str(encoded_application.as_ref()); - p.push_str("/_clear_cache"); - p.into() - } + SecurityBulkUpdateApiKeysParts::None => "/_security/api_key/_bulk_update".into(), } } } -#[doc = "Builder for the [Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] +#[doc = "Builder for the [Security Bulk Update Api Keys API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-bulk-update-api-keys.html)\n\nUpdates the attributes of multiple existing API keys."] #[derive(Clone, Debug)] -pub struct SecurityClearCachedPrivileges<'a, 'b, B> { +pub struct SecurityBulkUpdateApiKeys<'a, 'b, B> { transport: &'a Transport, - parts: SecurityClearCachedPrivilegesParts<'b>, + parts: SecurityBulkUpdateApiKeysParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -642,16 +618,16 @@ pub struct SecurityClearCachedPrivileges<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityClearCachedPrivileges<'a, 'b, B> +impl<'a, 'b, B> SecurityBulkUpdateApiKeys<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityClearCachedPrivileges] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityClearCachedPrivilegesParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityBulkUpdateApiKeys]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityClearCachedPrivileges { + SecurityBulkUpdateApiKeys { transport, - parts, + parts: SecurityBulkUpdateApiKeysParts::None, headers, body: None, error_trace: None, @@ -663,11 +639,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityClearCachedPrivileges<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityBulkUpdateApiKeys<'a, 'b, JsonBody> where T: Serialize, { - SecurityClearCachedPrivileges { + SecurityBulkUpdateApiKeys { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -715,10 +691,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Clear Cached Privileges API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Bulk Update Api Keys API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -750,51 +726,53 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Clear Cached Realms API"] -pub enum SecurityClearCachedRealmsParts<'b> { - #[doc = "Realms"] - Realms(&'b [&'b str]), +#[doc = "API parts for the Security Change Password API"] +pub enum SecurityChangePasswordParts<'b> { + #[doc = "Username"] + Username(&'b str), + #[doc = "No parts"] + None, } -impl<'b> SecurityClearCachedRealmsParts<'b> { - #[doc = "Builds a relative URL path to the Security Clear Cached Realms API"] +impl<'b> SecurityChangePasswordParts<'b> { + #[doc = "Builds a relative URL path to the Security Change Password API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityClearCachedRealmsParts::Realms(ref realms) => { - let realms_str = realms.join(","); - let encoded_realms: Cow = - percent_encode(realms_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(30usize + encoded_realms.len()); - p.push_str("/_security/realm/"); - p.push_str(encoded_realms.as_ref()); - p.push_str("/_clear_cache"); + SecurityChangePasswordParts::Username(ref username) => { + let encoded_username: Cow = + percent_encode(username.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(26usize + encoded_username.len()); + p.push_str("/_security/user/"); + p.push_str(encoded_username.as_ref()); + p.push_str("/_password"); p.into() } + SecurityChangePasswordParts::None => "/_security/user/_password".into(), } } } -#[doc = "Builder for the [Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] +#[doc = "Builder for the [Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] #[derive(Clone, Debug)] -pub struct SecurityClearCachedRealms<'a, 'b, B> { +pub struct SecurityChangePassword<'a, 'b, B> { transport: &'a Transport, - parts: SecurityClearCachedRealmsParts<'b>, + parts: SecurityChangePasswordParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, + refresh: Option, request_timeout: Option, source: Option<&'b str>, - usernames: Option<&'b [&'b str]>, } -impl<'a, 'b, B> SecurityClearCachedRealms<'a, 'b, B> +impl<'a, 'b, B> SecurityChangePassword<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityClearCachedRealms] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityClearCachedRealmsParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityChangePassword] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityChangePasswordParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityClearCachedRealms { + SecurityChangePassword { transport, parts, headers, @@ -803,17 +781,17 @@ where filter_path: None, human: None, pretty: None, + refresh: None, request_timeout: None, source: None, - usernames: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityClearCachedRealms<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityChangePassword<'a, 'b, JsonBody> where T: Serialize, { - SecurityClearCachedRealms { + SecurityChangePassword { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -822,9 +800,9 @@ where headers: self.headers, human: self.human, pretty: self.pretty, + refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, - usernames: self.usernames, } } #[doc = "Include the stack trace of returned errors."] @@ -852,6 +830,11 @@ where self.pretty = Some(pretty); self } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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); @@ -862,15 +845,10 @@ where self.source = Some(source); self } - #[doc = "Comma-separated list of usernames to clear from the cache"] - pub fn usernames(mut self, usernames: &'b [&'b str]) -> Self { - self.usernames = Some(usernames); - self - } - #[doc = "Creates an asynchronous call to the Security Clear Cached Realms API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Change Password API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -882,17 +860,16 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, + refresh: Option, source: Option<&'b str>, - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - usernames: Option<&'b [&'b str]>, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, pretty: self.pretty, + refresh: self.refresh, source: self.source, - usernames: self.usernames, }; Some(query_params) }; @@ -905,33 +882,33 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Clear Cached Roles API"] -pub enum SecurityClearCachedRolesParts<'b> { - #[doc = "Name"] - Name(&'b [&'b str]), +#[doc = "API parts for the Security Clear Api Key Cache API"] +pub enum SecurityClearApiKeyCacheParts<'b> { + #[doc = "Ids"] + Ids(&'b [&'b str]), } -impl<'b> SecurityClearCachedRolesParts<'b> { - #[doc = "Builds a relative URL path to the Security Clear Cached Roles API"] +impl<'b> SecurityClearApiKeyCacheParts<'b> { + #[doc = "Builds a relative URL path to the Security Clear Api Key Cache API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityClearCachedRolesParts::Name(ref name) => { - let name_str = name.join(","); - let encoded_name: Cow = - percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(29usize + encoded_name.len()); - p.push_str("/_security/role/"); - p.push_str(encoded_name.as_ref()); + SecurityClearApiKeyCacheParts::Ids(ref ids) => { + let ids_str = ids.join(","); + let encoded_ids: Cow = + percent_encode(ids_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(32usize + encoded_ids.len()); + p.push_str("/_security/api_key/"); + p.push_str(encoded_ids.as_ref()); p.push_str("/_clear_cache"); p.into() } } } } -#[doc = "Builder for the [Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] +#[doc = "Builder for the [Security Clear Api Key Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-api-key-cache.html)\n\nClear a subset or all entries from the API key cache."] #[derive(Clone, Debug)] -pub struct SecurityClearCachedRoles<'a, 'b, B> { +pub struct SecurityClearApiKeyCache<'a, 'b, B> { transport: &'a Transport, - parts: SecurityClearCachedRolesParts<'b>, + parts: SecurityClearApiKeyCacheParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -941,14 +918,14 @@ pub struct SecurityClearCachedRoles<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityClearCachedRoles<'a, 'b, B> +impl<'a, 'b, B> SecurityClearApiKeyCache<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityClearCachedRoles] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityClearCachedRolesParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityClearApiKeyCache] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityClearApiKeyCacheParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityClearCachedRoles { + SecurityClearApiKeyCache { transport, parts, headers, @@ -962,11 +939,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityClearCachedRoles<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityClearApiKeyCache<'a, 'b, JsonBody> where T: Serialize, { - SecurityClearCachedRoles { + SecurityClearApiKeyCache { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -1014,10 +991,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Clear Cached Roles API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Clear Api Key Cache API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1049,47 +1026,33 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Clear Cached Service Tokens API"] -pub enum SecurityClearCachedServiceTokensParts<'b> { - #[doc = "Namespace, Service and Name"] - NamespaceServiceName(&'b str, &'b str, &'b [&'b str]), +#[doc = "API parts for the Security Clear Cached Privileges API"] +pub enum SecurityClearCachedPrivilegesParts<'b> { + #[doc = "Application"] + Application(&'b [&'b str]), } -impl<'b> SecurityClearCachedServiceTokensParts<'b> { - #[doc = "Builds a relative URL path to the Security Clear Cached Service Tokens API"] +impl<'b> SecurityClearCachedPrivilegesParts<'b> { + #[doc = "Builds a relative URL path to the Security Clear Cached Privileges API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityClearCachedServiceTokensParts::NamespaceServiceName( - ref namespace, - ref service, - ref name, - ) => { - let name_str = name.join(","); - let encoded_namespace: Cow = - percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); - let encoded_service: Cow = - percent_encode(service.as_bytes(), PARTS_ENCODED).into(); - let encoded_name: Cow = - percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 51usize + encoded_namespace.len() + encoded_service.len() + encoded_name.len(), - ); - p.push_str("/_security/service/"); - p.push_str(encoded_namespace.as_ref()); - p.push_str("/"); - p.push_str(encoded_service.as_ref()); - p.push_str("/credential/token/"); - p.push_str(encoded_name.as_ref()); + SecurityClearCachedPrivilegesParts::Application(ref application) => { + let application_str = application.join(","); + let encoded_application: Cow = + percent_encode(application_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(34usize + encoded_application.len()); + p.push_str("/_security/privilege/"); + p.push_str(encoded_application.as_ref()); p.push_str("/_clear_cache"); p.into() } } } } -#[doc = "Builder for the [Security Clear Cached Service Tokens API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-service-token-caches.html)\n\nEvicts tokens from the service account token caches."] +#[doc = "Builder for the [Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] #[derive(Clone, Debug)] -pub struct SecurityClearCachedServiceTokens<'a, 'b, B> { +pub struct SecurityClearCachedPrivileges<'a, 'b, B> { transport: &'a Transport, - parts: SecurityClearCachedServiceTokensParts<'b>, + parts: SecurityClearCachedPrivilegesParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -1099,14 +1062,14 @@ pub struct SecurityClearCachedServiceTokens<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityClearCachedServiceTokens<'a, 'b, B> +impl<'a, 'b, B> SecurityClearCachedPrivileges<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityClearCachedServiceTokens] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityClearCachedServiceTokensParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityClearCachedPrivileges] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityClearCachedPrivilegesParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityClearCachedServiceTokens { + SecurityClearCachedPrivileges { transport, parts, headers, @@ -1120,11 +1083,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityClearCachedServiceTokens<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityClearCachedPrivileges<'a, 'b, JsonBody> where T: Serialize, { - SecurityClearCachedServiceTokens { + SecurityClearCachedPrivileges { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -1172,10 +1135,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Clear Cached Service Tokens API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Clear Cached Privileges API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1207,61 +1170,70 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Create Api Key API"] -pub enum SecurityCreateApiKeyParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Clear Cached Realms API"] +pub enum SecurityClearCachedRealmsParts<'b> { + #[doc = "Realms"] + Realms(&'b [&'b str]), } -impl SecurityCreateApiKeyParts { - #[doc = "Builds a relative URL path to the Security Create Api Key API"] +impl<'b> SecurityClearCachedRealmsParts<'b> { + #[doc = "Builds a relative URL path to the Security Clear Cached Realms API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityCreateApiKeyParts::None => "/_security/api_key".into(), + SecurityClearCachedRealmsParts::Realms(ref realms) => { + let realms_str = realms.join(","); + let encoded_realms: Cow = + percent_encode(realms_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(30usize + encoded_realms.len()); + p.push_str("/_security/realm/"); + p.push_str(encoded_realms.as_ref()); + p.push_str("/_clear_cache"); + p.into() + } } } } -#[doc = "Builder for the [Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] +#[doc = "Builder for the [Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] #[derive(Clone, Debug)] -pub struct SecurityCreateApiKey<'a, 'b, B> { +pub struct SecurityClearCachedRealms<'a, 'b, B> { transport: &'a Transport, - parts: SecurityCreateApiKeyParts, + parts: SecurityClearCachedRealmsParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, + usernames: Option<&'b [&'b str]>, } -impl<'a, 'b, B> SecurityCreateApiKey<'a, 'b, B> +impl<'a, 'b, B> SecurityClearCachedRealms<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityCreateApiKey]"] - pub fn new(transport: &'a Transport) -> Self { + #[doc = "Creates a new instance of [SecurityClearCachedRealms] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityClearCachedRealmsParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityCreateApiKey { + SecurityClearCachedRealms { transport, - parts: SecurityCreateApiKeyParts::None, + parts, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, + usernames: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityCreateApiKey<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityClearCachedRealms<'a, 'b, JsonBody> where T: Serialize, { - SecurityCreateApiKey { + SecurityClearCachedRealms { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -1270,9 +1242,9 @@ where headers: self.headers, human: self.human, pretty: self.pretty, - refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, + usernames: self.usernames, } } #[doc = "Include the stack trace of returned errors."] @@ -1300,11 +1272,6 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -1315,10 +1282,15 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Create Api Key API that can be awaited"] + #[doc = "Comma-separated list of usernames to clear from the cache"] + pub fn usernames(mut self, usernames: &'b [&'b str]) -> Self { + self.usernames = Some(usernames); + self + } + #[doc = "Creates an asynchronous call to the Security Clear Cached Realms API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1330,16 +1302,17 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + usernames: Option<&'b [&'b str]>, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, + usernames: self.usernames, }; Some(query_params) }; @@ -1352,79 +1325,50 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Create Service Token API"] -pub enum SecurityCreateServiceTokenParts<'b> { - #[doc = "Namespace, Service and Name"] - NamespaceServiceName(&'b str, &'b str, &'b str), - #[doc = "Namespace and Service"] - NamespaceService(&'b str, &'b str), +#[doc = "API parts for the Security Clear Cached Roles API"] +pub enum SecurityClearCachedRolesParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), } -impl<'b> SecurityCreateServiceTokenParts<'b> { - #[doc = "Builds a relative URL path to the Security Create Service Token API"] +impl<'b> SecurityClearCachedRolesParts<'b> { + #[doc = "Builds a relative URL path to the Security Clear Cached Roles API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityCreateServiceTokenParts::NamespaceServiceName( - ref namespace, - ref service, - ref name, - ) => { - let encoded_namespace: Cow = - percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); - let encoded_service: Cow = - percent_encode(service.as_bytes(), PARTS_ENCODED).into(); - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 38usize + encoded_namespace.len() + encoded_service.len() + encoded_name.len(), - ); - p.push_str("/_security/service/"); - p.push_str(encoded_namespace.as_ref()); - p.push_str("/"); - p.push_str(encoded_service.as_ref()); - p.push_str("/credential/token/"); + SecurityClearCachedRolesParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(29usize + encoded_name.len()); + p.push_str("/_security/role/"); p.push_str(encoded_name.as_ref()); - p.into() - } - SecurityCreateServiceTokenParts::NamespaceService(ref namespace, ref service) => { - let encoded_namespace: Cow = - percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); - let encoded_service: Cow = - percent_encode(service.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 37usize + encoded_namespace.len() + encoded_service.len(), - ); - p.push_str("/_security/service/"); - p.push_str(encoded_namespace.as_ref()); - p.push_str("/"); - p.push_str(encoded_service.as_ref()); - p.push_str("/credential/token"); + p.push_str("/_clear_cache"); p.into() } } } } -#[doc = "Builder for the [Security Create Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-create-service-token.html)\n\nCreates a service account token for access without requiring basic authentication."] +#[doc = "Builder for the [Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] #[derive(Clone, Debug)] -pub struct SecurityCreateServiceToken<'a, 'b, B> { +pub struct SecurityClearCachedRoles<'a, 'b, B> { transport: &'a Transport, - parts: SecurityCreateServiceTokenParts<'b>, + parts: SecurityClearCachedRolesParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityCreateServiceToken<'a, 'b, B> +impl<'a, 'b, B> SecurityClearCachedRoles<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityCreateServiceToken] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityCreateServiceTokenParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityClearCachedRoles] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityClearCachedRolesParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityCreateServiceToken { + SecurityClearCachedRoles { transport, parts, headers, @@ -1433,17 +1377,16 @@ where filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityCreateServiceToken<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityClearCachedRoles<'a, 'b, JsonBody> where T: Serialize, { - SecurityCreateServiceToken { + SecurityClearCachedRoles { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -1452,7 +1395,6 @@ where headers: self.headers, human: self.human, pretty: self.pretty, - refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -1482,11 +1424,6 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -1497,10 +1434,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Create Service Token API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Clear Cached Roles API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1512,7 +1449,6 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -1520,7 +1456,6 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, }; Some(query_params) @@ -1534,61 +1469,94 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Delete Privileges API"] -pub enum SecurityDeletePrivilegesParts<'b> { - #[doc = "Application and Name"] - ApplicationName(&'b str, &'b str), +#[doc = "API parts for the Security Clear Cached Service Tokens API"] +pub enum SecurityClearCachedServiceTokensParts<'b> { + #[doc = "Namespace, Service and Name"] + NamespaceServiceName(&'b str, &'b str, &'b [&'b str]), } -impl<'b> SecurityDeletePrivilegesParts<'b> { - #[doc = "Builds a relative URL path to the Security Delete Privileges API"] +impl<'b> SecurityClearCachedServiceTokensParts<'b> { + #[doc = "Builds a relative URL path to the Security Clear Cached Service Tokens API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityDeletePrivilegesParts::ApplicationName(ref application, ref name) => { - let encoded_application: Cow = - percent_encode(application.as_bytes(), PARTS_ENCODED).into(); - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(22usize + encoded_application.len() + encoded_name.len()); - p.push_str("/_security/privilege/"); - p.push_str(encoded_application.as_ref()); + SecurityClearCachedServiceTokensParts::NamespaceServiceName( + ref namespace, + ref service, + ref name, + ) => { + let name_str = name.join(","); + let encoded_namespace: Cow = + percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); + let encoded_service: Cow = + percent_encode(service.as_bytes(), PARTS_ENCODED).into(); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 51usize + encoded_namespace.len() + encoded_service.len() + encoded_name.len(), + ); + p.push_str("/_security/service/"); + p.push_str(encoded_namespace.as_ref()); p.push_str("/"); + p.push_str(encoded_service.as_ref()); + p.push_str("/credential/token/"); p.push_str(encoded_name.as_ref()); + p.push_str("/_clear_cache"); p.into() } } } } -#[doc = "Builder for the [Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-privilege.html)\n\nRemoves application privileges."] +#[doc = "Builder for the [Security Clear Cached Service Tokens API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-service-token-caches.html)\n\nEvicts tokens from the service account token caches."] #[derive(Clone, Debug)] -pub struct SecurityDeletePrivileges<'a, 'b> { +pub struct SecurityClearCachedServiceTokens<'a, 'b, B> { transport: &'a Transport, - parts: SecurityDeletePrivilegesParts<'b>, + parts: SecurityClearCachedServiceTokensParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityDeletePrivileges<'a, 'b> { - #[doc = "Creates a new instance of [SecurityDeletePrivileges] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityDeletePrivilegesParts<'b>) -> Self { +impl<'a, 'b, B> SecurityClearCachedServiceTokens<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityClearCachedServiceTokens] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityClearCachedServiceTokensParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityDeletePrivileges { + SecurityClearCachedServiceTokens { transport, parts, headers, + body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityClearCachedServiceTokens<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityClearCachedServiceTokens { + 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); @@ -1614,11 +1582,6 @@ impl<'a, 'b> SecurityDeletePrivileges<'a, 'b> { self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -1629,10 +1592,10 @@ impl<'a, 'b> SecurityDeletePrivileges<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Delete Privileges API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Clear Cached Service Tokens API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1644,7 +1607,6 @@ impl<'a, 'b> SecurityDeletePrivileges<'a, 'b> { filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -1652,12 +1614,11 @@ impl<'a, 'b> SecurityDeletePrivileges<'a, 'b> { filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -1666,30 +1627,25 @@ impl<'a, 'b> SecurityDeletePrivileges<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Delete Role API"] -pub enum SecurityDeleteRoleParts<'b> { - #[doc = "Name"] - Name(&'b str), +#[doc = "API parts for the Security Create Api Key API"] +pub enum SecurityCreateApiKeyParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityDeleteRoleParts<'b> { - #[doc = "Builds a relative URL path to the Security Delete Role API"] +impl SecurityCreateApiKeyParts { + #[doc = "Builds a relative URL path to the Security Create Api Key API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityDeleteRoleParts::Name(ref name) => { - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_name.len()); - p.push_str("/_security/role/"); - p.push_str(encoded_name.as_ref()); - p.into() - } + SecurityCreateApiKeyParts::None => "/_security/api_key".into(), } } } -#[doc = "Builder for the [Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-role.html)\n\nRemoves roles in the native realm."] +#[doc = "Builder for the [Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] #[derive(Clone, Debug)] -pub struct SecurityDeleteRole<'a, 'b> { +pub struct SecurityCreateApiKey<'a, 'b, B> { transport: &'a Transport, - parts: SecurityDeleteRoleParts<'b>, + parts: SecurityCreateApiKeyParts, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -1699,14 +1655,18 @@ pub struct SecurityDeleteRole<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityDeleteRole<'a, 'b> { - #[doc = "Creates a new instance of [SecurityDeleteRole] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityDeleteRoleParts<'b>) -> Self { +impl<'a, 'b, B> SecurityCreateApiKey<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityCreateApiKey]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityDeleteRole { + SecurityCreateApiKey { transport, - parts, + parts: SecurityCreateApiKeyParts::None, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -1716,6 +1676,25 @@ impl<'a, 'b> SecurityDeleteRole<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityCreateApiKey<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityCreateApiKey { + 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, + refresh: self.refresh, + 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); @@ -1756,10 +1735,10 @@ impl<'a, 'b> SecurityDeleteRole<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Delete Role API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Create Api Key API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1784,7 +1763,7 @@ impl<'a, 'b> SecurityDeleteRole<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -1792,57 +1771,79 @@ impl<'a, 'b> SecurityDeleteRole<'a, 'b> { Ok(response) } } +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Delete Role Mapping API"] -pub enum SecurityDeleteRoleMappingParts<'b> { - #[doc = "Name"] - Name(&'b str), +#[doc = "API parts for the Security Create Cross Cluster Api Key API"] +pub enum SecurityCreateCrossClusterApiKeyParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityDeleteRoleMappingParts<'b> { - #[doc = "Builds a relative URL path to the Security Delete Role Mapping API"] +#[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> { match self { - SecurityDeleteRoleMappingParts::Name(ref name) => { - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(24usize + encoded_name.len()); - p.push_str("/_security/role_mapping/"); - p.push_str(encoded_name.as_ref()); - p.into() + SecurityCreateCrossClusterApiKeyParts::None => { + "/_security/cross_cluster/api_key".into() } } } } -#[doc = "Builder for the [Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] +#[doc = "Builder for the [Security Create Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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 SecurityDeleteRoleMapping<'a, 'b> { +pub struct SecurityCreateCrossClusterApiKey<'a, 'b, B> { transport: &'a Transport, - parts: SecurityDeleteRoleMappingParts<'b>, + parts: SecurityCreateCrossClusterApiKeyParts, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityDeleteRoleMapping<'a, 'b> { - #[doc = "Creates a new instance of [SecurityDeleteRoleMapping] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityDeleteRoleMappingParts<'b>) -> Self { +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> SecurityCreateCrossClusterApiKey<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityCreateCrossClusterApiKey]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityDeleteRoleMapping { + SecurityCreateCrossClusterApiKey { transport, - parts, + parts: SecurityCreateCrossClusterApiKeyParts::None, headers, + body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityCreateCrossClusterApiKey<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityCreateCrossClusterApiKey { + 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); @@ -1868,11 +1869,6 @@ impl<'a, 'b> SecurityDeleteRoleMapping<'a, 'b> { self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -1883,10 +1879,10 @@ impl<'a, 'b> SecurityDeleteRoleMapping<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Delete Role Mapping API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Create Cross Cluster Api Key API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1898,7 +1894,6 @@ impl<'a, 'b> SecurityDeleteRoleMapping<'a, 'b> { filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -1906,12 +1901,11 @@ impl<'a, 'b> SecurityDeleteRoleMapping<'a, 'b> { filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -1920,16 +1914,18 @@ impl<'a, 'b> SecurityDeleteRoleMapping<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Delete Service Token API"] -pub enum SecurityDeleteServiceTokenParts<'b> { +#[doc = "API parts for the Security Create Service Token API"] +pub enum SecurityCreateServiceTokenParts<'b> { #[doc = "Namespace, Service and Name"] NamespaceServiceName(&'b str, &'b str, &'b str), + #[doc = "Namespace and Service"] + NamespaceService(&'b str, &'b str), } -impl<'b> SecurityDeleteServiceTokenParts<'b> { - #[doc = "Builds a relative URL path to the Security Delete Service Token API"] +impl<'b> SecurityCreateServiceTokenParts<'b> { + #[doc = "Builds a relative URL path to the Security Create Service Token API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityDeleteServiceTokenParts::NamespaceServiceName( + SecurityCreateServiceTokenParts::NamespaceServiceName( ref namespace, ref service, ref name, @@ -1950,14 +1946,30 @@ impl<'b> SecurityDeleteServiceTokenParts<'b> { p.push_str(encoded_name.as_ref()); p.into() } + SecurityCreateServiceTokenParts::NamespaceService(ref namespace, ref service) => { + let encoded_namespace: Cow = + percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); + let encoded_service: Cow = + percent_encode(service.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 37usize + encoded_namespace.len() + encoded_service.len(), + ); + p.push_str("/_security/service/"); + p.push_str(encoded_namespace.as_ref()); + p.push_str("/"); + p.push_str(encoded_service.as_ref()); + p.push_str("/credential/token"); + p.into() + } } } } -#[doc = "Builder for the [Security Delete Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-service-token.html)\n\nDeletes a service account token."] +#[doc = "Builder for the [Security Create Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-create-service-token.html)\n\nCreates a service account token for access without requiring basic authentication."] #[derive(Clone, Debug)] -pub struct SecurityDeleteServiceToken<'a, 'b> { +pub struct SecurityCreateServiceToken<'a, 'b, B> { transport: &'a Transport, - parts: SecurityDeleteServiceTokenParts<'b>, + parts: SecurityCreateServiceTokenParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -1967,14 +1979,18 @@ pub struct SecurityDeleteServiceToken<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityDeleteServiceToken<'a, 'b> { - #[doc = "Creates a new instance of [SecurityDeleteServiceToken] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityDeleteServiceTokenParts<'b>) -> Self { +impl<'a, 'b, B> SecurityCreateServiceToken<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityCreateServiceToken] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityCreateServiceTokenParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityDeleteServiceToken { + SecurityCreateServiceToken { transport, parts, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -1984,6 +2000,25 @@ impl<'a, 'b> SecurityDeleteServiceToken<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityCreateServiceToken<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityCreateServiceToken { + 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, + refresh: self.refresh, + 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); @@ -2024,10 +2059,10 @@ impl<'a, 'b> SecurityDeleteServiceToken<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Delete Service Token API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Create Service Token API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2052,7 +2087,7 @@ impl<'a, 'b> SecurityDeleteServiceToken<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -2061,31 +2096,35 @@ impl<'a, 'b> SecurityDeleteServiceToken<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Delete User API"] -pub enum SecurityDeleteUserParts<'b> { - #[doc = "Username"] - Username(&'b str), +#[doc = "API parts for the Security Delete Privileges API"] +pub enum SecurityDeletePrivilegesParts<'b> { + #[doc = "Application and Name"] + ApplicationName(&'b str, &'b str), } -impl<'b> SecurityDeleteUserParts<'b> { - #[doc = "Builds a relative URL path to the Security Delete User API"] +impl<'b> SecurityDeletePrivilegesParts<'b> { + #[doc = "Builds a relative URL path to the Security Delete Privileges API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityDeleteUserParts::Username(ref username) => { - let encoded_username: Cow = - percent_encode(username.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_username.len()); - p.push_str("/_security/user/"); - p.push_str(encoded_username.as_ref()); + SecurityDeletePrivilegesParts::ApplicationName(ref application, ref name) => { + let encoded_application: Cow = + percent_encode(application.as_bytes(), PARTS_ENCODED).into(); + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(22usize + encoded_application.len() + encoded_name.len()); + p.push_str("/_security/privilege/"); + p.push_str(encoded_application.as_ref()); + p.push_str("/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } -#[doc = "Builder for the [Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-user.html)\n\nDeletes users from the native realm."] +#[doc = "Builder for the [Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-privilege.html)\n\nRemoves application privileges."] #[derive(Clone, Debug)] -pub struct SecurityDeleteUser<'a, 'b> { +pub struct SecurityDeletePrivileges<'a, 'b> { transport: &'a Transport, - parts: SecurityDeleteUserParts<'b>, + parts: SecurityDeletePrivilegesParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -2095,11 +2134,11 @@ pub struct SecurityDeleteUser<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityDeleteUser<'a, 'b> { - #[doc = "Creates a new instance of [SecurityDeleteUser] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityDeleteUserParts<'b>) -> Self { +impl<'a, 'b> SecurityDeletePrivileges<'a, 'b> { + #[doc = "Creates a new instance of [SecurityDeletePrivileges] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityDeletePrivilegesParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityDeleteUser { + SecurityDeletePrivileges { transport, parts, headers, @@ -2152,10 +2191,10 @@ impl<'a, 'b> SecurityDeleteUser<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Delete User API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Delete Privileges API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2189,33 +2228,30 @@ impl<'a, 'b> SecurityDeleteUser<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Disable User API"] -pub enum SecurityDisableUserParts<'b> { - #[doc = "Username"] - Username(&'b str), +#[doc = "API parts for the Security Delete Role API"] +pub enum SecurityDeleteRoleParts<'b> { + #[doc = "Name"] + Name(&'b str), } -impl<'b> SecurityDisableUserParts<'b> { - #[doc = "Builds a relative URL path to the Security Disable User API"] +impl<'b> SecurityDeleteRoleParts<'b> { + #[doc = "Builds a relative URL path to the Security Delete Role API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityDisableUserParts::Username(ref username) => { - let encoded_username: Cow = - percent_encode(username.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(25usize + encoded_username.len()); - p.push_str("/_security/user/"); - p.push_str(encoded_username.as_ref()); - p.push_str("/_disable"); + SecurityDeleteRoleParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_name.len()); + p.push_str("/_security/role/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } -#[doc = "Builder for the [Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-disable-user.html)\n\nDisables users in the native realm."] +#[doc = "Builder for the [Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-role.html)\n\nRemoves roles in the native realm."] #[derive(Clone, Debug)] -pub struct SecurityDisableUser<'a, 'b, B> { +pub struct SecurityDeleteRole<'a, 'b> { transport: &'a Transport, - parts: SecurityDisableUserParts<'b>, - body: Option, + parts: SecurityDeleteRoleParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -2225,18 +2261,14 @@ pub struct SecurityDisableUser<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityDisableUser<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [SecurityDisableUser] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityDisableUserParts<'b>) -> Self { +impl<'a, 'b> SecurityDeleteRole<'a, 'b> { + #[doc = "Creates a new instance of [SecurityDeleteRole] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityDeleteRoleParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityDisableUser { + SecurityDeleteRole { transport, parts, headers, - body: None, error_trace: None, filter_path: None, human: None, @@ -2246,25 +2278,6 @@ where source: None, } } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityDisableUser<'a, 'b, JsonBody> - where - T: Serialize, - { - SecurityDisableUser { - 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, - refresh: self.refresh, - 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); @@ -2305,10 +2318,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Disable User API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Delete Role API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2333,7 +2346,7 @@ where }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -2341,37 +2354,31 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Disable User Profile API"] -pub enum SecurityDisableUserProfileParts<'b> { - #[doc = "Uid"] - Uid(&'b str), +#[doc = "API parts for the Security Delete Role Mapping API"] +pub enum SecurityDeleteRoleMappingParts<'b> { + #[doc = "Name"] + Name(&'b str), } -#[cfg(feature = "experimental-apis")] -impl<'b> SecurityDisableUserProfileParts<'b> { - #[doc = "Builds a relative URL path to the Security Disable User Profile API"] +impl<'b> SecurityDeleteRoleMappingParts<'b> { + #[doc = "Builds a relative URL path to the Security Delete Role Mapping API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityDisableUserProfileParts::Uid(ref uid) => { - let encoded_uid: Cow = percent_encode(uid.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(28usize + encoded_uid.len()); - p.push_str("/_security/profile/"); - p.push_str(encoded_uid.as_ref()); - p.push_str("/_disable"); + SecurityDeleteRoleMappingParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_name.len()); + p.push_str("/_security/role_mapping/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } -#[doc = "Builder for the [Security Disable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-disable-user-profile.html)\n\nDisables a user profile so it's not visible in user profile searches."] -#[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")] +#[doc = "Builder for the [Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] #[derive(Clone, Debug)] -pub struct SecurityDisableUserProfile<'a, 'b, B> { +pub struct SecurityDeleteRoleMapping<'a, 'b> { transport: &'a Transport, - parts: SecurityDisableUserProfileParts<'b>, - body: Option, + parts: SecurityDeleteRoleMappingParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -2381,19 +2388,14 @@ pub struct SecurityDisableUserProfile<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] -impl<'a, 'b, B> SecurityDisableUserProfile<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [SecurityDisableUserProfile] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityDisableUserProfileParts<'b>) -> Self { +impl<'a, 'b> SecurityDeleteRoleMapping<'a, 'b> { + #[doc = "Creates a new instance of [SecurityDeleteRoleMapping] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityDeleteRoleMappingParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityDisableUserProfile { + SecurityDeleteRoleMapping { transport, parts, headers, - body: None, error_trace: None, filter_path: None, human: None, @@ -2403,25 +2405,6 @@ where source: None, } } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityDisableUserProfile<'a, 'b, JsonBody> - where - T: Serialize, - { - SecurityDisableUserProfile { - 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, - refresh: self.refresh, - 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); @@ -2447,7 +2430,7 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] pub fn refresh(mut self, refresh: Refresh) -> Self { self.refresh = Some(refresh); self @@ -2462,10 +2445,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Disable User Profile API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Delete Role Mapping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2490,7 +2473,7 @@ where }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -2499,33 +2482,44 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Enable User API"] -pub enum SecurityEnableUserParts<'b> { - #[doc = "Username"] - Username(&'b str), +#[doc = "API parts for the Security Delete Service Token API"] +pub enum SecurityDeleteServiceTokenParts<'b> { + #[doc = "Namespace, Service and Name"] + NamespaceServiceName(&'b str, &'b str, &'b str), } -impl<'b> SecurityEnableUserParts<'b> { - #[doc = "Builds a relative URL path to the Security Enable User API"] +impl<'b> SecurityDeleteServiceTokenParts<'b> { + #[doc = "Builds a relative URL path to the Security Delete Service Token API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityEnableUserParts::Username(ref username) => { - let encoded_username: Cow = - percent_encode(username.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(24usize + encoded_username.len()); - p.push_str("/_security/user/"); - p.push_str(encoded_username.as_ref()); - p.push_str("/_enable"); + SecurityDeleteServiceTokenParts::NamespaceServiceName( + ref namespace, + ref service, + ref name, + ) => { + let encoded_namespace: Cow = + percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); + let encoded_service: Cow = + percent_encode(service.as_bytes(), PARTS_ENCODED).into(); + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 38usize + encoded_namespace.len() + encoded_service.len() + encoded_name.len(), + ); + p.push_str("/_security/service/"); + p.push_str(encoded_namespace.as_ref()); + p.push_str("/"); + p.push_str(encoded_service.as_ref()); + p.push_str("/credential/token/"); + p.push_str(encoded_name.as_ref()); p.into() } } } } -#[doc = "Builder for the [Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-enable-user.html)\n\nEnables users in the native realm."] +#[doc = "Builder for the [Security Delete Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-service-token.html)\n\nDeletes a service account token."] #[derive(Clone, Debug)] -pub struct SecurityEnableUser<'a, 'b, B> { +pub struct SecurityDeleteServiceToken<'a, 'b> { transport: &'a Transport, - parts: SecurityEnableUserParts<'b>, - body: Option, + parts: SecurityDeleteServiceTokenParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -2535,18 +2529,14 @@ pub struct SecurityEnableUser<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityEnableUser<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [SecurityEnableUser] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityEnableUserParts<'b>) -> Self { +impl<'a, 'b> SecurityDeleteServiceToken<'a, 'b> { + #[doc = "Creates a new instance of [SecurityDeleteServiceToken] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityDeleteServiceTokenParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityEnableUser { + SecurityDeleteServiceToken { transport, parts, headers, - body: None, error_trace: None, filter_path: None, human: None, @@ -2556,25 +2546,6 @@ where source: None, } } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityEnableUser<'a, 'b, JsonBody> - where - T: Serialize, - { - SecurityEnableUser { - 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, - refresh: self.refresh, - 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); @@ -2600,7 +2571,7 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + #[doc = "If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] pub fn refresh(mut self, refresh: Refresh) -> Self { self.refresh = Some(refresh); self @@ -2615,10 +2586,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Enable User API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Delete Service Token API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2643,7 +2614,7 @@ where }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -2651,37 +2622,32 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Enable User Profile API"] -pub enum SecurityEnableUserProfileParts<'b> { - #[doc = "Uid"] - Uid(&'b str), +#[doc = "API parts for the Security Delete User API"] +pub enum SecurityDeleteUserParts<'b> { + #[doc = "Username"] + Username(&'b str), } -#[cfg(feature = "experimental-apis")] -impl<'b> SecurityEnableUserProfileParts<'b> { - #[doc = "Builds a relative URL path to the Security Enable User Profile API"] +impl<'b> SecurityDeleteUserParts<'b> { + #[doc = "Builds a relative URL path to the Security Delete User API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityEnableUserProfileParts::Uid(ref uid) => { - let encoded_uid: Cow = percent_encode(uid.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(27usize + encoded_uid.len()); - p.push_str("/_security/profile/"); - p.push_str(encoded_uid.as_ref()); - p.push_str("/_enable"); + SecurityDeleteUserParts::Username(ref username) => { + let encoded_username: Cow = + percent_encode(username.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_username.len()); + p.push_str("/_security/user/"); + p.push_str(encoded_username.as_ref()); p.into() } } } } -#[doc = "Builder for the [Security Enable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-enable-user-profile.html)\n\nEnables a user profile so it's visible in user profile searches."] -#[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")] +#[doc = "Builder for the [Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-user.html)\n\nDeletes users from the native realm."] #[derive(Clone, Debug)] -pub struct SecurityEnableUserProfile<'a, 'b, B> { +pub struct SecurityDeleteUser<'a, 'b> { transport: &'a Transport, - parts: SecurityEnableUserProfileParts<'b>, - body: Option, + parts: SecurityDeleteUserParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -2691,19 +2657,14 @@ pub struct SecurityEnableUserProfile<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] -impl<'a, 'b, B> SecurityEnableUserProfile<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [SecurityEnableUserProfile] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityEnableUserProfileParts<'b>) -> Self { +impl<'a, 'b> SecurityDeleteUser<'a, 'b> { + #[doc = "Creates a new instance of [SecurityDeleteUser] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityDeleteUserParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityEnableUserProfile { + SecurityDeleteUser { transport, parts, headers, - body: None, error_trace: None, filter_path: None, human: None, @@ -2713,25 +2674,6 @@ where source: None, } } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityEnableUserProfile<'a, 'b, JsonBody> - where - T: Serialize, - { - SecurityEnableUserProfile { - 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, - refresh: self.refresh, - 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); @@ -2757,7 +2699,7 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] pub fn refresh(mut self, refresh: Refresh) -> Self { self.refresh = Some(refresh); self @@ -2772,10 +2714,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Enable User Profile API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Delete User API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2800,7 +2742,7 @@ where }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -2809,24 +2751,1301 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Enroll Kibana API"] -pub enum SecurityEnrollKibanaParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Disable User API"] +pub enum SecurityDisableUserParts<'b> { + #[doc = "Username"] + Username(&'b str), } -impl SecurityEnrollKibanaParts { - #[doc = "Builds a relative URL path to the Security Enroll Kibana API"] +impl<'b> SecurityDisableUserParts<'b> { + #[doc = "Builds a relative URL path to the Security Disable User API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityEnrollKibanaParts::None => "/_security/enroll/kibana".into(), + SecurityDisableUserParts::Username(ref username) => { + let encoded_username: Cow = + percent_encode(username.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(25usize + encoded_username.len()); + p.push_str("/_security/user/"); + p.push_str(encoded_username.as_ref()); + p.push_str("/_disable"); + p.into() + } + } + } +} +#[doc = "Builder for the [Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-disable-user.html)\n\nDisables users in the native realm."] +#[derive(Clone, Debug)] +pub struct SecurityDisableUser<'a, 'b, B> { + transport: &'a Transport, + parts: SecurityDisableUserParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + refresh: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> SecurityDisableUser<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityDisableUser] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityDisableUserParts<'b>) -> Self { + let headers = HeaderMap::new(); + SecurityDisableUser { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + refresh: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityDisableUser<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityDisableUser { + 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, + refresh: self.refresh, + 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 = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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 Security Disable User 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, + refresh: 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, + refresh: self.refresh, + 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)] +#[doc = "API parts for the Security Disable User Profile API"] +pub enum SecurityDisableUserProfileParts<'b> { + #[doc = "Uid"] + Uid(&'b str), +} +impl<'b> SecurityDisableUserProfileParts<'b> { + #[doc = "Builds a relative URL path to the Security Disable User Profile API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityDisableUserProfileParts::Uid(ref uid) => { + let encoded_uid: Cow = percent_encode(uid.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(28usize + encoded_uid.len()); + p.push_str("/_security/profile/"); + p.push_str(encoded_uid.as_ref()); + p.push_str("/_disable"); + p.into() + } + } + } +} +#[doc = "Builder for the [Security Disable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-disable-user-profile.html)\n\nDisables a user profile so it's not visible in user profile searches."] +#[derive(Clone, Debug)] +pub struct SecurityDisableUserProfile<'a, 'b, B> { + transport: &'a Transport, + parts: SecurityDisableUserProfileParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + refresh: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> SecurityDisableUserProfile<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityDisableUserProfile] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityDisableUserProfileParts<'b>) -> Self { + let headers = HeaderMap::new(); + SecurityDisableUserProfile { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + refresh: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityDisableUserProfile<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityDisableUserProfile { + 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, + refresh: self.refresh, + 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 = "If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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 Security Disable User Profile 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, + refresh: 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, + refresh: self.refresh, + 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)] +#[doc = "API parts for the Security Enable User API"] +pub enum SecurityEnableUserParts<'b> { + #[doc = "Username"] + Username(&'b str), +} +impl<'b> SecurityEnableUserParts<'b> { + #[doc = "Builds a relative URL path to the Security Enable User API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityEnableUserParts::Username(ref username) => { + let encoded_username: Cow = + percent_encode(username.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_username.len()); + p.push_str("/_security/user/"); + p.push_str(encoded_username.as_ref()); + p.push_str("/_enable"); + p.into() + } + } + } +} +#[doc = "Builder for the [Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-enable-user.html)\n\nEnables users in the native realm."] +#[derive(Clone, Debug)] +pub struct SecurityEnableUser<'a, 'b, B> { + transport: &'a Transport, + parts: SecurityEnableUserParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + refresh: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> SecurityEnableUser<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityEnableUser] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityEnableUserParts<'b>) -> Self { + let headers = HeaderMap::new(); + SecurityEnableUser { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + refresh: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityEnableUser<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityEnableUser { + 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, + refresh: self.refresh, + 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 = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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 Security Enable User 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, + refresh: 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, + refresh: self.refresh, + 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)] +#[doc = "API parts for the Security Enable User Profile API"] +pub enum SecurityEnableUserProfileParts<'b> { + #[doc = "Uid"] + Uid(&'b str), +} +impl<'b> SecurityEnableUserProfileParts<'b> { + #[doc = "Builds a relative URL path to the Security Enable User Profile API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityEnableUserProfileParts::Uid(ref uid) => { + let encoded_uid: Cow = percent_encode(uid.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(27usize + encoded_uid.len()); + p.push_str("/_security/profile/"); + p.push_str(encoded_uid.as_ref()); + p.push_str("/_enable"); + p.into() + } + } + } +} +#[doc = "Builder for the [Security Enable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-enable-user-profile.html)\n\nEnables a user profile so it's visible in user profile searches."] +#[derive(Clone, Debug)] +pub struct SecurityEnableUserProfile<'a, 'b, B> { + transport: &'a Transport, + parts: SecurityEnableUserProfileParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pretty: Option, + refresh: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b, B> SecurityEnableUserProfile<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityEnableUserProfile] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityEnableUserProfileParts<'b>) -> Self { + let headers = HeaderMap::new(); + SecurityEnableUserProfile { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + refresh: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityEnableUserProfile<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityEnableUserProfile { + 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, + refresh: self.refresh, + 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 = "If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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 Security Enable User Profile 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, + refresh: 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, + refresh: self.refresh, + 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)] +#[doc = "API parts for the Security Enroll Kibana API"] +pub enum SecurityEnrollKibanaParts { + #[doc = "No parts"] + None, +} +impl SecurityEnrollKibanaParts { + #[doc = "Builds a relative URL path to the Security Enroll Kibana API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityEnrollKibanaParts::None => "/_security/enroll/kibana".into(), + } + } +} +#[doc = "Builder for the [Security Enroll Kibana API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-kibana-enrollment.html)\n\nAllows a kibana instance to configure itself to communicate with a secured elasticsearch cluster."] +#[derive(Clone, Debug)] +pub struct SecurityEnrollKibana<'a, 'b> { + transport: &'a Transport, + parts: SecurityEnrollKibanaParts, + 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> SecurityEnrollKibana<'a, 'b> { + #[doc = "Creates a new instance of [SecurityEnrollKibana]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SecurityEnrollKibana { + transport, + parts: SecurityEnrollKibanaParts::None, + 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 Security Enroll Kibana 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)] +#[doc = "API parts for the Security Enroll Node API"] +pub enum SecurityEnrollNodeParts { + #[doc = "No parts"] + None, +} +impl SecurityEnrollNodeParts { + #[doc = "Builds a relative URL path to the Security Enroll Node API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityEnrollNodeParts::None => "/_security/enroll/node".into(), + } + } +} +#[doc = "Builder for the [Security Enroll Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-node-enrollment.html)\n\nAllows a new node to enroll to an existing cluster with security enabled."] +#[derive(Clone, Debug)] +pub struct SecurityEnrollNode<'a, 'b> { + transport: &'a Transport, + parts: SecurityEnrollNodeParts, + 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> SecurityEnrollNode<'a, 'b> { + #[doc = "Creates a new instance of [SecurityEnrollNode]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SecurityEnrollNode { + transport, + parts: SecurityEnrollNodeParts::None, + 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 Security Enroll Node 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)] +#[doc = "API parts for the Security Get Api Key API"] +pub enum SecurityGetApiKeyParts { + #[doc = "No parts"] + None, +} +impl SecurityGetApiKeyParts { + #[doc = "Builds a relative URL path to the Security Get Api Key API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityGetApiKeyParts::None => "/_security/api_key".into(), + } + } +} +#[doc = "Builder for the [Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] +#[derive(Clone, Debug)] +pub struct SecurityGetApiKey<'a, 'b> { + transport: &'a Transport, + parts: SecurityGetApiKeyParts, + active_only: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + id: Option<&'b str>, + name: Option<&'b str>, + owner: Option, + pretty: Option, + realm_name: Option<&'b str>, + request_timeout: Option, + source: Option<&'b str>, + username: Option<&'b str>, + with_limited_by: Option, + with_profile_uid: Option, +} +impl<'a, 'b> SecurityGetApiKey<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetApiKey]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SecurityGetApiKey { + transport, + parts: SecurityGetApiKeyParts::None, + headers, + active_only: None, + error_trace: None, + filter_path: None, + human: None, + id: None, + name: None, + owner: None, + pretty: None, + realm_name: None, + request_timeout: None, + source: None, + username: None, + with_limited_by: None, + with_profile_uid: None, + } + } + #[doc = "flag to limit response to only active (not invalidated or expired) API keys"] + pub fn active_only(mut self, active_only: bool) -> Self { + self.active_only = Some(active_only); + 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); + 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 = "API key id of the API key to be retrieved"] + pub fn id(mut self, id: &'b str) -> Self { + self.id = Some(id); + self + } + #[doc = "API key name of the API key to be retrieved"] + pub fn name(mut self, name: &'b str) -> Self { + self.name = Some(name); + self + } + #[doc = "flag to query API keys owned by the currently authenticated user"] + pub fn owner(mut self, owner: bool) -> Self { + self.owner = Some(owner); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "realm name of the user who created this API key to be retrieved"] + pub fn realm_name(mut self, realm_name: &'b str) -> Self { + self.realm_name = Some(realm_name); + 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 = "user name of the user who created this API key to be retrieved"] + pub fn username(mut self, username: &'b str) -> Self { + self.username = Some(username); + self + } + #[doc = "flag to show the limited-by role descriptors of API Keys"] + pub fn with_limited_by(mut self, with_limited_by: bool) -> Self { + self.with_limited_by = Some(with_limited_by); + self + } + #[doc = "flag to also retrieve the API Key's owner profile uid, if it exists"] + pub fn with_profile_uid(mut self, with_profile_uid: bool) -> Self { + self.with_profile_uid = Some(with_profile_uid); + self + } + #[doc = "Creates an asynchronous call to the Security Get Api Key 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> { + active_only: Option, + error_trace: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + human: Option, + id: Option<&'b str>, + name: Option<&'b str>, + owner: Option, + pretty: Option, + realm_name: Option<&'b str>, + source: Option<&'b str>, + username: Option<&'b str>, + with_limited_by: Option, + with_profile_uid: Option, + } + let query_params = QueryParams { + active_only: self.active_only, + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + id: self.id, + name: self.name, + owner: self.owner, + pretty: self.pretty, + realm_name: self.realm_name, + source: self.source, + username: self.username, + with_limited_by: self.with_limited_by, + with_profile_uid: self.with_profile_uid, + }; + 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)] +#[doc = "API parts for the Security Get Builtin Privileges API"] +pub enum SecurityGetBuiltinPrivilegesParts { + #[doc = "No parts"] + None, +} +impl SecurityGetBuiltinPrivilegesParts { + #[doc = "Builds a relative URL path to the Security Get Builtin Privileges API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityGetBuiltinPrivilegesParts::None => "/_security/privilege/_builtin".into(), + } + } +} +#[doc = "Builder for the [Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] +#[derive(Clone, Debug)] +pub struct SecurityGetBuiltinPrivileges<'a, 'b> { + transport: &'a Transport, + parts: SecurityGetBuiltinPrivilegesParts, + 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> SecurityGetBuiltinPrivileges<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetBuiltinPrivileges]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SecurityGetBuiltinPrivileges { + transport, + parts: SecurityGetBuiltinPrivilegesParts::None, + 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 Security Get Builtin Privileges 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)] +#[doc = "API parts for the Security Get Privileges API"] +pub enum SecurityGetPrivilegesParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Application"] + Application(&'b str), + #[doc = "Application and Name"] + ApplicationName(&'b str, &'b str), +} +impl<'b> SecurityGetPrivilegesParts<'b> { + #[doc = "Builds a relative URL path to the Security Get Privileges API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityGetPrivilegesParts::None => "/_security/privilege".into(), + SecurityGetPrivilegesParts::Application(ref application) => { + let encoded_application: Cow = + percent_encode(application.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(21usize + encoded_application.len()); + p.push_str("/_security/privilege/"); + p.push_str(encoded_application.as_ref()); + p.into() + } + SecurityGetPrivilegesParts::ApplicationName(ref application, ref name) => { + let encoded_application: Cow = + percent_encode(application.as_bytes(), PARTS_ENCODED).into(); + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(22usize + encoded_application.len() + encoded_name.len()); + p.push_str("/_security/privilege/"); + p.push_str(encoded_application.as_ref()); + p.push_str("/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-privileges.html)\n\nRetrieves application privileges."] +#[derive(Clone, Debug)] +pub struct SecurityGetPrivileges<'a, 'b> { + transport: &'a Transport, + parts: SecurityGetPrivilegesParts<'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> SecurityGetPrivileges<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetPrivileges] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityGetPrivilegesParts<'b>) -> Self { + let headers = HeaderMap::new(); + SecurityGetPrivileges { + 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 Security Get Privileges 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)] +#[doc = "API parts for the Security Get Role API"] +pub enum SecurityGetRoleParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), + #[doc = "No parts"] + None, +} +impl<'b> SecurityGetRoleParts<'b> { + #[doc = "Builds a relative URL path to the Security Get Role API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SecurityGetRoleParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_name.len()); + p.push_str("/_security/role/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + SecurityGetRoleParts::None => "/_security/role".into(), } } } -#[doc = "Builder for the [Security Enroll Kibana API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-kibana-enrollment.html)\n\nAllows a kibana instance to configure itself to communicate with a secured elasticsearch cluster."] +#[doc = "Builder for the [Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-role.html)\n\nRetrieves roles in the native realm."] #[derive(Clone, Debug)] -pub struct SecurityEnrollKibana<'a, 'b> { +pub struct SecurityGetRole<'a, 'b> { transport: &'a Transport, - parts: SecurityEnrollKibanaParts, + parts: SecurityGetRoleParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -2835,13 +4054,13 @@ pub struct SecurityEnrollKibana<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityEnrollKibana<'a, 'b> { - #[doc = "Creates a new instance of [SecurityEnrollKibana]"] - pub fn new(transport: &'a Transport) -> Self { +impl<'a, 'b> SecurityGetRole<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetRole] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityGetRoleParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityEnrollKibana { + SecurityGetRole { transport, - parts: SecurityEnrollKibanaParts::None, + parts, headers, error_trace: None, filter_path: None, @@ -2886,10 +4105,10 @@ impl<'a, 'b> SecurityEnrollKibana<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Enroll Kibana API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get Role API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2921,24 +4140,35 @@ impl<'a, 'b> SecurityEnrollKibana<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Enroll Node API"] -pub enum SecurityEnrollNodeParts { +#[doc = "API parts for the Security Get Role Mapping API"] +pub enum SecurityGetRoleMappingParts<'b> { + #[doc = "Name"] + Name(&'b [&'b str]), #[doc = "No parts"] None, } -impl SecurityEnrollNodeParts { - #[doc = "Builds a relative URL path to the Security Enroll Node API"] +impl<'b> SecurityGetRoleMappingParts<'b> { + #[doc = "Builds a relative URL path to the Security Get Role Mapping API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityEnrollNodeParts::None => "/_security/enroll/node".into(), + SecurityGetRoleMappingParts::Name(ref name) => { + let name_str = name.join(","); + let encoded_name: Cow = + percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_name.len()); + p.push_str("/_security/role_mapping/"); + p.push_str(encoded_name.as_ref()); + p.into() + } + SecurityGetRoleMappingParts::None => "/_security/role_mapping".into(), } } } -#[doc = "Builder for the [Security Enroll Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-node-enrollment.html)\n\nAllows a new node to enroll to an existing cluster with security enabled."] +#[doc = "Builder for the [Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] #[derive(Clone, Debug)] -pub struct SecurityEnrollNode<'a, 'b> { +pub struct SecurityGetRoleMapping<'a, 'b> { transport: &'a Transport, - parts: SecurityEnrollNodeParts, + parts: SecurityGetRoleMappingParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -2947,13 +4177,13 @@ pub struct SecurityEnrollNode<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityEnrollNode<'a, 'b> { - #[doc = "Creates a new instance of [SecurityEnrollNode]"] - pub fn new(transport: &'a Transport) -> Self { +impl<'a, 'b> SecurityGetRoleMapping<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetRoleMapping] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityGetRoleMappingParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityEnrollNode { + SecurityGetRoleMapping { transport, - parts: SecurityEnrollNodeParts::None, + parts, headers, error_trace: None, filter_path: None, @@ -2998,10 +4228,10 @@ impl<'a, 'b> SecurityEnrollNode<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Enroll Node API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get Role Mapping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3033,56 +4263,72 @@ impl<'a, 'b> SecurityEnrollNode<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Api Key API"] -pub enum SecurityGetApiKeyParts { +#[doc = "API parts for the Security Get Service Accounts API"] +pub enum SecurityGetServiceAccountsParts<'b> { + #[doc = "Namespace and Service"] + NamespaceService(&'b str, &'b str), + #[doc = "Namespace"] + Namespace(&'b str), #[doc = "No parts"] None, } -impl SecurityGetApiKeyParts { - #[doc = "Builds a relative URL path to the Security Get Api Key API"] +impl<'b> SecurityGetServiceAccountsParts<'b> { + #[doc = "Builds a relative URL path to the Security Get Service Accounts API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetApiKeyParts::None => "/_security/api_key".into(), + SecurityGetServiceAccountsParts::NamespaceService(ref namespace, ref service) => { + let encoded_namespace: Cow = + percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); + let encoded_service: Cow = + percent_encode(service.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 20usize + encoded_namespace.len() + encoded_service.len(), + ); + p.push_str("/_security/service/"); + p.push_str(encoded_namespace.as_ref()); + p.push_str("/"); + p.push_str(encoded_service.as_ref()); + p.into() + } + SecurityGetServiceAccountsParts::Namespace(ref namespace) => { + let encoded_namespace: Cow = + percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(19usize + encoded_namespace.len()); + p.push_str("/_security/service/"); + p.push_str(encoded_namespace.as_ref()); + p.into() + } + SecurityGetServiceAccountsParts::None => "/_security/service".into(), } } } -#[doc = "Builder for the [Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] +#[doc = "Builder for the [Security Get Service Accounts API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-service-accounts.html)\n\nRetrieves information about service accounts."] #[derive(Clone, Debug)] -pub struct SecurityGetApiKey<'a, 'b> { +pub struct SecurityGetServiceAccounts<'a, 'b> { transport: &'a Transport, - parts: SecurityGetApiKeyParts, + parts: SecurityGetServiceAccountsParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, - id: Option<&'b str>, - name: Option<&'b str>, - owner: Option, pretty: Option, - realm_name: Option<&'b str>, request_timeout: Option, source: Option<&'b str>, - username: Option<&'b str>, } -impl<'a, 'b> SecurityGetApiKey<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetApiKey]"] - pub fn new(transport: &'a Transport) -> Self { +impl<'a, 'b> SecurityGetServiceAccounts<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetServiceAccounts] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityGetServiceAccountsParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityGetApiKey { + SecurityGetServiceAccounts { transport, - parts: SecurityGetApiKeyParts::None, + parts, headers, error_trace: None, filter_path: None, human: None, - id: None, - name: None, - owner: None, pretty: None, - realm_name: None, request_timeout: None, source: None, - username: None, } } #[doc = "Include the stack trace of returned errors."] @@ -3105,31 +4351,11 @@ impl<'a, 'b> SecurityGetApiKey<'a, 'b> { self.human = Some(human); self } - #[doc = "API key id of the API key to be retrieved"] - pub fn id(mut self, id: &'b str) -> Self { - self.id = Some(id); - self - } - #[doc = "API key name of the API key to be retrieved"] - pub fn name(mut self, name: &'b str) -> Self { - self.name = Some(name); - self - } - #[doc = "flag to query API keys owned by the currently authenticated user"] - pub fn owner(mut self, owner: bool) -> Self { - self.owner = Some(owner); - self - } #[doc = "Pretty format the returned JSON response."] pub fn pretty(mut self, pretty: bool) -> Self { self.pretty = Some(pretty); self } - #[doc = "realm name of the user who created this API key to be retrieved"] - pub fn realm_name(mut self, realm_name: &'b str) -> Self { - self.realm_name = Some(realm_name); - 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); @@ -3140,15 +4366,10 @@ impl<'a, 'b> SecurityGetApiKey<'a, 'b> { self.source = Some(source); self } - #[doc = "user name of the user who created this API key to be retrieved"] - pub fn username(mut self, username: &'b str) -> Self { - self.username = Some(username); - self - } - #[doc = "Creates an asynchronous call to the Security Get Api Key API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get Service Accounts API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3159,25 +4380,15 @@ impl<'a, 'b> SecurityGetApiKey<'a, 'b> { #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, human: Option, - id: Option<&'b str>, - name: Option<&'b str>, - owner: Option, pretty: Option, - realm_name: Option<&'b str>, source: Option<&'b str>, - username: Option<&'b str>, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, - id: self.id, - name: self.name, - owner: self.owner, pretty: self.pretty, - realm_name: self.realm_name, source: self.source, - username: self.username, }; Some(query_params) }; @@ -3190,24 +4401,38 @@ impl<'a, 'b> SecurityGetApiKey<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Builtin Privileges API"] -pub enum SecurityGetBuiltinPrivilegesParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Get Service Credentials API"] +pub enum SecurityGetServiceCredentialsParts<'b> { + #[doc = "Namespace and Service"] + NamespaceService(&'b str, &'b str), } -impl SecurityGetBuiltinPrivilegesParts { - #[doc = "Builds a relative URL path to the Security Get Builtin Privileges API"] +impl<'b> SecurityGetServiceCredentialsParts<'b> { + #[doc = "Builds a relative URL path to the Security Get Service Credentials API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetBuiltinPrivilegesParts::None => "/_security/privilege/_builtin".into(), + SecurityGetServiceCredentialsParts::NamespaceService(ref namespace, ref service) => { + let encoded_namespace: Cow = + percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); + let encoded_service: Cow = + percent_encode(service.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity( + 31usize + encoded_namespace.len() + encoded_service.len(), + ); + p.push_str("/_security/service/"); + p.push_str(encoded_namespace.as_ref()); + p.push_str("/"); + p.push_str(encoded_service.as_ref()); + p.push_str("/credential"); + p.into() + } } } } -#[doc = "Builder for the [Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] +#[doc = "Builder for the [Security Get Service Credentials API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-service-credentials.html)\n\nRetrieves information of all service credentials for a service account."] #[derive(Clone, Debug)] -pub struct SecurityGetBuiltinPrivileges<'a, 'b> { +pub struct SecurityGetServiceCredentials<'a, 'b> { transport: &'a Transport, - parts: SecurityGetBuiltinPrivilegesParts, + parts: SecurityGetServiceCredentialsParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -3216,13 +4441,13 @@ pub struct SecurityGetBuiltinPrivileges<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityGetBuiltinPrivileges<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetBuiltinPrivileges]"] - pub fn new(transport: &'a Transport) -> Self { +impl<'a, 'b> SecurityGetServiceCredentials<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetServiceCredentials] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityGetServiceCredentialsParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityGetBuiltinPrivileges { + SecurityGetServiceCredentials { transport, - parts: SecurityGetBuiltinPrivilegesParts::None, + parts, headers, error_trace: None, filter_path: None, @@ -3267,10 +4492,10 @@ impl<'a, 'b> SecurityGetBuiltinPrivileges<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get Builtin Privileges API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get Service Credentials API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3302,67 +4527,45 @@ impl<'a, 'b> SecurityGetBuiltinPrivileges<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Privileges API"] -pub enum SecurityGetPrivilegesParts<'b> { +#[doc = "API parts for the Security Get Settings API"] +pub enum SecurityGetSettingsParts { #[doc = "No parts"] None, - #[doc = "Application"] - Application(&'b str), - #[doc = "Application and Name"] - ApplicationName(&'b str, &'b str), } -impl<'b> SecurityGetPrivilegesParts<'b> { - #[doc = "Builds a relative URL path to the Security Get Privileges API"] +impl SecurityGetSettingsParts { + #[doc = "Builds a relative URL path to the Security Get Settings API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetPrivilegesParts::None => "/_security/privilege".into(), - SecurityGetPrivilegesParts::Application(ref application) => { - let encoded_application: Cow = - percent_encode(application.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(21usize + encoded_application.len()); - p.push_str("/_security/privilege/"); - p.push_str(encoded_application.as_ref()); - p.into() - } - SecurityGetPrivilegesParts::ApplicationName(ref application, ref name) => { - let encoded_application: Cow = - percent_encode(application.as_bytes(), PARTS_ENCODED).into(); - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = - String::with_capacity(22usize + encoded_application.len() + encoded_name.len()); - p.push_str("/_security/privilege/"); - p.push_str(encoded_application.as_ref()); - p.push_str("/"); - p.push_str(encoded_name.as_ref()); - p.into() - } + SecurityGetSettingsParts::None => "/_security/settings".into(), } } } -#[doc = "Builder for the [Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-privileges.html)\n\nRetrieves application privileges."] +#[doc = "Builder for the [Security Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-settings.html)\n\nRetrieve settings for the security system indices"] #[derive(Clone, Debug)] -pub struct SecurityGetPrivileges<'a, 'b> { +pub struct SecurityGetSettings<'a, 'b> { transport: &'a Transport, - parts: SecurityGetPrivilegesParts<'b>, + parts: SecurityGetSettingsParts, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, + master_timeout: Option<&'b str>, pretty: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityGetPrivileges<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetPrivileges] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityGetPrivilegesParts<'b>) -> Self { +impl<'a, 'b> SecurityGetSettings<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetSettings]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityGetPrivileges { + SecurityGetSettings { transport, - parts, + parts: SecurityGetSettingsParts::None, headers, error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -3388,6 +4591,11 @@ impl<'a, 'b> SecurityGetPrivileges<'a, 'b> { self.human = Some(human); self } + #[doc = "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); @@ -3403,10 +4611,10 @@ impl<'a, 'b> SecurityGetPrivileges<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get Privileges API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3417,6 +4625,7 @@ impl<'a, 'b> SecurityGetPrivileges<'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>, } @@ -3424,6 +4633,7 @@ impl<'a, 'b> SecurityGetPrivileges<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -3438,35 +4648,25 @@ impl<'a, 'b> SecurityGetPrivileges<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Role API"] -pub enum SecurityGetRoleParts<'b> { - #[doc = "Name"] - Name(&'b [&'b str]), +#[doc = "API parts for the Security Get Token API"] +pub enum SecurityGetTokenParts { #[doc = "No parts"] None, } -impl<'b> SecurityGetRoleParts<'b> { - #[doc = "Builds a relative URL path to the Security Get Role API"] +impl SecurityGetTokenParts { + #[doc = "Builds a relative URL path to the Security Get Token API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetRoleParts::Name(ref name) => { - let name_str = name.join(","); - let encoded_name: Cow = - percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_name.len()); - p.push_str("/_security/role/"); - p.push_str(encoded_name.as_ref()); - p.into() - } - SecurityGetRoleParts::None => "/_security/role".into(), + SecurityGetTokenParts::None => "/_security/oauth2/token".into(), } } } -#[doc = "Builder for the [Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-role.html)\n\nRetrieves roles in the native realm."] +#[doc = "Builder for the [Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] #[derive(Clone, Debug)] -pub struct SecurityGetRole<'a, 'b> { +pub struct SecurityGetToken<'a, 'b, B> { transport: &'a Transport, - parts: SecurityGetRoleParts<'b>, + parts: SecurityGetTokenParts, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -3475,14 +4675,18 @@ pub struct SecurityGetRole<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityGetRole<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetRole] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityGetRoleParts<'b>) -> Self { +impl<'a, 'b, B> SecurityGetToken<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityGetToken]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityGetRole { + SecurityGetToken { transport, - parts, + parts: SecurityGetTokenParts::None, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -3491,6 +4695,24 @@ impl<'a, 'b> SecurityGetRole<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityGetToken<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityGetToken { + 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); @@ -3526,10 +4748,10 @@ impl<'a, 'b> SecurityGetRole<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get Role API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get Token API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3552,7 +4774,7 @@ impl<'a, 'b> SecurityGetRole<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -3561,35 +4783,35 @@ impl<'a, 'b> SecurityGetRole<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Role Mapping API"] -pub enum SecurityGetRoleMappingParts<'b> { - #[doc = "Name"] - Name(&'b [&'b str]), +#[doc = "API parts for the Security Get User API"] +pub enum SecurityGetUserParts<'b> { + #[doc = "Username"] + Username(&'b [&'b str]), #[doc = "No parts"] None, } -impl<'b> SecurityGetRoleMappingParts<'b> { - #[doc = "Builds a relative URL path to the Security Get Role Mapping API"] +impl<'b> SecurityGetUserParts<'b> { + #[doc = "Builds a relative URL path to the Security Get User API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetRoleMappingParts::Name(ref name) => { - let name_str = name.join(","); - let encoded_name: Cow = - percent_encode(name_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(24usize + encoded_name.len()); - p.push_str("/_security/role_mapping/"); - p.push_str(encoded_name.as_ref()); + SecurityGetUserParts::Username(ref username) => { + let username_str = username.join(","); + let encoded_username: Cow = + percent_encode(username_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_username.len()); + p.push_str("/_security/user/"); + p.push_str(encoded_username.as_ref()); p.into() } - SecurityGetRoleMappingParts::None => "/_security/role_mapping".into(), + SecurityGetUserParts::None => "/_security/user".into(), } } } -#[doc = "Builder for the [Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] +#[doc = "Builder for the [Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] #[derive(Clone, Debug)] -pub struct SecurityGetRoleMapping<'a, 'b> { +pub struct SecurityGetUser<'a, 'b> { transport: &'a Transport, - parts: SecurityGetRoleMappingParts<'b>, + parts: SecurityGetUserParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -3597,12 +4819,13 @@ pub struct SecurityGetRoleMapping<'a, 'b> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + with_profile_uid: Option, } -impl<'a, 'b> SecurityGetRoleMapping<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetRoleMapping] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityGetRoleMappingParts<'b>) -> Self { +impl<'a, 'b> SecurityGetUser<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetUser] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityGetUserParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityGetRoleMapping { + SecurityGetUser { transport, parts, headers, @@ -3612,6 +4835,7 @@ impl<'a, 'b> SecurityGetRoleMapping<'a, 'b> { pretty: None, request_timeout: None, source: None, + with_profile_uid: None, } } #[doc = "Include the stack trace of returned errors."] @@ -3649,10 +4873,15 @@ impl<'a, 'b> SecurityGetRoleMapping<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get Role Mapping API that can be awaited"] + #[doc = "flag to retrieve profile uid (if exists) associated to the user"] + pub fn with_profile_uid(mut self, with_profile_uid: bool) -> Self { + self.with_profile_uid = Some(with_profile_uid); + self + } + #[doc = "Creates an asynchronous call to the Security Get User API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3665,6 +4894,7 @@ impl<'a, 'b> SecurityGetRoleMapping<'a, 'b> { human: Option, pretty: Option, source: Option<&'b str>, + with_profile_uid: Option, } let query_params = QueryParams { error_trace: self.error_trace, @@ -3672,6 +4902,7 @@ impl<'a, 'b> SecurityGetRoleMapping<'a, 'b> { human: self.human, pretty: self.pretty, source: self.source, + with_profile_uid: self.with_profile_uid, }; Some(query_params) }; @@ -3684,50 +4915,24 @@ impl<'a, 'b> SecurityGetRoleMapping<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Service Accounts API"] -pub enum SecurityGetServiceAccountsParts<'b> { - #[doc = "Namespace and Service"] - NamespaceService(&'b str, &'b str), - #[doc = "Namespace"] - Namespace(&'b str), +#[doc = "API parts for the Security Get User Privileges API"] +pub enum SecurityGetUserPrivilegesParts { #[doc = "No parts"] None, } -impl<'b> SecurityGetServiceAccountsParts<'b> { - #[doc = "Builds a relative URL path to the Security Get Service Accounts API"] +impl SecurityGetUserPrivilegesParts { + #[doc = "Builds a relative URL path to the Security Get User Privileges API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetServiceAccountsParts::NamespaceService(ref namespace, ref service) => { - let encoded_namespace: Cow = - percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); - let encoded_service: Cow = - percent_encode(service.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 20usize + encoded_namespace.len() + encoded_service.len(), - ); - p.push_str("/_security/service/"); - p.push_str(encoded_namespace.as_ref()); - p.push_str("/"); - p.push_str(encoded_service.as_ref()); - p.into() - } - SecurityGetServiceAccountsParts::Namespace(ref namespace) => { - let encoded_namespace: Cow = - percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_namespace.len()); - p.push_str("/_security/service/"); - p.push_str(encoded_namespace.as_ref()); - p.into() - } - SecurityGetServiceAccountsParts::None => "/_security/service".into(), + SecurityGetUserPrivilegesParts::None => "/_security/user/_privileges".into(), } } } -#[doc = "Builder for the [Security Get Service Accounts API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-service-accounts.html)\n\nRetrieves information about service accounts."] +#[doc = "Builder for the [Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-user-privileges.html)\n\nRetrieves security privileges for the logged in user."] #[derive(Clone, Debug)] -pub struct SecurityGetServiceAccounts<'a, 'b> { +pub struct SecurityGetUserPrivileges<'a, 'b> { transport: &'a Transport, - parts: SecurityGetServiceAccountsParts<'b>, + parts: SecurityGetUserPrivilegesParts, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -3736,13 +4941,13 @@ pub struct SecurityGetServiceAccounts<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityGetServiceAccounts<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetServiceAccounts] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityGetServiceAccountsParts<'b>) -> Self { +impl<'a, 'b> SecurityGetUserPrivileges<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetUserPrivileges]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityGetServiceAccounts { + SecurityGetUserPrivileges { transport, - parts, + parts: SecurityGetUserPrivilegesParts::None, headers, error_trace: None, filter_path: None, @@ -3787,10 +4992,10 @@ impl<'a, 'b> SecurityGetServiceAccounts<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get Service Accounts API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get User Privileges API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -3822,38 +5027,33 @@ impl<'a, 'b> SecurityGetServiceAccounts<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Service Credentials API"] -pub enum SecurityGetServiceCredentialsParts<'b> { - #[doc = "Namespace and Service"] - NamespaceService(&'b str, &'b str), +#[doc = "API parts for the Security Get User Profile API"] +pub enum SecurityGetUserProfileParts<'b> { + #[doc = "Uid"] + Uid(&'b [&'b str]), } -impl<'b> SecurityGetServiceCredentialsParts<'b> { - #[doc = "Builds a relative URL path to the Security Get Service Credentials API"] +impl<'b> SecurityGetUserProfileParts<'b> { + #[doc = "Builds a relative URL path to the Security Get User Profile API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetServiceCredentialsParts::NamespaceService(ref namespace, ref service) => { - let encoded_namespace: Cow = - percent_encode(namespace.as_bytes(), PARTS_ENCODED).into(); - let encoded_service: Cow = - percent_encode(service.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity( - 31usize + encoded_namespace.len() + encoded_service.len(), - ); - p.push_str("/_security/service/"); - p.push_str(encoded_namespace.as_ref()); - p.push_str("/"); - p.push_str(encoded_service.as_ref()); - p.push_str("/credential"); + SecurityGetUserProfileParts::Uid(ref uid) => { + let uid_str = uid.join(","); + let encoded_uid: Cow = + percent_encode(uid_str.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(19usize + encoded_uid.len()); + p.push_str("/_security/profile/"); + p.push_str(encoded_uid.as_ref()); p.into() } } } } -#[doc = "Builder for the [Security Get Service Credentials API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-service-credentials.html)\n\nRetrieves information of all service credentials for a service account."] +#[doc = "Builder for the [Security Get User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-user-profile.html)\n\nRetrieves user profiles for the given unique ID(s)."] #[derive(Clone, Debug)] -pub struct SecurityGetServiceCredentials<'a, 'b> { +pub struct SecurityGetUserProfile<'a, 'b> { transport: &'a Transport, - parts: SecurityGetServiceCredentialsParts<'b>, + parts: SecurityGetUserProfileParts<'b>, + data: Option<&'b [&'b str]>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -3862,14 +5062,15 @@ pub struct SecurityGetServiceCredentials<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityGetServiceCredentials<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetServiceCredentials] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityGetServiceCredentialsParts<'b>) -> Self { +impl<'a, 'b> SecurityGetUserProfile<'a, 'b> { + #[doc = "Creates a new instance of [SecurityGetUserProfile] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityGetUserProfileParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityGetServiceCredentials { + SecurityGetUserProfile { transport, parts, headers, + data: None, error_trace: None, filter_path: None, human: None, @@ -3878,6 +5079,11 @@ impl<'a, 'b> SecurityGetServiceCredentials<'a, 'b> { source: None, } } + #[doc = "A comma-separated list of keys for which the corresponding application data are retrieved."] + pub fn data(mut self, data: &'b [&'b str]) -> Self { + self.data = Some(data); + 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); @@ -3913,16 +5119,18 @@ impl<'a, 'b> SecurityGetServiceCredentials<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get Service Credentials API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Get User Profile API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + 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> { + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + data: Option<&'b [&'b str]>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -3931,6 +5139,7 @@ impl<'a, 'b> SecurityGetServiceCredentials<'a, 'b> { source: Option<&'b str>, } let query_params = QueryParams { + data: self.data, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, @@ -3948,59 +5157,61 @@ impl<'a, 'b> SecurityGetServiceCredentials<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get Token API"] -pub enum SecurityGetTokenParts { +#[doc = "API parts for the Security Grant Api Key API"] +pub enum SecurityGrantApiKeyParts { #[doc = "No parts"] None, } -impl SecurityGetTokenParts { - #[doc = "Builds a relative URL path to the Security Get Token API"] +impl SecurityGrantApiKeyParts { + #[doc = "Builds a relative URL path to the Security Grant Api Key API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetTokenParts::None => "/_security/oauth2/token".into(), + SecurityGrantApiKeyParts::None => "/_security/api_key/grant".into(), } } } -#[doc = "Builder for the [Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] +#[doc = "Builder for the [Security Grant Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-grant-api-key.html)\n\nCreates an API key on behalf of another user."] #[derive(Clone, Debug)] -pub struct SecurityGetToken<'a, 'b, B> { +pub struct SecurityGrantApiKey<'a, 'b, B> { transport: &'a Transport, - parts: SecurityGetTokenParts, + parts: SecurityGrantApiKeyParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, + refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityGetToken<'a, 'b, B> +impl<'a, 'b, B> SecurityGrantApiKey<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityGetToken]"] + #[doc = "Creates a new instance of [SecurityGrantApiKey]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityGetToken { + SecurityGrantApiKey { transport, - parts: SecurityGetTokenParts::None, + parts: SecurityGrantApiKeyParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, + refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityGetToken<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityGrantApiKey<'a, 'b, JsonBody> where T: Serialize, { - SecurityGetToken { + SecurityGrantApiKey { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4009,6 +5220,7 @@ where headers: self.headers, human: self.human, pretty: self.pretty, + refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -4038,6 +5250,11 @@ where self.pretty = Some(pretty); self } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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); @@ -4048,10 +5265,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get Token API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Grant Api Key API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4063,6 +5280,7 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, + refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -4070,6 +5288,7 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, + refresh: self.refresh, source: self.source, }; Some(query_params) @@ -4083,35 +5302,35 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get User API"] -pub enum SecurityGetUserParts<'b> { - #[doc = "Username"] - Username(&'b [&'b str]), +#[doc = "API parts for the Security Has Privileges API"] +pub enum SecurityHasPrivilegesParts<'b> { #[doc = "No parts"] None, + #[doc = "User"] + User(&'b str), } -impl<'b> SecurityGetUserParts<'b> { - #[doc = "Builds a relative URL path to the Security Get User API"] +impl<'b> SecurityHasPrivilegesParts<'b> { + #[doc = "Builds a relative URL path to the Security Has Privileges API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetUserParts::Username(ref username) => { - let username_str = username.join(","); - let encoded_username: Cow = - percent_encode(username_str.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_username.len()); + SecurityHasPrivilegesParts::None => "/_security/user/_has_privileges".into(), + SecurityHasPrivilegesParts::User(ref user) => { + let encoded_user: Cow = percent_encode(user.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(32usize + encoded_user.len()); p.push_str("/_security/user/"); - p.push_str(encoded_username.as_ref()); + p.push_str(encoded_user.as_ref()); + p.push_str("/_has_privileges"); p.into() } - SecurityGetUserParts::None => "/_security/user".into(), } } } -#[doc = "Builder for the [Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] +#[doc = "Builder for the [Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] #[derive(Clone, Debug)] -pub struct SecurityGetUser<'a, 'b> { +pub struct SecurityHasPrivileges<'a, 'b, B> { transport: &'a Transport, - parts: SecurityGetUserParts<'b>, + parts: SecurityHasPrivilegesParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -4120,14 +5339,18 @@ pub struct SecurityGetUser<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityGetUser<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetUser] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityGetUserParts<'b>) -> Self { +impl<'a, 'b, B> SecurityHasPrivileges<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityHasPrivileges] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityHasPrivilegesParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityGetUser { + SecurityHasPrivileges { transport, parts, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -4136,6 +5359,24 @@ impl<'a, 'b> SecurityGetUser<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityHasPrivileges<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityHasPrivileges { + 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); @@ -4171,10 +5412,13 @@ impl<'a, 'b> SecurityGetUser<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get User API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Has Privileges API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = match self.body { + Some(_) => http::Method::Post, + None => http::Method::Get, + }; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4197,7 +5441,7 @@ impl<'a, 'b> SecurityGetUser<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -4206,24 +5450,27 @@ impl<'a, 'b> SecurityGetUser<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get User Privileges API"] -pub enum SecurityGetUserPrivilegesParts { +#[doc = "API parts for the Security Has Privileges User Profile API"] +pub enum SecurityHasPrivilegesUserProfileParts { #[doc = "No parts"] None, } -impl SecurityGetUserPrivilegesParts { - #[doc = "Builds a relative URL path to the Security Get User Privileges API"] +impl SecurityHasPrivilegesUserProfileParts { + #[doc = "Builds a relative URL path to the Security Has Privileges User Profile API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetUserPrivilegesParts::None => "/_security/user/_privileges".into(), + SecurityHasPrivilegesUserProfileParts::None => { + "/_security/profile/_has_privileges".into() + } } } } -#[doc = "Builder for the [Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-user-privileges.html)\n\nRetrieves security privileges for the logged in user."] +#[doc = "Builder for the [Security Has Privileges User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-has-privileges-user-profile.html)\n\nDetermines whether the users associated with the specified profile IDs have all the requested privileges."] #[derive(Clone, Debug)] -pub struct SecurityGetUserPrivileges<'a, 'b> { +pub struct SecurityHasPrivilegesUserProfile<'a, 'b, B> { transport: &'a Transport, - parts: SecurityGetUserPrivilegesParts, + parts: SecurityHasPrivilegesUserProfileParts, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -4232,14 +5479,18 @@ pub struct SecurityGetUserPrivileges<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecurityGetUserPrivileges<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetUserPrivileges]"] +impl<'a, 'b, B> SecurityHasPrivilegesUserProfile<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityHasPrivilegesUserProfile]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityGetUserPrivileges { + SecurityHasPrivilegesUserProfile { transport, - parts: SecurityGetUserPrivilegesParts::None, + parts: SecurityHasPrivilegesUserProfileParts::None, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -4248,6 +5499,24 @@ impl<'a, 'b> SecurityGetUserPrivileges<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityHasPrivilegesUserProfile<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityHasPrivilegesUserProfile { + 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); @@ -4283,10 +5552,13 @@ impl<'a, 'b> SecurityGetUserPrivileges<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get User Privileges API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Has Privileges User Profile API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = match self.body { + Some(_) => http::Method::Post, + None => http::Method::Get, + }; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4309,7 +5581,7 @@ impl<'a, 'b> SecurityGetUserPrivileges<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -4317,36 +5589,26 @@ impl<'a, 'b> SecurityGetUserPrivileges<'a, 'b> { Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Get User Profile API"] -pub enum SecurityGetUserProfileParts<'b> { - #[doc = "Uid"] - Uid(&'b str), +#[doc = "API parts for the Security Invalidate Api Key API"] +pub enum SecurityInvalidateApiKeyParts { + #[doc = "No parts"] + None, } -#[cfg(feature = "experimental-apis")] -impl<'b> SecurityGetUserProfileParts<'b> { - #[doc = "Builds a relative URL path to the Security Get User Profile API"] +impl SecurityInvalidateApiKeyParts { + #[doc = "Builds a relative URL path to the Security Invalidate Api Key API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGetUserProfileParts::Uid(ref uid) => { - let encoded_uid: Cow = percent_encode(uid.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_uid.len()); - p.push_str("/_security/profile/"); - p.push_str(encoded_uid.as_ref()); - p.into() - } + SecurityInvalidateApiKeyParts::None => "/_security/api_key".into(), } } } -#[doc = "Builder for the [Security Get User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-user-profile.html)\n\nRetrieves user profile for the given unique ID."] -#[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")] +#[doc = "Builder for the [Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] #[derive(Clone, Debug)] -pub struct SecurityGetUserProfile<'a, 'b> { +pub struct SecurityInvalidateApiKey<'a, 'b, B> { transport: &'a Transport, - parts: SecurityGetUserProfileParts<'b>, - data: Option<&'b [&'b str]>, + parts: SecurityInvalidateApiKeyParts, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -4355,16 +5617,18 @@ pub struct SecurityGetUserProfile<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] -impl<'a, 'b> SecurityGetUserProfile<'a, 'b> { - #[doc = "Creates a new instance of [SecurityGetUserProfile] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityGetUserProfileParts<'b>) -> Self { +impl<'a, 'b, B> SecurityInvalidateApiKey<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityInvalidateApiKey]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityGetUserProfile { + SecurityInvalidateApiKey { transport, - parts, + parts: SecurityInvalidateApiKeyParts::None, headers, - data: None, + body: None, error_trace: None, filter_path: None, human: None, @@ -4373,10 +5637,23 @@ impl<'a, 'b> SecurityGetUserProfile<'a, 'b> { source: None, } } - #[doc = "A comma-separated list of keys for which the corresponding application data are retrieved."] - pub fn data(mut self, data: &'b [&'b str]) -> Self { - self.data = Some(data); - self + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityInvalidateApiKey<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityInvalidateApiKey { + 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 { @@ -4413,18 +5690,16 @@ impl<'a, 'b> SecurityGetUserProfile<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Get User Profile API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Invalidate Api Key API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + 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> { - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - data: Option<&'b [&'b str]>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -4433,7 +5708,6 @@ impl<'a, 'b> SecurityGetUserProfile<'a, 'b> { source: Option<&'b str>, } let query_params = QueryParams { - data: self.data, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, @@ -4442,7 +5716,7 @@ impl<'a, 'b> SecurityGetUserProfile<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -4451,61 +5725,59 @@ impl<'a, 'b> SecurityGetUserProfile<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Grant Api Key API"] -pub enum SecurityGrantApiKeyParts { +#[doc = "API parts for the Security Invalidate Token API"] +pub enum SecurityInvalidateTokenParts { #[doc = "No parts"] None, } -impl SecurityGrantApiKeyParts { - #[doc = "Builds a relative URL path to the Security Grant Api Key API"] +impl SecurityInvalidateTokenParts { + #[doc = "Builds a relative URL path to the Security Invalidate Token API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityGrantApiKeyParts::None => "/_security/api_key/grant".into(), + SecurityInvalidateTokenParts::None => "/_security/oauth2/token".into(), } } } -#[doc = "Builder for the [Security Grant Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-grant-api-key.html)\n\nCreates an API key on behalf of another user."] +#[doc = "Builder for the [Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] #[derive(Clone, Debug)] -pub struct SecurityGrantApiKey<'a, 'b, B> { +pub struct SecurityInvalidateToken<'a, 'b, B> { transport: &'a Transport, - parts: SecurityGrantApiKeyParts, + parts: SecurityInvalidateTokenParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityGrantApiKey<'a, 'b, B> +impl<'a, 'b, B> SecurityInvalidateToken<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityGrantApiKey]"] + #[doc = "Creates a new instance of [SecurityInvalidateToken]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityGrantApiKey { + SecurityInvalidateToken { transport, - parts: SecurityGrantApiKeyParts::None, + parts: SecurityInvalidateTokenParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityGrantApiKey<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityInvalidateToken<'a, 'b, JsonBody> where T: Serialize, { - SecurityGrantApiKey { + SecurityInvalidateToken { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4514,7 +5786,6 @@ where headers: self.headers, human: self.human, pretty: self.pretty, - refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -4544,11 +5815,6 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -4559,10 +5825,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Grant Api Key API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Invalidate Token API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4574,7 +5840,6 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -4582,7 +5847,6 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, }; Some(query_params) @@ -4596,34 +5860,24 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Has Privileges API"] -pub enum SecurityHasPrivilegesParts<'b> { +#[doc = "API parts for the Security Oidc Authenticate API"] +pub enum SecurityOidcAuthenticateParts { #[doc = "No parts"] None, - #[doc = "User"] - User(&'b str), } -impl<'b> SecurityHasPrivilegesParts<'b> { - #[doc = "Builds a relative URL path to the Security Has Privileges API"] +impl SecurityOidcAuthenticateParts { + #[doc = "Builds a relative URL path to the Security Oidc Authenticate API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityHasPrivilegesParts::None => "/_security/user/_has_privileges".into(), - SecurityHasPrivilegesParts::User(ref user) => { - let encoded_user: Cow = percent_encode(user.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(32usize + encoded_user.len()); - p.push_str("/_security/user/"); - p.push_str(encoded_user.as_ref()); - p.push_str("/_has_privileges"); - p.into() - } + SecurityOidcAuthenticateParts::None => "/_security/oidc/authenticate".into(), } } } -#[doc = "Builder for the [Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] +#[doc = "Builder for the [Security Oidc Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-oidc-authenticate.html)\n\nExchanges an OpenID Connection authentication response message for an Elasticsearch access token and refresh token pair"] #[derive(Clone, Debug)] -pub struct SecurityHasPrivileges<'a, 'b, B> { +pub struct SecurityOidcAuthenticate<'a, 'b, B> { transport: &'a Transport, - parts: SecurityHasPrivilegesParts<'b>, + parts: SecurityOidcAuthenticateParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -4633,16 +5887,16 @@ pub struct SecurityHasPrivileges<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityHasPrivileges<'a, 'b, B> +impl<'a, 'b, B> SecurityOidcAuthenticate<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityHasPrivileges] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityHasPrivilegesParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityOidcAuthenticate]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityHasPrivileges { + SecurityOidcAuthenticate { transport, - parts, + parts: SecurityOidcAuthenticateParts::None, headers, body: None, error_trace: None, @@ -4654,11 +5908,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityHasPrivileges<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityOidcAuthenticate<'a, 'b, JsonBody> where T: Serialize, { - SecurityHasPrivileges { + SecurityOidcAuthenticate { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4706,13 +5960,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Has Privileges API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Oidc Authenticate API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4743,31 +5994,25 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Has Privileges User Profile API"] -pub enum SecurityHasPrivilegesUserProfileParts { +#[doc = "API parts for the Security Oidc Logout API"] +pub enum SecurityOidcLogoutParts { #[doc = "No parts"] None, } -#[cfg(feature = "experimental-apis")] -impl SecurityHasPrivilegesUserProfileParts { - #[doc = "Builds a relative URL path to the Security Has Privileges User Profile API"] +impl SecurityOidcLogoutParts { + #[doc = "Builds a relative URL path to the Security Oidc Logout API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityHasPrivilegesUserProfileParts::None => { - "/_security/profile/_has_privileges".into() - } + SecurityOidcLogoutParts::None => "/_security/oidc/logout".into(), } } } -#[doc = "Builder for the [Security Has Privileges User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-has-privileges-user-profile.html)\n\nDetermines whether the users associated with the specified profile IDs have all the requested privileges."] -#[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")] +#[doc = "Builder for the [Security Oidc Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-oidc-logout.html)\n\nInvalidates a refresh token and access token that was generated from the OpenID Connect Authenticate API"] #[derive(Clone, Debug)] -pub struct SecurityHasPrivilegesUserProfile<'a, 'b, B> { +pub struct SecurityOidcLogout<'a, 'b, B> { transport: &'a Transport, - parts: SecurityHasPrivilegesUserProfileParts, + parts: SecurityOidcLogoutParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -4777,17 +6022,16 @@ pub struct SecurityHasPrivilegesUserProfile<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] -impl<'a, 'b, B> SecurityHasPrivilegesUserProfile<'a, 'b, B> +impl<'a, 'b, B> SecurityOidcLogout<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityHasPrivilegesUserProfile]"] + #[doc = "Creates a new instance of [SecurityOidcLogout]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityHasPrivilegesUserProfile { + SecurityOidcLogout { transport, - parts: SecurityHasPrivilegesUserProfileParts::None, + parts: SecurityOidcLogoutParts::None, headers, body: None, error_trace: None, @@ -4799,11 +6043,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityHasPrivilegesUserProfile<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityOidcLogout<'a, 'b, JsonBody> where T: Serialize, { - SecurityHasPrivilegesUserProfile { + SecurityOidcLogout { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4851,13 +6095,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Has Privileges User Profile API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Oidc Logout API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -4889,24 +6130,24 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Invalidate Api Key API"] -pub enum SecurityInvalidateApiKeyParts { +#[doc = "API parts for the Security Oidc Prepare Authentication API"] +pub enum SecurityOidcPrepareAuthenticationParts { #[doc = "No parts"] None, } -impl SecurityInvalidateApiKeyParts { - #[doc = "Builds a relative URL path to the Security Invalidate Api Key API"] +impl SecurityOidcPrepareAuthenticationParts { + #[doc = "Builds a relative URL path to the Security Oidc Prepare Authentication API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityInvalidateApiKeyParts::None => "/_security/api_key".into(), + SecurityOidcPrepareAuthenticationParts::None => "/_security/oidc/prepare".into(), } } } -#[doc = "Builder for the [Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] +#[doc = "Builder for the [Security Oidc Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-oidc-prepare-authentication.html)\n\nCreates an OAuth 2.0 authentication request as a URL string"] #[derive(Clone, Debug)] -pub struct SecurityInvalidateApiKey<'a, 'b, B> { +pub struct SecurityOidcPrepareAuthentication<'a, 'b, B> { transport: &'a Transport, - parts: SecurityInvalidateApiKeyParts, + parts: SecurityOidcPrepareAuthenticationParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -4916,16 +6157,16 @@ pub struct SecurityInvalidateApiKey<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityInvalidateApiKey<'a, 'b, B> +impl<'a, 'b, B> SecurityOidcPrepareAuthentication<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityInvalidateApiKey]"] + #[doc = "Creates a new instance of [SecurityOidcPrepareAuthentication]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityInvalidateApiKey { + SecurityOidcPrepareAuthentication { transport, - parts: SecurityInvalidateApiKeyParts::None, + parts: SecurityOidcPrepareAuthenticationParts::None, headers, body: None, error_trace: None, @@ -4937,11 +6178,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityInvalidateApiKey<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityOidcPrepareAuthentication<'a, 'b, JsonBody> where T: Serialize, { - SecurityInvalidateApiKey { + SecurityOidcPrepareAuthentication { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -4989,10 +6230,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Invalidate Api Key API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Oidc Prepare Authentication API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5024,59 +6265,61 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Invalidate Token API"] -pub enum SecurityInvalidateTokenParts { +#[doc = "API parts for the Security Put Privileges API"] +pub enum SecurityPutPrivilegesParts { #[doc = "No parts"] None, } -impl SecurityInvalidateTokenParts { - #[doc = "Builds a relative URL path to the Security Invalidate Token API"] +impl SecurityPutPrivilegesParts { + #[doc = "Builds a relative URL path to the Security Put Privileges API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityInvalidateTokenParts::None => "/_security/oauth2/token".into(), + SecurityPutPrivilegesParts::None => "/_security/privilege".into(), } } } -#[doc = "Builder for the [Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] +#[doc = "Builder for the [Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-privileges.html)\n\nAdds or updates application privileges."] #[derive(Clone, Debug)] -pub struct SecurityInvalidateToken<'a, 'b, B> { +pub struct SecurityPutPrivileges<'a, 'b, B> { transport: &'a Transport, - parts: SecurityInvalidateTokenParts, + parts: SecurityPutPrivilegesParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, + refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityInvalidateToken<'a, 'b, B> +impl<'a, 'b, B> SecurityPutPrivileges<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityInvalidateToken]"] + #[doc = "Creates a new instance of [SecurityPutPrivileges]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityInvalidateToken { + SecurityPutPrivileges { transport, - parts: SecurityInvalidateTokenParts::None, + parts: SecurityPutPrivilegesParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, + refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityInvalidateToken<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityPutPrivileges<'a, 'b, JsonBody> where T: Serialize, { - SecurityInvalidateToken { + SecurityPutPrivileges { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5085,6 +6328,7 @@ where headers: self.headers, human: self.human, pretty: self.pretty, + refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -5114,6 +6358,11 @@ where self.pretty = Some(pretty); self } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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); @@ -5124,10 +6373,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Invalidate Token API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Put Privileges API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5139,6 +6388,7 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, + refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -5146,6 +6396,7 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, + refresh: self.refresh, source: self.source, }; Some(query_params) @@ -5159,59 +6410,67 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Oidc Authenticate API"] -pub enum SecurityOidcAuthenticateParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Put Role API"] +pub enum SecurityPutRoleParts<'b> { + #[doc = "Name"] + Name(&'b str), } -impl SecurityOidcAuthenticateParts { - #[doc = "Builds a relative URL path to the Security Oidc Authenticate API"] +impl<'b> SecurityPutRoleParts<'b> { + #[doc = "Builds a relative URL path to the Security Put Role API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityOidcAuthenticateParts::None => "/_security/oidc/authenticate".into(), + SecurityPutRoleParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_name.len()); + p.push_str("/_security/role/"); + p.push_str(encoded_name.as_ref()); + p.into() + } } } } -#[doc = "Builder for the [Security Oidc Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-oidc-authenticate.html)\n\nExchanges an OpenID Connection authentication response message for an Elasticsearch access token and refresh token pair"] +#[doc = "Builder for the [Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] #[derive(Clone, Debug)] -pub struct SecurityOidcAuthenticate<'a, 'b, B> { +pub struct SecurityPutRole<'a, 'b, B> { transport: &'a Transport, - parts: SecurityOidcAuthenticateParts, + parts: SecurityPutRoleParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, + refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityOidcAuthenticate<'a, 'b, B> +impl<'a, 'b, B> SecurityPutRole<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityOidcAuthenticate]"] - pub fn new(transport: &'a Transport) -> Self { + #[doc = "Creates a new instance of [SecurityPutRole] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityPutRoleParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityOidcAuthenticate { + SecurityPutRole { transport, - parts: SecurityOidcAuthenticateParts::None, + parts, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, + refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityOidcAuthenticate<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityPutRole<'a, 'b, JsonBody> where T: Serialize, { - SecurityOidcAuthenticate { + SecurityPutRole { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5220,6 +6479,7 @@ where headers: self.headers, human: self.human, pretty: self.pretty, + refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -5249,6 +6509,11 @@ where self.pretty = Some(pretty); self } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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); @@ -5259,10 +6524,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Oidc Authenticate API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Put Role API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5274,6 +6539,7 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, + refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -5281,6 +6547,7 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, + refresh: self.refresh, source: self.source, }; Some(query_params) @@ -5294,59 +6561,67 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Oidc Logout API"] -pub enum SecurityOidcLogoutParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Put Role Mapping API"] +pub enum SecurityPutRoleMappingParts<'b> { + #[doc = "Name"] + Name(&'b str), } -impl SecurityOidcLogoutParts { - #[doc = "Builds a relative URL path to the Security Oidc Logout API"] +impl<'b> SecurityPutRoleMappingParts<'b> { + #[doc = "Builds a relative URL path to the Security Put Role Mapping API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityOidcLogoutParts::None => "/_security/oidc/logout".into(), + SecurityPutRoleMappingParts::Name(ref name) => { + let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(24usize + encoded_name.len()); + p.push_str("/_security/role_mapping/"); + p.push_str(encoded_name.as_ref()); + p.into() + } } } } -#[doc = "Builder for the [Security Oidc Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-oidc-logout.html)\n\nInvalidates a refresh token and access token that was generated from the OpenID Connect Authenticate API"] +#[doc = "Builder for the [Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] #[derive(Clone, Debug)] -pub struct SecurityOidcLogout<'a, 'b, B> { +pub struct SecurityPutRoleMapping<'a, 'b, B> { transport: &'a Transport, - parts: SecurityOidcLogoutParts, + parts: SecurityPutRoleMappingParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, + refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityOidcLogout<'a, 'b, B> +impl<'a, 'b, B> SecurityPutRoleMapping<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityOidcLogout]"] - pub fn new(transport: &'a Transport) -> Self { + #[doc = "Creates a new instance of [SecurityPutRoleMapping] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityPutRoleMappingParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityOidcLogout { + SecurityPutRoleMapping { transport, - parts: SecurityOidcLogoutParts::None, + parts, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, + refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityOidcLogout<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityPutRoleMapping<'a, 'b, JsonBody> where T: Serialize, { - SecurityOidcLogout { + SecurityPutRoleMapping { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5355,6 +6630,7 @@ where headers: self.headers, human: self.human, pretty: self.pretty, + refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -5384,6 +6660,11 @@ where self.pretty = Some(pretty); self } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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); @@ -5394,10 +6675,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Oidc Logout API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Put Role Mapping API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5409,6 +6690,7 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, + refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -5416,6 +6698,7 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, + refresh: self.refresh, source: self.source, }; Some(query_params) @@ -5429,59 +6712,68 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Oidc Prepare Authentication API"] -pub enum SecurityOidcPrepareAuthenticationParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Put User API"] +pub enum SecurityPutUserParts<'b> { + #[doc = "Username"] + Username(&'b str), } -impl SecurityOidcPrepareAuthenticationParts { - #[doc = "Builds a relative URL path to the Security Oidc Prepare Authentication API"] +impl<'b> SecurityPutUserParts<'b> { + #[doc = "Builds a relative URL path to the Security Put User API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityOidcPrepareAuthenticationParts::None => "/_security/oidc/prepare".into(), + SecurityPutUserParts::Username(ref username) => { + let encoded_username: Cow = + percent_encode(username.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(16usize + encoded_username.len()); + p.push_str("/_security/user/"); + p.push_str(encoded_username.as_ref()); + p.into() + } } } } -#[doc = "Builder for the [Security Oidc Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-oidc-prepare-authentication.html)\n\nCreates an OAuth 2.0 authentication request as a URL string"] +#[doc = "Builder for the [Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] #[derive(Clone, Debug)] -pub struct SecurityOidcPrepareAuthentication<'a, 'b, B> { +pub struct SecurityPutUser<'a, 'b, B> { transport: &'a Transport, - parts: SecurityOidcPrepareAuthenticationParts, + parts: SecurityPutUserParts<'b>, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, + refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityOidcPrepareAuthentication<'a, 'b, B> +impl<'a, 'b, B> SecurityPutUser<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityOidcPrepareAuthentication]"] - pub fn new(transport: &'a Transport) -> Self { + #[doc = "Creates a new instance of [SecurityPutUser] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityPutUserParts<'b>) -> Self { let headers = HeaderMap::new(); - SecurityOidcPrepareAuthentication { + SecurityPutUser { transport, - parts: SecurityOidcPrepareAuthenticationParts::None, + parts, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, + refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityOidcPrepareAuthentication<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityPutUser<'a, 'b, JsonBody> where T: Serialize, { - SecurityOidcPrepareAuthentication { + SecurityPutUser { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5490,6 +6782,7 @@ where headers: self.headers, human: self.human, pretty: self.pretty, + refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -5519,6 +6812,11 @@ where self.pretty = Some(pretty); self } + #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] + pub fn refresh(mut self, refresh: Refresh) -> Self { + self.refresh = Some(refresh); + 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); @@ -5529,10 +6827,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Oidc Prepare Authentication API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Put User API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5544,6 +6842,7 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, + refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -5551,6 +6850,7 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, + refresh: self.refresh, source: self.source, }; Some(query_params) @@ -5564,61 +6864,65 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Put Privileges API"] -pub enum SecurityPutPrivilegesParts { +#[doc = "API parts for the Security Query Api Keys API"] +pub enum SecurityQueryApiKeysParts { #[doc = "No parts"] None, } -impl SecurityPutPrivilegesParts { - #[doc = "Builds a relative URL path to the Security Put Privileges API"] +impl SecurityQueryApiKeysParts { + #[doc = "Builds a relative URL path to the Security Query Api Keys API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityPutPrivilegesParts::None => "/_security/privilege/".into(), + SecurityQueryApiKeysParts::None => "/_security/_query/api_key".into(), } } } -#[doc = "Builder for the [Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-privileges.html)\n\nAdds or updates application privileges."] +#[doc = "Builder for the [Security Query Api Keys API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-query-api-key.html)\n\nRetrieves information for API keys using a subset of query DSL"] #[derive(Clone, Debug)] -pub struct SecurityPutPrivileges<'a, 'b, B> { +pub struct SecurityQueryApiKeys<'a, 'b, B> { transport: &'a Transport, - parts: SecurityPutPrivilegesParts, + parts: SecurityQueryApiKeysParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, + typed_keys: Option, + with_limited_by: Option, + with_profile_uid: Option, } -impl<'a, 'b, B> SecurityPutPrivileges<'a, 'b, B> +impl<'a, 'b, B> SecurityQueryApiKeys<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityPutPrivileges]"] + #[doc = "Creates a new instance of [SecurityQueryApiKeys]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityPutPrivileges { + SecurityQueryApiKeys { transport, - parts: SecurityPutPrivilegesParts::None, + parts: SecurityQueryApiKeysParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, + typed_keys: None, + with_limited_by: None, + with_profile_uid: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityPutPrivileges<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityQueryApiKeys<'a, 'b, JsonBody> where T: Serialize, { - SecurityPutPrivileges { + SecurityQueryApiKeys { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5627,9 +6931,11 @@ where headers: self.headers, human: self.human, pretty: self.pretty, - refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, + typed_keys: self.typed_keys, + with_limited_by: self.with_limited_by, + with_profile_uid: self.with_profile_uid, } } #[doc = "Include the stack trace of returned errors."] @@ -5657,11 +6963,6 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -5672,10 +6973,28 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Put Privileges API that can be awaited"] + #[doc = "flag to prefix aggregation names by their respective types in the response"] + pub fn typed_keys(mut self, typed_keys: bool) -> Self { + self.typed_keys = Some(typed_keys); + self + } + #[doc = "flag to show the limited-by role descriptors of API Keys"] + pub fn with_limited_by(mut self, with_limited_by: bool) -> Self { + self.with_limited_by = Some(with_limited_by); + self + } + #[doc = "flag to also retrieve the API Key's owner profile uid, if it exists"] + pub fn with_profile_uid(mut self, with_profile_uid: bool) -> Self { + self.with_profile_uid = Some(with_profile_uid); + self + } + #[doc = "Creates an asynchronous call to the Security Query Api Keys API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = match self.body { + Some(_) => http::Method::Post, + None => http::Method::Get, + }; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5687,16 +7006,20 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, + typed_keys: Option, + with_limited_by: Option, + with_profile_uid: Option, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, + typed_keys: self.typed_keys, + with_limited_by: self.with_limited_by, + with_profile_uid: self.with_profile_uid, }; Some(query_params) }; @@ -5709,67 +7032,59 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Put Role API"] -pub enum SecurityPutRoleParts<'b> { - #[doc = "Name"] - Name(&'b str), +#[doc = "API parts for the Security Query Role API"] +pub enum SecurityQueryRoleParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityPutRoleParts<'b> { - #[doc = "Builds a relative URL path to the Security Put Role API"] +impl SecurityQueryRoleParts { + #[doc = "Builds a relative URL path to the Security Query Role API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityPutRoleParts::Name(ref name) => { - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_name.len()); - p.push_str("/_security/role/"); - p.push_str(encoded_name.as_ref()); - p.into() - } + SecurityQueryRoleParts::None => "/_security/_query/role".into(), } } } -#[doc = "Builder for the [Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] +#[doc = "Builder for the [Security Query Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-query-role.html)\n\nRetrieves information for Roles using a subset of query DSL"] #[derive(Clone, Debug)] -pub struct SecurityPutRole<'a, 'b, B> { +pub struct SecurityQueryRole<'a, 'b, B> { transport: &'a Transport, - parts: SecurityPutRoleParts<'b>, + parts: SecurityQueryRoleParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityPutRole<'a, 'b, B> +impl<'a, 'b, B> SecurityQueryRole<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityPutRole] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityPutRoleParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityQueryRole]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityPutRole { + SecurityQueryRole { transport, - parts, + parts: SecurityQueryRoleParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityPutRole<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityQueryRole<'a, 'b, JsonBody> where T: Serialize, { - SecurityPutRole { + SecurityQueryRole { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5778,7 +7093,6 @@ where headers: self.headers, human: self.human, pretty: self.pretty, - refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -5808,11 +7122,6 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -5823,10 +7132,13 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Put Role API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Query Role API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = match self.body { + Some(_) => http::Method::Post, + None => http::Method::Get, + }; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5838,7 +7150,6 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -5846,7 +7157,6 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, }; Some(query_params) @@ -5860,67 +7170,61 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Put Role Mapping API"] -pub enum SecurityPutRoleMappingParts<'b> { - #[doc = "Name"] - Name(&'b str), +#[doc = "API parts for the Security Query User API"] +pub enum SecurityQueryUserParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityPutRoleMappingParts<'b> { - #[doc = "Builds a relative URL path to the Security Put Role Mapping API"] +impl SecurityQueryUserParts { + #[doc = "Builds a relative URL path to the Security Query User API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityPutRoleMappingParts::Name(ref name) => { - let encoded_name: Cow = percent_encode(name.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(24usize + encoded_name.len()); - p.push_str("/_security/role_mapping/"); - p.push_str(encoded_name.as_ref()); - p.into() - } + SecurityQueryUserParts::None => "/_security/_query/user".into(), } } } -#[doc = "Builder for the [Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] +#[doc = "Builder for the [Security Query User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-query-user.html)\n\nRetrieves information for Users using a subset of query DSL"] #[derive(Clone, Debug)] -pub struct SecurityPutRoleMapping<'a, 'b, B> { +pub struct SecurityQueryUser<'a, 'b, B> { transport: &'a Transport, - parts: SecurityPutRoleMappingParts<'b>, + parts: SecurityQueryUserParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, + with_profile_uid: Option, } -impl<'a, 'b, B> SecurityPutRoleMapping<'a, 'b, B> +impl<'a, 'b, B> SecurityQueryUser<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityPutRoleMapping] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityPutRoleMappingParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityQueryUser]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityPutRoleMapping { + SecurityQueryUser { transport, - parts, + parts: SecurityQueryUserParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, + with_profile_uid: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityPutRoleMapping<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityQueryUser<'a, 'b, JsonBody> where T: Serialize, { - SecurityPutRoleMapping { + SecurityQueryUser { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -5929,9 +7233,9 @@ where headers: self.headers, human: self.human, pretty: self.pretty, - refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, + with_profile_uid: self.with_profile_uid, } } #[doc = "Include the stack trace of returned errors."] @@ -5959,11 +7263,6 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -5974,10 +7273,18 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Put Role Mapping API that can be awaited"] + #[doc = "flag to retrieve profile uid (if exists) associated with the user"] + pub fn with_profile_uid(mut self, with_profile_uid: bool) -> Self { + self.with_profile_uid = Some(with_profile_uid); + self + } + #[doc = "Creates an asynchronous call to the Security Query User API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = match self.body { + Some(_) => http::Method::Post, + None => http::Method::Get, + }; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -5989,16 +7296,16 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, + with_profile_uid: Option, } let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, + with_profile_uid: self.with_profile_uid, }; Some(query_params) }; @@ -6011,68 +7318,59 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Put User API"] -pub enum SecurityPutUserParts<'b> { - #[doc = "Username"] - Username(&'b str), +#[doc = "API parts for the Security Saml Authenticate API"] +pub enum SecuritySamlAuthenticateParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityPutUserParts<'b> { - #[doc = "Builds a relative URL path to the Security Put User API"] +impl SecuritySamlAuthenticateParts { + #[doc = "Builds a relative URL path to the Security Saml Authenticate API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityPutUserParts::Username(ref username) => { - let encoded_username: Cow = - percent_encode(username.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(16usize + encoded_username.len()); - p.push_str("/_security/user/"); - p.push_str(encoded_username.as_ref()); - p.into() - } + SecuritySamlAuthenticateParts::None => "/_security/saml/authenticate".into(), } } } -#[doc = "Builder for the [Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] +#[doc = "Builder for the [Security Saml Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-authenticate.html)\n\nExchanges a SAML Response message for an Elasticsearch access token and refresh token pair"] #[derive(Clone, Debug)] -pub struct SecurityPutUser<'a, 'b, B> { +pub struct SecuritySamlAuthenticate<'a, 'b, B> { transport: &'a Transport, - parts: SecurityPutUserParts<'b>, + parts: SecuritySamlAuthenticateParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, human: Option, pretty: Option, - refresh: Option, request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityPutUser<'a, 'b, B> +impl<'a, 'b, B> SecuritySamlAuthenticate<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityPutUser] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityPutUserParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecuritySamlAuthenticate]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityPutUser { + SecuritySamlAuthenticate { transport, - parts, + parts: SecuritySamlAuthenticateParts::None, headers, body: None, error_trace: None, filter_path: None, human: None, pretty: None, - refresh: None, request_timeout: None, source: None, } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityPutUser<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecuritySamlAuthenticate<'a, 'b, JsonBody> where T: Serialize, { - SecurityPutUser { + SecuritySamlAuthenticate { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -6081,7 +7379,6 @@ where headers: self.headers, human: self.human, pretty: self.pretty, - refresh: self.refresh, request_timeout: self.request_timeout, source: self.source, } @@ -6111,11 +7408,6 @@ where self.pretty = Some(pretty); self } - #[doc = "If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes."] - pub fn refresh(mut self, refresh: Refresh) -> Self { - self.refresh = Some(refresh); - 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); @@ -6126,10 +7418,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Put User API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Saml Authenticate API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6141,7 +7433,6 @@ where filter_path: Option<&'b [&'b str]>, human: Option, pretty: Option, - refresh: Option, source: Option<&'b str>, } let query_params = QueryParams { @@ -6149,7 +7440,6 @@ where filter_path: self.filter_path, human: self.human, pretty: self.pretty, - refresh: self.refresh, source: self.source, }; Some(query_params) @@ -6163,24 +7453,24 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Query Api Keys API"] -pub enum SecurityQueryApiKeysParts { +#[doc = "API parts for the Security Saml Complete Logout API"] +pub enum SecuritySamlCompleteLogoutParts { #[doc = "No parts"] None, } -impl SecurityQueryApiKeysParts { - #[doc = "Builds a relative URL path to the Security Query Api Keys API"] +impl SecuritySamlCompleteLogoutParts { + #[doc = "Builds a relative URL path to the Security Saml Complete Logout API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityQueryApiKeysParts::None => "/_security/_query/api_key".into(), + SecuritySamlCompleteLogoutParts::None => "/_security/saml/complete_logout".into(), } } } -#[doc = "Builder for the [Security Query Api Keys API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-query-api-key.html)\n\nRetrieves information for API keys using a subset of query DSL"] +#[doc = "Builder for the [Security Saml Complete Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-complete-logout.html)\n\nVerifies the logout response sent from the SAML IdP"] #[derive(Clone, Debug)] -pub struct SecurityQueryApiKeys<'a, 'b, B> { +pub struct SecuritySamlCompleteLogout<'a, 'b, B> { transport: &'a Transport, - parts: SecurityQueryApiKeysParts, + parts: SecuritySamlCompleteLogoutParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -6190,16 +7480,16 @@ pub struct SecurityQueryApiKeys<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecurityQueryApiKeys<'a, 'b, B> +impl<'a, 'b, B> SecuritySamlCompleteLogout<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityQueryApiKeys]"] + #[doc = "Creates a new instance of [SecuritySamlCompleteLogout]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityQueryApiKeys { + SecuritySamlCompleteLogout { transport, - parts: SecurityQueryApiKeysParts::None, + parts: SecuritySamlCompleteLogoutParts::None, headers, body: None, error_trace: None, @@ -6211,11 +7501,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecurityQueryApiKeys<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecuritySamlCompleteLogout<'a, 'b, JsonBody> where T: Serialize, { - SecurityQueryApiKeys { + SecuritySamlCompleteLogout { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -6263,13 +7553,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Query Api Keys API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Saml Complete Logout API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6301,24 +7588,24 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Saml Authenticate API"] -pub enum SecuritySamlAuthenticateParts { +#[doc = "API parts for the Security Saml Invalidate API"] +pub enum SecuritySamlInvalidateParts { #[doc = "No parts"] None, } -impl SecuritySamlAuthenticateParts { - #[doc = "Builds a relative URL path to the Security Saml Authenticate API"] +impl SecuritySamlInvalidateParts { + #[doc = "Builds a relative URL path to the Security Saml Invalidate API"] pub fn url(self) -> Cow<'static, str> { match self { - SecuritySamlAuthenticateParts::None => "/_security/saml/authenticate".into(), + SecuritySamlInvalidateParts::None => "/_security/saml/invalidate".into(), } } } -#[doc = "Builder for the [Security Saml Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-authenticate.html)\n\nExchanges a SAML Response message for an Elasticsearch access token and refresh token pair"] +#[doc = "Builder for the [Security Saml Invalidate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-invalidate.html)\n\nConsumes a SAML LogoutRequest"] #[derive(Clone, Debug)] -pub struct SecuritySamlAuthenticate<'a, 'b, B> { +pub struct SecuritySamlInvalidate<'a, 'b, B> { transport: &'a Transport, - parts: SecuritySamlAuthenticateParts, + parts: SecuritySamlInvalidateParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -6328,16 +7615,16 @@ pub struct SecuritySamlAuthenticate<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecuritySamlAuthenticate<'a, 'b, B> +impl<'a, 'b, B> SecuritySamlInvalidate<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecuritySamlAuthenticate]"] + #[doc = "Creates a new instance of [SecuritySamlInvalidate]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecuritySamlAuthenticate { + SecuritySamlInvalidate { transport, - parts: SecuritySamlAuthenticateParts::None, + parts: SecuritySamlInvalidateParts::None, headers, body: None, error_trace: None, @@ -6349,11 +7636,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecuritySamlAuthenticate<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecuritySamlInvalidate<'a, 'b, JsonBody> where T: Serialize, { - SecuritySamlAuthenticate { + SecuritySamlInvalidate { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -6401,10 +7688,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Saml Authenticate API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Saml Invalidate API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6436,24 +7723,24 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Saml Complete Logout API"] -pub enum SecuritySamlCompleteLogoutParts { +#[doc = "API parts for the Security Saml Logout API"] +pub enum SecuritySamlLogoutParts { #[doc = "No parts"] None, } -impl SecuritySamlCompleteLogoutParts { - #[doc = "Builds a relative URL path to the Security Saml Complete Logout API"] +impl SecuritySamlLogoutParts { + #[doc = "Builds a relative URL path to the Security Saml Logout API"] pub fn url(self) -> Cow<'static, str> { match self { - SecuritySamlCompleteLogoutParts::None => "/_security/saml/complete_logout".into(), + SecuritySamlLogoutParts::None => "/_security/saml/logout".into(), } } } -#[doc = "Builder for the [Security Saml Complete Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-complete-logout.html)\n\nVerifies the logout response sent from the SAML IdP"] +#[doc = "Builder for the [Security Saml Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-logout.html)\n\nInvalidates an access token and a refresh token that were generated via the SAML Authenticate API"] #[derive(Clone, Debug)] -pub struct SecuritySamlCompleteLogout<'a, 'b, B> { +pub struct SecuritySamlLogout<'a, 'b, B> { transport: &'a Transport, - parts: SecuritySamlCompleteLogoutParts, + parts: SecuritySamlLogoutParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -6463,16 +7750,16 @@ pub struct SecuritySamlCompleteLogout<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecuritySamlCompleteLogout<'a, 'b, B> +impl<'a, 'b, B> SecuritySamlLogout<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecuritySamlCompleteLogout]"] + #[doc = "Creates a new instance of [SecuritySamlLogout]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecuritySamlCompleteLogout { + SecuritySamlLogout { transport, - parts: SecuritySamlCompleteLogoutParts::None, + parts: SecuritySamlLogoutParts::None, headers, body: None, error_trace: None, @@ -6484,11 +7771,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecuritySamlCompleteLogout<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecuritySamlLogout<'a, 'b, JsonBody> where T: Serialize, { - SecuritySamlCompleteLogout { + SecuritySamlLogout { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -6536,10 +7823,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Saml Complete Logout API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Saml Logout API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6571,24 +7858,24 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Saml Invalidate API"] -pub enum SecuritySamlInvalidateParts { +#[doc = "API parts for the Security Saml Prepare Authentication API"] +pub enum SecuritySamlPrepareAuthenticationParts { #[doc = "No parts"] None, } -impl SecuritySamlInvalidateParts { - #[doc = "Builds a relative URL path to the Security Saml Invalidate API"] +impl SecuritySamlPrepareAuthenticationParts { + #[doc = "Builds a relative URL path to the Security Saml Prepare Authentication API"] pub fn url(self) -> Cow<'static, str> { match self { - SecuritySamlInvalidateParts::None => "/_security/saml/invalidate".into(), + SecuritySamlPrepareAuthenticationParts::None => "/_security/saml/prepare".into(), } } } -#[doc = "Builder for the [Security Saml Invalidate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-invalidate.html)\n\nConsumes a SAML LogoutRequest"] +#[doc = "Builder for the [Security Saml Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-prepare-authentication.html)\n\nCreates a SAML authentication request"] #[derive(Clone, Debug)] -pub struct SecuritySamlInvalidate<'a, 'b, B> { +pub struct SecuritySamlPrepareAuthentication<'a, 'b, B> { transport: &'a Transport, - parts: SecuritySamlInvalidateParts, + parts: SecuritySamlPrepareAuthenticationParts, body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, @@ -6598,16 +7885,16 @@ pub struct SecuritySamlInvalidate<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecuritySamlInvalidate<'a, 'b, B> +impl<'a, 'b, B> SecuritySamlPrepareAuthentication<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecuritySamlInvalidate]"] + #[doc = "Creates a new instance of [SecuritySamlPrepareAuthentication]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecuritySamlInvalidate { + SecuritySamlPrepareAuthentication { transport, - parts: SecuritySamlInvalidateParts::None, + parts: SecuritySamlPrepareAuthenticationParts::None, headers, body: None, error_trace: None, @@ -6619,11 +7906,11 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecuritySamlInvalidate<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecuritySamlPrepareAuthentication<'a, 'b, JsonBody> where T: Serialize, { - SecuritySamlInvalidate { + SecuritySamlPrepareAuthentication { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -6671,10 +7958,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Saml Invalidate API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Saml Prepare Authentication API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6706,25 +7993,31 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Saml Logout API"] -pub enum SecuritySamlLogoutParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Saml Service Provider Metadata API"] +pub enum SecuritySamlServiceProviderMetadataParts<'b> { + #[doc = "RealmName"] + RealmName(&'b str), } -impl SecuritySamlLogoutParts { - #[doc = "Builds a relative URL path to the Security Saml Logout API"] +impl<'b> SecuritySamlServiceProviderMetadataParts<'b> { + #[doc = "Builds a relative URL path to the Security Saml Service Provider Metadata API"] pub fn url(self) -> Cow<'static, str> { match self { - SecuritySamlLogoutParts::None => "/_security/saml/logout".into(), + SecuritySamlServiceProviderMetadataParts::RealmName(ref realm_name) => { + let encoded_realm_name: Cow = + percent_encode(realm_name.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(25usize + encoded_realm_name.len()); + p.push_str("/_security/saml/metadata/"); + p.push_str(encoded_realm_name.as_ref()); + p.into() + } } } } -#[doc = "Builder for the [Security Saml Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-logout.html)\n\nInvalidates an access token and a refresh token that were generated via the SAML Authenticate API"] +#[doc = "Builder for the [Security Saml Service Provider Metadata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-sp-metadata.html)\n\nGenerates SAML metadata for the Elastic stack SAML 2.0 Service Provider"] #[derive(Clone, Debug)] -pub struct SecuritySamlLogout<'a, 'b, B> { +pub struct SecuritySamlServiceProviderMetadata<'a, 'b> { transport: &'a Transport, - parts: SecuritySamlLogoutParts, - body: Option, + parts: SecuritySamlServiceProviderMetadataParts<'b>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -6733,18 +8026,17 @@ pub struct SecuritySamlLogout<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecuritySamlLogout<'a, 'b, B> -where - B: Body, -{ - #[doc = "Creates a new instance of [SecuritySamlLogout]"] - pub fn new(transport: &'a Transport) -> Self { +impl<'a, 'b> SecuritySamlServiceProviderMetadata<'a, 'b> { + #[doc = "Creates a new instance of [SecuritySamlServiceProviderMetadata] with the specified API parts"] + pub fn new( + transport: &'a Transport, + parts: SecuritySamlServiceProviderMetadataParts<'b>, + ) -> Self { let headers = HeaderMap::new(); - SecuritySamlLogout { + SecuritySamlServiceProviderMetadata { transport, - parts: SecuritySamlLogoutParts::None, + parts, headers, - body: None, error_trace: None, filter_path: None, human: None, @@ -6753,24 +8045,6 @@ where source: None, } } - #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecuritySamlLogout<'a, 'b, JsonBody> - where - T: Serialize, - { - SecuritySamlLogout { - 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); @@ -6806,10 +8080,10 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Saml Logout API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Saml Service Provider Metadata API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -6832,7 +8106,7 @@ where }; Some(query_params) }; - let body = self.body; + let body = Option::<()>::None; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -6841,25 +8115,26 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Saml Prepare Authentication API"] -pub enum SecuritySamlPrepareAuthenticationParts { +#[doc = "API parts for the Security Suggest User Profiles API"] +pub enum SecuritySuggestUserProfilesParts { #[doc = "No parts"] None, } -impl SecuritySamlPrepareAuthenticationParts { - #[doc = "Builds a relative URL path to the Security Saml Prepare Authentication API"] +impl SecuritySuggestUserProfilesParts { + #[doc = "Builds a relative URL path to the Security Suggest User Profiles API"] pub fn url(self) -> Cow<'static, str> { match self { - SecuritySamlPrepareAuthenticationParts::None => "/_security/saml/prepare".into(), + SecuritySuggestUserProfilesParts::None => "/_security/profile/_suggest".into(), } } } -#[doc = "Builder for the [Security Saml Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-prepare-authentication.html)\n\nCreates a SAML authentication request"] +#[doc = "Builder for the [Security Suggest User Profiles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-suggest-user-profile.html)\n\nGet suggestions for user profiles that match specified search criteria."] #[derive(Clone, Debug)] -pub struct SecuritySamlPrepareAuthentication<'a, 'b, B> { +pub struct SecuritySuggestUserProfiles<'a, 'b, B> { transport: &'a Transport, - parts: SecuritySamlPrepareAuthenticationParts, + parts: SecuritySuggestUserProfilesParts, body: Option, + data: Option<&'b [&'b str]>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -6868,18 +8143,19 @@ pub struct SecuritySamlPrepareAuthentication<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b, B> SecuritySamlPrepareAuthentication<'a, 'b, B> +impl<'a, 'b, B> SecuritySuggestUserProfiles<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecuritySamlPrepareAuthentication]"] + #[doc = "Creates a new instance of [SecuritySuggestUserProfiles]"] pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecuritySamlPrepareAuthentication { + SecuritySuggestUserProfiles { transport, - parts: SecuritySamlPrepareAuthenticationParts::None, + parts: SecuritySuggestUserProfilesParts::None, headers, body: None, + data: None, error_trace: None, filter_path: None, human: None, @@ -6889,14 +8165,15 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecuritySamlPrepareAuthentication<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecuritySuggestUserProfiles<'a, 'b, JsonBody> where T: Serialize, { - SecuritySamlPrepareAuthentication { + SecuritySuggestUserProfiles { transport: self.transport, parts: self.parts, body: Some(body.into()), + data: self.data, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, @@ -6906,6 +8183,11 @@ where source: self.source, } } + #[doc = "A comma-separated list of keys for which the corresponding application data are retrieved."] + pub fn data(mut self, data: &'b [&'b str]) -> Self { + self.data = Some(data); + 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); @@ -6941,16 +8223,21 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Saml Prepare Authentication API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Suggest User Profiles API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = match self.body { + Some(_) => http::Method::Post, + None => 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> { + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + data: Option<&'b [&'b str]>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -6959,6 +8246,7 @@ where source: Option<&'b str>, } let query_params = QueryParams { + data: self.data, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, @@ -6976,31 +8264,31 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Saml Service Provider Metadata API"] -pub enum SecuritySamlServiceProviderMetadataParts<'b> { - #[doc = "RealmName"] - RealmName(&'b str), +#[doc = "API parts for the Security Update Api Key API"] +pub enum SecurityUpdateApiKeyParts<'b> { + #[doc = "Id"] + Id(&'b str), } -impl<'b> SecuritySamlServiceProviderMetadataParts<'b> { - #[doc = "Builds a relative URL path to the Security Saml Service Provider Metadata API"] +impl<'b> SecurityUpdateApiKeyParts<'b> { + #[doc = "Builds a relative URL path to the Security Update Api Key API"] pub fn url(self) -> Cow<'static, str> { match self { - SecuritySamlServiceProviderMetadataParts::RealmName(ref realm_name) => { - let encoded_realm_name: Cow = - percent_encode(realm_name.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(25usize + encoded_realm_name.len()); - p.push_str("/_security/saml/metadata/"); - p.push_str(encoded_realm_name.as_ref()); + SecurityUpdateApiKeyParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(19usize + encoded_id.len()); + p.push_str("/_security/api_key/"); + p.push_str(encoded_id.as_ref()); p.into() } } } } -#[doc = "Builder for the [Security Saml Service Provider Metadata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-sp-metadata.html)\n\nGenerates SAML metadata for the Elastic stack SAML 2.0 Service Provider"] +#[doc = "Builder for the [Security Update Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-update-api-key.html)\n\nUpdates attributes of an existing API key."] #[derive(Clone, Debug)] -pub struct SecuritySamlServiceProviderMetadata<'a, 'b> { +pub struct SecurityUpdateApiKey<'a, 'b, B> { transport: &'a Transport, - parts: SecuritySamlServiceProviderMetadataParts<'b>, + parts: SecurityUpdateApiKeyParts<'b>, + body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -7009,17 +8297,18 @@ pub struct SecuritySamlServiceProviderMetadata<'a, 'b> { request_timeout: Option, source: Option<&'b str>, } -impl<'a, 'b> SecuritySamlServiceProviderMetadata<'a, 'b> { - #[doc = "Creates a new instance of [SecuritySamlServiceProviderMetadata] with the specified API parts"] - pub fn new( - transport: &'a Transport, - parts: SecuritySamlServiceProviderMetadataParts<'b>, - ) -> Self { +impl<'a, 'b, B> SecurityUpdateApiKey<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SecurityUpdateApiKey] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityUpdateApiKeyParts<'b>) -> Self { let headers = HeaderMap::new(); - SecuritySamlServiceProviderMetadata { + SecurityUpdateApiKey { transport, parts, headers, + body: None, error_trace: None, filter_path: None, human: None, @@ -7028,6 +8317,24 @@ impl<'a, 'b> SecuritySamlServiceProviderMetadata<'a, 'b> { source: None, } } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SecurityUpdateApiKey<'a, 'b, JsonBody> + where + T: Serialize, + { + SecurityUpdateApiKey { + 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); @@ -7063,10 +8370,10 @@ impl<'a, 'b> SecuritySamlServiceProviderMetadata<'a, 'b> { self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Saml Service Provider Metadata API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Update Api Key API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7089,7 +8396,7 @@ impl<'a, 'b> SecuritySamlServiceProviderMetadata<'a, 'b> { }; Some(query_params) }; - let body = Option::<()>::None; + let body = self.body; let response = self .transport .send(method, &path, headers, query_string.as_ref(), body, timeout) @@ -7097,31 +8404,36 @@ impl<'a, 'b> SecuritySamlServiceProviderMetadata<'a, 'b> { Ok(response) } } -#[cfg(feature = "experimental-apis")] +#[cfg(feature = "beta-apis")] #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Suggest User Profiles API"] -pub enum SecuritySuggestUserProfilesParts { - #[doc = "No parts"] - None, +#[doc = "API parts for the Security Update Cross Cluster Api Key API"] +pub enum SecurityUpdateCrossClusterApiKeyParts<'b> { + #[doc = "Id"] + Id(&'b str), } -#[cfg(feature = "experimental-apis")] -impl SecuritySuggestUserProfilesParts { - #[doc = "Builds a relative URL path to the Security Suggest User Profiles API"] +#[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> { match self { - SecuritySuggestUserProfilesParts::None => "/_security/profile/_suggest".into(), + SecurityUpdateCrossClusterApiKeyParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(33usize + encoded_id.len()); + p.push_str("/_security/cross_cluster/api_key/"); + p.push_str(encoded_id.as_ref()); + p.into() + } } } } -#[doc = "Builder for the [Security Suggest User Profiles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-suggest-user-profile.html)\n\nGet suggestions for user profiles that match specified search 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")] +#[doc = "Builder for the [Security Update Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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 SecuritySuggestUserProfiles<'a, 'b, B> { +pub struct SecurityUpdateCrossClusterApiKey<'a, 'b, B> { transport: &'a Transport, - parts: SecuritySuggestUserProfilesParts, + parts: SecurityUpdateCrossClusterApiKeyParts<'b>, body: Option, - data: Option<&'b [&'b str]>, error_trace: Option, filter_path: Option<&'b [&'b str]>, headers: HeaderMap, @@ -7130,20 +8442,19 @@ pub struct SecuritySuggestUserProfiles<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] -impl<'a, 'b, B> SecuritySuggestUserProfiles<'a, 'b, B> +#[cfg(feature = "beta-apis")] +impl<'a, 'b, B> SecurityUpdateCrossClusterApiKey<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecuritySuggestUserProfiles]"] - pub fn new(transport: &'a Transport) -> Self { + #[doc = "Creates a new instance of [SecurityUpdateCrossClusterApiKey] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SecurityUpdateCrossClusterApiKeyParts<'b>) -> Self { let headers = HeaderMap::new(); - SecuritySuggestUserProfiles { + SecurityUpdateCrossClusterApiKey { transport, - parts: SecuritySuggestUserProfilesParts::None, + parts, headers, body: None, - data: None, error_trace: None, filter_path: None, human: None, @@ -7153,15 +8464,14 @@ where } } #[doc = "The body for the API call"] - pub fn body(self, body: T) -> SecuritySuggestUserProfiles<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityUpdateCrossClusterApiKey<'a, 'b, JsonBody> where T: Serialize, { - SecuritySuggestUserProfiles { + SecurityUpdateCrossClusterApiKey { transport: self.transport, parts: self.parts, body: Some(body.into()), - data: self.data, error_trace: self.error_trace, filter_path: self.filter_path, headers: self.headers, @@ -7171,11 +8481,6 @@ where source: self.source, } } - #[doc = "A comma-separated list of keys for which the corresponding application data are retrieved."] - pub fn data(mut self, data: &'b [&'b str]) -> Self { - self.data = Some(data); - 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); @@ -7211,21 +8516,16 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Suggest User Profiles API that can be awaited"] + #[doc = "Creates an asynchronous call to the Security Update Cross Cluster Api Key API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, - }; + 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> { - #[serde(serialize_with = "crate::client::serialize_coll_qs")] - data: Option<&'b [&'b str]>, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -7234,7 +8534,6 @@ where source: Option<&'b str>, } let query_params = QueryParams { - data: self.data, error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, @@ -7252,65 +8551,63 @@ where } } #[derive(Debug, Clone, PartialEq)] -#[doc = "API parts for the Security Update Api Key API"] -pub enum SecurityUpdateApiKeyParts<'b> { - #[doc = "Id"] - Id(&'b str), +#[doc = "API parts for the Security Update Settings API"] +pub enum SecurityUpdateSettingsParts { + #[doc = "No parts"] + None, } -impl<'b> SecurityUpdateApiKeyParts<'b> { - #[doc = "Builds a relative URL path to the Security Update Api Key API"] +impl SecurityUpdateSettingsParts { + #[doc = "Builds a relative URL path to the Security Update Settings API"] pub fn url(self) -> Cow<'static, str> { match self { - SecurityUpdateApiKeyParts::Id(ref id) => { - let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); - let mut p = String::with_capacity(19usize + encoded_id.len()); - p.push_str("/_security/api_key/"); - p.push_str(encoded_id.as_ref()); - p.into() - } + SecurityUpdateSettingsParts::None => "/_security/settings".into(), } } } -#[doc = "Builder for the [Security Update Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-update-api-key.html)\n\nUpdates attributes of an existing API key."] +#[doc = "Builder for the [Security Update Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-update-settings.html)\n\nUpdate settings for the security system index"] #[derive(Clone, Debug)] -pub struct SecurityUpdateApiKey<'a, 'b, B> { +pub struct SecurityUpdateSettings<'a, 'b, B> { transport: &'a Transport, - parts: SecurityUpdateApiKeyParts<'b>, + parts: SecurityUpdateSettingsParts, body: Option, error_trace: Option, 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> SecurityUpdateApiKey<'a, 'b, B> +impl<'a, 'b, B> SecurityUpdateSettings<'a, 'b, B> where B: Body, { - #[doc = "Creates a new instance of [SecurityUpdateApiKey] with the specified API parts"] - pub fn new(transport: &'a Transport, parts: SecurityUpdateApiKeyParts<'b>) -> Self { + #[doc = "Creates a new instance of [SecurityUpdateSettings]"] + pub fn new(transport: &'a Transport) -> Self { let headers = HeaderMap::new(); - SecurityUpdateApiKey { + SecurityUpdateSettings { transport, - parts, + parts: SecurityUpdateSettingsParts::None, headers, body: None, 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"] - pub fn body(self, body: T) -> SecurityUpdateApiKey<'a, 'b, JsonBody> + pub fn body(self, body: T) -> SecurityUpdateSettings<'a, 'b, JsonBody> where T: Serialize, { - SecurityUpdateApiKey { + SecurityUpdateSettings { transport: self.transport, parts: self.parts, body: Some(body.into()), @@ -7318,9 +8615,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."] @@ -7343,6 +8642,11 @@ where self.human = Some(human); self } + #[doc = "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); @@ -7358,10 +8662,15 @@ where self.source = Some(source); self } - #[doc = "Creates an asynchronous call to the Security Update Api Key API that can be awaited"] + #[doc = "Timeout for acknowledgements from all nodes"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Security Update Settings API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7372,15 +8681,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) }; @@ -7392,14 +8705,12 @@ where Ok(response) } } -#[cfg(feature = "experimental-apis")] #[derive(Debug, Clone, PartialEq)] #[doc = "API parts for the Security Update User Profile Data API"] pub enum SecurityUpdateUserProfileDataParts<'b> { #[doc = "Uid"] Uid(&'b str), } -#[cfg(feature = "experimental-apis")] impl<'b> SecurityUpdateUserProfileDataParts<'b> { #[doc = "Builds a relative URL path to the Security Update User Profile Data API"] pub fn url(self) -> Cow<'static, str> { @@ -7415,9 +8726,7 @@ impl<'b> SecurityUpdateUserProfileDataParts<'b> { } } } -#[doc = "Builder for the [Security Update User Profile Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-update-user-profile-data.html)\n\nUpdate application specific data for the user profile of the given unique ID."] -#[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")] +#[doc = "Builder for the [Security Update User Profile Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-update-user-profile-data.html)\n\nUpdate application specific data for the user profile of the given unique ID."] #[derive(Clone, Debug)] pub struct SecurityUpdateUserProfileData<'a, 'b, B> { transport: &'a Transport, @@ -7434,7 +8743,6 @@ pub struct SecurityUpdateUserProfileData<'a, 'b, B> { request_timeout: Option, source: Option<&'b str>, } -#[cfg(feature = "experimental-apis")] impl<'a, 'b, B> SecurityUpdateUserProfileData<'a, 'b, B> where B: Body, @@ -7532,7 +8840,7 @@ where #[doc = "Creates an asynchronous call to the Security Update User Profile Data API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -7581,314 +8889,345 @@ impl<'a> Security<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Security Activate User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-activate-user-profile.html)\n\nCreates or updates the user profile on behalf of another user."] - #[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")] + #[doc = "[Security Activate User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-activate-user-profile.html)\n\nCreates or updates the user profile on behalf of another user."] pub fn activate_user_profile<'b>(&'a self) -> SecurityActivateUserProfile<'a, 'b, ()> { SecurityActivateUserProfile::new(self.transport()) } - #[doc = "[Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] + #[doc = "[Security Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-authenticate.html)\n\nEnables authentication as a user and retrieve information about the authenticated user."] pub fn authenticate<'b>(&'a self) -> SecurityAuthenticate<'a, 'b> { SecurityAuthenticate::new(self.transport()) } - #[doc = "[Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] + #[doc = "[Security Bulk Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-bulk-delete-role.html)\n\nBulk delete roles in the native realm."] + pub fn bulk_delete_role<'b>(&'a self) -> SecurityBulkDeleteRole<'a, 'b, ()> { + SecurityBulkDeleteRole::new(self.transport()) + } + #[doc = "[Security Bulk Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-bulk-put-role.html)\n\nBulk adds and updates roles in the native realm."] + pub fn bulk_put_role<'b>(&'a self) -> SecurityBulkPutRole<'a, 'b, ()> { + SecurityBulkPutRole::new(self.transport()) + } + #[doc = "[Security Bulk Update Api Keys API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-bulk-update-api-keys.html)\n\nUpdates the attributes of multiple existing API keys."] + pub fn bulk_update_api_keys<'b>(&'a self) -> SecurityBulkUpdateApiKeys<'a, 'b, ()> { + SecurityBulkUpdateApiKeys::new(self.transport()) + } + #[doc = "[Security Change Password API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-change-password.html)\n\nChanges the passwords of users in the native realm and built-in users."] pub fn change_password<'b>( &'a self, parts: SecurityChangePasswordParts<'b>, ) -> SecurityChangePassword<'a, 'b, ()> { SecurityChangePassword::new(self.transport(), parts) } - #[doc = "[Security Clear Api Key Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-api-key-cache.html)\n\nClear a subset or all entries from the API key cache."] + #[doc = "[Security Clear Api Key Cache API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-api-key-cache.html)\n\nClear a subset or all entries from the API key cache."] pub fn clear_api_key_cache<'b>( &'a self, parts: SecurityClearApiKeyCacheParts<'b>, ) -> SecurityClearApiKeyCache<'a, 'b, ()> { SecurityClearApiKeyCache::new(self.transport(), parts) } - #[doc = "[Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] + #[doc = "[Security Clear Cached Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-privilege-cache.html)\n\nEvicts application privileges from the native application privileges cache."] pub fn clear_cached_privileges<'b>( &'a self, parts: SecurityClearCachedPrivilegesParts<'b>, ) -> SecurityClearCachedPrivileges<'a, 'b, ()> { SecurityClearCachedPrivileges::new(self.transport(), parts) } - #[doc = "[Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] + #[doc = "[Security Clear Cached Realms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-cache.html)\n\nEvicts users from the user cache. Can completely clear the cache or evict specific users."] pub fn clear_cached_realms<'b>( &'a self, parts: SecurityClearCachedRealmsParts<'b>, ) -> SecurityClearCachedRealms<'a, 'b, ()> { SecurityClearCachedRealms::new(self.transport(), parts) } - #[doc = "[Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] + #[doc = "[Security Clear Cached Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-role-cache.html)\n\nEvicts roles from the native role cache."] pub fn clear_cached_roles<'b>( &'a self, parts: SecurityClearCachedRolesParts<'b>, ) -> SecurityClearCachedRoles<'a, 'b, ()> { SecurityClearCachedRoles::new(self.transport(), parts) } - #[doc = "[Security Clear Cached Service Tokens API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-clear-service-token-caches.html)\n\nEvicts tokens from the service account token caches."] + #[doc = "[Security Clear Cached Service Tokens API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-clear-service-token-caches.html)\n\nEvicts tokens from the service account token caches."] pub fn clear_cached_service_tokens<'b>( &'a self, parts: SecurityClearCachedServiceTokensParts<'b>, ) -> SecurityClearCachedServiceTokens<'a, 'b, ()> { SecurityClearCachedServiceTokens::new(self.transport(), parts) } - #[doc = "[Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] + #[doc = "[Security Create Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-create-api-key.html)\n\nCreates an API key for access without requiring basic authentication."] pub fn create_api_key<'b>(&'a self) -> SecurityCreateApiKey<'a, 'b, ()> { SecurityCreateApiKey::new(self.transport()) } - #[doc = "[Security Create Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-create-service-token.html)\n\nCreates a service account token for access without requiring basic authentication."] + #[doc = "[Security Create Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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, ()> { + SecurityCreateCrossClusterApiKey::new(self.transport()) + } + #[doc = "[Security Create Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-create-service-token.html)\n\nCreates a service account token for access without requiring basic authentication."] pub fn create_service_token<'b>( &'a self, parts: SecurityCreateServiceTokenParts<'b>, ) -> SecurityCreateServiceToken<'a, 'b, ()> { SecurityCreateServiceToken::new(self.transport(), parts) } - #[doc = "[Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-privilege.html)\n\nRemoves application privileges."] + #[doc = "[Security Delete Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-privilege.html)\n\nRemoves application privileges."] pub fn delete_privileges<'b>( &'a self, parts: SecurityDeletePrivilegesParts<'b>, ) -> SecurityDeletePrivileges<'a, 'b> { SecurityDeletePrivileges::new(self.transport(), parts) } - #[doc = "[Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-role.html)\n\nRemoves roles in the native realm."] + #[doc = "[Security Delete Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-role.html)\n\nRemoves roles in the native realm."] pub fn delete_role<'b>( &'a self, parts: SecurityDeleteRoleParts<'b>, ) -> SecurityDeleteRole<'a, 'b> { SecurityDeleteRole::new(self.transport(), parts) } - #[doc = "[Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] + #[doc = "[Security Delete Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-role-mapping.html)\n\nRemoves role mappings."] pub fn delete_role_mapping<'b>( &'a self, parts: SecurityDeleteRoleMappingParts<'b>, ) -> SecurityDeleteRoleMapping<'a, 'b> { SecurityDeleteRoleMapping::new(self.transport(), parts) } - #[doc = "[Security Delete Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-service-token.html)\n\nDeletes a service account token."] + #[doc = "[Security Delete Service Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-service-token.html)\n\nDeletes a service account token."] pub fn delete_service_token<'b>( &'a self, parts: SecurityDeleteServiceTokenParts<'b>, ) -> SecurityDeleteServiceToken<'a, 'b> { SecurityDeleteServiceToken::new(self.transport(), parts) } - #[doc = "[Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-delete-user.html)\n\nDeletes users from the native realm."] + #[doc = "[Security Delete User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-delete-user.html)\n\nDeletes users from the native realm."] pub fn delete_user<'b>( &'a self, parts: SecurityDeleteUserParts<'b>, ) -> SecurityDeleteUser<'a, 'b> { SecurityDeleteUser::new(self.transport(), parts) } - #[doc = "[Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-disable-user.html)\n\nDisables users in the native realm."] + #[doc = "[Security Disable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-disable-user.html)\n\nDisables users in the native realm."] pub fn disable_user<'b>( &'a self, parts: SecurityDisableUserParts<'b>, ) -> SecurityDisableUser<'a, 'b, ()> { SecurityDisableUser::new(self.transport(), parts) } - #[doc = "[Security Disable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-disable-user-profile.html)\n\nDisables a user profile so it's not visible in user profile searches."] - #[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")] + #[doc = "[Security Disable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-disable-user-profile.html)\n\nDisables a user profile so it's not visible in user profile searches."] pub fn disable_user_profile<'b>( &'a self, parts: SecurityDisableUserProfileParts<'b>, ) -> SecurityDisableUserProfile<'a, 'b, ()> { SecurityDisableUserProfile::new(self.transport(), parts) } - #[doc = "[Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-enable-user.html)\n\nEnables users in the native realm."] + #[doc = "[Security Enable User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-enable-user.html)\n\nEnables users in the native realm."] pub fn enable_user<'b>( &'a self, parts: SecurityEnableUserParts<'b>, ) -> SecurityEnableUser<'a, 'b, ()> { SecurityEnableUser::new(self.transport(), parts) } - #[doc = "[Security Enable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-enable-user-profile.html)\n\nEnables a user profile so it's visible in user profile searches."] - #[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")] + #[doc = "[Security Enable User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-enable-user-profile.html)\n\nEnables a user profile so it's visible in user profile searches."] pub fn enable_user_profile<'b>( &'a self, parts: SecurityEnableUserProfileParts<'b>, ) -> SecurityEnableUserProfile<'a, 'b, ()> { SecurityEnableUserProfile::new(self.transport(), parts) } - #[doc = "[Security Enroll Kibana API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-kibana-enrollment.html)\n\nAllows a kibana instance to configure itself to communicate with a secured elasticsearch cluster."] + #[doc = "[Security Enroll Kibana API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-kibana-enrollment.html)\n\nAllows a kibana instance to configure itself to communicate with a secured elasticsearch cluster."] pub fn enroll_kibana<'b>(&'a self) -> SecurityEnrollKibana<'a, 'b> { SecurityEnrollKibana::new(self.transport()) } - #[doc = "[Security Enroll Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-node-enrollment.html)\n\nAllows a new node to enroll to an existing cluster with security enabled."] + #[doc = "[Security Enroll Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-node-enrollment.html)\n\nAllows a new node to enroll to an existing cluster with security enabled."] pub fn enroll_node<'b>(&'a self) -> SecurityEnrollNode<'a, 'b> { SecurityEnrollNode::new(self.transport()) } - #[doc = "[Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] + #[doc = "[Security Get Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-api-key.html)\n\nRetrieves information for one or more API keys."] pub fn get_api_key<'b>(&'a self) -> SecurityGetApiKey<'a, 'b> { SecurityGetApiKey::new(self.transport()) } - #[doc = "[Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] + #[doc = "[Security Get Builtin Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-builtin-privileges.html)\n\nRetrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch."] pub fn get_builtin_privileges<'b>(&'a self) -> SecurityGetBuiltinPrivileges<'a, 'b> { SecurityGetBuiltinPrivileges::new(self.transport()) } - #[doc = "[Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-privileges.html)\n\nRetrieves application privileges."] + #[doc = "[Security Get Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-privileges.html)\n\nRetrieves application privileges."] pub fn get_privileges<'b>( &'a self, parts: SecurityGetPrivilegesParts<'b>, ) -> SecurityGetPrivileges<'a, 'b> { SecurityGetPrivileges::new(self.transport(), parts) } - #[doc = "[Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-role.html)\n\nRetrieves roles in the native realm."] + #[doc = "[Security Get Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-role.html)\n\nRetrieves roles in the native realm."] pub fn get_role<'b>(&'a self, parts: SecurityGetRoleParts<'b>) -> SecurityGetRole<'a, 'b> { SecurityGetRole::new(self.transport(), parts) } - #[doc = "[Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] + #[doc = "[Security Get Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-role-mapping.html)\n\nRetrieves role mappings."] pub fn get_role_mapping<'b>( &'a self, parts: SecurityGetRoleMappingParts<'b>, ) -> SecurityGetRoleMapping<'a, 'b> { SecurityGetRoleMapping::new(self.transport(), parts) } - #[doc = "[Security Get Service Accounts API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-service-accounts.html)\n\nRetrieves information about service accounts."] + #[doc = "[Security Get Service Accounts API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-service-accounts.html)\n\nRetrieves information about service accounts."] pub fn get_service_accounts<'b>( &'a self, parts: SecurityGetServiceAccountsParts<'b>, ) -> SecurityGetServiceAccounts<'a, 'b> { SecurityGetServiceAccounts::new(self.transport(), parts) } - #[doc = "[Security Get Service Credentials API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-service-credentials.html)\n\nRetrieves information of all service credentials for a service account."] + #[doc = "[Security Get Service Credentials API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-service-credentials.html)\n\nRetrieves information of all service credentials for a service account."] pub fn get_service_credentials<'b>( &'a self, parts: SecurityGetServiceCredentialsParts<'b>, ) -> SecurityGetServiceCredentials<'a, 'b> { SecurityGetServiceCredentials::new(self.transport(), parts) } - #[doc = "[Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] + #[doc = "[Security Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-settings.html)\n\nRetrieve settings for the security system indices"] + pub fn get_settings<'b>(&'a self) -> SecurityGetSettings<'a, 'b> { + SecurityGetSettings::new(self.transport()) + } + #[doc = "[Security Get Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-token.html)\n\nCreates a bearer token for access without requiring basic authentication."] pub fn get_token<'b>(&'a self) -> SecurityGetToken<'a, 'b, ()> { SecurityGetToken::new(self.transport()) } - #[doc = "[Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] + #[doc = "[Security Get User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-user.html)\n\nRetrieves information about users in the native realm and built-in users."] pub fn get_user<'b>(&'a self, parts: SecurityGetUserParts<'b>) -> SecurityGetUser<'a, 'b> { SecurityGetUser::new(self.transport(), parts) } - #[doc = "[Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-user-privileges.html)\n\nRetrieves security privileges for the logged in user."] + #[doc = "[Security Get User Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-user-privileges.html)\n\nRetrieves security privileges for the logged in user."] pub fn get_user_privileges<'b>(&'a self) -> SecurityGetUserPrivileges<'a, 'b> { SecurityGetUserPrivileges::new(self.transport()) } - #[doc = "[Security Get User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-get-user-profile.html)\n\nRetrieves user profile for the given unique ID."] - #[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")] + #[doc = "[Security Get User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-get-user-profile.html)\n\nRetrieves user profiles for the given unique ID(s)."] pub fn get_user_profile<'b>( &'a self, parts: SecurityGetUserProfileParts<'b>, ) -> SecurityGetUserProfile<'a, 'b> { SecurityGetUserProfile::new(self.transport(), parts) } - #[doc = "[Security Grant Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-grant-api-key.html)\n\nCreates an API key on behalf of another user."] + #[doc = "[Security Grant Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-grant-api-key.html)\n\nCreates an API key on behalf of another user."] pub fn grant_api_key<'b>(&'a self) -> SecurityGrantApiKey<'a, 'b, ()> { SecurityGrantApiKey::new(self.transport()) } - #[doc = "[Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] + #[doc = "[Security Has Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-has-privileges.html)\n\nDetermines whether the specified user has a specified list of privileges."] pub fn has_privileges<'b>( &'a self, parts: SecurityHasPrivilegesParts<'b>, ) -> SecurityHasPrivileges<'a, 'b, ()> { SecurityHasPrivileges::new(self.transport(), parts) } - #[doc = "[Security Has Privileges User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-has-privileges-user-profile.html)\n\nDetermines whether the users associated with the specified profile IDs have all the requested privileges."] - #[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")] + #[doc = "[Security Has Privileges User Profile API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-has-privileges-user-profile.html)\n\nDetermines whether the users associated with the specified profile IDs have all the requested privileges."] pub fn has_privileges_user_profile<'b>( &'a self, ) -> SecurityHasPrivilegesUserProfile<'a, 'b, ()> { SecurityHasPrivilegesUserProfile::new(self.transport()) } - #[doc = "[Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] + #[doc = "[Security Invalidate Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-invalidate-api-key.html)\n\nInvalidates one or more API keys."] pub fn invalidate_api_key<'b>(&'a self) -> SecurityInvalidateApiKey<'a, 'b, ()> { SecurityInvalidateApiKey::new(self.transport()) } - #[doc = "[Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] + #[doc = "[Security Invalidate Token API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-invalidate-token.html)\n\nInvalidates one or more access tokens or refresh tokens."] pub fn invalidate_token<'b>(&'a self) -> SecurityInvalidateToken<'a, 'b, ()> { SecurityInvalidateToken::new(self.transport()) } - #[doc = "[Security Oidc Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-oidc-authenticate.html)\n\nExchanges an OpenID Connection authentication response message for an Elasticsearch access token and refresh token pair"] + #[doc = "[Security Oidc Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-oidc-authenticate.html)\n\nExchanges an OpenID Connection authentication response message for an Elasticsearch access token and refresh token pair"] pub fn oidc_authenticate<'b>(&'a self) -> SecurityOidcAuthenticate<'a, 'b, ()> { SecurityOidcAuthenticate::new(self.transport()) } - #[doc = "[Security Oidc Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-oidc-logout.html)\n\nInvalidates a refresh token and access token that was generated from the OpenID Connect Authenticate API"] + #[doc = "[Security Oidc Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-oidc-logout.html)\n\nInvalidates a refresh token and access token that was generated from the OpenID Connect Authenticate API"] pub fn oidc_logout<'b>(&'a self) -> SecurityOidcLogout<'a, 'b, ()> { SecurityOidcLogout::new(self.transport()) } - #[doc = "[Security Oidc Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-oidc-prepare-authentication.html)\n\nCreates an OAuth 2.0 authentication request as a URL string"] + #[doc = "[Security Oidc Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-oidc-prepare-authentication.html)\n\nCreates an OAuth 2.0 authentication request as a URL string"] pub fn oidc_prepare_authentication<'b>( &'a self, ) -> SecurityOidcPrepareAuthentication<'a, 'b, ()> { SecurityOidcPrepareAuthentication::new(self.transport()) } - #[doc = "[Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-privileges.html)\n\nAdds or updates application privileges."] + #[doc = "[Security Put Privileges API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-privileges.html)\n\nAdds or updates application privileges."] pub fn put_privileges<'b>(&'a self) -> SecurityPutPrivileges<'a, 'b, ()> { SecurityPutPrivileges::new(self.transport()) } - #[doc = "[Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] + #[doc = "[Security Put Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-role.html)\n\nAdds and updates roles in the native realm."] pub fn put_role<'b>(&'a self, parts: SecurityPutRoleParts<'b>) -> SecurityPutRole<'a, 'b, ()> { SecurityPutRole::new(self.transport(), parts) } - #[doc = "[Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] + #[doc = "[Security Put Role Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-role-mapping.html)\n\nCreates and updates role mappings."] pub fn put_role_mapping<'b>( &'a self, parts: SecurityPutRoleMappingParts<'b>, ) -> SecurityPutRoleMapping<'a, 'b, ()> { SecurityPutRoleMapping::new(self.transport(), parts) } - #[doc = "[Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] + #[doc = "[Security Put User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-put-user.html)\n\nAdds and updates users in the native realm. These users are commonly referred to as native users."] pub fn put_user<'b>(&'a self, parts: SecurityPutUserParts<'b>) -> SecurityPutUser<'a, 'b, ()> { SecurityPutUser::new(self.transport(), parts) } - #[doc = "[Security Query Api Keys API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-query-api-key.html)\n\nRetrieves information for API keys using a subset of query DSL"] + #[doc = "[Security Query Api Keys API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-query-api-key.html)\n\nRetrieves information for API keys using a subset of query DSL"] pub fn query_api_keys<'b>(&'a self) -> SecurityQueryApiKeys<'a, 'b, ()> { SecurityQueryApiKeys::new(self.transport()) } - #[doc = "[Security Saml Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-authenticate.html)\n\nExchanges a SAML Response message for an Elasticsearch access token and refresh token pair"] + #[doc = "[Security Query Role API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-query-role.html)\n\nRetrieves information for Roles using a subset of query DSL"] + pub fn query_role<'b>(&'a self) -> SecurityQueryRole<'a, 'b, ()> { + SecurityQueryRole::new(self.transport()) + } + #[doc = "[Security Query User API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-query-user.html)\n\nRetrieves information for Users using a subset of query DSL"] + pub fn query_user<'b>(&'a self) -> SecurityQueryUser<'a, 'b, ()> { + SecurityQueryUser::new(self.transport()) + } + #[doc = "[Security Saml Authenticate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-authenticate.html)\n\nExchanges a SAML Response message for an Elasticsearch access token and refresh token pair"] pub fn saml_authenticate<'b>(&'a self) -> SecuritySamlAuthenticate<'a, 'b, ()> { SecuritySamlAuthenticate::new(self.transport()) } - #[doc = "[Security Saml Complete Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-complete-logout.html)\n\nVerifies the logout response sent from the SAML IdP"] + #[doc = "[Security Saml Complete Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-complete-logout.html)\n\nVerifies the logout response sent from the SAML IdP"] pub fn saml_complete_logout<'b>(&'a self) -> SecuritySamlCompleteLogout<'a, 'b, ()> { SecuritySamlCompleteLogout::new(self.transport()) } - #[doc = "[Security Saml Invalidate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-invalidate.html)\n\nConsumes a SAML LogoutRequest"] + #[doc = "[Security Saml Invalidate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-invalidate.html)\n\nConsumes a SAML LogoutRequest"] pub fn saml_invalidate<'b>(&'a self) -> SecuritySamlInvalidate<'a, 'b, ()> { SecuritySamlInvalidate::new(self.transport()) } - #[doc = "[Security Saml Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-logout.html)\n\nInvalidates an access token and a refresh token that were generated via the SAML Authenticate API"] + #[doc = "[Security Saml Logout API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-logout.html)\n\nInvalidates an access token and a refresh token that were generated via the SAML Authenticate API"] pub fn saml_logout<'b>(&'a self) -> SecuritySamlLogout<'a, 'b, ()> { SecuritySamlLogout::new(self.transport()) } - #[doc = "[Security Saml Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-prepare-authentication.html)\n\nCreates a SAML authentication request"] + #[doc = "[Security Saml Prepare Authentication API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-prepare-authentication.html)\n\nCreates a SAML authentication request"] pub fn saml_prepare_authentication<'b>( &'a self, ) -> SecuritySamlPrepareAuthentication<'a, 'b, ()> { SecuritySamlPrepareAuthentication::new(self.transport()) } - #[doc = "[Security Saml Service Provider Metadata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-saml-sp-metadata.html)\n\nGenerates SAML metadata for the Elastic stack SAML 2.0 Service Provider"] + #[doc = "[Security Saml Service Provider Metadata API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-saml-sp-metadata.html)\n\nGenerates SAML metadata for the Elastic stack SAML 2.0 Service Provider"] pub fn saml_service_provider_metadata<'b>( &'a self, parts: SecuritySamlServiceProviderMetadataParts<'b>, ) -> SecuritySamlServiceProviderMetadata<'a, 'b> { SecuritySamlServiceProviderMetadata::new(self.transport(), parts) } - #[doc = "[Security Suggest User Profiles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-suggest-user-profile.html)\n\nGet suggestions for user profiles that match specified search 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")] + #[doc = "[Security Suggest User Profiles API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-suggest-user-profile.html)\n\nGet suggestions for user profiles that match specified search criteria."] pub fn suggest_user_profiles<'b>(&'a self) -> SecuritySuggestUserProfiles<'a, 'b, ()> { SecuritySuggestUserProfiles::new(self.transport()) } - #[doc = "[Security Update Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-update-api-key.html)\n\nUpdates attributes of an existing API key."] + #[doc = "[Security Update Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-update-api-key.html)\n\nUpdates attributes of an existing API key."] pub fn update_api_key<'b>( &'a self, parts: SecurityUpdateApiKeyParts<'b>, ) -> SecurityUpdateApiKey<'a, 'b, ()> { SecurityUpdateApiKey::new(self.transport(), parts) } - #[doc = "[Security Update User Profile Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-update-user-profile-data.html)\n\nUpdate application specific data for the user profile of the given unique ID."] - #[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")] + #[doc = "[Security Update Cross Cluster Api Key API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/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>, + ) -> SecurityUpdateCrossClusterApiKey<'a, 'b, ()> { + SecurityUpdateCrossClusterApiKey::new(self.transport(), parts) + } + #[doc = "[Security Update Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-update-settings.html)\n\nUpdate settings for the security system index"] + pub fn update_settings<'b>(&'a self) -> SecurityUpdateSettings<'a, 'b, ()> { + SecurityUpdateSettings::new(self.transport()) + } + #[doc = "[Security Update User Profile Data API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-update-user-profile-data.html)\n\nUpdate application specific data for the user profile of the given unique ID."] pub fn update_user_profile_data<'b>( &'a self, parts: SecurityUpdateUserProfileDataParts<'b>, diff --git a/elasticsearch/src/shutdown.rs b/elasticsearch/src/shutdown.rs index 21fd4e0f..17e570aa 100644 --- a/elasticsearch/src/shutdown.rs +++ b/elasticsearch/src/shutdown.rs @@ -31,11 +31,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -64,7 +64,7 @@ impl<'b> ShutdownDeleteNodeParts<'b> { } } } -#[doc = "Builder for the [Shutdown Delete Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3)\n\nRemoves a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[doc = "Builder for the [Shutdown Delete Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7)\n\nRemoves a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] #[derive(Clone, Debug)] pub struct ShutdownDeleteNode<'a, 'b> { transport: &'a Transport, @@ -131,7 +131,7 @@ impl<'a, 'b> ShutdownDeleteNode<'a, 'b> { #[doc = "Creates an asynchronous call to the Shutdown Delete Node API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -187,7 +187,7 @@ impl<'b> ShutdownGetNodeParts<'b> { } } } -#[doc = "Builder for the [Shutdown Get Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3)\n\nRetrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[doc = "Builder for the [Shutdown Get Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7)\n\nRetrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] #[derive(Clone, Debug)] pub struct ShutdownGetNode<'a, 'b> { transport: &'a Transport, @@ -196,6 +196,7 @@ pub struct ShutdownGetNode<'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>, @@ -211,6 +212,7 @@ impl<'a, 'b> ShutdownGetNode<'a, 'b> { error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -236,6 +238,11 @@ impl<'a, 'b> ShutdownGetNode<'a, 'b> { self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -254,7 +261,7 @@ impl<'a, 'b> ShutdownGetNode<'a, 'b> { #[doc = "Creates an asynchronous call to the Shutdown Get Node API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -265,6 +272,7 @@ impl<'a, 'b> ShutdownGetNode<'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>, } @@ -272,6 +280,7 @@ impl<'a, 'b> ShutdownGetNode<'a, 'b> { error_trace: self.error_trace, filter_path: self.filter_path, human: self.human, + master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, }; @@ -307,7 +316,7 @@ impl<'b> ShutdownPutNodeParts<'b> { } } } -#[doc = "Builder for the [Shutdown Put Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3)\n\nAdds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] +#[doc = "Builder for the [Shutdown Put Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7)\n\nAdds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] #[derive(Clone, Debug)] pub struct ShutdownPutNode<'a, 'b, B> { transport: &'a Transport, @@ -397,7 +406,7 @@ where #[doc = "Creates an asynchronous call to the Shutdown Put Node API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -440,18 +449,18 @@ impl<'a> Shutdown<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Shutdown Delete Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3)\n\nRemoves a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + #[doc = "[Shutdown Delete Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7)\n\nRemoves a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] pub fn delete_node<'b>( &'a self, parts: ShutdownDeleteNodeParts<'b>, ) -> ShutdownDeleteNode<'a, 'b> { ShutdownDeleteNode::new(self.transport(), parts) } - #[doc = "[Shutdown Get Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3)\n\nRetrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + #[doc = "[Shutdown Get Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7)\n\nRetrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] pub fn get_node<'b>(&'a self, parts: ShutdownGetNodeParts<'b>) -> ShutdownGetNode<'a, 'b> { ShutdownGetNode::new(self.transport(), parts) } - #[doc = "[Shutdown Put Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3)\n\nAdds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] + #[doc = "[Shutdown Put Node API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7)\n\nAdds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."] pub fn put_node<'b>(&'a self, parts: ShutdownPutNodeParts<'b>) -> ShutdownPutNode<'a, 'b, ()> { ShutdownPutNode::new(self.transport(), parts) } diff --git a/elasticsearch/src/simulate.rs b/elasticsearch/src/simulate.rs new file mode 100644 index 00000000..32b70009 --- /dev/null +++ b/elasticsearch/src/simulate.rs @@ -0,0 +1,237 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![cfg(feature = "experimental-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 "] +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[cfg(feature = "experimental-apis")] +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Simulate Ingest API"] +pub enum SimulateIngestParts<'b> { + #[doc = "No parts"] + None, + #[doc = "Index"] + Index(&'b str), +} +#[cfg(feature = "experimental-apis")] +impl<'b> SimulateIngestParts<'b> { + #[doc = "Builds a relative URL path to the Simulate Ingest API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SimulateIngestParts::None => "/_ingest/_simulate".into(), + SimulateIngestParts::Index(ref index) => { + let encoded_index: Cow = + percent_encode(index.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(19usize + encoded_index.len()); + p.push_str("/_ingest/"); + p.push_str(encoded_index.as_ref()); + p.push_str("/_simulate"); + p.into() + } + } + } +} +#[doc = "Builder for the [Simulate Ingest API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/simulate-ingest-api.html)\n\nSimulates running ingest with example documents."] +#[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 SimulateIngest<'a, 'b, B> { + transport: &'a Transport, + parts: SimulateIngestParts<'b>, + body: Option, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + pipeline: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +#[cfg(feature = "experimental-apis")] +impl<'a, 'b, B> SimulateIngest<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SimulateIngest] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SimulateIngestParts<'b>) -> Self { + let headers = HeaderMap::new(); + SimulateIngest { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pipeline: None, + pretty: None, + request_timeout: None, + source: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> SimulateIngest<'a, 'b, JsonBody> + where + T: Serialize, + { + SimulateIngest { + 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, + pipeline: self.pipeline, + 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 = "The pipeline id to preprocess incoming documents with if no pipeline is given for a particular document"] + pub fn pipeline(mut self, pipeline: &'b str) -> Self { + self.pipeline = Some(pipeline); + 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 Simulate Ingest API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => http::Method::Post, + None => 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, + pipeline: Option<&'b str>, + pretty: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + human: self.human, + pipeline: self.pipeline, + 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 Simulate 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")] +pub struct Simulate<'a> { + transport: &'a Transport, +} +#[cfg(feature = "experimental-apis")] +impl<'a> Simulate<'a> { + #[doc = "Creates a new instance of [Simulate]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Simulate Ingest API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/simulate-ingest-api.html)\n\nSimulates running ingest with example documents."] + #[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 ingest<'b>(&'a self, parts: SimulateIngestParts<'b>) -> SimulateIngest<'a, 'b, ()> { + SimulateIngest::new(self.transport(), parts) + } +} +#[cfg(feature = "experimental-apis")] +impl Elasticsearch { + #[doc = "Creates a namespace client for Simulate APIs"] + pub fn simulate(&self) -> Simulate { + Simulate::new(self.transport()) + } +} diff --git a/elasticsearch/src/slm.rs b/elasticsearch/src/slm.rs index 75b7353f..7bc7a344 100644 --- a/elasticsearch/src/slm.rs +++ b/elasticsearch/src/slm.rs @@ -38,11 +38,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -70,7 +70,7 @@ impl<'b> SlmDeleteLifecycleParts<'b> { } } } -#[doc = "Builder for the [Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] +#[doc = "Builder for the [Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] #[derive(Clone, Debug)] pub struct SlmDeleteLifecycle<'a, 'b> { transport: &'a Transport, @@ -137,7 +137,7 @@ impl<'a, 'b> SlmDeleteLifecycle<'a, 'b> { #[doc = "Creates an asynchronous call to the Slm Delete Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -190,7 +190,7 @@ impl<'b> SlmExecuteLifecycleParts<'b> { } } } -#[doc = "Builder for the [Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] +#[doc = "Builder for the [Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] #[derive(Clone, Debug)] pub struct SlmExecuteLifecycle<'a, 'b, B> { transport: &'a Transport, @@ -280,7 +280,7 @@ where #[doc = "Creates an asynchronous call to the Slm Execute Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -325,7 +325,7 @@ impl SlmExecuteRetentionParts { } } } -#[doc = "Builder for the [Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] +#[doc = "Builder for the [Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] #[derive(Clone, Debug)] pub struct SlmExecuteRetention<'a, 'b, B> { transport: &'a Transport, @@ -415,7 +415,7 @@ where #[doc = "Creates an asynchronous call to the Slm Execute Retention API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -471,7 +471,7 @@ impl<'b> SlmGetLifecycleParts<'b> { } } } -#[doc = "Builder for the [Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] +#[doc = "Builder for the [Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] #[derive(Clone, Debug)] pub struct SlmGetLifecycle<'a, 'b> { transport: &'a Transport, @@ -538,7 +538,7 @@ impl<'a, 'b> SlmGetLifecycle<'a, 'b> { #[doc = "Creates an asynchronous call to the Slm Get Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -583,7 +583,7 @@ impl SlmGetStatsParts { } } } -#[doc = "Builder for the [Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] +#[doc = "Builder for the [Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] #[derive(Clone, Debug)] pub struct SlmGetStats<'a, 'b> { transport: &'a Transport, @@ -650,7 +650,7 @@ impl<'a, 'b> SlmGetStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Slm Get Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -695,7 +695,7 @@ impl SlmGetStatusParts { } } } -#[doc = "Builder for the [Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] +#[doc = "Builder for the [Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] #[derive(Clone, Debug)] pub struct SlmGetStatus<'a, 'b> { transport: &'a Transport, @@ -762,7 +762,7 @@ impl<'a, 'b> SlmGetStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the Slm Get Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -814,7 +814,7 @@ impl<'b> SlmPutLifecycleParts<'b> { } } } -#[doc = "Builder for the [Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] +#[doc = "Builder for the [Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] #[derive(Clone, Debug)] pub struct SlmPutLifecycle<'a, 'b, B> { transport: &'a Transport, @@ -904,7 +904,7 @@ where #[doc = "Creates an asynchronous call to the Slm Put Lifecycle API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -949,7 +949,7 @@ impl SlmStartParts { } } } -#[doc = "Builder for the [Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] +#[doc = "Builder for the [Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] #[derive(Clone, Debug)] pub struct SlmStart<'a, 'b, B> { transport: &'a Transport, @@ -959,9 +959,11 @@ pub struct SlmStart<'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> SlmStart<'a, 'b, B> where @@ -978,9 +980,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"] @@ -996,9 +1000,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."] @@ -1021,6 +1027,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -1036,10 +1047,15 @@ where self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Slm Start API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1050,15 +1066,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) }; @@ -1084,7 +1104,7 @@ impl SlmStopParts { } } } -#[doc = "Builder for the [Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] +#[doc = "Builder for the [Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] #[derive(Clone, Debug)] pub struct SlmStop<'a, 'b, B> { transport: &'a Transport, @@ -1094,9 +1114,11 @@ pub struct SlmStop<'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> SlmStop<'a, 'b, B> where @@ -1113,9 +1135,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"] @@ -1131,9 +1155,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."] @@ -1156,6 +1182,11 @@ where self.human = Some(human); self } + #[doc = "Timeout for processing on master node"] + 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); @@ -1171,10 +1202,15 @@ where self.source = Some(source); self } + #[doc = "Timeout for acknowledgement of update from all nodes in cluster"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Slm Stop API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1185,15 +1221,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) }; @@ -1217,48 +1257,48 @@ impl<'a> Slm<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] + #[doc = "[Slm Delete Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-delete-policy.html)\n\nDeletes an existing snapshot lifecycle policy."] pub fn delete_lifecycle<'b>( &'a self, parts: SlmDeleteLifecycleParts<'b>, ) -> SlmDeleteLifecycle<'a, 'b> { SlmDeleteLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] + #[doc = "[Slm Execute Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-execute-lifecycle.html)\n\nImmediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time."] pub fn execute_lifecycle<'b>( &'a self, parts: SlmExecuteLifecycleParts<'b>, ) -> SlmExecuteLifecycle<'a, 'b, ()> { SlmExecuteLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] + #[doc = "[Slm Execute Retention API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-execute-retention.html)\n\nDeletes any snapshots that are expired according to the policy's retention rules."] pub fn execute_retention<'b>(&'a self) -> SlmExecuteRetention<'a, 'b, ()> { SlmExecuteRetention::new(self.transport()) } - #[doc = "[Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] + #[doc = "[Slm Get Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-get-policy.html)\n\nRetrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts."] pub fn get_lifecycle<'b>(&'a self, parts: SlmGetLifecycleParts<'b>) -> SlmGetLifecycle<'a, 'b> { SlmGetLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] + #[doc = "[Slm Get Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-get-stats.html)\n\nReturns global and policy-level statistics about actions taken by snapshot lifecycle management."] pub fn get_stats<'b>(&'a self) -> SlmGetStats<'a, 'b> { SlmGetStats::new(self.transport()) } - #[doc = "[Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] + #[doc = "[Slm Get Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-get-status.html)\n\nRetrieves the status of snapshot lifecycle management (SLM)."] pub fn get_status<'b>(&'a self) -> SlmGetStatus<'a, 'b> { SlmGetStatus::new(self.transport()) } - #[doc = "[Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] + #[doc = "[Slm Put Lifecycle API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-put-policy.html)\n\nCreates or updates a snapshot lifecycle policy."] pub fn put_lifecycle<'b>( &'a self, parts: SlmPutLifecycleParts<'b>, ) -> SlmPutLifecycle<'a, 'b, ()> { SlmPutLifecycle::new(self.transport(), parts) } - #[doc = "[Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] + #[doc = "[Slm Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-start.html)\n\nTurns on snapshot lifecycle management (SLM)."] pub fn start<'b>(&'a self) -> SlmStart<'a, 'b, ()> { SlmStart::new(self.transport()) } - #[doc = "[Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] + #[doc = "[Slm Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/slm-api-stop.html)\n\nTurns off snapshot lifecycle management (SLM)."] pub fn stop<'b>(&'a self) -> SlmStop<'a, 'b, ()> { SlmStop::new(self.transport()) } diff --git a/elasticsearch/src/snapshot.rs b/elasticsearch/src/snapshot.rs index d0ce1996..60b70f7d 100644 --- a/elasticsearch/src/snapshot.rs +++ b/elasticsearch/src/snapshot.rs @@ -36,11 +36,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -69,7 +69,7 @@ impl<'b> SnapshotCleanupRepositoryParts<'b> { } } } -#[doc = "Builder for the [Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] +#[doc = "Builder for the [Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] #[derive(Clone, Debug)] pub struct SnapshotCleanupRepository<'a, 'b, B> { transport: &'a Transport, @@ -175,7 +175,7 @@ where #[doc = "Creates an asynchronous call to the Snapshot Cleanup Repository API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -248,7 +248,7 @@ impl<'b> SnapshotCloneParts<'b> { } } } -#[doc = "Builder for the [Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."] +#[doc = "Builder for the [Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."] #[derive(Clone, Debug)] pub struct SnapshotClone<'a, 'b, B> { transport: &'a Transport, @@ -346,7 +346,7 @@ where #[doc = "Creates an asynchronous call to the Snapshot Clone API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -406,7 +406,7 @@ impl<'b> SnapshotCreateParts<'b> { } } } -#[doc = "Builder for the [Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nCreates a snapshot in a repository."] +#[doc = "Builder for the [Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nCreates a snapshot in a repository."] #[derive(Clone, Debug)] pub struct SnapshotCreate<'a, 'b, B> { transport: &'a Transport, @@ -512,7 +512,7 @@ where #[doc = "Creates an asynchronous call to the Snapshot Create API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -568,7 +568,7 @@ impl<'b> SnapshotCreateRepositoryParts<'b> { } } } -#[doc = "Builder for the [Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nCreates a repository."] +#[doc = "Builder for the [Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nCreates a repository."] #[derive(Clone, Debug)] pub struct SnapshotCreateRepository<'a, 'b, B> { transport: &'a Transport, @@ -682,7 +682,7 @@ where #[doc = "Creates an asynchronous call to the Snapshot Create Repository API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -747,7 +747,7 @@ impl<'b> SnapshotDeleteParts<'b> { } } } -#[doc = "Builder for the [Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nDeletes one or more snapshots."] +#[doc = "Builder for the [Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nDeletes one or more snapshots."] #[derive(Clone, Debug)] pub struct SnapshotDelete<'a, 'b> { transport: &'a Transport, @@ -760,6 +760,7 @@ pub struct SnapshotDelete<'a, 'b> { pretty: Option, request_timeout: Option, source: Option<&'b str>, + wait_for_completion: Option, } impl<'a, 'b> SnapshotDelete<'a, 'b> { #[doc = "Creates a new instance of [SnapshotDelete] with the specified API parts"] @@ -776,6 +777,7 @@ impl<'a, 'b> SnapshotDelete<'a, 'b> { pretty: None, request_timeout: None, source: None, + wait_for_completion: None, } } #[doc = "Include the stack trace of returned errors."] @@ -818,10 +820,15 @@ impl<'a, 'b> SnapshotDelete<'a, 'b> { self.source = Some(source); self } + #[doc = "Should this request wait until the operation has completed before returning"] + pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self { + self.wait_for_completion = Some(wait_for_completion); + self + } #[doc = "Creates an asynchronous call to the Snapshot Delete API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -835,6 +842,7 @@ impl<'a, 'b> SnapshotDelete<'a, 'b> { master_timeout: Option<&'b str>, pretty: Option, source: Option<&'b str>, + wait_for_completion: Option, } let query_params = QueryParams { error_trace: self.error_trace, @@ -843,6 +851,7 @@ impl<'a, 'b> SnapshotDelete<'a, 'b> { master_timeout: self.master_timeout, pretty: self.pretty, source: self.source, + wait_for_completion: self.wait_for_completion, }; Some(query_params) }; @@ -876,7 +885,7 @@ impl<'b> SnapshotDeleteRepositoryParts<'b> { } } } -#[doc = "Builder for the [Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nDeletes a repository."] +#[doc = "Builder for the [Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nDeletes a repository."] #[derive(Clone, Debug)] pub struct SnapshotDeleteRepository<'a, 'b> { transport: &'a Transport, @@ -957,7 +966,7 @@ impl<'a, 'b> SnapshotDeleteRepository<'a, 'b> { #[doc = "Creates an asynchronous call to the Snapshot Delete Repository API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1020,7 +1029,7 @@ impl<'b> SnapshotGetParts<'b> { } } } -#[doc = "Builder for the [Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nReturns information about a snapshot."] +#[doc = "Builder for the [Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nReturns information about a snapshot."] #[derive(Clone, Debug)] pub struct SnapshotGet<'a, 'b> { transport: &'a Transport, @@ -1178,7 +1187,7 @@ impl<'a, 'b> SnapshotGet<'a, 'b> { #[doc = "Creates an asynchronous call to the Snapshot Get API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1260,7 +1269,7 @@ impl<'b> SnapshotGetRepositoryParts<'b> { } } } -#[doc = "Builder for the [Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nReturns information about a repository."] +#[doc = "Builder for the [Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nReturns information about a repository."] #[derive(Clone, Debug)] pub struct SnapshotGetRepository<'a, 'b> { transport: &'a Transport, @@ -1341,7 +1350,7 @@ impl<'a, 'b> SnapshotGetRepository<'a, 'b> { #[doc = "Creates an asynchronous call to the Snapshot Get Repository API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1398,7 +1407,7 @@ impl<'b> SnapshotRepositoryAnalyzeParts<'b> { } } } -#[doc = "Builder for the [Snapshot Repository Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nAnalyzes a repository for correctness and performance"] +#[doc = "Builder for the [Snapshot Repository Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nAnalyzes a repository for correctness and performance"] #[derive(Clone, Debug)] pub struct SnapshotRepositoryAnalyze<'a, 'b, B> { transport: &'a Transport, @@ -1576,7 +1585,7 @@ where #[doc = "Creates an asynchronous call to the Snapshot Repository Analyze API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1657,7 +1666,7 @@ impl<'b> SnapshotRestoreParts<'b> { } } } -#[doc = "Builder for the [Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nRestores a snapshot."] +#[doc = "Builder for the [Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nRestores a snapshot."] #[derive(Clone, Debug)] pub struct SnapshotRestore<'a, 'b, B> { transport: &'a Transport, @@ -1763,7 +1772,7 @@ where #[doc = "Creates an asynchronous call to the Snapshot Restore API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1841,7 +1850,7 @@ impl<'b> SnapshotStatusParts<'b> { } } } -#[doc = "Builder for the [Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] +#[doc = "Builder for the [Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] #[derive(Clone, Debug)] pub struct SnapshotStatus<'a, 'b> { transport: &'a Transport, @@ -1922,7 +1931,7 @@ impl<'a, 'b> SnapshotStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the Snapshot Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1979,7 +1988,7 @@ impl<'b> SnapshotVerifyRepositoryParts<'b> { } } } -#[doc = "Builder for the [Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nVerifies a repository."] +#[doc = "Builder for the [Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nVerifies a repository."] #[derive(Clone, Debug)] pub struct SnapshotVerifyRepository<'a, 'b, B> { transport: &'a Transport, @@ -2085,7 +2094,7 @@ where #[doc = "Creates an asynchronous call to the Snapshot Verify Repository API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -2132,66 +2141,66 @@ impl<'a> Snapshot<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] + #[doc = "[Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."] pub fn cleanup_repository<'b>( &'a self, parts: SnapshotCleanupRepositoryParts<'b>, ) -> SnapshotCleanupRepository<'a, 'b, ()> { SnapshotCleanupRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."] + #[doc = "[Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."] pub fn clone<'b>(&'a self, parts: SnapshotCloneParts<'b>) -> SnapshotClone<'a, 'b, ()> { SnapshotClone::new(self.transport(), parts) } - #[doc = "[Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nCreates a snapshot in a repository."] + #[doc = "[Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nCreates a snapshot in a repository."] pub fn create<'b>(&'a self, parts: SnapshotCreateParts<'b>) -> SnapshotCreate<'a, 'b, ()> { SnapshotCreate::new(self.transport(), parts) } - #[doc = "[Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nCreates a repository."] + #[doc = "[Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nCreates a repository."] pub fn create_repository<'b>( &'a self, parts: SnapshotCreateRepositoryParts<'b>, ) -> SnapshotCreateRepository<'a, 'b, ()> { SnapshotCreateRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nDeletes one or more snapshots."] + #[doc = "[Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nDeletes one or more snapshots."] pub fn delete<'b>(&'a self, parts: SnapshotDeleteParts<'b>) -> SnapshotDelete<'a, 'b> { SnapshotDelete::new(self.transport(), parts) } - #[doc = "[Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nDeletes a repository."] + #[doc = "[Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nDeletes a repository."] pub fn delete_repository<'b>( &'a self, parts: SnapshotDeleteRepositoryParts<'b>, ) -> SnapshotDeleteRepository<'a, 'b> { SnapshotDeleteRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nReturns information about a snapshot."] + #[doc = "[Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nReturns information about a snapshot."] pub fn get<'b>(&'a self, parts: SnapshotGetParts<'b>) -> SnapshotGet<'a, 'b> { SnapshotGet::new(self.transport(), parts) } - #[doc = "[Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nReturns information about a repository."] + #[doc = "[Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nReturns information about a repository."] pub fn get_repository<'b>( &'a self, parts: SnapshotGetRepositoryParts<'b>, ) -> SnapshotGetRepository<'a, 'b> { SnapshotGetRepository::new(self.transport(), parts) } - #[doc = "[Snapshot Repository Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nAnalyzes a repository for correctness and performance"] + #[doc = "[Snapshot Repository Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nAnalyzes a repository for correctness and performance"] pub fn repository_analyze<'b>( &'a self, parts: SnapshotRepositoryAnalyzeParts<'b>, ) -> SnapshotRepositoryAnalyze<'a, 'b, ()> { SnapshotRepositoryAnalyze::new(self.transport(), parts) } - #[doc = "[Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nRestores a snapshot."] + #[doc = "[Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nRestores a snapshot."] pub fn restore<'b>(&'a self, parts: SnapshotRestoreParts<'b>) -> SnapshotRestore<'a, 'b, ()> { SnapshotRestore::new(self.transport(), parts) } - #[doc = "[Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] + #[doc = "[Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nReturns information about the status of a snapshot."] pub fn status<'b>(&'a self, parts: SnapshotStatusParts<'b>) -> SnapshotStatus<'a, 'b> { SnapshotStatus::new(self.transport(), parts) } - #[doc = "[Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/modules-snapshots.html)\n\nVerifies a repository."] + #[doc = "[Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/modules-snapshots.html)\n\nVerifies a repository."] pub fn verify_repository<'b>( &'a self, parts: SnapshotVerifyRepositoryParts<'b>, diff --git a/elasticsearch/src/sql.rs b/elasticsearch/src/sql.rs index f3165750..e0b368c3 100644 --- a/elasticsearch/src/sql.rs +++ b/elasticsearch/src/sql.rs @@ -33,11 +33,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -58,7 +58,7 @@ impl SqlClearCursorParts { } } } -#[doc = "Builder for the [Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clear-sql-cursor-api.html)\n\nClears the SQL cursor"] +#[doc = "Builder for the [Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-sql-cursor-api.html)\n\nClears the SQL cursor"] #[derive(Clone, Debug)] pub struct SqlClearCursor<'a, 'b, B> { transport: &'a Transport, @@ -148,7 +148,7 @@ where #[doc = "Creates an asynchronous call to the Sql Clear Cursor API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -199,7 +199,7 @@ impl<'b> SqlDeleteAsyncParts<'b> { } } } -#[doc = "Builder for the [Sql Delete Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-async-sql-search-api.html)\n\nDeletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it."] +#[doc = "Builder for the [Sql Delete Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-async-sql-search-api.html)\n\nDeletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it."] #[derive(Clone, Debug)] pub struct SqlDeleteAsync<'a, 'b> { transport: &'a Transport, @@ -266,7 +266,7 @@ impl<'a, 'b> SqlDeleteAsync<'a, 'b> { #[doc = "Creates an asynchronous call to the Sql Delete Async API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -317,7 +317,7 @@ impl<'b> SqlGetAsyncParts<'b> { } } } -#[doc = "Builder for the [Sql Get Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-async-sql-search-api.html)\n\nReturns the current status and available results for an async SQL search or stored synchronous SQL search"] +#[doc = "Builder for the [Sql Get Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-async-sql-search-api.html)\n\nReturns the current status and available results for an async SQL search or stored synchronous SQL search"] #[derive(Clone, Debug)] pub struct SqlGetAsync<'a, 'b> { transport: &'a Transport, @@ -412,7 +412,7 @@ impl<'a, 'b> SqlGetAsync<'a, 'b> { #[doc = "Creates an asynchronous call to the Sql Get Async API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -471,7 +471,7 @@ impl<'b> SqlGetAsyncStatusParts<'b> { } } } -#[doc = "Builder for the [Sql Get Async Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-async-sql-search-status-api.html)\n\nReturns the current status of an async SQL search or a stored synchronous SQL search"] +#[doc = "Builder for the [Sql Get Async Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-async-sql-search-status-api.html)\n\nReturns the current status of an async SQL search or a stored synchronous SQL search"] #[derive(Clone, Debug)] pub struct SqlGetAsyncStatus<'a, 'b> { transport: &'a Transport, @@ -538,7 +538,7 @@ impl<'a, 'b> SqlGetAsyncStatus<'a, 'b> { #[doc = "Creates an asynchronous call to the Sql Get Async Status API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -583,7 +583,7 @@ impl SqlQueryParts { } } } -#[doc = "Builder for the [Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/sql-search-api.html)\n\nExecutes a SQL request"] +#[doc = "Builder for the [Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/sql-search-api.html)\n\nExecutes a SQL request"] #[derive(Clone, Debug)] pub struct SqlQuery<'a, 'b, B> { transport: &'a Transport, @@ -682,8 +682,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -731,7 +731,7 @@ impl SqlTranslateParts { } } } -#[doc = "Builder for the [Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/sql-translate-api.html)\n\nTranslates SQL into Elasticsearch queries"] +#[doc = "Builder for the [Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/sql-translate-api.html)\n\nTranslates SQL into Elasticsearch queries"] #[derive(Clone, Debug)] pub struct SqlTranslate<'a, 'b, B> { transport: &'a Transport, @@ -822,8 +822,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -867,30 +867,30 @@ impl<'a> Sql<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/clear-sql-cursor-api.html)\n\nClears the SQL cursor"] + #[doc = "[Sql Clear Cursor API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/clear-sql-cursor-api.html)\n\nClears the SQL cursor"] pub fn clear_cursor<'b>(&'a self) -> SqlClearCursor<'a, 'b, ()> { SqlClearCursor::new(self.transport()) } - #[doc = "[Sql Delete Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-async-sql-search-api.html)\n\nDeletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it."] + #[doc = "[Sql Delete Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-async-sql-search-api.html)\n\nDeletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it."] pub fn delete_async<'b>(&'a self, parts: SqlDeleteAsyncParts<'b>) -> SqlDeleteAsync<'a, 'b> { SqlDeleteAsync::new(self.transport(), parts) } - #[doc = "[Sql Get Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-async-sql-search-api.html)\n\nReturns the current status and available results for an async SQL search or stored synchronous SQL search"] + #[doc = "[Sql Get Async API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-async-sql-search-api.html)\n\nReturns the current status and available results for an async SQL search or stored synchronous SQL search"] pub fn get_async<'b>(&'a self, parts: SqlGetAsyncParts<'b>) -> SqlGetAsync<'a, 'b> { SqlGetAsync::new(self.transport(), parts) } - #[doc = "[Sql Get Async Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-async-sql-search-status-api.html)\n\nReturns the current status of an async SQL search or a stored synchronous SQL search"] + #[doc = "[Sql Get Async Status API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-async-sql-search-status-api.html)\n\nReturns the current status of an async SQL search or a stored synchronous SQL search"] pub fn get_async_status<'b>( &'a self, parts: SqlGetAsyncStatusParts<'b>, ) -> SqlGetAsyncStatus<'a, 'b> { SqlGetAsyncStatus::new(self.transport(), parts) } - #[doc = "[Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/sql-search-api.html)\n\nExecutes a SQL request"] + #[doc = "[Sql Query API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/sql-search-api.html)\n\nExecutes a SQL request"] pub fn query<'b>(&'a self) -> SqlQuery<'a, 'b, ()> { SqlQuery::new(self.transport()) } - #[doc = "[Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/sql-translate-api.html)\n\nTranslates SQL into Elasticsearch queries"] + #[doc = "[Sql Translate API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/sql-translate-api.html)\n\nTranslates SQL into Elasticsearch queries"] pub fn translate<'b>(&'a self) -> SqlTranslate<'a, 'b, ()> { SqlTranslate::new(self.transport()) } diff --git a/elasticsearch/src/ssl.rs b/elasticsearch/src/ssl.rs index acf53bb5..c6f62f67 100644 --- a/elasticsearch/src/ssl.rs +++ b/elasticsearch/src/ssl.rs @@ -33,11 +33,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -58,7 +58,7 @@ impl SslCertificatesParts { } } } -#[doc = "Builder for the [Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] +#[doc = "Builder for the [Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] #[derive(Clone, Debug)] pub struct SslCertificates<'a, 'b> { transport: &'a Transport, @@ -125,7 +125,7 @@ impl<'a, 'b> SslCertificates<'a, 'b> { #[doc = "Creates an asynchronous call to the Ssl Certificates API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -168,7 +168,7 @@ impl<'a> Ssl<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] + #[doc = "[Ssl Certificates API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/security-api-ssl.html)\n\nRetrieves information about the X.509 certificates used to encrypt communications in the cluster."] pub fn certificates<'b>(&'a self) -> SslCertificates<'a, 'b> { SslCertificates::new(self.transport()) } diff --git a/elasticsearch/src/synonyms.rs b/elasticsearch/src/synonyms.rs new file mode 100644 index 00000000..c733adef --- /dev/null +++ b/elasticsearch/src/synonyms.rs @@ -0,0 +1,1027 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// ----------------------------------------------- +// This file is generated, Please do not edit it manually. +// Run the following in the root of the repo to regenerate: +// +// cargo make generate-api +// ----------------------------------------------- + +#![allow(unused_imports)] +use crate::{ + client::Elasticsearch, + error::Error, + http::{ + self, + headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, + request::{Body, JsonBody, NdBody, PARTS_ENCODED}, + response::Response, + transport::Transport, + }, + params::*, +}; +use percent_encoding::percent_encode; +use serde::Serialize; +use std::{borrow::Cow, time::Duration}; +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Synonyms Delete Synonym API"] +pub enum SynonymsDeleteSynonymParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> SynonymsDeleteSynonymParts<'b> { + #[doc = "Builds a relative URL path to the Synonyms Delete Synonym API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SynonymsDeleteSynonymParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_id.len()); + p.push_str("/_synonyms/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Synonyms Delete Synonym API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-synonyms-set.html)\n\nDeletes a synonym set"] +#[derive(Clone, Debug)] +pub struct SynonymsDeleteSynonym<'a, 'b> { + transport: &'a Transport, + parts: SynonymsDeleteSynonymParts<'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> SynonymsDeleteSynonym<'a, 'b> { + #[doc = "Creates a new instance of [SynonymsDeleteSynonym] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SynonymsDeleteSynonymParts<'b>) -> Self { + let headers = HeaderMap::new(); + SynonymsDeleteSynonym { + 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 Synonyms Delete Synonym 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)] +#[doc = "API parts for the Synonyms Delete Synonym Rule API"] +pub enum SynonymsDeleteSynonymRuleParts<'b> { + #[doc = "SetId and RuleId"] + SetIdRuleId(&'b str, &'b str), +} +impl<'b> SynonymsDeleteSynonymRuleParts<'b> { + #[doc = "Builds a relative URL path to the Synonyms Delete Synonym Rule API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SynonymsDeleteSynonymRuleParts::SetIdRuleId(ref set_id, ref rule_id) => { + let encoded_set_id: Cow = + percent_encode(set_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_rule_id: Cow = + percent_encode(rule_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(12usize + encoded_set_id.len() + encoded_rule_id.len()); + p.push_str("/_synonyms/"); + p.push_str(encoded_set_id.as_ref()); + p.push_str("/"); + p.push_str(encoded_rule_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Synonyms Delete Synonym Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-synonym-rule.html)\n\nDeletes a synonym rule in a synonym set"] +#[derive(Clone, Debug)] +pub struct SynonymsDeleteSynonymRule<'a, 'b> { + transport: &'a Transport, + parts: SynonymsDeleteSynonymRuleParts<'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> SynonymsDeleteSynonymRule<'a, 'b> { + #[doc = "Creates a new instance of [SynonymsDeleteSynonymRule] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SynonymsDeleteSynonymRuleParts<'b>) -> Self { + let headers = HeaderMap::new(); + SynonymsDeleteSynonymRule { + 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 Synonyms Delete Synonym Rule 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)] +#[doc = "API parts for the Synonyms Get Synonym API"] +pub enum SynonymsGetSynonymParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> SynonymsGetSynonymParts<'b> { + #[doc = "Builds a relative URL path to the Synonyms Get Synonym API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SynonymsGetSynonymParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_id.len()); + p.push_str("/_synonyms/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Synonyms Get Synonym API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-synonyms-set.html)\n\nRetrieves a synonym set"] +#[derive(Clone, Debug)] +pub struct SynonymsGetSynonym<'a, 'b> { + transport: &'a Transport, + parts: SynonymsGetSynonymParts<'b>, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + size: Option, + source: Option<&'b str>, +} +impl<'a, 'b> SynonymsGetSynonym<'a, 'b> { + #[doc = "Creates a new instance of [SynonymsGetSynonym] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SynonymsGetSynonymParts<'b>) -> Self { + let headers = HeaderMap::new(); + SynonymsGetSynonym { + transport, + parts, + headers, + error_trace: None, + filter_path: None, + from: None, + human: None, + pretty: None, + request_timeout: None, + size: 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 = "Starting offset"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + 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 = "specifies a max number of results to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + 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 Synonyms Get Synonym 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]>, + from: Option, + human: Option, + pretty: Option, + size: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + pretty: self.pretty, + size: self.size, + 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)] +#[doc = "API parts for the Synonyms Get Synonym Rule API"] +pub enum SynonymsGetSynonymRuleParts<'b> { + #[doc = "SetId and RuleId"] + SetIdRuleId(&'b str, &'b str), +} +impl<'b> SynonymsGetSynonymRuleParts<'b> { + #[doc = "Builds a relative URL path to the Synonyms Get Synonym Rule API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SynonymsGetSynonymRuleParts::SetIdRuleId(ref set_id, ref rule_id) => { + let encoded_set_id: Cow = + percent_encode(set_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_rule_id: Cow = + percent_encode(rule_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(12usize + encoded_set_id.len() + encoded_rule_id.len()); + p.push_str("/_synonyms/"); + p.push_str(encoded_set_id.as_ref()); + p.push_str("/"); + p.push_str(encoded_rule_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Synonyms Get Synonym Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-synonym-rule.html)\n\nRetrieves a synonym rule from a synonym set"] +#[derive(Clone, Debug)] +pub struct SynonymsGetSynonymRule<'a, 'b> { + transport: &'a Transport, + parts: SynonymsGetSynonymRuleParts<'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> SynonymsGetSynonymRule<'a, 'b> { + #[doc = "Creates a new instance of [SynonymsGetSynonymRule] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SynonymsGetSynonymRuleParts<'b>) -> Self { + let headers = HeaderMap::new(); + SynonymsGetSynonymRule { + 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 Synonyms Get Synonym Rule 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)] +#[doc = "API parts for the Synonyms Get Synonyms Sets API"] +pub enum SynonymsGetSynonymsSetsParts { + #[doc = "No parts"] + None, +} +impl SynonymsGetSynonymsSetsParts { + #[doc = "Builds a relative URL path to the Synonyms Get Synonyms Sets API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SynonymsGetSynonymsSetsParts::None => "/_synonyms".into(), + } + } +} +#[doc = "Builder for the [Synonyms Get Synonyms Sets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-synonyms-sets.html)\n\nRetrieves a summary of all defined synonym sets"] +#[derive(Clone, Debug)] +pub struct SynonymsGetSynonymsSets<'a, 'b> { + transport: &'a Transport, + parts: SynonymsGetSynonymsSetsParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + from: Option, + headers: HeaderMap, + human: Option, + pretty: Option, + request_timeout: Option, + size: Option, + source: Option<&'b str>, +} +impl<'a, 'b> SynonymsGetSynonymsSets<'a, 'b> { + #[doc = "Creates a new instance of [SynonymsGetSynonymsSets]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + SynonymsGetSynonymsSets { + transport, + parts: SynonymsGetSynonymsSetsParts::None, + headers, + error_trace: None, + filter_path: None, + from: None, + human: None, + pretty: None, + request_timeout: None, + size: 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 = "Starting offset"] + pub fn from(mut self, from: i32) -> Self { + self.from = Some(from); + 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 = "specifies a max number of results to get"] + pub fn size(mut self, size: i32) -> Self { + self.size = Some(size); + 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 Synonyms Get Synonyms Sets 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]>, + from: Option, + human: Option, + pretty: Option, + size: Option, + source: Option<&'b str>, + } + let query_params = QueryParams { + error_trace: self.error_trace, + filter_path: self.filter_path, + from: self.from, + human: self.human, + pretty: self.pretty, + size: self.size, + 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)] +#[doc = "API parts for the Synonyms Put Synonym API"] +pub enum SynonymsPutSynonymParts<'b> { + #[doc = "Id"] + Id(&'b str), +} +impl<'b> SynonymsPutSynonymParts<'b> { + #[doc = "Builds a relative URL path to the Synonyms Put Synonym API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SynonymsPutSynonymParts::Id(ref id) => { + let encoded_id: Cow = percent_encode(id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(11usize + encoded_id.len()); + p.push_str("/_synonyms/"); + p.push_str(encoded_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Synonyms Put Synonym API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-synonyms-set.html)\n\nCreates or updates a synonyms set"] +#[derive(Clone, Debug)] +pub struct SynonymsPutSynonym<'a, 'b, B> { + transport: &'a Transport, + parts: SynonymsPutSynonymParts<'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> SynonymsPutSynonym<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SynonymsPutSynonym] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SynonymsPutSynonymParts<'b>) -> Self { + let headers = HeaderMap::new(); + SynonymsPutSynonym { + 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) -> SynonymsPutSynonym<'a, 'b, JsonBody> + where + T: Serialize, + { + SynonymsPutSynonym { + 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 Synonyms Put Synonym 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)] +#[doc = "API parts for the Synonyms Put Synonym Rule API"] +pub enum SynonymsPutSynonymRuleParts<'b> { + #[doc = "SetId and RuleId"] + SetIdRuleId(&'b str, &'b str), +} +impl<'b> SynonymsPutSynonymRuleParts<'b> { + #[doc = "Builds a relative URL path to the Synonyms Put Synonym Rule API"] + pub fn url(self) -> Cow<'static, str> { + match self { + SynonymsPutSynonymRuleParts::SetIdRuleId(ref set_id, ref rule_id) => { + let encoded_set_id: Cow = + percent_encode(set_id.as_bytes(), PARTS_ENCODED).into(); + let encoded_rule_id: Cow = + percent_encode(rule_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = + String::with_capacity(12usize + encoded_set_id.len() + encoded_rule_id.len()); + p.push_str("/_synonyms/"); + p.push_str(encoded_set_id.as_ref()); + p.push_str("/"); + p.push_str(encoded_rule_id.as_ref()); + p.into() + } + } + } +} +#[doc = "Builder for the [Synonyms Put Synonym Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-synonym-rule.html)\n\nCreates or updates a synonym rule in a synonym set"] +#[derive(Clone, Debug)] +pub struct SynonymsPutSynonymRule<'a, 'b, B> { + transport: &'a Transport, + parts: SynonymsPutSynonymRuleParts<'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> SynonymsPutSynonymRule<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [SynonymsPutSynonymRule] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: SynonymsPutSynonymRuleParts<'b>) -> Self { + let headers = HeaderMap::new(); + SynonymsPutSynonymRule { + 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) -> SynonymsPutSynonymRule<'a, 'b, JsonBody> + where + T: Serialize, + { + SynonymsPutSynonymRule { + 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 Synonyms Put Synonym Rule 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) + } +} +#[doc = "Namespace client for Synonyms APIs"] +pub struct Synonyms<'a> { + transport: &'a Transport, +} +impl<'a> Synonyms<'a> { + #[doc = "Creates a new instance of [Synonyms]"] + pub fn new(transport: &'a Transport) -> Self { + Self { transport } + } + pub fn transport(&self) -> &Transport { + self.transport + } + #[doc = "[Synonyms Delete Synonym API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-synonyms-set.html)\n\nDeletes a synonym set"] + pub fn delete_synonym<'b>( + &'a self, + parts: SynonymsDeleteSynonymParts<'b>, + ) -> SynonymsDeleteSynonym<'a, 'b> { + SynonymsDeleteSynonym::new(self.transport(), parts) + } + #[doc = "[Synonyms Delete Synonym Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-synonym-rule.html)\n\nDeletes a synonym rule in a synonym set"] + pub fn delete_synonym_rule<'b>( + &'a self, + parts: SynonymsDeleteSynonymRuleParts<'b>, + ) -> SynonymsDeleteSynonymRule<'a, 'b> { + SynonymsDeleteSynonymRule::new(self.transport(), parts) + } + #[doc = "[Synonyms Get Synonym API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-synonyms-set.html)\n\nRetrieves a synonym set"] + pub fn get_synonym<'b>( + &'a self, + parts: SynonymsGetSynonymParts<'b>, + ) -> SynonymsGetSynonym<'a, 'b> { + SynonymsGetSynonym::new(self.transport(), parts) + } + #[doc = "[Synonyms Get Synonym Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-synonym-rule.html)\n\nRetrieves a synonym rule from a synonym set"] + pub fn get_synonym_rule<'b>( + &'a self, + parts: SynonymsGetSynonymRuleParts<'b>, + ) -> SynonymsGetSynonymRule<'a, 'b> { + SynonymsGetSynonymRule::new(self.transport(), parts) + } + #[doc = "[Synonyms Get Synonyms Sets API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/list-synonyms-sets.html)\n\nRetrieves a summary of all defined synonym sets"] + pub fn get_synonyms_sets<'b>(&'a self) -> SynonymsGetSynonymsSets<'a, 'b> { + SynonymsGetSynonymsSets::new(self.transport()) + } + #[doc = "[Synonyms Put Synonym API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-synonyms-set.html)\n\nCreates or updates a synonyms set"] + pub fn put_synonym<'b>( + &'a self, + parts: SynonymsPutSynonymParts<'b>, + ) -> SynonymsPutSynonym<'a, 'b, ()> { + SynonymsPutSynonym::new(self.transport(), parts) + } + #[doc = "[Synonyms Put Synonym Rule API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-synonym-rule.html)\n\nCreates or updates a synonym rule in a synonym set"] + pub fn put_synonym_rule<'b>( + &'a self, + parts: SynonymsPutSynonymRuleParts<'b>, + ) -> SynonymsPutSynonymRule<'a, 'b, ()> { + SynonymsPutSynonymRule::new(self.transport(), parts) + } +} +impl Elasticsearch { + #[doc = "Creates a namespace client for Synonyms APIs"] + pub fn synonyms(&self) -> Synonyms { + Synonyms::new(self.transport()) + } +} diff --git a/elasticsearch/src/tasks.rs b/elasticsearch/src/tasks.rs index 67bc669a..580ffb63 100644 --- a/elasticsearch/src/tasks.rs +++ b/elasticsearch/src/tasks.rs @@ -35,11 +35,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -73,7 +73,7 @@ impl<'b> TasksCancelParts<'b> { } } } -#[doc = "Builder for the [Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] +#[doc = "Builder for the [Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] #[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)] @@ -198,7 +198,7 @@ where #[doc = "Creates an asynchronous call to the Tasks Cancel API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -262,7 +262,7 @@ impl<'b> TasksGetParts<'b> { } } } -#[doc = "Builder for the [Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nReturns information about a task."] +#[doc = "Builder for the [Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nReturns information about a task."] #[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)] @@ -346,7 +346,7 @@ impl<'a, 'b> TasksGet<'a, 'b> { #[doc = "Creates an asynchronous call to the Tasks Get API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -397,7 +397,7 @@ impl TasksListParts { } } } -#[doc = "Builder for the [Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nReturns a list of tasks."] +#[doc = "Builder for the [Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nReturns a list of tasks."] #[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)] @@ -516,7 +516,7 @@ impl<'a, 'b> TasksList<'a, 'b> { #[doc = "Creates an asynchronous call to the Tasks List API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -578,19 +578,19 @@ impl<'a> Tasks<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] + #[doc = "[Tasks Cancel API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nCancels a task, if it can be cancelled through an API."] #[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 cancel<'b>(&'a self, parts: TasksCancelParts<'b>) -> TasksCancel<'a, 'b, ()> { TasksCancel::new(self.transport(), parts) } - #[doc = "[Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nReturns information about a task."] + #[doc = "[Tasks Get API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nReturns information about a task."] #[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<'b>(&'a self, parts: TasksGetParts<'b>) -> TasksGet<'a, 'b> { TasksGet::new(self.transport(), parts) } - #[doc = "[Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/tasks.html)\n\nReturns a list of tasks."] + #[doc = "[Tasks List API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/tasks.html)\n\nReturns a list of tasks."] #[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 list<'b>(&'a self) -> TasksList<'a, 'b> { diff --git a/elasticsearch/src/text_structure.rs b/elasticsearch/src/text_structure.rs index 2ef29adc..cbbbe6c2 100644 --- a/elasticsearch/src/text_structure.rs +++ b/elasticsearch/src/text_structure.rs @@ -34,11 +34,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -46,6 +46,498 @@ use percent_encoding::percent_encode; use serde::Serialize; use std::{borrow::Cow, time::Duration}; #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Text Structure Find Field Structure API"] +pub enum TextStructureFindFieldStructureParts { + #[doc = "No parts"] + None, +} +impl TextStructureFindFieldStructureParts { + #[doc = "Builds a relative URL path to the Text Structure Find Field Structure API"] + pub fn url(self) -> Cow<'static, str> { + match self { + TextStructureFindFieldStructureParts::None => { + "/_text_structure/find_field_structure".into() + } + } + } +} +#[doc = "Builder for the [Text Structure Find Field Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/find-field-structure.html)\n\nFinds the structure of a text field in an index."] +#[derive(Clone, Debug)] +pub struct TextStructureFindFieldStructure<'a, 'b> { + transport: &'a Transport, + parts: TextStructureFindFieldStructureParts, + column_names: Option<&'b [&'b str]>, + delimiter: Option<&'b str>, + documents_to_sample: Option, + ecs_compatibility: Option<&'b str>, + error_trace: Option, + explain: Option, + field: Option<&'b str>, + filter_path: Option<&'b [&'b str]>, + format: Option, + grok_pattern: Option<&'b str>, + headers: HeaderMap, + human: Option, + index: Option<&'b str>, + pretty: Option, + quote: Option<&'b str>, + request_timeout: Option, + should_trim_fields: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + timestamp_field: Option<&'b str>, + timestamp_format: Option<&'b str>, +} +impl<'a, 'b> TextStructureFindFieldStructure<'a, 'b> { + #[doc = "Creates a new instance of [TextStructureFindFieldStructure]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + TextStructureFindFieldStructure { + transport, + parts: TextStructureFindFieldStructureParts::None, + headers, + column_names: None, + delimiter: None, + documents_to_sample: None, + ecs_compatibility: None, + error_trace: None, + explain: None, + field: None, + filter_path: None, + format: None, + grok_pattern: None, + human: None, + index: None, + pretty: None, + quote: None, + request_timeout: None, + should_trim_fields: None, + source: None, + timeout: None, + timestamp_field: None, + timestamp_format: None, + } + } + #[doc = "Optional parameter containing a comma separated list of the column names for a delimited file"] + pub fn column_names(mut self, column_names: &'b [&'b str]) -> Self { + self.column_names = Some(column_names); + self + } + #[doc = "Optional parameter to specify the delimiter character for a delimited file - must be a single character"] + pub fn delimiter(mut self, delimiter: &'b str) -> Self { + self.delimiter = Some(delimiter); + self + } + #[doc = "How many documents should be included in the analysis"] + pub fn documents_to_sample(mut self, documents_to_sample: i32) -> Self { + self.documents_to_sample = Some(documents_to_sample); + self + } + #[doc = "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'"] + pub fn ecs_compatibility(mut self, ecs_compatibility: &'b str) -> Self { + self.ecs_compatibility = Some(ecs_compatibility); + 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); + self + } + #[doc = "Whether to include a commentary on how the structure was derived"] + pub fn explain(mut self, explain: bool) -> Self { + self.explain = Some(explain); + self + } + #[doc = "The field that should be analyzed"] + pub fn field(mut self, field: &'b str) -> Self { + self.field = Some(field); + 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 = "Optional parameter to specify the high level file format"] + pub fn format(mut self, format: Format) -> Self { + self.format = Some(format); + self + } + #[doc = "Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file"] + pub fn grok_pattern(mut self, grok_pattern: &'b str) -> Self { + self.grok_pattern = Some(grok_pattern); + 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 = "The index containing the analyzed field"] + pub fn index(mut self, index: &'b str) -> Self { + self.index = Some(index); + self + } + #[doc = "Pretty format the returned JSON response."] + pub fn pretty(mut self, pretty: bool) -> Self { + self.pretty = Some(pretty); + self + } + #[doc = "Optional parameter to specify the quote character for a delimited file - must be a single character"] + pub fn quote(mut self, quote: &'b str) -> Self { + self.quote = Some(quote); + 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 = "Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them"] + pub fn should_trim_fields(mut self, should_trim_fields: bool) -> Self { + self.should_trim_fields = Some(should_trim_fields); + 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 = "Timeout after which the analysis will be aborted"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Optional parameter to specify the timestamp field in the file"] + pub fn timestamp_field(mut self, timestamp_field: &'b str) -> Self { + self.timestamp_field = Some(timestamp_field); + self + } + #[doc = "Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format"] + pub fn timestamp_format(mut self, timestamp_format: &'b str) -> Self { + self.timestamp_format = Some(timestamp_format); + self + } + #[doc = "Creates an asynchronous call to the Text Structure Find Field Structure 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> { + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + column_names: Option<&'b [&'b str]>, + delimiter: Option<&'b str>, + documents_to_sample: Option, + ecs_compatibility: Option<&'b str>, + error_trace: Option, + explain: Option, + field: Option<&'b str>, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + format: Option, + grok_pattern: Option<&'b str>, + human: Option, + index: Option<&'b str>, + pretty: Option, + quote: Option<&'b str>, + should_trim_fields: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + timestamp_field: Option<&'b str>, + timestamp_format: Option<&'b str>, + } + let query_params = QueryParams { + column_names: self.column_names, + delimiter: self.delimiter, + documents_to_sample: self.documents_to_sample, + ecs_compatibility: self.ecs_compatibility, + error_trace: self.error_trace, + explain: self.explain, + field: self.field, + filter_path: self.filter_path, + format: self.format, + grok_pattern: self.grok_pattern, + human: self.human, + index: self.index, + pretty: self.pretty, + quote: self.quote, + should_trim_fields: self.should_trim_fields, + source: self.source, + timeout: self.timeout, + timestamp_field: self.timestamp_field, + timestamp_format: self.timestamp_format, + }; + 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)] +#[doc = "API parts for the Text Structure Find Message Structure API"] +pub enum TextStructureFindMessageStructureParts { + #[doc = "No parts"] + None, +} +impl TextStructureFindMessageStructureParts { + #[doc = "Builds a relative URL path to the Text Structure Find Message Structure API"] + pub fn url(self) -> Cow<'static, str> { + match self { + TextStructureFindMessageStructureParts::None => { + "/_text_structure/find_message_structure".into() + } + } + } +} +#[doc = "Builder for the [Text Structure Find Message Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/find-message-structure.html)\n\nFinds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch."] +#[derive(Clone, Debug)] +pub struct TextStructureFindMessageStructure<'a, 'b, B> { + transport: &'a Transport, + parts: TextStructureFindMessageStructureParts, + body: Option, + column_names: Option<&'b [&'b str]>, + delimiter: Option<&'b str>, + ecs_compatibility: Option<&'b str>, + error_trace: Option, + explain: Option, + filter_path: Option<&'b [&'b str]>, + format: Option, + grok_pattern: Option<&'b str>, + headers: HeaderMap, + human: Option, + pretty: Option, + quote: Option<&'b str>, + request_timeout: Option, + should_trim_fields: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + timestamp_field: Option<&'b str>, + timestamp_format: Option<&'b str>, +} +impl<'a, 'b, B> TextStructureFindMessageStructure<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [TextStructureFindMessageStructure]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + TextStructureFindMessageStructure { + transport, + parts: TextStructureFindMessageStructureParts::None, + headers, + body: None, + column_names: None, + delimiter: None, + ecs_compatibility: None, + error_trace: None, + explain: None, + filter_path: None, + format: None, + grok_pattern: None, + human: None, + pretty: None, + quote: None, + request_timeout: None, + should_trim_fields: None, + source: None, + timeout: None, + timestamp_field: None, + timestamp_format: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> TextStructureFindMessageStructure<'a, 'b, JsonBody> + where + T: Serialize, + { + TextStructureFindMessageStructure { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + column_names: self.column_names, + delimiter: self.delimiter, + ecs_compatibility: self.ecs_compatibility, + error_trace: self.error_trace, + explain: self.explain, + filter_path: self.filter_path, + format: self.format, + grok_pattern: self.grok_pattern, + headers: self.headers, + human: self.human, + pretty: self.pretty, + quote: self.quote, + request_timeout: self.request_timeout, + should_trim_fields: self.should_trim_fields, + source: self.source, + timeout: self.timeout, + timestamp_field: self.timestamp_field, + timestamp_format: self.timestamp_format, + } + } + #[doc = "Optional parameter containing a comma separated list of the column names for a delimited file"] + pub fn column_names(mut self, column_names: &'b [&'b str]) -> Self { + self.column_names = Some(column_names); + self + } + #[doc = "Optional parameter to specify the delimiter character for a delimited file - must be a single character"] + pub fn delimiter(mut self, delimiter: &'b str) -> Self { + self.delimiter = Some(delimiter); + self + } + #[doc = "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'"] + pub fn ecs_compatibility(mut self, ecs_compatibility: &'b str) -> Self { + self.ecs_compatibility = Some(ecs_compatibility); + 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); + self + } + #[doc = "Whether to include a commentary on how the structure was derived"] + pub fn explain(mut self, explain: bool) -> Self { + self.explain = Some(explain); + 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 = "Optional parameter to specify the high level file format"] + pub fn format(mut self, format: Format) -> Self { + self.format = Some(format); + self + } + #[doc = "Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file"] + pub fn grok_pattern(mut self, grok_pattern: &'b str) -> Self { + self.grok_pattern = Some(grok_pattern); + 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 = "Optional parameter to specify the quote character for a delimited file - must be a single character"] + pub fn quote(mut self, quote: &'b str) -> Self { + self.quote = Some(quote); + 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 = "Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them"] + pub fn should_trim_fields(mut self, should_trim_fields: bool) -> Self { + self.should_trim_fields = Some(should_trim_fields); + 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 = "Timeout after which the analysis will be aborted"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Optional parameter to specify the timestamp field in the file"] + pub fn timestamp_field(mut self, timestamp_field: &'b str) -> Self { + self.timestamp_field = Some(timestamp_field); + self + } + #[doc = "Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format"] + pub fn timestamp_format(mut self, timestamp_format: &'b str) -> Self { + self.timestamp_format = Some(timestamp_format); + self + } + #[doc = "Creates an asynchronous call to the Text Structure Find Message Structure API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => http::Method::Post, + None => 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> { + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + column_names: Option<&'b [&'b str]>, + delimiter: Option<&'b str>, + ecs_compatibility: Option<&'b str>, + error_trace: Option, + explain: Option, + #[serde(serialize_with = "crate::client::serialize_coll_qs")] + filter_path: Option<&'b [&'b str]>, + format: Option, + grok_pattern: Option<&'b str>, + human: Option, + pretty: Option, + quote: Option<&'b str>, + should_trim_fields: Option, + source: Option<&'b str>, + timeout: Option<&'b str>, + timestamp_field: Option<&'b str>, + timestamp_format: Option<&'b str>, + } + let query_params = QueryParams { + column_names: self.column_names, + delimiter: self.delimiter, + ecs_compatibility: self.ecs_compatibility, + error_trace: self.error_trace, + explain: self.explain, + filter_path: self.filter_path, + format: self.format, + grok_pattern: self.grok_pattern, + human: self.human, + pretty: self.pretty, + quote: self.quote, + should_trim_fields: self.should_trim_fields, + source: self.source, + timeout: self.timeout, + timestamp_field: self.timestamp_field, + timestamp_format: self.timestamp_format, + }; + 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)] #[doc = "API parts for the Text Structure Find Structure API"] pub enum TextStructureFindStructureParts { #[doc = "No parts"] @@ -59,7 +551,7 @@ impl TextStructureFindStructureParts { } } } -#[doc = "Builder for the [Text Structure Find Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/find-structure.html)\n\nFinds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."] +#[doc = "Builder for the [Text Structure Find Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/find-structure.html)\n\nFinds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."] #[derive(Clone, Debug)] pub struct TextStructureFindStructure<'a, 'b, B> { transport: &'a Transport, @@ -68,6 +560,7 @@ pub struct TextStructureFindStructure<'a, 'b, B> { charset: Option<&'b str>, column_names: Option<&'b [&'b str]>, delimiter: Option<&'b str>, + ecs_compatibility: Option<&'b str>, error_trace: Option, explain: Option, filter_path: Option<&'b [&'b str]>, @@ -102,6 +595,7 @@ where charset: None, column_names: None, delimiter: None, + ecs_compatibility: None, error_trace: None, explain: None, filter_path: None, @@ -133,6 +627,7 @@ where charset: self.charset, column_names: self.column_names, delimiter: self.delimiter, + ecs_compatibility: self.ecs_compatibility, error_trace: self.error_trace, explain: self.explain, filter_path: self.filter_path, @@ -168,6 +663,11 @@ where self.delimiter = Some(delimiter); self } + #[doc = "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'"] + pub fn ecs_compatibility(mut self, ecs_compatibility: &'b str) -> Self { + self.ecs_compatibility = Some(ecs_compatibility); + 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); @@ -261,7 +761,7 @@ where #[doc = "Creates an asynchronous call to the Text Structure Find Structure API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -272,6 +772,7 @@ where #[serde(serialize_with = "crate::client::serialize_coll_qs")] column_names: Option<&'b [&'b str]>, delimiter: Option<&'b str>, + ecs_compatibility: Option<&'b str>, error_trace: Option, explain: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] @@ -294,6 +795,7 @@ where charset: self.charset, column_names: self.column_names, delimiter: self.delimiter, + ecs_compatibility: self.ecs_compatibility, error_trace: self.error_trace, explain: self.explain, filter_path: self.filter_path, @@ -321,6 +823,154 @@ where Ok(response) } } +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Text Structure Test Grok Pattern API"] +pub enum TextStructureTestGrokPatternParts { + #[doc = "No parts"] + None, +} +impl TextStructureTestGrokPatternParts { + #[doc = "Builds a relative URL path to the Text Structure Test Grok Pattern API"] + pub fn url(self) -> Cow<'static, str> { + match self { + TextStructureTestGrokPatternParts::None => "/_text_structure/test_grok_pattern".into(), + } + } +} +#[doc = "Builder for the [Text Structure Test Grok Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/test-grok-pattern.html)\n\nTests a Grok pattern on some text."] +#[derive(Clone, Debug)] +pub struct TextStructureTestGrokPattern<'a, 'b, B> { + transport: &'a Transport, + parts: TextStructureTestGrokPatternParts, + body: Option, + ecs_compatibility: Option<&'b str>, + 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> TextStructureTestGrokPattern<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [TextStructureTestGrokPattern]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + TextStructureTestGrokPattern { + transport, + parts: TextStructureTestGrokPatternParts::None, + headers, + body: None, + ecs_compatibility: 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) -> TextStructureTestGrokPattern<'a, 'b, JsonBody> + where + T: Serialize, + { + TextStructureTestGrokPattern { + transport: self.transport, + parts: self.parts, + body: Some(body.into()), + ecs_compatibility: self.ecs_compatibility, + 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 = "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'"] + pub fn ecs_compatibility(mut self, ecs_compatibility: &'b str) -> Self { + self.ecs_compatibility = Some(ecs_compatibility); + 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); + 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 Text Structure Test Grok Pattern API that can be awaited"] + pub async fn send(self) -> Result { + let path = self.parts.url(); + let method = match self.body { + Some(_) => http::Method::Post, + None => 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> { + ecs_compatibility: Option<&'b str>, + 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 { + ecs_compatibility: self.ecs_compatibility, + 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 TextStructure APIs"] pub struct TextStructure<'a> { transport: &'a Transport, @@ -333,10 +983,22 @@ impl<'a> TextStructure<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Text Structure Find Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/find-structure.html)\n\nFinds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."] + #[doc = "[Text Structure Find Field Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/find-field-structure.html)\n\nFinds the structure of a text field in an index."] + pub fn find_field_structure<'b>(&'a self) -> TextStructureFindFieldStructure<'a, 'b> { + TextStructureFindFieldStructure::new(self.transport()) + } + #[doc = "[Text Structure Find Message Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/find-message-structure.html)\n\nFinds the structure of a list of messages. The messages must contain data that is suitable to be ingested into Elasticsearch."] + pub fn find_message_structure<'b>(&'a self) -> TextStructureFindMessageStructure<'a, 'b, ()> { + TextStructureFindMessageStructure::new(self.transport()) + } + #[doc = "[Text Structure Find Structure API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/find-structure.html)\n\nFinds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch."] pub fn find_structure<'b>(&'a self) -> TextStructureFindStructure<'a, 'b, ()> { TextStructureFindStructure::new(self.transport()) } + #[doc = "[Text Structure Test Grok Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/test-grok-pattern.html)\n\nTests a Grok pattern on some text."] + pub fn test_grok_pattern<'b>(&'a self) -> TextStructureTestGrokPattern<'a, 'b, ()> { + TextStructureTestGrokPattern::new(self.transport()) + } } impl Elasticsearch { #[doc = "Creates a namespace client for TextStructure APIs"] diff --git a/elasticsearch/src/transform.rs b/elasticsearch/src/transform.rs index 7c927f67..1afb9b3c 100644 --- a/elasticsearch/src/transform.rs +++ b/elasticsearch/src/transform.rs @@ -35,11 +35,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -67,11 +67,12 @@ impl<'b> TransformDeleteTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-transform.html)\n\nDeletes an existing transform."] +#[doc = "Builder for the [Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-transform.html)\n\nDeletes an existing transform."] #[derive(Clone, Debug)] pub struct TransformDeleteTransform<'a, 'b> { transport: &'a Transport, parts: TransformDeleteTransformParts<'b>, + delete_dest_index: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, force: Option, @@ -90,6 +91,7 @@ impl<'a, 'b> TransformDeleteTransform<'a, 'b> { transport, parts, headers, + delete_dest_index: None, error_trace: None, filter_path: None, force: None, @@ -100,6 +102,11 @@ impl<'a, 'b> TransformDeleteTransform<'a, 'b> { timeout: None, } } + #[doc = "When `true`, the destination index is deleted together with the transform. The default value is `false`, meaning that the destination index will not be deleted."] + pub fn delete_dest_index(mut self, delete_dest_index: bool) -> Self { + self.delete_dest_index = Some(delete_dest_index); + 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); @@ -148,13 +155,14 @@ impl<'a, 'b> TransformDeleteTransform<'a, 'b> { #[doc = "Creates an asynchronous call to the Transform Delete Transform API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + 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> { + delete_dest_index: Option, error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, @@ -165,6 +173,7 @@ impl<'a, 'b> TransformDeleteTransform<'a, 'b> { timeout: Option<&'b str>, } let query_params = QueryParams { + delete_dest_index: self.delete_dest_index, error_trace: self.error_trace, filter_path: self.filter_path, force: self.force, @@ -184,6 +193,118 @@ impl<'a, 'b> TransformDeleteTransform<'a, 'b> { } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Transform Get Node Stats API"] +pub enum TransformGetNodeStatsParts { + #[doc = "No parts"] + None, +} +impl TransformGetNodeStatsParts { + #[doc = "Builds a relative URL path to the Transform Get Node Stats API"] + pub fn url(self) -> Cow<'static, str> { + match self { + TransformGetNodeStatsParts::None => "/_transform/_node_stats".into(), + } + } +} +#[doc = "Builder for the [Transform Get Node Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-transform-node-stats.html)\n\nRetrieves transform usage information for transform nodes."] +#[derive(Clone, Debug)] +pub struct TransformGetNodeStats<'a, 'b> { + transport: &'a Transport, + parts: TransformGetNodeStatsParts, + 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> TransformGetNodeStats<'a, 'b> { + #[doc = "Creates a new instance of [TransformGetNodeStats]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + TransformGetNodeStats { + transport, + parts: TransformGetNodeStatsParts::None, + 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 Transform Get Node Stats 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)] #[doc = "API parts for the Transform Get Transform API"] pub enum TransformGetTransformParts<'b> { #[doc = "TransformId"] @@ -207,7 +328,7 @@ impl<'b> TransformGetTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-transform.html)\n\nRetrieves configuration information for transforms."] +#[doc = "Builder for the [Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-transform.html)\n\nRetrieves configuration information for transforms."] #[derive(Clone, Debug)] pub struct TransformGetTransform<'a, 'b> { transport: &'a Transport, @@ -302,7 +423,7 @@ impl<'a, 'b> TransformGetTransform<'a, 'b> { #[doc = "Creates an asynchronous call to the Transform Get Transform API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -363,7 +484,7 @@ impl<'b> TransformGetTransformStatsParts<'b> { } } } -#[doc = "Builder for the [Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-transform-stats.html)\n\nRetrieves usage information for transforms."] +#[doc = "Builder for the [Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-transform-stats.html)\n\nRetrieves usage information for transforms."] #[derive(Clone, Debug)] pub struct TransformGetTransformStats<'a, 'b> { transport: &'a Transport, @@ -378,6 +499,7 @@ pub struct TransformGetTransformStats<'a, 'b> { request_timeout: Option, size: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } impl<'a, 'b> TransformGetTransformStats<'a, 'b> { #[doc = "Creates a new instance of [TransformGetTransformStats] with the specified API parts"] @@ -396,6 +518,7 @@ impl<'a, 'b> TransformGetTransformStats<'a, 'b> { request_timeout: None, size: None, source: None, + timeout: None, } } #[doc = "Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)"] @@ -448,10 +571,15 @@ impl<'a, 'b> TransformGetTransformStats<'a, 'b> { self.source = Some(source); self } + #[doc = "Controls the time to wait for the stats"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } #[doc = "Creates an asynchronous call to the Transform Get Transform Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -467,6 +595,7 @@ impl<'a, 'b> TransformGetTransformStats<'a, 'b> { pretty: Option, size: Option, source: Option<&'b str>, + timeout: Option<&'b str>, } let query_params = QueryParams { allow_no_match: self.allow_no_match, @@ -477,6 +606,7 @@ impl<'a, 'b> TransformGetTransformStats<'a, 'b> { pretty: self.pretty, size: self.size, source: self.source, + timeout: self.timeout, }; Some(query_params) }; @@ -513,7 +643,7 @@ impl<'b> TransformPreviewTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/preview-transform.html)\n\nPreviews a transform."] +#[doc = "Builder for the [Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/preview-transform.html)\n\nPreviews a transform."] #[derive(Clone, Debug)] pub struct TransformPreviewTransform<'a, 'b, B> { transport: &'a Transport, @@ -612,8 +742,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -668,7 +798,7 @@ impl<'b> TransformPutTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-transform.html)\n\nInstantiates a transform."] +#[doc = "Builder for the [Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-transform.html)\n\nInstantiates a transform."] #[derive(Clone, Debug)] pub struct TransformPutTransform<'a, 'b, B> { transport: &'a Transport, @@ -774,7 +904,7 @@ where #[doc = "Creates an asynchronous call to the Transform Put Transform API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -831,7 +961,7 @@ impl<'b> TransformResetTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Reset Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/reset-transform.html)\n\nResets an existing transform."] +#[doc = "Builder for the [Transform Reset Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/reset-transform.html)\n\nResets an existing transform."] #[derive(Clone, Debug)] pub struct TransformResetTransform<'a, 'b, B> { transport: &'a Transport, @@ -937,7 +1067,7 @@ where #[doc = "Creates an asynchronous call to the Transform Reset Transform API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -973,6 +1103,159 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Transform Schedule Now Transform API"] +pub enum TransformScheduleNowTransformParts<'b> { + #[doc = "TransformId"] + TransformId(&'b str), +} +impl<'b> TransformScheduleNowTransformParts<'b> { + #[doc = "Builds a relative URL path to the Transform Schedule Now Transform API"] + pub fn url(self) -> Cow<'static, str> { + match self { + TransformScheduleNowTransformParts::TransformId(ref transform_id) => { + let encoded_transform_id: Cow = + percent_encode(transform_id.as_bytes(), PARTS_ENCODED).into(); + let mut p = String::with_capacity(26usize + encoded_transform_id.len()); + p.push_str("/_transform/"); + p.push_str(encoded_transform_id.as_ref()); + p.push_str("/_schedule_now"); + p.into() + } + } + } +} +#[doc = "Builder for the [Transform Schedule Now Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/schedule-now-transform.html)\n\nSchedules now a transform."] +#[derive(Clone, Debug)] +pub struct TransformScheduleNowTransform<'a, 'b, B> { + transport: &'a Transport, + parts: TransformScheduleNowTransformParts<'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>, + timeout: Option<&'b str>, +} +impl<'a, 'b, B> TransformScheduleNowTransform<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [TransformScheduleNowTransform] with the specified API parts"] + pub fn new(transport: &'a Transport, parts: TransformScheduleNowTransformParts<'b>) -> Self { + let headers = HeaderMap::new(); + TransformScheduleNowTransform { + transport, + parts, + headers, + body: None, + error_trace: None, + filter_path: None, + human: None, + pretty: None, + request_timeout: None, + source: None, + timeout: None, + } + } + #[doc = "The body for the API call"] + pub fn body(self, body: T) -> TransformScheduleNowTransform<'a, 'b, JsonBody> + where + T: Serialize, + { + TransformScheduleNowTransform { + 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, + timeout: self.timeout, + } + } + #[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 = "Controls the time to wait for the scheduling to take place"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Transform Schedule Now Transform 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>, + timeout: 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, + timeout: self.timeout, + }; + 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)] #[doc = "API parts for the Transform Start Transform API"] pub enum TransformStartTransformParts<'b> { #[doc = "TransformId"] @@ -994,7 +1277,7 @@ impl<'b> TransformStartTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-transform.html)\n\nStarts one or more transforms."] +#[doc = "Builder for the [Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-transform.html)\n\nStarts one or more transforms."] #[derive(Clone, Debug)] pub struct TransformStartTransform<'a, 'b, B> { transport: &'a Transport, @@ -1002,6 +1285,7 @@ pub struct TransformStartTransform<'a, 'b, B> { body: Option, error_trace: Option, filter_path: Option<&'b [&'b str]>, + from: Option<&'b str>, headers: HeaderMap, human: Option, pretty: Option, @@ -1023,6 +1307,7 @@ where body: None, error_trace: None, filter_path: None, + from: None, human: None, pretty: None, request_timeout: None, @@ -1041,6 +1326,7 @@ where body: Some(body.into()), error_trace: self.error_trace, filter_path: self.filter_path, + from: self.from, headers: self.headers, human: self.human, pretty: self.pretty, @@ -1059,6 +1345,11 @@ where self.filter_path = Some(filter_path); self } + #[doc = "Restricts the set of transformed entities to those changed after this time"] + pub fn from(mut self, from: &'b str) -> Self { + self.from = Some(from); + self + } #[doc = "Adds a HTTP header"] pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self { self.headers.insert(key, value); @@ -1092,7 +1383,7 @@ where #[doc = "Creates an asynchronous call to the Transform Start Transform API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1102,6 +1393,7 @@ where error_trace: Option, #[serde(serialize_with = "crate::client::serialize_coll_qs")] filter_path: Option<&'b [&'b str]>, + from: Option<&'b str>, human: Option, pretty: Option, source: Option<&'b str>, @@ -1110,6 +1402,7 @@ where let query_params = QueryParams { error_trace: self.error_trace, filter_path: self.filter_path, + from: self.from, human: self.human, pretty: self.pretty, source: self.source, @@ -1147,7 +1440,7 @@ impl<'b> TransformStopTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/stop-transform.html)\n\nStops one or more transforms."] +#[doc = "Builder for the [Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/stop-transform.html)\n\nStops one or more transforms."] #[derive(Clone, Debug)] pub struct TransformStopTransform<'a, 'b, B> { transport: &'a Transport, @@ -1277,7 +1570,7 @@ where #[doc = "Creates an asynchronous call to the Transform Stop Transform API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1340,7 +1633,7 @@ impl<'b> TransformUpdateTransformParts<'b> { } } } -#[doc = "Builder for the [Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/update-transform.html)\n\nUpdates certain properties of a transform."] +#[doc = "Builder for the [Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-transform.html)\n\nUpdates certain properties of a transform."] #[derive(Clone, Debug)] pub struct TransformUpdateTransform<'a, 'b, B> { transport: &'a Transport, @@ -1446,7 +1739,7 @@ where #[doc = "Creates an asynchronous call to the Transform Update Transform API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1495,7 +1788,7 @@ impl TransformUpgradeTransformsParts { } } } -#[doc = "Builder for the [Transform Upgrade Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/upgrade-transforms.html)\n\nUpgrades all transforms."] +#[doc = "Builder for the [Transform Upgrade Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/upgrade-transforms.html)\n\nUpgrades all transforms."] #[derive(Clone, Debug)] pub struct TransformUpgradeTransforms<'a, 'b, B> { transport: &'a Transport, @@ -1601,7 +1894,7 @@ where #[doc = "Creates an asynchronous call to the Transform Upgrade Transforms API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1648,70 +1941,81 @@ impl<'a> Transform<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/delete-transform.html)\n\nDeletes an existing transform."] + #[doc = "[Transform Delete Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/delete-transform.html)\n\nDeletes an existing transform."] pub fn delete_transform<'b>( &'a self, parts: TransformDeleteTransformParts<'b>, ) -> TransformDeleteTransform<'a, 'b> { TransformDeleteTransform::new(self.transport(), parts) } - #[doc = "[Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-transform.html)\n\nRetrieves configuration information for transforms."] + #[doc = "[Transform Get Node Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-transform-node-stats.html)\n\nRetrieves transform usage information for transform nodes."] + pub fn get_node_stats<'b>(&'a self) -> TransformGetNodeStats<'a, 'b> { + TransformGetNodeStats::new(self.transport()) + } + #[doc = "[Transform Get Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-transform.html)\n\nRetrieves configuration information for transforms."] pub fn get_transform<'b>( &'a self, parts: TransformGetTransformParts<'b>, ) -> TransformGetTransform<'a, 'b> { TransformGetTransform::new(self.transport(), parts) } - #[doc = "[Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/get-transform-stats.html)\n\nRetrieves usage information for transforms."] + #[doc = "[Transform Get Transform Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/get-transform-stats.html)\n\nRetrieves usage information for transforms."] pub fn get_transform_stats<'b>( &'a self, parts: TransformGetTransformStatsParts<'b>, ) -> TransformGetTransformStats<'a, 'b> { TransformGetTransformStats::new(self.transport(), parts) } - #[doc = "[Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/preview-transform.html)\n\nPreviews a transform."] + #[doc = "[Transform Preview Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/preview-transform.html)\n\nPreviews a transform."] pub fn preview_transform<'b>( &'a self, parts: TransformPreviewTransformParts<'b>, ) -> TransformPreviewTransform<'a, 'b, ()> { TransformPreviewTransform::new(self.transport(), parts) } - #[doc = "[Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/put-transform.html)\n\nInstantiates a transform."] + #[doc = "[Transform Put Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/put-transform.html)\n\nInstantiates a transform."] pub fn put_transform<'b>( &'a self, parts: TransformPutTransformParts<'b>, ) -> TransformPutTransform<'a, 'b, ()> { TransformPutTransform::new(self.transport(), parts) } - #[doc = "[Transform Reset Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/reset-transform.html)\n\nResets an existing transform."] + #[doc = "[Transform Reset Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/reset-transform.html)\n\nResets an existing transform."] pub fn reset_transform<'b>( &'a self, parts: TransformResetTransformParts<'b>, ) -> TransformResetTransform<'a, 'b, ()> { TransformResetTransform::new(self.transport(), parts) } - #[doc = "[Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/start-transform.html)\n\nStarts one or more transforms."] + #[doc = "[Transform Schedule Now Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/schedule-now-transform.html)\n\nSchedules now a transform."] + pub fn schedule_now_transform<'b>( + &'a self, + parts: TransformScheduleNowTransformParts<'b>, + ) -> TransformScheduleNowTransform<'a, 'b, ()> { + TransformScheduleNowTransform::new(self.transport(), parts) + } + #[doc = "[Transform Start Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/start-transform.html)\n\nStarts one or more transforms."] pub fn start_transform<'b>( &'a self, parts: TransformStartTransformParts<'b>, ) -> TransformStartTransform<'a, 'b, ()> { TransformStartTransform::new(self.transport(), parts) } - #[doc = "[Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/stop-transform.html)\n\nStops one or more transforms."] + #[doc = "[Transform Stop Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/stop-transform.html)\n\nStops one or more transforms."] pub fn stop_transform<'b>( &'a self, parts: TransformStopTransformParts<'b>, ) -> TransformStopTransform<'a, 'b, ()> { TransformStopTransform::new(self.transport(), parts) } - #[doc = "[Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/update-transform.html)\n\nUpdates certain properties of a transform."] + #[doc = "[Transform Update Transform API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/update-transform.html)\n\nUpdates certain properties of a transform."] pub fn update_transform<'b>( &'a self, parts: TransformUpdateTransformParts<'b>, ) -> TransformUpdateTransform<'a, 'b, ()> { TransformUpdateTransform::new(self.transport(), parts) } - #[doc = "[Transform Upgrade Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/upgrade-transforms.html)\n\nUpgrades all transforms."] + #[doc = "[Transform Upgrade Transforms API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/upgrade-transforms.html)\n\nUpgrades all transforms."] pub fn upgrade_transforms<'b>(&'a self) -> TransformUpgradeTransforms<'a, 'b, ()> { TransformUpgradeTransforms::new(self.transport()) } diff --git a/elasticsearch/src/watcher.rs b/elasticsearch/src/watcher.rs index e84f6b03..1f8f17f9 100644 --- a/elasticsearch/src/watcher.rs +++ b/elasticsearch/src/watcher.rs @@ -34,11 +34,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -84,7 +84,7 @@ impl<'b> WatcherAckWatchParts<'b> { } } } -#[doc = "Builder for the [Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] +#[doc = "Builder for the [Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] #[derive(Clone, Debug)] pub struct WatcherAckWatch<'a, 'b, B> { transport: &'a Transport, @@ -174,7 +174,7 @@ where #[doc = "Creates an asynchronous call to the Watcher Ack Watch API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -227,7 +227,7 @@ impl<'b> WatcherActivateWatchParts<'b> { } } } -#[doc = "Builder for the [Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] +#[doc = "Builder for the [Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] #[derive(Clone, Debug)] pub struct WatcherActivateWatch<'a, 'b, B> { transport: &'a Transport, @@ -317,7 +317,7 @@ where #[doc = "Creates an asynchronous call to the Watcher Activate Watch API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -370,7 +370,7 @@ impl<'b> WatcherDeactivateWatchParts<'b> { } } } -#[doc = "Builder for the [Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] +#[doc = "Builder for the [Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] #[derive(Clone, Debug)] pub struct WatcherDeactivateWatch<'a, 'b, B> { transport: &'a Transport, @@ -460,7 +460,7 @@ where #[doc = "Creates an asynchronous call to the Watcher Deactivate Watch API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -511,7 +511,7 @@ impl<'b> WatcherDeleteWatchParts<'b> { } } } -#[doc = "Builder for the [Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] +#[doc = "Builder for the [Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] #[derive(Clone, Debug)] pub struct WatcherDeleteWatch<'a, 'b> { transport: &'a Transport, @@ -578,7 +578,7 @@ impl<'a, 'b> WatcherDeleteWatch<'a, 'b> { #[doc = "Creates an asynchronous call to the Watcher Delete Watch API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Delete; + let method = http::Method::Delete; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -633,7 +633,7 @@ impl<'b> WatcherExecuteWatchParts<'b> { } } } -#[doc = "Builder for the [Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] +#[doc = "Builder for the [Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] #[derive(Clone, Debug)] pub struct WatcherExecuteWatch<'a, 'b, B> { transport: &'a Transport, @@ -731,7 +731,7 @@ where #[doc = "Creates an asynchronous call to the Watcher Execute Watch API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -765,6 +765,127 @@ where } } #[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Watcher Get Settings API"] +pub enum WatcherGetSettingsParts { + #[doc = "No parts"] + None, +} +impl WatcherGetSettingsParts { + #[doc = "Builds a relative URL path to the Watcher Get Settings API"] + pub fn url(self) -> Cow<'static, str> { + match self { + WatcherGetSettingsParts::None => "/_watcher/settings".into(), + } + } +} +#[doc = "Builder for the [Watcher Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-get-settings.html)\n\nRetrieve settings for the watcher system index"] +#[derive(Clone, Debug)] +pub struct WatcherGetSettings<'a, 'b> { + transport: &'a Transport, + parts: WatcherGetSettingsParts, + error_trace: Option, + filter_path: Option<&'b [&'b str]>, + headers: HeaderMap, + human: Option, + master_timeout: Option<&'b str>, + pretty: Option, + request_timeout: Option, + source: Option<&'b str>, +} +impl<'a, 'b> WatcherGetSettings<'a, 'b> { + #[doc = "Creates a new instance of [WatcherGetSettings]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + WatcherGetSettings { + transport, + parts: WatcherGetSettingsParts::None, + headers, + error_trace: None, + filter_path: None, + human: None, + master_timeout: 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 = "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); + 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 Watcher Get Settings 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, + master_timeout: Option<&'b str>, + pretty: Option, + source: 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, + }; + 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)] #[doc = "API parts for the Watcher Get Watch API"] pub enum WatcherGetWatchParts<'b> { #[doc = "Id"] @@ -784,7 +905,7 @@ impl<'b> WatcherGetWatchParts<'b> { } } } -#[doc = "Builder for the [Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] +#[doc = "Builder for the [Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] #[derive(Clone, Debug)] pub struct WatcherGetWatch<'a, 'b> { transport: &'a Transport, @@ -851,7 +972,7 @@ impl<'a, 'b> WatcherGetWatch<'a, 'b> { #[doc = "Creates an asynchronous call to the Watcher Get Watch API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -902,7 +1023,7 @@ impl<'b> WatcherPutWatchParts<'b> { } } } -#[doc = "Builder for the [Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] +#[doc = "Builder for the [Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] #[derive(Clone, Debug)] pub struct WatcherPutWatch<'a, 'b, B> { transport: &'a Transport, @@ -1024,7 +1145,7 @@ where #[doc = "Creates an asynchronous call to the Watcher Put Watch API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Put; + let method = http::Method::Put; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1077,7 +1198,7 @@ impl WatcherQueryWatchesParts { } } } -#[doc = "Builder for the [Watcher Query Watches API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-query-watches.html)\n\nRetrieves stored watches."] +#[doc = "Builder for the [Watcher Query Watches API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-query-watches.html)\n\nRetrieves stored watches."] #[derive(Clone, Debug)] pub struct WatcherQueryWatches<'a, 'b, B> { transport: &'a Transport, @@ -1168,8 +1289,8 @@ where pub async fn send(self) -> Result { let path = self.parts.url(); let method = match self.body { - Some(_) => Method::Post, - None => Method::Get, + Some(_) => http::Method::Post, + None => http::Method::Get, }; let headers = self.headers; let timeout = self.request_timeout; @@ -1215,7 +1336,7 @@ impl WatcherStartParts { } } } -#[doc = "Builder for the [Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] +#[doc = "Builder for the [Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] #[derive(Clone, Debug)] pub struct WatcherStart<'a, 'b, B> { transport: &'a Transport, @@ -1225,6 +1346,7 @@ pub struct WatcherStart<'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>, @@ -1244,6 +1366,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1262,6 +1385,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, @@ -1287,6 +1411,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); @@ -1305,7 +1434,7 @@ where #[doc = "Creates an asynchronous call to the Watcher Start API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1316,6 +1445,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>, } @@ -1323,6 +1453,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, }; @@ -1361,7 +1492,7 @@ impl<'b> WatcherStatsParts<'b> { } } } -#[doc = "Builder for the [Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] +#[doc = "Builder for the [Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] #[derive(Clone, Debug)] pub struct WatcherStats<'a, 'b> { transport: &'a Transport, @@ -1442,7 +1573,7 @@ impl<'a, 'b> WatcherStats<'a, 'b> { #[doc = "Creates an asynchronous call to the Watcher Stats API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1492,7 +1623,7 @@ impl WatcherStopParts { } } } -#[doc = "Builder for the [Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-stop.html)\n\nStops Watcher if it is running."] +#[doc = "Builder for the [Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-stop.html)\n\nStops Watcher if it is running."] #[derive(Clone, Debug)] pub struct WatcherStop<'a, 'b, B> { transport: &'a Transport, @@ -1502,6 +1633,7 @@ pub struct WatcherStop<'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>, @@ -1521,6 +1653,7 @@ where error_trace: None, filter_path: None, human: None, + master_timeout: None, pretty: None, request_timeout: None, source: None, @@ -1539,6 +1672,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, @@ -1564,6 +1698,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); @@ -1582,7 +1721,7 @@ where #[doc = "Creates an asynchronous call to the Watcher Stop API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Post; + let method = http::Method::Post; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -1593,6 +1732,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>, } @@ -1600,6 +1740,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, }; @@ -1613,6 +1754,161 @@ where Ok(response) } } +#[derive(Debug, Clone, PartialEq)] +#[doc = "API parts for the Watcher Update Settings API"] +pub enum WatcherUpdateSettingsParts { + #[doc = "No parts"] + None, +} +impl WatcherUpdateSettingsParts { + #[doc = "Builds a relative URL path to the Watcher Update Settings API"] + pub fn url(self) -> Cow<'static, str> { + match self { + WatcherUpdateSettingsParts::None => "/_watcher/settings".into(), + } + } +} +#[doc = "Builder for the [Watcher Update Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-update-settings.html)\n\nUpdate settings for the watcher system index"] +#[derive(Clone, Debug)] +pub struct WatcherUpdateSettings<'a, 'b, B> { + transport: &'a Transport, + parts: WatcherUpdateSettingsParts, + body: Option, + error_trace: Option, + 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> WatcherUpdateSettings<'a, 'b, B> +where + B: Body, +{ + #[doc = "Creates a new instance of [WatcherUpdateSettings]"] + pub fn new(transport: &'a Transport) -> Self { + let headers = HeaderMap::new(); + WatcherUpdateSettings { + transport, + parts: WatcherUpdateSettingsParts::None, + headers, + body: None, + 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"] + pub fn body(self, body: T) -> WatcherUpdateSettings<'a, 'b, JsonBody> + where + T: Serialize, + { + WatcherUpdateSettings { + 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, + 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."] + 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 = "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); + 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 = "Specify timeout for waiting for acknowledgement from all nodes"] + pub fn timeout(mut self, timeout: &'b str) -> Self { + self.timeout = Some(timeout); + self + } + #[doc = "Creates an asynchronous call to the Watcher Update Settings 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, + 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) + }; + 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 Watcher APIs"] pub struct Watcher<'a> { transport: &'a Transport, @@ -1625,62 +1921,70 @@ impl<'a> Watcher<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] + #[doc = "[Watcher Ack Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-ack-watch.html)\n\nAcknowledges a watch, manually throttling the execution of the watch's actions."] pub fn ack_watch<'b>(&'a self, parts: WatcherAckWatchParts<'b>) -> WatcherAckWatch<'a, 'b, ()> { WatcherAckWatch::new(self.transport(), parts) } - #[doc = "[Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] + #[doc = "[Watcher Activate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-activate-watch.html)\n\nActivates a currently inactive watch."] pub fn activate_watch<'b>( &'a self, parts: WatcherActivateWatchParts<'b>, ) -> WatcherActivateWatch<'a, 'b, ()> { WatcherActivateWatch::new(self.transport(), parts) } - #[doc = "[Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] + #[doc = "[Watcher Deactivate Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-deactivate-watch.html)\n\nDeactivates a currently active watch."] pub fn deactivate_watch<'b>( &'a self, parts: WatcherDeactivateWatchParts<'b>, ) -> WatcherDeactivateWatch<'a, 'b, ()> { WatcherDeactivateWatch::new(self.transport(), parts) } - #[doc = "[Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] + #[doc = "[Watcher Delete Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-delete-watch.html)\n\nRemoves a watch from Watcher."] pub fn delete_watch<'b>( &'a self, parts: WatcherDeleteWatchParts<'b>, ) -> WatcherDeleteWatch<'a, 'b> { WatcherDeleteWatch::new(self.transport(), parts) } - #[doc = "[Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] + #[doc = "[Watcher Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-execute-watch.html)\n\nForces the execution of a stored watch."] pub fn execute_watch<'b>( &'a self, parts: WatcherExecuteWatchParts<'b>, ) -> WatcherExecuteWatch<'a, 'b, ()> { WatcherExecuteWatch::new(self.transport(), parts) } - #[doc = "[Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] + #[doc = "[Watcher Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-get-settings.html)\n\nRetrieve settings for the watcher system index"] + pub fn get_settings<'b>(&'a self) -> WatcherGetSettings<'a, 'b> { + WatcherGetSettings::new(self.transport()) + } + #[doc = "[Watcher Get Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-get-watch.html)\n\nRetrieves a watch by its ID."] pub fn get_watch<'b>(&'a self, parts: WatcherGetWatchParts<'b>) -> WatcherGetWatch<'a, 'b> { WatcherGetWatch::new(self.transport(), parts) } - #[doc = "[Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] + #[doc = "[Watcher Put Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-put-watch.html)\n\nCreates a new watch, or updates an existing one."] pub fn put_watch<'b>(&'a self, parts: WatcherPutWatchParts<'b>) -> WatcherPutWatch<'a, 'b, ()> { WatcherPutWatch::new(self.transport(), parts) } - #[doc = "[Watcher Query Watches API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-query-watches.html)\n\nRetrieves stored watches."] + #[doc = "[Watcher Query Watches API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-query-watches.html)\n\nRetrieves stored watches."] pub fn query_watches<'b>(&'a self) -> WatcherQueryWatches<'a, 'b, ()> { WatcherQueryWatches::new(self.transport()) } - #[doc = "[Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] + #[doc = "[Watcher Start API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-start.html)\n\nStarts Watcher if it is not already running."] pub fn start<'b>(&'a self) -> WatcherStart<'a, 'b, ()> { WatcherStart::new(self.transport()) } - #[doc = "[Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] + #[doc = "[Watcher Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-stats.html)\n\nRetrieves the current Watcher metrics."] pub fn stats<'b>(&'a self, parts: WatcherStatsParts<'b>) -> WatcherStats<'a, 'b> { WatcherStats::new(self.transport(), parts) } - #[doc = "[Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/watcher-api-stop.html)\n\nStops Watcher if it is running."] + #[doc = "[Watcher Stop API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-stop.html)\n\nStops Watcher if it is running."] pub fn stop<'b>(&'a self) -> WatcherStop<'a, 'b, ()> { WatcherStop::new(self.transport()) } + #[doc = "[Watcher Update Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/watcher-api-update-settings.html)\n\nUpdate settings for the watcher system index"] + pub fn update_settings<'b>(&'a self) -> WatcherUpdateSettings<'a, 'b, ()> { + WatcherUpdateSettings::new(self.transport()) + } } impl Elasticsearch { #[doc = "Creates a namespace client for Watcher APIs"] diff --git a/elasticsearch/src/xpack.rs b/elasticsearch/src/xpack.rs index b9a40729..a6f88d0a 100644 --- a/elasticsearch/src/xpack.rs +++ b/elasticsearch/src/xpack.rs @@ -33,11 +33,11 @@ use crate::{ client::Elasticsearch, error::Error, http::{ + self, headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE}, request::{Body, JsonBody, NdBody, PARTS_ENCODED}, response::Response, transport::Transport, - Method, }, params::*, }; @@ -58,7 +58,7 @@ impl XpackInfoParts { } } } -#[doc = "Builder for the [Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/info-api.html)\n\nRetrieves information about the installed X-Pack features."] +#[doc = "Builder for the [Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/info-api.html)\n\nRetrieves information about the installed X-Pack features."] #[derive(Clone, Debug)] pub struct XpackInfo<'a, 'b> { transport: &'a Transport, @@ -139,7 +139,7 @@ impl<'a, 'b> XpackInfo<'a, 'b> { #[doc = "Creates an asynchronous call to the Xpack Info API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -189,7 +189,7 @@ impl XpackUsageParts { } } } -#[doc = "Builder for the [Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] +#[doc = "Builder for the [Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] #[derive(Clone, Debug)] pub struct XpackUsage<'a, 'b> { transport: &'a Transport, @@ -263,7 +263,7 @@ impl<'a, 'b> XpackUsage<'a, 'b> { #[doc = "Creates an asynchronous call to the Xpack Usage API that can be awaited"] pub async fn send(self) -> Result { let path = self.parts.url(); - let method = Method::Get; + let method = http::Method::Get; let headers = self.headers; let timeout = self.request_timeout; let query_string = { @@ -308,11 +308,11 @@ impl<'a> Xpack<'a> { pub fn transport(&self) -> &Transport { self.transport } - #[doc = "[Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/info-api.html)\n\nRetrieves information about the installed X-Pack features."] + #[doc = "[Xpack Info API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/info-api.html)\n\nRetrieves information about the installed X-Pack features."] pub fn info<'b>(&'a self) -> XpackInfo<'a, 'b> { XpackInfo::new(self.transport()) } - #[doc = "[Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.3/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] + #[doc = "[Xpack Usage API](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/usage-api.html)\n\nRetrieves usage information about the installed X-Pack features."] pub fn usage<'b>(&'a self) -> XpackUsage<'a, 'b> { XpackUsage::new(self.transport()) } diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 31ba3d04..6f3254a3 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "8.7.0-alpha.1" +version = "8.15.0-alpha.1" edition = "2018" publish = false diff --git a/yaml_test_runner/Cargo.toml b/yaml_test_runner/Cargo.toml index 2ce64937..dacbd0eb 100644 --- a/yaml_test_runner/Cargo.toml +++ b/yaml_test_runner/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "yaml_test_runner" -version = "8.7.0-alpha.1" +version = "8.15.0-alpha.1" publish = false edition = "2018" authors = ["Elastic and Contributors"]