elasticsearch/
cluster.rs

1/*
2 * Licensed to Elasticsearch B.V. under one or more contributor
3 * license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright
5 * ownership. Elasticsearch B.V. licenses this file to you under
6 * the Apache License, Version 2.0 (the "License"); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *	http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20// -----------------------------------------------
21// This file is generated, Please do not edit it manually.
22// Run the following in the root of the repo to regenerate:
23//
24// cargo make generate-api
25// -----------------------------------------------
26
27//! Cluster APIs
28//!
29//! [Manage settings](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster.html),
30//! perform operations, and retrieve information about an Elasticsearch cluster.
31
32#![allow(unused_imports)]
33use crate::{
34    client::Elasticsearch,
35    error::Error,
36    http::{
37        self,
38        headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE},
39        request::{Body, JsonBody, NdBody, PARTS_ENCODED},
40        response::Response,
41        transport::Transport,
42    },
43    params::*,
44};
45use percent_encoding::percent_encode;
46use serde::Serialize;
47use std::{borrow::Cow, time::Duration};
48#[derive(Debug, Clone, PartialEq, Eq)]
49#[doc = "API parts for the Cluster Allocation Explain API"]
50pub enum ClusterAllocationExplainParts {
51    #[doc = "No parts"]
52    None,
53}
54impl ClusterAllocationExplainParts {
55    #[doc = "Builds a relative URL path to the Cluster Allocation Explain API"]
56    pub fn url(self) -> Cow<'static, str> {
57        match self {
58            ClusterAllocationExplainParts::None => "/_cluster/allocation/explain".into(),
59        }
60    }
61}
62#[doc = "Builder for the [Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."]
63#[derive(Clone, Debug)]
64pub struct ClusterAllocationExplain<'a, 'b, B> {
65    transport: &'a Transport,
66    parts: ClusterAllocationExplainParts,
67    body: Option<B>,
68    error_trace: Option<bool>,
69    filter_path: Option<&'b [&'b str]>,
70    headers: HeaderMap,
71    human: Option<bool>,
72    include_disk_info: Option<bool>,
73    include_yes_decisions: Option<bool>,
74    master_timeout: Option<&'b str>,
75    pretty: Option<bool>,
76    request_timeout: Option<Duration>,
77    source: Option<&'b str>,
78}
79impl<'a, 'b, B> ClusterAllocationExplain<'a, 'b, B>
80where
81    B: Body,
82{
83    #[doc = "Creates a new instance of [ClusterAllocationExplain]"]
84    pub fn new(transport: &'a Transport) -> Self {
85        let headers = HeaderMap::new();
86        ClusterAllocationExplain {
87            transport,
88            parts: ClusterAllocationExplainParts::None,
89            headers,
90            body: None,
91            error_trace: None,
92            filter_path: None,
93            human: None,
94            include_disk_info: None,
95            include_yes_decisions: None,
96            master_timeout: None,
97            pretty: None,
98            request_timeout: None,
99            source: None,
100        }
101    }
102    #[doc = "The body for the API call"]
103    pub fn body<T>(self, body: T) -> ClusterAllocationExplain<'a, 'b, JsonBody<T>>
104    where
105        T: Serialize,
106    {
107        ClusterAllocationExplain {
108            transport: self.transport,
109            parts: self.parts,
110            body: Some(body.into()),
111            error_trace: self.error_trace,
112            filter_path: self.filter_path,
113            headers: self.headers,
114            human: self.human,
115            include_disk_info: self.include_disk_info,
116            include_yes_decisions: self.include_yes_decisions,
117            master_timeout: self.master_timeout,
118            pretty: self.pretty,
119            request_timeout: self.request_timeout,
120            source: self.source,
121        }
122    }
123    #[doc = "Include the stack trace of returned errors."]
124    pub fn error_trace(mut self, error_trace: bool) -> Self {
125        self.error_trace = Some(error_trace);
126        self
127    }
128    #[doc = "A comma-separated list of filters used to reduce the response."]
129    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
130        self.filter_path = Some(filter_path);
131        self
132    }
133    #[doc = "Adds a HTTP header"]
134    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
135        self.headers.insert(key, value);
136        self
137    }
138    #[doc = "Return human readable values for statistics."]
139    pub fn human(mut self, human: bool) -> Self {
140        self.human = Some(human);
141        self
142    }
143    #[doc = "Return information about disk usage and shard sizes (default: false)"]
144    pub fn include_disk_info(mut self, include_disk_info: bool) -> Self {
145        self.include_disk_info = Some(include_disk_info);
146        self
147    }
148    #[doc = "Return 'YES' decisions in explanation (default: false)"]
149    pub fn include_yes_decisions(mut self, include_yes_decisions: bool) -> Self {
150        self.include_yes_decisions = Some(include_yes_decisions);
151        self
152    }
153    #[doc = "Timeout for connection to master node"]
154    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
155        self.master_timeout = Some(master_timeout);
156        self
157    }
158    #[doc = "Pretty format the returned JSON response."]
159    pub fn pretty(mut self, pretty: bool) -> Self {
160        self.pretty = Some(pretty);
161        self
162    }
163    #[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."]
164    pub fn request_timeout(mut self, timeout: Duration) -> Self {
165        self.request_timeout = Some(timeout);
166        self
167    }
168    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
169    pub fn source(mut self, source: &'b str) -> Self {
170        self.source = Some(source);
171        self
172    }
173    #[doc = "Creates an asynchronous call to the Cluster Allocation Explain API that can be awaited"]
174    pub async fn send(self) -> Result<Response, Error> {
175        let path = self.parts.url();
176        let method = match self.body {
177            Some(_) => http::Method::Post,
178            None => http::Method::Get,
179        };
180        let headers = self.headers;
181        let timeout = self.request_timeout;
182        let query_string = {
183            #[serde_with::skip_serializing_none]
184            #[derive(Serialize)]
185            struct QueryParams<'b> {
186                error_trace: Option<bool>,
187                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
188                filter_path: Option<&'b [&'b str]>,
189                human: Option<bool>,
190                include_disk_info: Option<bool>,
191                include_yes_decisions: Option<bool>,
192                master_timeout: Option<&'b str>,
193                pretty: Option<bool>,
194                source: Option<&'b str>,
195            }
196            let query_params = QueryParams {
197                error_trace: self.error_trace,
198                filter_path: self.filter_path,
199                human: self.human,
200                include_disk_info: self.include_disk_info,
201                include_yes_decisions: self.include_yes_decisions,
202                master_timeout: self.master_timeout,
203                pretty: self.pretty,
204                source: self.source,
205            };
206            Some(query_params)
207        };
208        let body = self.body;
209        let response = self
210            .transport
211            .send(method, &path, headers, query_string.as_ref(), body, timeout)
212            .await?;
213        Ok(response)
214    }
215}
216#[derive(Debug, Clone, PartialEq, Eq)]
217#[doc = "API parts for the Cluster Delete Component Template API"]
218pub enum ClusterDeleteComponentTemplateParts<'b> {
219    #[doc = "Name"]
220    Name(&'b str),
221}
222impl<'b> ClusterDeleteComponentTemplateParts<'b> {
223    #[doc = "Builds a relative URL path to the Cluster Delete Component Template API"]
224    pub fn url(self) -> Cow<'static, str> {
225        match self {
226            ClusterDeleteComponentTemplateParts::Name(name) => {
227                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
228                let mut p = String::with_capacity(21usize + encoded_name.len());
229                p.push_str("/_component_template/");
230                p.push_str(encoded_name.as_ref());
231                p.into()
232            }
233        }
234    }
235}
236#[doc = "Builder for the [Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nDeletes a component template"]
237#[derive(Clone, Debug)]
238pub struct ClusterDeleteComponentTemplate<'a, 'b> {
239    transport: &'a Transport,
240    parts: ClusterDeleteComponentTemplateParts<'b>,
241    error_trace: Option<bool>,
242    filter_path: Option<&'b [&'b str]>,
243    headers: HeaderMap,
244    human: Option<bool>,
245    master_timeout: Option<&'b str>,
246    pretty: Option<bool>,
247    request_timeout: Option<Duration>,
248    source: Option<&'b str>,
249    timeout: Option<&'b str>,
250}
251impl<'a, 'b> ClusterDeleteComponentTemplate<'a, 'b> {
252    #[doc = "Creates a new instance of [ClusterDeleteComponentTemplate] with the specified API parts"]
253    pub fn new(transport: &'a Transport, parts: ClusterDeleteComponentTemplateParts<'b>) -> Self {
254        let headers = HeaderMap::new();
255        ClusterDeleteComponentTemplate {
256            transport,
257            parts,
258            headers,
259            error_trace: None,
260            filter_path: None,
261            human: None,
262            master_timeout: None,
263            pretty: None,
264            request_timeout: None,
265            source: None,
266            timeout: None,
267        }
268    }
269    #[doc = "Include the stack trace of returned errors."]
270    pub fn error_trace(mut self, error_trace: bool) -> Self {
271        self.error_trace = Some(error_trace);
272        self
273    }
274    #[doc = "A comma-separated list of filters used to reduce the response."]
275    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
276        self.filter_path = Some(filter_path);
277        self
278    }
279    #[doc = "Adds a HTTP header"]
280    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
281        self.headers.insert(key, value);
282        self
283    }
284    #[doc = "Return human readable values for statistics."]
285    pub fn human(mut self, human: bool) -> Self {
286        self.human = Some(human);
287        self
288    }
289    #[doc = "Specify timeout for connection to master"]
290    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
291        self.master_timeout = Some(master_timeout);
292        self
293    }
294    #[doc = "Pretty format the returned JSON response."]
295    pub fn pretty(mut self, pretty: bool) -> Self {
296        self.pretty = Some(pretty);
297        self
298    }
299    #[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."]
300    pub fn request_timeout(mut self, timeout: Duration) -> Self {
301        self.request_timeout = Some(timeout);
302        self
303    }
304    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
305    pub fn source(mut self, source: &'b str) -> Self {
306        self.source = Some(source);
307        self
308    }
309    #[doc = "Explicit operation timeout"]
310    pub fn timeout(mut self, timeout: &'b str) -> Self {
311        self.timeout = Some(timeout);
312        self
313    }
314    #[doc = "Creates an asynchronous call to the Cluster Delete Component Template API that can be awaited"]
315    pub async fn send(self) -> Result<Response, Error> {
316        let path = self.parts.url();
317        let method = http::Method::Delete;
318        let headers = self.headers;
319        let timeout = self.request_timeout;
320        let query_string = {
321            #[serde_with::skip_serializing_none]
322            #[derive(Serialize)]
323            struct QueryParams<'b> {
324                error_trace: Option<bool>,
325                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
326                filter_path: Option<&'b [&'b str]>,
327                human: Option<bool>,
328                master_timeout: Option<&'b str>,
329                pretty: Option<bool>,
330                source: Option<&'b str>,
331                timeout: Option<&'b str>,
332            }
333            let query_params = QueryParams {
334                error_trace: self.error_trace,
335                filter_path: self.filter_path,
336                human: self.human,
337                master_timeout: self.master_timeout,
338                pretty: self.pretty,
339                source: self.source,
340                timeout: self.timeout,
341            };
342            Some(query_params)
343        };
344        let body = Option::<()>::None;
345        let response = self
346            .transport
347            .send(method, &path, headers, query_string.as_ref(), body, timeout)
348            .await?;
349        Ok(response)
350    }
351}
352#[derive(Debug, Clone, PartialEq, Eq)]
353#[doc = "API parts for the Cluster Delete Voting Config Exclusions API"]
354pub enum ClusterDeleteVotingConfigExclusionsParts {
355    #[doc = "No parts"]
356    None,
357}
358impl ClusterDeleteVotingConfigExclusionsParts {
359    #[doc = "Builds a relative URL path to the Cluster Delete Voting Config Exclusions API"]
360    pub fn url(self) -> Cow<'static, str> {
361        match self {
362            ClusterDeleteVotingConfigExclusionsParts::None => {
363                "/_cluster/voting_config_exclusions".into()
364            }
365        }
366    }
367}
368#[doc = "Builder for the [Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."]
369#[derive(Clone, Debug)]
370pub struct ClusterDeleteVotingConfigExclusions<'a, 'b> {
371    transport: &'a Transport,
372    parts: ClusterDeleteVotingConfigExclusionsParts,
373    error_trace: Option<bool>,
374    filter_path: Option<&'b [&'b str]>,
375    headers: HeaderMap,
376    human: Option<bool>,
377    master_timeout: Option<&'b str>,
378    pretty: Option<bool>,
379    request_timeout: Option<Duration>,
380    source: Option<&'b str>,
381    wait_for_removal: Option<bool>,
382}
383impl<'a, 'b> ClusterDeleteVotingConfigExclusions<'a, 'b> {
384    #[doc = "Creates a new instance of [ClusterDeleteVotingConfigExclusions]"]
385    pub fn new(transport: &'a Transport) -> Self {
386        let headers = HeaderMap::new();
387        ClusterDeleteVotingConfigExclusions {
388            transport,
389            parts: ClusterDeleteVotingConfigExclusionsParts::None,
390            headers,
391            error_trace: None,
392            filter_path: None,
393            human: None,
394            master_timeout: None,
395            pretty: None,
396            request_timeout: None,
397            source: None,
398            wait_for_removal: None,
399        }
400    }
401    #[doc = "Include the stack trace of returned errors."]
402    pub fn error_trace(mut self, error_trace: bool) -> Self {
403        self.error_trace = Some(error_trace);
404        self
405    }
406    #[doc = "A comma-separated list of filters used to reduce the response."]
407    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
408        self.filter_path = Some(filter_path);
409        self
410    }
411    #[doc = "Adds a HTTP header"]
412    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
413        self.headers.insert(key, value);
414        self
415    }
416    #[doc = "Return human readable values for statistics."]
417    pub fn human(mut self, human: bool) -> Self {
418        self.human = Some(human);
419        self
420    }
421    #[doc = "Timeout for submitting request to master"]
422    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
423        self.master_timeout = Some(master_timeout);
424        self
425    }
426    #[doc = "Pretty format the returned JSON response."]
427    pub fn pretty(mut self, pretty: bool) -> Self {
428        self.pretty = Some(pretty);
429        self
430    }
431    #[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."]
432    pub fn request_timeout(mut self, timeout: Duration) -> Self {
433        self.request_timeout = Some(timeout);
434        self
435    }
436    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
437    pub fn source(mut self, source: &'b str) -> Self {
438        self.source = Some(source);
439        self
440    }
441    #[doc = "Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list."]
442    pub fn wait_for_removal(mut self, wait_for_removal: bool) -> Self {
443        self.wait_for_removal = Some(wait_for_removal);
444        self
445    }
446    #[doc = "Creates an asynchronous call to the Cluster Delete Voting Config Exclusions API that can be awaited"]
447    pub async fn send(self) -> Result<Response, Error> {
448        let path = self.parts.url();
449        let method = http::Method::Delete;
450        let headers = self.headers;
451        let timeout = self.request_timeout;
452        let query_string = {
453            #[serde_with::skip_serializing_none]
454            #[derive(Serialize)]
455            struct QueryParams<'b> {
456                error_trace: Option<bool>,
457                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
458                filter_path: Option<&'b [&'b str]>,
459                human: Option<bool>,
460                master_timeout: Option<&'b str>,
461                pretty: Option<bool>,
462                source: Option<&'b str>,
463                wait_for_removal: Option<bool>,
464            }
465            let query_params = QueryParams {
466                error_trace: self.error_trace,
467                filter_path: self.filter_path,
468                human: self.human,
469                master_timeout: self.master_timeout,
470                pretty: self.pretty,
471                source: self.source,
472                wait_for_removal: self.wait_for_removal,
473            };
474            Some(query_params)
475        };
476        let body = Option::<()>::None;
477        let response = self
478            .transport
479            .send(method, &path, headers, query_string.as_ref(), body, timeout)
480            .await?;
481        Ok(response)
482    }
483}
484#[derive(Debug, Clone, PartialEq, Eq)]
485#[doc = "API parts for the Cluster Exists Component Template API"]
486pub enum ClusterExistsComponentTemplateParts<'b> {
487    #[doc = "Name"]
488    Name(&'b str),
489}
490impl<'b> ClusterExistsComponentTemplateParts<'b> {
491    #[doc = "Builds a relative URL path to the Cluster Exists Component Template API"]
492    pub fn url(self) -> Cow<'static, str> {
493        match self {
494            ClusterExistsComponentTemplateParts::Name(name) => {
495                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
496                let mut p = String::with_capacity(21usize + encoded_name.len());
497                p.push_str("/_component_template/");
498                p.push_str(encoded_name.as_ref());
499                p.into()
500            }
501        }
502    }
503}
504#[doc = "Builder for the [Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nReturns information about whether a particular component template exist"]
505#[derive(Clone, Debug)]
506pub struct ClusterExistsComponentTemplate<'a, 'b> {
507    transport: &'a Transport,
508    parts: ClusterExistsComponentTemplateParts<'b>,
509    error_trace: Option<bool>,
510    filter_path: Option<&'b [&'b str]>,
511    headers: HeaderMap,
512    human: Option<bool>,
513    local: Option<bool>,
514    master_timeout: Option<&'b str>,
515    pretty: Option<bool>,
516    request_timeout: Option<Duration>,
517    source: Option<&'b str>,
518}
519impl<'a, 'b> ClusterExistsComponentTemplate<'a, 'b> {
520    #[doc = "Creates a new instance of [ClusterExistsComponentTemplate] with the specified API parts"]
521    pub fn new(transport: &'a Transport, parts: ClusterExistsComponentTemplateParts<'b>) -> Self {
522        let headers = HeaderMap::new();
523        ClusterExistsComponentTemplate {
524            transport,
525            parts,
526            headers,
527            error_trace: None,
528            filter_path: None,
529            human: None,
530            local: None,
531            master_timeout: None,
532            pretty: None,
533            request_timeout: None,
534            source: None,
535        }
536    }
537    #[doc = "Include the stack trace of returned errors."]
538    pub fn error_trace(mut self, error_trace: bool) -> Self {
539        self.error_trace = Some(error_trace);
540        self
541    }
542    #[doc = "A comma-separated list of filters used to reduce the response."]
543    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
544        self.filter_path = Some(filter_path);
545        self
546    }
547    #[doc = "Adds a HTTP header"]
548    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
549        self.headers.insert(key, value);
550        self
551    }
552    #[doc = "Return human readable values for statistics."]
553    pub fn human(mut self, human: bool) -> Self {
554        self.human = Some(human);
555        self
556    }
557    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
558    pub fn local(mut self, local: bool) -> Self {
559        self.local = Some(local);
560        self
561    }
562    #[doc = "Timeout for waiting for new cluster state in case it is blocked"]
563    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
564        self.master_timeout = Some(master_timeout);
565        self
566    }
567    #[doc = "Pretty format the returned JSON response."]
568    pub fn pretty(mut self, pretty: bool) -> Self {
569        self.pretty = Some(pretty);
570        self
571    }
572    #[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."]
573    pub fn request_timeout(mut self, timeout: Duration) -> Self {
574        self.request_timeout = Some(timeout);
575        self
576    }
577    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
578    pub fn source(mut self, source: &'b str) -> Self {
579        self.source = Some(source);
580        self
581    }
582    #[doc = "Creates an asynchronous call to the Cluster Exists Component Template API that can be awaited"]
583    pub async fn send(self) -> Result<Response, Error> {
584        let path = self.parts.url();
585        let method = http::Method::Head;
586        let headers = self.headers;
587        let timeout = self.request_timeout;
588        let query_string = {
589            #[serde_with::skip_serializing_none]
590            #[derive(Serialize)]
591            struct QueryParams<'b> {
592                error_trace: Option<bool>,
593                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
594                filter_path: Option<&'b [&'b str]>,
595                human: Option<bool>,
596                local: Option<bool>,
597                master_timeout: Option<&'b str>,
598                pretty: Option<bool>,
599                source: Option<&'b str>,
600            }
601            let query_params = QueryParams {
602                error_trace: self.error_trace,
603                filter_path: self.filter_path,
604                human: self.human,
605                local: self.local,
606                master_timeout: self.master_timeout,
607                pretty: self.pretty,
608                source: self.source,
609            };
610            Some(query_params)
611        };
612        let body = Option::<()>::None;
613        let response = self
614            .transport
615            .send(method, &path, headers, query_string.as_ref(), body, timeout)
616            .await?;
617        Ok(response)
618    }
619}
620#[derive(Debug, Clone, PartialEq, Eq)]
621#[doc = "API parts for the Cluster Get Component Template API"]
622pub enum ClusterGetComponentTemplateParts<'b> {
623    #[doc = "No parts"]
624    None,
625    #[doc = "Name"]
626    Name(&'b [&'b str]),
627}
628impl<'b> ClusterGetComponentTemplateParts<'b> {
629    #[doc = "Builds a relative URL path to the Cluster Get Component Template API"]
630    pub fn url(self) -> Cow<'static, str> {
631        match self {
632            ClusterGetComponentTemplateParts::None => "/_component_template".into(),
633            ClusterGetComponentTemplateParts::Name(name) => {
634                let name_str = name.join(",");
635                let encoded_name: Cow<str> =
636                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
637                let mut p = String::with_capacity(21usize + encoded_name.len());
638                p.push_str("/_component_template/");
639                p.push_str(encoded_name.as_ref());
640                p.into()
641            }
642        }
643    }
644}
645#[doc = "Builder for the [Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nReturns one or more component templates"]
646#[derive(Clone, Debug)]
647pub struct ClusterGetComponentTemplate<'a, 'b> {
648    transport: &'a Transport,
649    parts: ClusterGetComponentTemplateParts<'b>,
650    error_trace: Option<bool>,
651    filter_path: Option<&'b [&'b str]>,
652    headers: HeaderMap,
653    human: Option<bool>,
654    include_defaults: Option<bool>,
655    local: Option<bool>,
656    master_timeout: Option<&'b str>,
657    pretty: Option<bool>,
658    request_timeout: Option<Duration>,
659    source: Option<&'b str>,
660}
661impl<'a, 'b> ClusterGetComponentTemplate<'a, 'b> {
662    #[doc = "Creates a new instance of [ClusterGetComponentTemplate] with the specified API parts"]
663    pub fn new(transport: &'a Transport, parts: ClusterGetComponentTemplateParts<'b>) -> Self {
664        let headers = HeaderMap::new();
665        ClusterGetComponentTemplate {
666            transport,
667            parts,
668            headers,
669            error_trace: None,
670            filter_path: None,
671            human: None,
672            include_defaults: None,
673            local: None,
674            master_timeout: None,
675            pretty: None,
676            request_timeout: None,
677            source: None,
678        }
679    }
680    #[doc = "Include the stack trace of returned errors."]
681    pub fn error_trace(mut self, error_trace: bool) -> Self {
682        self.error_trace = Some(error_trace);
683        self
684    }
685    #[doc = "A comma-separated list of filters used to reduce the response."]
686    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
687        self.filter_path = Some(filter_path);
688        self
689    }
690    #[doc = "Adds a HTTP header"]
691    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
692        self.headers.insert(key, value);
693        self
694    }
695    #[doc = "Return human readable values for statistics."]
696    pub fn human(mut self, human: bool) -> Self {
697        self.human = Some(human);
698        self
699    }
700    #[doc = "Return all default configurations for the component template (default: false)"]
701    pub fn include_defaults(mut self, include_defaults: bool) -> Self {
702        self.include_defaults = Some(include_defaults);
703        self
704    }
705    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
706    pub fn local(mut self, local: bool) -> Self {
707        self.local = Some(local);
708        self
709    }
710    #[doc = "Timeout for waiting for new cluster state in case it is blocked"]
711    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
712        self.master_timeout = Some(master_timeout);
713        self
714    }
715    #[doc = "Pretty format the returned JSON response."]
716    pub fn pretty(mut self, pretty: bool) -> Self {
717        self.pretty = Some(pretty);
718        self
719    }
720    #[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."]
721    pub fn request_timeout(mut self, timeout: Duration) -> Self {
722        self.request_timeout = Some(timeout);
723        self
724    }
725    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
726    pub fn source(mut self, source: &'b str) -> Self {
727        self.source = Some(source);
728        self
729    }
730    #[doc = "Creates an asynchronous call to the Cluster Get Component Template API that can be awaited"]
731    pub async fn send(self) -> Result<Response, Error> {
732        let path = self.parts.url();
733        let method = http::Method::Get;
734        let headers = self.headers;
735        let timeout = self.request_timeout;
736        let query_string = {
737            #[serde_with::skip_serializing_none]
738            #[derive(Serialize)]
739            struct QueryParams<'b> {
740                error_trace: Option<bool>,
741                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
742                filter_path: Option<&'b [&'b str]>,
743                human: Option<bool>,
744                include_defaults: Option<bool>,
745                local: Option<bool>,
746                master_timeout: Option<&'b str>,
747                pretty: Option<bool>,
748                source: Option<&'b str>,
749            }
750            let query_params = QueryParams {
751                error_trace: self.error_trace,
752                filter_path: self.filter_path,
753                human: self.human,
754                include_defaults: self.include_defaults,
755                local: self.local,
756                master_timeout: self.master_timeout,
757                pretty: self.pretty,
758                source: self.source,
759            };
760            Some(query_params)
761        };
762        let body = Option::<()>::None;
763        let response = self
764            .transport
765            .send(method, &path, headers, query_string.as_ref(), body, timeout)
766            .await?;
767        Ok(response)
768    }
769}
770#[derive(Debug, Clone, PartialEq, Eq)]
771#[doc = "API parts for the Cluster Get Settings API"]
772pub enum ClusterGetSettingsParts {
773    #[doc = "No parts"]
774    None,
775}
776impl ClusterGetSettingsParts {
777    #[doc = "Builds a relative URL path to the Cluster Get Settings API"]
778    pub fn url(self) -> Cow<'static, str> {
779        match self {
780            ClusterGetSettingsParts::None => "/_cluster/settings".into(),
781        }
782    }
783}
784#[doc = "Builder for the [Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-get-settings.html)\n\nReturns cluster settings."]
785#[derive(Clone, Debug)]
786pub struct ClusterGetSettings<'a, 'b> {
787    transport: &'a Transport,
788    parts: ClusterGetSettingsParts,
789    error_trace: Option<bool>,
790    filter_path: Option<&'b [&'b str]>,
791    flat_settings: Option<bool>,
792    headers: HeaderMap,
793    human: Option<bool>,
794    include_defaults: Option<bool>,
795    master_timeout: Option<&'b str>,
796    pretty: Option<bool>,
797    request_timeout: Option<Duration>,
798    source: Option<&'b str>,
799    timeout: Option<&'b str>,
800}
801impl<'a, 'b> ClusterGetSettings<'a, 'b> {
802    #[doc = "Creates a new instance of [ClusterGetSettings]"]
803    pub fn new(transport: &'a Transport) -> Self {
804        let headers = HeaderMap::new();
805        ClusterGetSettings {
806            transport,
807            parts: ClusterGetSettingsParts::None,
808            headers,
809            error_trace: None,
810            filter_path: None,
811            flat_settings: None,
812            human: None,
813            include_defaults: None,
814            master_timeout: None,
815            pretty: None,
816            request_timeout: None,
817            source: None,
818            timeout: None,
819        }
820    }
821    #[doc = "Include the stack trace of returned errors."]
822    pub fn error_trace(mut self, error_trace: bool) -> Self {
823        self.error_trace = Some(error_trace);
824        self
825    }
826    #[doc = "A comma-separated list of filters used to reduce the response."]
827    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
828        self.filter_path = Some(filter_path);
829        self
830    }
831    #[doc = "Return settings in flat format (default: false)"]
832    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
833        self.flat_settings = Some(flat_settings);
834        self
835    }
836    #[doc = "Adds a HTTP header"]
837    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
838        self.headers.insert(key, value);
839        self
840    }
841    #[doc = "Return human readable values for statistics."]
842    pub fn human(mut self, human: bool) -> Self {
843        self.human = Some(human);
844        self
845    }
846    #[doc = "Whether to return all default clusters setting."]
847    pub fn include_defaults(mut self, include_defaults: bool) -> Self {
848        self.include_defaults = Some(include_defaults);
849        self
850    }
851    #[doc = "Timeout for waiting for new cluster state in case it is blocked"]
852    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
853        self.master_timeout = Some(master_timeout);
854        self
855    }
856    #[doc = "Pretty format the returned JSON response."]
857    pub fn pretty(mut self, pretty: bool) -> Self {
858        self.pretty = Some(pretty);
859        self
860    }
861    #[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."]
862    pub fn request_timeout(mut self, timeout: Duration) -> Self {
863        self.request_timeout = Some(timeout);
864        self
865    }
866    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
867    pub fn source(mut self, source: &'b str) -> Self {
868        self.source = Some(source);
869        self
870    }
871    #[doc = "Explicit operation timeout"]
872    pub fn timeout(mut self, timeout: &'b str) -> Self {
873        self.timeout = Some(timeout);
874        self
875    }
876    #[doc = "Creates an asynchronous call to the Cluster Get Settings API that can be awaited"]
877    pub async fn send(self) -> Result<Response, Error> {
878        let path = self.parts.url();
879        let method = http::Method::Get;
880        let headers = self.headers;
881        let timeout = self.request_timeout;
882        let query_string = {
883            #[serde_with::skip_serializing_none]
884            #[derive(Serialize)]
885            struct QueryParams<'b> {
886                error_trace: Option<bool>,
887                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
888                filter_path: Option<&'b [&'b str]>,
889                flat_settings: Option<bool>,
890                human: Option<bool>,
891                include_defaults: Option<bool>,
892                master_timeout: Option<&'b str>,
893                pretty: Option<bool>,
894                source: Option<&'b str>,
895                timeout: Option<&'b str>,
896            }
897            let query_params = QueryParams {
898                error_trace: self.error_trace,
899                filter_path: self.filter_path,
900                flat_settings: self.flat_settings,
901                human: self.human,
902                include_defaults: self.include_defaults,
903                master_timeout: self.master_timeout,
904                pretty: self.pretty,
905                source: self.source,
906                timeout: self.timeout,
907            };
908            Some(query_params)
909        };
910        let body = Option::<()>::None;
911        let response = self
912            .transport
913            .send(method, &path, headers, query_string.as_ref(), body, timeout)
914            .await?;
915        Ok(response)
916    }
917}
918#[derive(Debug, Clone, PartialEq, Eq)]
919#[doc = "API parts for the Cluster Health API"]
920pub enum ClusterHealthParts<'b> {
921    #[doc = "No parts"]
922    None,
923    #[doc = "Index"]
924    Index(&'b [&'b str]),
925}
926impl<'b> ClusterHealthParts<'b> {
927    #[doc = "Builds a relative URL path to the Cluster Health API"]
928    pub fn url(self) -> Cow<'static, str> {
929        match self {
930            ClusterHealthParts::None => "/_cluster/health".into(),
931            ClusterHealthParts::Index(index) => {
932                let index_str = index.join(",");
933                let encoded_index: Cow<str> =
934                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
935                let mut p = String::with_capacity(17usize + encoded_index.len());
936                p.push_str("/_cluster/health/");
937                p.push_str(encoded_index.as_ref());
938                p.into()
939            }
940        }
941    }
942}
943#[doc = "Builder for the [Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-health.html)\n\nReturns basic information about the health of the cluster."]
944#[derive(Clone, Debug)]
945pub struct ClusterHealth<'a, 'b> {
946    transport: &'a Transport,
947    parts: ClusterHealthParts<'b>,
948    error_trace: Option<bool>,
949    expand_wildcards: Option<&'b [ExpandWildcards]>,
950    filter_path: Option<&'b [&'b str]>,
951    headers: HeaderMap,
952    human: Option<bool>,
953    level: Option<Level>,
954    local: Option<bool>,
955    master_timeout: Option<&'b str>,
956    pretty: Option<bool>,
957    request_timeout: Option<Duration>,
958    source: Option<&'b str>,
959    timeout: Option<&'b str>,
960    wait_for_active_shards: Option<&'b str>,
961    wait_for_events: Option<WaitForEvents>,
962    wait_for_no_initializing_shards: Option<bool>,
963    wait_for_no_relocating_shards: Option<bool>,
964    wait_for_nodes: Option<&'b str>,
965    wait_for_status: Option<WaitForStatus>,
966}
967impl<'a, 'b> ClusterHealth<'a, 'b> {
968    #[doc = "Creates a new instance of [ClusterHealth] with the specified API parts"]
969    pub fn new(transport: &'a Transport, parts: ClusterHealthParts<'b>) -> Self {
970        let headers = HeaderMap::new();
971        ClusterHealth {
972            transport,
973            parts,
974            headers,
975            error_trace: None,
976            expand_wildcards: None,
977            filter_path: None,
978            human: None,
979            level: None,
980            local: None,
981            master_timeout: None,
982            pretty: None,
983            request_timeout: None,
984            source: None,
985            timeout: None,
986            wait_for_active_shards: None,
987            wait_for_events: None,
988            wait_for_no_initializing_shards: None,
989            wait_for_no_relocating_shards: None,
990            wait_for_nodes: None,
991            wait_for_status: None,
992        }
993    }
994    #[doc = "Include the stack trace of returned errors."]
995    pub fn error_trace(mut self, error_trace: bool) -> Self {
996        self.error_trace = Some(error_trace);
997        self
998    }
999    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
1000    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
1001        self.expand_wildcards = Some(expand_wildcards);
1002        self
1003    }
1004    #[doc = "A comma-separated list of filters used to reduce the response."]
1005    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1006        self.filter_path = Some(filter_path);
1007        self
1008    }
1009    #[doc = "Adds a HTTP header"]
1010    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1011        self.headers.insert(key, value);
1012        self
1013    }
1014    #[doc = "Return human readable values for statistics."]
1015    pub fn human(mut self, human: bool) -> Self {
1016        self.human = Some(human);
1017        self
1018    }
1019    #[doc = "Specify the level of detail for returned information"]
1020    pub fn level(mut self, level: Level) -> Self {
1021        self.level = Some(level);
1022        self
1023    }
1024    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
1025    pub fn local(mut self, local: bool) -> Self {
1026        self.local = Some(local);
1027        self
1028    }
1029    #[doc = "Explicit operation timeout for connection to master node"]
1030    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1031        self.master_timeout = Some(master_timeout);
1032        self
1033    }
1034    #[doc = "Pretty format the returned JSON response."]
1035    pub fn pretty(mut self, pretty: bool) -> Self {
1036        self.pretty = Some(pretty);
1037        self
1038    }
1039    #[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."]
1040    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1041        self.request_timeout = Some(timeout);
1042        self
1043    }
1044    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1045    pub fn source(mut self, source: &'b str) -> Self {
1046        self.source = Some(source);
1047        self
1048    }
1049    #[doc = "Explicit operation timeout"]
1050    pub fn timeout(mut self, timeout: &'b str) -> Self {
1051        self.timeout = Some(timeout);
1052        self
1053    }
1054    #[doc = "Wait until the specified number of shards is active"]
1055    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
1056        self.wait_for_active_shards = Some(wait_for_active_shards);
1057        self
1058    }
1059    #[doc = "Wait until all currently queued events with the given priority are processed"]
1060    pub fn wait_for_events(mut self, wait_for_events: WaitForEvents) -> Self {
1061        self.wait_for_events = Some(wait_for_events);
1062        self
1063    }
1064    #[doc = "Whether to wait until there are no initializing shards in the cluster"]
1065    pub fn wait_for_no_initializing_shards(
1066        mut self,
1067        wait_for_no_initializing_shards: bool,
1068    ) -> Self {
1069        self.wait_for_no_initializing_shards = Some(wait_for_no_initializing_shards);
1070        self
1071    }
1072    #[doc = "Whether to wait until there are no relocating shards in the cluster"]
1073    pub fn wait_for_no_relocating_shards(mut self, wait_for_no_relocating_shards: bool) -> Self {
1074        self.wait_for_no_relocating_shards = Some(wait_for_no_relocating_shards);
1075        self
1076    }
1077    #[doc = "Wait until the specified number of nodes is available"]
1078    pub fn wait_for_nodes(mut self, wait_for_nodes: &'b str) -> Self {
1079        self.wait_for_nodes = Some(wait_for_nodes);
1080        self
1081    }
1082    #[doc = "Wait until cluster is in a specific state"]
1083    pub fn wait_for_status(mut self, wait_for_status: WaitForStatus) -> Self {
1084        self.wait_for_status = Some(wait_for_status);
1085        self
1086    }
1087    #[doc = "Creates an asynchronous call to the Cluster Health API that can be awaited"]
1088    pub async fn send(self) -> Result<Response, Error> {
1089        let path = self.parts.url();
1090        let method = http::Method::Get;
1091        let headers = self.headers;
1092        let timeout = self.request_timeout;
1093        let query_string = {
1094            #[serde_with::skip_serializing_none]
1095            #[derive(Serialize)]
1096            struct QueryParams<'b> {
1097                error_trace: Option<bool>,
1098                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1099                expand_wildcards: Option<&'b [ExpandWildcards]>,
1100                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1101                filter_path: Option<&'b [&'b str]>,
1102                human: Option<bool>,
1103                level: Option<Level>,
1104                local: Option<bool>,
1105                master_timeout: Option<&'b str>,
1106                pretty: Option<bool>,
1107                source: Option<&'b str>,
1108                timeout: Option<&'b str>,
1109                wait_for_active_shards: Option<&'b str>,
1110                wait_for_events: Option<WaitForEvents>,
1111                wait_for_no_initializing_shards: Option<bool>,
1112                wait_for_no_relocating_shards: Option<bool>,
1113                wait_for_nodes: Option<&'b str>,
1114                wait_for_status: Option<WaitForStatus>,
1115            }
1116            let query_params = QueryParams {
1117                error_trace: self.error_trace,
1118                expand_wildcards: self.expand_wildcards,
1119                filter_path: self.filter_path,
1120                human: self.human,
1121                level: self.level,
1122                local: self.local,
1123                master_timeout: self.master_timeout,
1124                pretty: self.pretty,
1125                source: self.source,
1126                timeout: self.timeout,
1127                wait_for_active_shards: self.wait_for_active_shards,
1128                wait_for_events: self.wait_for_events,
1129                wait_for_no_initializing_shards: self.wait_for_no_initializing_shards,
1130                wait_for_no_relocating_shards: self.wait_for_no_relocating_shards,
1131                wait_for_nodes: self.wait_for_nodes,
1132                wait_for_status: self.wait_for_status,
1133            };
1134            Some(query_params)
1135        };
1136        let body = Option::<()>::None;
1137        let response = self
1138            .transport
1139            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1140            .await?;
1141        Ok(response)
1142    }
1143}
1144#[derive(Debug, Clone, PartialEq, Eq)]
1145#[doc = "API parts for the Cluster Info API"]
1146pub enum ClusterInfoParts<'b> {
1147    #[doc = "Target"]
1148    Target(&'b [&'b str]),
1149}
1150impl<'b> ClusterInfoParts<'b> {
1151    #[doc = "Builds a relative URL path to the Cluster Info API"]
1152    pub fn url(self) -> Cow<'static, str> {
1153        match self {
1154            ClusterInfoParts::Target(target) => {
1155                let target_str = target.join(",");
1156                let encoded_target: Cow<str> =
1157                    percent_encode(target_str.as_bytes(), PARTS_ENCODED).into();
1158                let mut p = String::with_capacity(7usize + encoded_target.len());
1159                p.push_str("/_info/");
1160                p.push_str(encoded_target.as_ref());
1161                p.into()
1162            }
1163        }
1164    }
1165}
1166#[doc = "Builder for the [Cluster Info API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-info.html)\n\nReturns different information about the cluster."]
1167#[derive(Clone, Debug)]
1168pub struct ClusterInfo<'a, 'b> {
1169    transport: &'a Transport,
1170    parts: ClusterInfoParts<'b>,
1171    error_trace: Option<bool>,
1172    filter_path: Option<&'b [&'b str]>,
1173    headers: HeaderMap,
1174    human: Option<bool>,
1175    pretty: Option<bool>,
1176    request_timeout: Option<Duration>,
1177    source: Option<&'b str>,
1178}
1179impl<'a, 'b> ClusterInfo<'a, 'b> {
1180    #[doc = "Creates a new instance of [ClusterInfo] with the specified API parts"]
1181    pub fn new(transport: &'a Transport, parts: ClusterInfoParts<'b>) -> Self {
1182        let headers = HeaderMap::new();
1183        ClusterInfo {
1184            transport,
1185            parts,
1186            headers,
1187            error_trace: None,
1188            filter_path: None,
1189            human: None,
1190            pretty: None,
1191            request_timeout: None,
1192            source: None,
1193        }
1194    }
1195    #[doc = "Include the stack trace of returned errors."]
1196    pub fn error_trace(mut self, error_trace: bool) -> Self {
1197        self.error_trace = Some(error_trace);
1198        self
1199    }
1200    #[doc = "A comma-separated list of filters used to reduce the response."]
1201    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1202        self.filter_path = Some(filter_path);
1203        self
1204    }
1205    #[doc = "Adds a HTTP header"]
1206    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1207        self.headers.insert(key, value);
1208        self
1209    }
1210    #[doc = "Return human readable values for statistics."]
1211    pub fn human(mut self, human: bool) -> Self {
1212        self.human = Some(human);
1213        self
1214    }
1215    #[doc = "Pretty format the returned JSON response."]
1216    pub fn pretty(mut self, pretty: bool) -> Self {
1217        self.pretty = Some(pretty);
1218        self
1219    }
1220    #[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."]
1221    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1222        self.request_timeout = Some(timeout);
1223        self
1224    }
1225    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1226    pub fn source(mut self, source: &'b str) -> Self {
1227        self.source = Some(source);
1228        self
1229    }
1230    #[doc = "Creates an asynchronous call to the Cluster Info API that can be awaited"]
1231    pub async fn send(self) -> Result<Response, Error> {
1232        let path = self.parts.url();
1233        let method = http::Method::Get;
1234        let headers = self.headers;
1235        let timeout = self.request_timeout;
1236        let query_string = {
1237            #[serde_with::skip_serializing_none]
1238            #[derive(Serialize)]
1239            struct QueryParams<'b> {
1240                error_trace: Option<bool>,
1241                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1242                filter_path: Option<&'b [&'b str]>,
1243                human: Option<bool>,
1244                pretty: Option<bool>,
1245                source: Option<&'b str>,
1246            }
1247            let query_params = QueryParams {
1248                error_trace: self.error_trace,
1249                filter_path: self.filter_path,
1250                human: self.human,
1251                pretty: self.pretty,
1252                source: self.source,
1253            };
1254            Some(query_params)
1255        };
1256        let body = Option::<()>::None;
1257        let response = self
1258            .transport
1259            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1260            .await?;
1261        Ok(response)
1262    }
1263}
1264#[derive(Debug, Clone, PartialEq, Eq)]
1265#[doc = "API parts for the Cluster Pending Tasks API"]
1266pub enum ClusterPendingTasksParts {
1267    #[doc = "No parts"]
1268    None,
1269}
1270impl ClusterPendingTasksParts {
1271    #[doc = "Builds a relative URL path to the Cluster Pending Tasks API"]
1272    pub fn url(self) -> Cow<'static, str> {
1273        match self {
1274            ClusterPendingTasksParts::None => "/_cluster/pending_tasks".into(),
1275        }
1276    }
1277}
1278#[doc = "Builder for the [Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/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."]
1279#[derive(Clone, Debug)]
1280pub struct ClusterPendingTasks<'a, 'b> {
1281    transport: &'a Transport,
1282    parts: ClusterPendingTasksParts,
1283    error_trace: Option<bool>,
1284    filter_path: Option<&'b [&'b str]>,
1285    headers: HeaderMap,
1286    human: Option<bool>,
1287    local: Option<bool>,
1288    master_timeout: Option<&'b str>,
1289    pretty: Option<bool>,
1290    request_timeout: Option<Duration>,
1291    source: Option<&'b str>,
1292}
1293impl<'a, 'b> ClusterPendingTasks<'a, 'b> {
1294    #[doc = "Creates a new instance of [ClusterPendingTasks]"]
1295    pub fn new(transport: &'a Transport) -> Self {
1296        let headers = HeaderMap::new();
1297        ClusterPendingTasks {
1298            transport,
1299            parts: ClusterPendingTasksParts::None,
1300            headers,
1301            error_trace: None,
1302            filter_path: None,
1303            human: None,
1304            local: None,
1305            master_timeout: None,
1306            pretty: None,
1307            request_timeout: None,
1308            source: None,
1309        }
1310    }
1311    #[doc = "Include the stack trace of returned errors."]
1312    pub fn error_trace(mut self, error_trace: bool) -> Self {
1313        self.error_trace = Some(error_trace);
1314        self
1315    }
1316    #[doc = "A comma-separated list of filters used to reduce the response."]
1317    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1318        self.filter_path = Some(filter_path);
1319        self
1320    }
1321    #[doc = "Adds a HTTP header"]
1322    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1323        self.headers.insert(key, value);
1324        self
1325    }
1326    #[doc = "Return human readable values for statistics."]
1327    pub fn human(mut self, human: bool) -> Self {
1328        self.human = Some(human);
1329        self
1330    }
1331    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
1332    pub fn local(mut self, local: bool) -> Self {
1333        self.local = Some(local);
1334        self
1335    }
1336    #[doc = "Specify timeout for connection to master"]
1337    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1338        self.master_timeout = Some(master_timeout);
1339        self
1340    }
1341    #[doc = "Pretty format the returned JSON response."]
1342    pub fn pretty(mut self, pretty: bool) -> Self {
1343        self.pretty = Some(pretty);
1344        self
1345    }
1346    #[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."]
1347    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1348        self.request_timeout = Some(timeout);
1349        self
1350    }
1351    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1352    pub fn source(mut self, source: &'b str) -> Self {
1353        self.source = Some(source);
1354        self
1355    }
1356    #[doc = "Creates an asynchronous call to the Cluster Pending Tasks API that can be awaited"]
1357    pub async fn send(self) -> Result<Response, Error> {
1358        let path = self.parts.url();
1359        let method = http::Method::Get;
1360        let headers = self.headers;
1361        let timeout = self.request_timeout;
1362        let query_string = {
1363            #[serde_with::skip_serializing_none]
1364            #[derive(Serialize)]
1365            struct QueryParams<'b> {
1366                error_trace: Option<bool>,
1367                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1368                filter_path: Option<&'b [&'b str]>,
1369                human: Option<bool>,
1370                local: Option<bool>,
1371                master_timeout: Option<&'b str>,
1372                pretty: Option<bool>,
1373                source: Option<&'b str>,
1374            }
1375            let query_params = QueryParams {
1376                error_trace: self.error_trace,
1377                filter_path: self.filter_path,
1378                human: self.human,
1379                local: self.local,
1380                master_timeout: self.master_timeout,
1381                pretty: self.pretty,
1382                source: self.source,
1383            };
1384            Some(query_params)
1385        };
1386        let body = Option::<()>::None;
1387        let response = self
1388            .transport
1389            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1390            .await?;
1391        Ok(response)
1392    }
1393}
1394#[derive(Debug, Clone, PartialEq, Eq)]
1395#[doc = "API parts for the Cluster Post Voting Config Exclusions API"]
1396pub enum ClusterPostVotingConfigExclusionsParts {
1397    #[doc = "No parts"]
1398    None,
1399}
1400impl ClusterPostVotingConfigExclusionsParts {
1401    #[doc = "Builds a relative URL path to the Cluster Post Voting Config Exclusions API"]
1402    pub fn url(self) -> Cow<'static, str> {
1403        match self {
1404            ClusterPostVotingConfigExclusionsParts::None => {
1405                "/_cluster/voting_config_exclusions".into()
1406            }
1407        }
1408    }
1409}
1410#[doc = "Builder for the [Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."]
1411#[derive(Clone, Debug)]
1412pub struct ClusterPostVotingConfigExclusions<'a, 'b, B> {
1413    transport: &'a Transport,
1414    parts: ClusterPostVotingConfigExclusionsParts,
1415    body: Option<B>,
1416    error_trace: Option<bool>,
1417    filter_path: Option<&'b [&'b str]>,
1418    headers: HeaderMap,
1419    human: Option<bool>,
1420    master_timeout: Option<&'b str>,
1421    node_ids: Option<&'b str>,
1422    node_names: Option<&'b str>,
1423    pretty: Option<bool>,
1424    request_timeout: Option<Duration>,
1425    source: Option<&'b str>,
1426    timeout: Option<&'b str>,
1427}
1428impl<'a, 'b, B> ClusterPostVotingConfigExclusions<'a, 'b, B>
1429where
1430    B: Body,
1431{
1432    #[doc = "Creates a new instance of [ClusterPostVotingConfigExclusions]"]
1433    pub fn new(transport: &'a Transport) -> Self {
1434        let headers = HeaderMap::new();
1435        ClusterPostVotingConfigExclusions {
1436            transport,
1437            parts: ClusterPostVotingConfigExclusionsParts::None,
1438            headers,
1439            body: None,
1440            error_trace: None,
1441            filter_path: None,
1442            human: None,
1443            master_timeout: None,
1444            node_ids: None,
1445            node_names: None,
1446            pretty: None,
1447            request_timeout: None,
1448            source: None,
1449            timeout: None,
1450        }
1451    }
1452    #[doc = "The body for the API call"]
1453    pub fn body<T>(self, body: T) -> ClusterPostVotingConfigExclusions<'a, 'b, JsonBody<T>>
1454    where
1455        T: Serialize,
1456    {
1457        ClusterPostVotingConfigExclusions {
1458            transport: self.transport,
1459            parts: self.parts,
1460            body: Some(body.into()),
1461            error_trace: self.error_trace,
1462            filter_path: self.filter_path,
1463            headers: self.headers,
1464            human: self.human,
1465            master_timeout: self.master_timeout,
1466            node_ids: self.node_ids,
1467            node_names: self.node_names,
1468            pretty: self.pretty,
1469            request_timeout: self.request_timeout,
1470            source: self.source,
1471            timeout: self.timeout,
1472        }
1473    }
1474    #[doc = "Include the stack trace of returned errors."]
1475    pub fn error_trace(mut self, error_trace: bool) -> Self {
1476        self.error_trace = Some(error_trace);
1477        self
1478    }
1479    #[doc = "A comma-separated list of filters used to reduce the response."]
1480    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1481        self.filter_path = Some(filter_path);
1482        self
1483    }
1484    #[doc = "Adds a HTTP header"]
1485    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1486        self.headers.insert(key, value);
1487        self
1488    }
1489    #[doc = "Return human readable values for statistics."]
1490    pub fn human(mut self, human: bool) -> Self {
1491        self.human = Some(human);
1492        self
1493    }
1494    #[doc = "Timeout for submitting request to master"]
1495    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1496        self.master_timeout = Some(master_timeout);
1497        self
1498    }
1499    #[doc = "A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names."]
1500    pub fn node_ids(mut self, node_ids: &'b str) -> Self {
1501        self.node_ids = Some(node_ids);
1502        self
1503    }
1504    #[doc = "A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids."]
1505    pub fn node_names(mut self, node_names: &'b str) -> Self {
1506        self.node_names = Some(node_names);
1507        self
1508    }
1509    #[doc = "Pretty format the returned JSON response."]
1510    pub fn pretty(mut self, pretty: bool) -> Self {
1511        self.pretty = Some(pretty);
1512        self
1513    }
1514    #[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."]
1515    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1516        self.request_timeout = Some(timeout);
1517        self
1518    }
1519    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1520    pub fn source(mut self, source: &'b str) -> Self {
1521        self.source = Some(source);
1522        self
1523    }
1524    #[doc = "Explicit operation timeout"]
1525    pub fn timeout(mut self, timeout: &'b str) -> Self {
1526        self.timeout = Some(timeout);
1527        self
1528    }
1529    #[doc = "Creates an asynchronous call to the Cluster Post Voting Config Exclusions API that can be awaited"]
1530    pub async fn send(self) -> Result<Response, Error> {
1531        let path = self.parts.url();
1532        let method = http::Method::Post;
1533        let headers = self.headers;
1534        let timeout = self.request_timeout;
1535        let query_string = {
1536            #[serde_with::skip_serializing_none]
1537            #[derive(Serialize)]
1538            struct QueryParams<'b> {
1539                error_trace: Option<bool>,
1540                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1541                filter_path: Option<&'b [&'b str]>,
1542                human: Option<bool>,
1543                master_timeout: Option<&'b str>,
1544                node_ids: Option<&'b str>,
1545                node_names: Option<&'b str>,
1546                pretty: Option<bool>,
1547                source: Option<&'b str>,
1548                timeout: Option<&'b str>,
1549            }
1550            let query_params = QueryParams {
1551                error_trace: self.error_trace,
1552                filter_path: self.filter_path,
1553                human: self.human,
1554                master_timeout: self.master_timeout,
1555                node_ids: self.node_ids,
1556                node_names: self.node_names,
1557                pretty: self.pretty,
1558                source: self.source,
1559                timeout: self.timeout,
1560            };
1561            Some(query_params)
1562        };
1563        let body = self.body;
1564        let response = self
1565            .transport
1566            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1567            .await?;
1568        Ok(response)
1569    }
1570}
1571#[derive(Debug, Clone, PartialEq, Eq)]
1572#[doc = "API parts for the Cluster Put Component Template API"]
1573pub enum ClusterPutComponentTemplateParts<'b> {
1574    #[doc = "Name"]
1575    Name(&'b str),
1576}
1577impl<'b> ClusterPutComponentTemplateParts<'b> {
1578    #[doc = "Builds a relative URL path to the Cluster Put Component Template API"]
1579    pub fn url(self) -> Cow<'static, str> {
1580        match self {
1581            ClusterPutComponentTemplateParts::Name(name) => {
1582                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
1583                let mut p = String::with_capacity(21usize + encoded_name.len());
1584                p.push_str("/_component_template/");
1585                p.push_str(encoded_name.as_ref());
1586                p.into()
1587            }
1588        }
1589    }
1590}
1591#[doc = "Builder for the [Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nCreates or updates a component template"]
1592#[derive(Clone, Debug)]
1593pub struct ClusterPutComponentTemplate<'a, 'b, B> {
1594    transport: &'a Transport,
1595    parts: ClusterPutComponentTemplateParts<'b>,
1596    body: Option<B>,
1597    create: Option<bool>,
1598    error_trace: Option<bool>,
1599    filter_path: Option<&'b [&'b str]>,
1600    headers: HeaderMap,
1601    human: Option<bool>,
1602    master_timeout: Option<&'b str>,
1603    pretty: Option<bool>,
1604    request_timeout: Option<Duration>,
1605    source: Option<&'b str>,
1606    timeout: Option<&'b str>,
1607}
1608impl<'a, 'b, B> ClusterPutComponentTemplate<'a, 'b, B>
1609where
1610    B: Body,
1611{
1612    #[doc = "Creates a new instance of [ClusterPutComponentTemplate] with the specified API parts"]
1613    pub fn new(transport: &'a Transport, parts: ClusterPutComponentTemplateParts<'b>) -> Self {
1614        let headers = HeaderMap::new();
1615        ClusterPutComponentTemplate {
1616            transport,
1617            parts,
1618            headers,
1619            body: None,
1620            create: None,
1621            error_trace: None,
1622            filter_path: None,
1623            human: None,
1624            master_timeout: None,
1625            pretty: None,
1626            request_timeout: None,
1627            source: None,
1628            timeout: None,
1629        }
1630    }
1631    #[doc = "The body for the API call"]
1632    pub fn body<T>(self, body: T) -> ClusterPutComponentTemplate<'a, 'b, JsonBody<T>>
1633    where
1634        T: Serialize,
1635    {
1636        ClusterPutComponentTemplate {
1637            transport: self.transport,
1638            parts: self.parts,
1639            body: Some(body.into()),
1640            create: self.create,
1641            error_trace: self.error_trace,
1642            filter_path: self.filter_path,
1643            headers: self.headers,
1644            human: self.human,
1645            master_timeout: self.master_timeout,
1646            pretty: self.pretty,
1647            request_timeout: self.request_timeout,
1648            source: self.source,
1649            timeout: self.timeout,
1650        }
1651    }
1652    #[doc = "Whether the index template should only be added if new or can also replace an existing one"]
1653    pub fn create(mut self, create: bool) -> Self {
1654        self.create = Some(create);
1655        self
1656    }
1657    #[doc = "Include the stack trace of returned errors."]
1658    pub fn error_trace(mut self, error_trace: bool) -> Self {
1659        self.error_trace = Some(error_trace);
1660        self
1661    }
1662    #[doc = "A comma-separated list of filters used to reduce the response."]
1663    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1664        self.filter_path = Some(filter_path);
1665        self
1666    }
1667    #[doc = "Adds a HTTP header"]
1668    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1669        self.headers.insert(key, value);
1670        self
1671    }
1672    #[doc = "Return human readable values for statistics."]
1673    pub fn human(mut self, human: bool) -> Self {
1674        self.human = Some(human);
1675        self
1676    }
1677    #[doc = "Specify timeout for connection to master"]
1678    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1679        self.master_timeout = Some(master_timeout);
1680        self
1681    }
1682    #[doc = "Pretty format the returned JSON response."]
1683    pub fn pretty(mut self, pretty: bool) -> Self {
1684        self.pretty = Some(pretty);
1685        self
1686    }
1687    #[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."]
1688    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1689        self.request_timeout = Some(timeout);
1690        self
1691    }
1692    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1693    pub fn source(mut self, source: &'b str) -> Self {
1694        self.source = Some(source);
1695        self
1696    }
1697    #[doc = "Explicit operation timeout"]
1698    pub fn timeout(mut self, timeout: &'b str) -> Self {
1699        self.timeout = Some(timeout);
1700        self
1701    }
1702    #[doc = "Creates an asynchronous call to the Cluster Put Component Template API that can be awaited"]
1703    pub async fn send(self) -> Result<Response, Error> {
1704        let path = self.parts.url();
1705        let method = http::Method::Put;
1706        let headers = self.headers;
1707        let timeout = self.request_timeout;
1708        let query_string = {
1709            #[serde_with::skip_serializing_none]
1710            #[derive(Serialize)]
1711            struct QueryParams<'b> {
1712                create: Option<bool>,
1713                error_trace: Option<bool>,
1714                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1715                filter_path: Option<&'b [&'b str]>,
1716                human: Option<bool>,
1717                master_timeout: Option<&'b str>,
1718                pretty: Option<bool>,
1719                source: Option<&'b str>,
1720                timeout: Option<&'b str>,
1721            }
1722            let query_params = QueryParams {
1723                create: self.create,
1724                error_trace: self.error_trace,
1725                filter_path: self.filter_path,
1726                human: self.human,
1727                master_timeout: self.master_timeout,
1728                pretty: self.pretty,
1729                source: self.source,
1730                timeout: self.timeout,
1731            };
1732            Some(query_params)
1733        };
1734        let body = self.body;
1735        let response = self
1736            .transport
1737            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1738            .await?;
1739        Ok(response)
1740    }
1741}
1742#[derive(Debug, Clone, PartialEq, Eq)]
1743#[doc = "API parts for the Cluster Put Settings API"]
1744pub enum ClusterPutSettingsParts {
1745    #[doc = "No parts"]
1746    None,
1747}
1748impl ClusterPutSettingsParts {
1749    #[doc = "Builds a relative URL path to the Cluster Put Settings API"]
1750    pub fn url(self) -> Cow<'static, str> {
1751        match self {
1752            ClusterPutSettingsParts::None => "/_cluster/settings".into(),
1753        }
1754    }
1755}
1756#[doc = "Builder for the [Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-update-settings.html)\n\nUpdates the cluster settings."]
1757#[derive(Clone, Debug)]
1758pub struct ClusterPutSettings<'a, 'b, B> {
1759    transport: &'a Transport,
1760    parts: ClusterPutSettingsParts,
1761    body: Option<B>,
1762    error_trace: Option<bool>,
1763    filter_path: Option<&'b [&'b str]>,
1764    flat_settings: Option<bool>,
1765    headers: HeaderMap,
1766    human: Option<bool>,
1767    master_timeout: Option<&'b str>,
1768    pretty: Option<bool>,
1769    request_timeout: Option<Duration>,
1770    source: Option<&'b str>,
1771    timeout: Option<&'b str>,
1772}
1773impl<'a, 'b, B> ClusterPutSettings<'a, 'b, B>
1774where
1775    B: Body,
1776{
1777    #[doc = "Creates a new instance of [ClusterPutSettings]"]
1778    pub fn new(transport: &'a Transport) -> Self {
1779        let headers = HeaderMap::new();
1780        ClusterPutSettings {
1781            transport,
1782            parts: ClusterPutSettingsParts::None,
1783            headers,
1784            body: None,
1785            error_trace: None,
1786            filter_path: None,
1787            flat_settings: None,
1788            human: None,
1789            master_timeout: None,
1790            pretty: None,
1791            request_timeout: None,
1792            source: None,
1793            timeout: None,
1794        }
1795    }
1796    #[doc = "The body for the API call"]
1797    pub fn body<T>(self, body: T) -> ClusterPutSettings<'a, 'b, JsonBody<T>>
1798    where
1799        T: Serialize,
1800    {
1801        ClusterPutSettings {
1802            transport: self.transport,
1803            parts: self.parts,
1804            body: Some(body.into()),
1805            error_trace: self.error_trace,
1806            filter_path: self.filter_path,
1807            flat_settings: self.flat_settings,
1808            headers: self.headers,
1809            human: self.human,
1810            master_timeout: self.master_timeout,
1811            pretty: self.pretty,
1812            request_timeout: self.request_timeout,
1813            source: self.source,
1814            timeout: self.timeout,
1815        }
1816    }
1817    #[doc = "Include the stack trace of returned errors."]
1818    pub fn error_trace(mut self, error_trace: bool) -> Self {
1819        self.error_trace = Some(error_trace);
1820        self
1821    }
1822    #[doc = "A comma-separated list of filters used to reduce the response."]
1823    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1824        self.filter_path = Some(filter_path);
1825        self
1826    }
1827    #[doc = "Return settings in flat format (default: false)"]
1828    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
1829        self.flat_settings = Some(flat_settings);
1830        self
1831    }
1832    #[doc = "Adds a HTTP header"]
1833    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1834        self.headers.insert(key, value);
1835        self
1836    }
1837    #[doc = "Return human readable values for statistics."]
1838    pub fn human(mut self, human: bool) -> Self {
1839        self.human = Some(human);
1840        self
1841    }
1842    #[doc = "Explicit operation timeout for connection to master node"]
1843    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1844        self.master_timeout = Some(master_timeout);
1845        self
1846    }
1847    #[doc = "Pretty format the returned JSON response."]
1848    pub fn pretty(mut self, pretty: bool) -> Self {
1849        self.pretty = Some(pretty);
1850        self
1851    }
1852    #[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."]
1853    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1854        self.request_timeout = Some(timeout);
1855        self
1856    }
1857    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1858    pub fn source(mut self, source: &'b str) -> Self {
1859        self.source = Some(source);
1860        self
1861    }
1862    #[doc = "Explicit operation timeout"]
1863    pub fn timeout(mut self, timeout: &'b str) -> Self {
1864        self.timeout = Some(timeout);
1865        self
1866    }
1867    #[doc = "Creates an asynchronous call to the Cluster Put Settings API that can be awaited"]
1868    pub async fn send(self) -> Result<Response, Error> {
1869        let path = self.parts.url();
1870        let method = http::Method::Put;
1871        let headers = self.headers;
1872        let timeout = self.request_timeout;
1873        let query_string = {
1874            #[serde_with::skip_serializing_none]
1875            #[derive(Serialize)]
1876            struct QueryParams<'b> {
1877                error_trace: Option<bool>,
1878                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1879                filter_path: Option<&'b [&'b str]>,
1880                flat_settings: Option<bool>,
1881                human: Option<bool>,
1882                master_timeout: Option<&'b str>,
1883                pretty: Option<bool>,
1884                source: Option<&'b str>,
1885                timeout: Option<&'b str>,
1886            }
1887            let query_params = QueryParams {
1888                error_trace: self.error_trace,
1889                filter_path: self.filter_path,
1890                flat_settings: self.flat_settings,
1891                human: self.human,
1892                master_timeout: self.master_timeout,
1893                pretty: self.pretty,
1894                source: self.source,
1895                timeout: self.timeout,
1896            };
1897            Some(query_params)
1898        };
1899        let body = self.body;
1900        let response = self
1901            .transport
1902            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1903            .await?;
1904        Ok(response)
1905    }
1906}
1907#[derive(Debug, Clone, PartialEq, Eq)]
1908#[doc = "API parts for the Cluster Remote Info API"]
1909pub enum ClusterRemoteInfoParts {
1910    #[doc = "No parts"]
1911    None,
1912}
1913impl ClusterRemoteInfoParts {
1914    #[doc = "Builds a relative URL path to the Cluster Remote Info API"]
1915    pub fn url(self) -> Cow<'static, str> {
1916        match self {
1917            ClusterRemoteInfoParts::None => "/_remote/info".into(),
1918        }
1919    }
1920}
1921#[doc = "Builder for the [Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."]
1922#[derive(Clone, Debug)]
1923pub struct ClusterRemoteInfo<'a, 'b> {
1924    transport: &'a Transport,
1925    parts: ClusterRemoteInfoParts,
1926    error_trace: Option<bool>,
1927    filter_path: Option<&'b [&'b str]>,
1928    headers: HeaderMap,
1929    human: Option<bool>,
1930    pretty: Option<bool>,
1931    request_timeout: Option<Duration>,
1932    source: Option<&'b str>,
1933}
1934impl<'a, 'b> ClusterRemoteInfo<'a, 'b> {
1935    #[doc = "Creates a new instance of [ClusterRemoteInfo]"]
1936    pub fn new(transport: &'a Transport) -> Self {
1937        let headers = HeaderMap::new();
1938        ClusterRemoteInfo {
1939            transport,
1940            parts: ClusterRemoteInfoParts::None,
1941            headers,
1942            error_trace: None,
1943            filter_path: None,
1944            human: None,
1945            pretty: None,
1946            request_timeout: None,
1947            source: None,
1948        }
1949    }
1950    #[doc = "Include the stack trace of returned errors."]
1951    pub fn error_trace(mut self, error_trace: bool) -> Self {
1952        self.error_trace = Some(error_trace);
1953        self
1954    }
1955    #[doc = "A comma-separated list of filters used to reduce the response."]
1956    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1957        self.filter_path = Some(filter_path);
1958        self
1959    }
1960    #[doc = "Adds a HTTP header"]
1961    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1962        self.headers.insert(key, value);
1963        self
1964    }
1965    #[doc = "Return human readable values for statistics."]
1966    pub fn human(mut self, human: bool) -> Self {
1967        self.human = Some(human);
1968        self
1969    }
1970    #[doc = "Pretty format the returned JSON response."]
1971    pub fn pretty(mut self, pretty: bool) -> Self {
1972        self.pretty = Some(pretty);
1973        self
1974    }
1975    #[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."]
1976    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1977        self.request_timeout = Some(timeout);
1978        self
1979    }
1980    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1981    pub fn source(mut self, source: &'b str) -> Self {
1982        self.source = Some(source);
1983        self
1984    }
1985    #[doc = "Creates an asynchronous call to the Cluster Remote Info API that can be awaited"]
1986    pub async fn send(self) -> Result<Response, Error> {
1987        let path = self.parts.url();
1988        let method = http::Method::Get;
1989        let headers = self.headers;
1990        let timeout = self.request_timeout;
1991        let query_string = {
1992            #[serde_with::skip_serializing_none]
1993            #[derive(Serialize)]
1994            struct QueryParams<'b> {
1995                error_trace: Option<bool>,
1996                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1997                filter_path: Option<&'b [&'b str]>,
1998                human: Option<bool>,
1999                pretty: Option<bool>,
2000                source: Option<&'b str>,
2001            }
2002            let query_params = QueryParams {
2003                error_trace: self.error_trace,
2004                filter_path: self.filter_path,
2005                human: self.human,
2006                pretty: self.pretty,
2007                source: self.source,
2008            };
2009            Some(query_params)
2010        };
2011        let body = Option::<()>::None;
2012        let response = self
2013            .transport
2014            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2015            .await?;
2016        Ok(response)
2017    }
2018}
2019#[derive(Debug, Clone, PartialEq, Eq)]
2020#[doc = "API parts for the Cluster Reroute API"]
2021pub enum ClusterRerouteParts {
2022    #[doc = "No parts"]
2023    None,
2024}
2025impl ClusterRerouteParts {
2026    #[doc = "Builds a relative URL path to the Cluster Reroute API"]
2027    pub fn url(self) -> Cow<'static, str> {
2028        match self {
2029            ClusterRerouteParts::None => "/_cluster/reroute".into(),
2030        }
2031    }
2032}
2033#[doc = "Builder for the [Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."]
2034#[derive(Clone, Debug)]
2035pub struct ClusterReroute<'a, 'b, B> {
2036    transport: &'a Transport,
2037    parts: ClusterRerouteParts,
2038    body: Option<B>,
2039    dry_run: Option<bool>,
2040    error_trace: Option<bool>,
2041    explain: Option<bool>,
2042    filter_path: Option<&'b [&'b str]>,
2043    headers: HeaderMap,
2044    human: Option<bool>,
2045    master_timeout: Option<&'b str>,
2046    metric: Option<&'b [&'b str]>,
2047    pretty: Option<bool>,
2048    request_timeout: Option<Duration>,
2049    retry_failed: Option<bool>,
2050    source: Option<&'b str>,
2051    timeout: Option<&'b str>,
2052}
2053impl<'a, 'b, B> ClusterReroute<'a, 'b, B>
2054where
2055    B: Body,
2056{
2057    #[doc = "Creates a new instance of [ClusterReroute]"]
2058    pub fn new(transport: &'a Transport) -> Self {
2059        let headers = HeaderMap::new();
2060        ClusterReroute {
2061            transport,
2062            parts: ClusterRerouteParts::None,
2063            headers,
2064            body: None,
2065            dry_run: None,
2066            error_trace: None,
2067            explain: None,
2068            filter_path: None,
2069            human: None,
2070            master_timeout: None,
2071            metric: None,
2072            pretty: None,
2073            request_timeout: None,
2074            retry_failed: None,
2075            source: None,
2076            timeout: None,
2077        }
2078    }
2079    #[doc = "The body for the API call"]
2080    pub fn body<T>(self, body: T) -> ClusterReroute<'a, 'b, JsonBody<T>>
2081    where
2082        T: Serialize,
2083    {
2084        ClusterReroute {
2085            transport: self.transport,
2086            parts: self.parts,
2087            body: Some(body.into()),
2088            dry_run: self.dry_run,
2089            error_trace: self.error_trace,
2090            explain: self.explain,
2091            filter_path: self.filter_path,
2092            headers: self.headers,
2093            human: self.human,
2094            master_timeout: self.master_timeout,
2095            metric: self.metric,
2096            pretty: self.pretty,
2097            request_timeout: self.request_timeout,
2098            retry_failed: self.retry_failed,
2099            source: self.source,
2100            timeout: self.timeout,
2101        }
2102    }
2103    #[doc = "Simulate the operation only and return the resulting state"]
2104    pub fn dry_run(mut self, dry_run: bool) -> Self {
2105        self.dry_run = Some(dry_run);
2106        self
2107    }
2108    #[doc = "Include the stack trace of returned errors."]
2109    pub fn error_trace(mut self, error_trace: bool) -> Self {
2110        self.error_trace = Some(error_trace);
2111        self
2112    }
2113    #[doc = "Return an explanation of why the commands can or cannot be executed"]
2114    pub fn explain(mut self, explain: bool) -> Self {
2115        self.explain = Some(explain);
2116        self
2117    }
2118    #[doc = "A comma-separated list of filters used to reduce the response."]
2119    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2120        self.filter_path = Some(filter_path);
2121        self
2122    }
2123    #[doc = "Adds a HTTP header"]
2124    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2125        self.headers.insert(key, value);
2126        self
2127    }
2128    #[doc = "Return human readable values for statistics."]
2129    pub fn human(mut self, human: bool) -> Self {
2130        self.human = Some(human);
2131        self
2132    }
2133    #[doc = "Explicit operation timeout for connection to master node"]
2134    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
2135        self.master_timeout = Some(master_timeout);
2136        self
2137    }
2138    #[doc = "Limit the information returned to the specified metrics. Defaults to all but metadata"]
2139    pub fn metric(mut self, metric: &'b [&'b str]) -> Self {
2140        self.metric = Some(metric);
2141        self
2142    }
2143    #[doc = "Pretty format the returned JSON response."]
2144    pub fn pretty(mut self, pretty: bool) -> Self {
2145        self.pretty = Some(pretty);
2146        self
2147    }
2148    #[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."]
2149    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2150        self.request_timeout = Some(timeout);
2151        self
2152    }
2153    #[doc = "Retries allocation of shards that are blocked due to too many subsequent allocation failures"]
2154    pub fn retry_failed(mut self, retry_failed: bool) -> Self {
2155        self.retry_failed = Some(retry_failed);
2156        self
2157    }
2158    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2159    pub fn source(mut self, source: &'b str) -> Self {
2160        self.source = Some(source);
2161        self
2162    }
2163    #[doc = "Explicit operation timeout"]
2164    pub fn timeout(mut self, timeout: &'b str) -> Self {
2165        self.timeout = Some(timeout);
2166        self
2167    }
2168    #[doc = "Creates an asynchronous call to the Cluster Reroute API that can be awaited"]
2169    pub async fn send(self) -> Result<Response, Error> {
2170        let path = self.parts.url();
2171        let method = http::Method::Post;
2172        let headers = self.headers;
2173        let timeout = self.request_timeout;
2174        let query_string = {
2175            #[serde_with::skip_serializing_none]
2176            #[derive(Serialize)]
2177            struct QueryParams<'b> {
2178                dry_run: Option<bool>,
2179                error_trace: Option<bool>,
2180                explain: Option<bool>,
2181                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2182                filter_path: Option<&'b [&'b str]>,
2183                human: Option<bool>,
2184                master_timeout: Option<&'b str>,
2185                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2186                metric: Option<&'b [&'b str]>,
2187                pretty: Option<bool>,
2188                retry_failed: Option<bool>,
2189                source: Option<&'b str>,
2190                timeout: Option<&'b str>,
2191            }
2192            let query_params = QueryParams {
2193                dry_run: self.dry_run,
2194                error_trace: self.error_trace,
2195                explain: self.explain,
2196                filter_path: self.filter_path,
2197                human: self.human,
2198                master_timeout: self.master_timeout,
2199                metric: self.metric,
2200                pretty: self.pretty,
2201                retry_failed: self.retry_failed,
2202                source: self.source,
2203                timeout: self.timeout,
2204            };
2205            Some(query_params)
2206        };
2207        let body = self.body;
2208        let response = self
2209            .transport
2210            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2211            .await?;
2212        Ok(response)
2213    }
2214}
2215#[derive(Debug, Clone, PartialEq, Eq)]
2216#[doc = "API parts for the Cluster State API"]
2217pub enum ClusterStateParts<'b> {
2218    #[doc = "No parts"]
2219    None,
2220    #[doc = "Metric"]
2221    Metric(&'b [&'b str]),
2222    #[doc = "Metric and Index"]
2223    MetricIndex(&'b [&'b str], &'b [&'b str]),
2224}
2225impl<'b> ClusterStateParts<'b> {
2226    #[doc = "Builds a relative URL path to the Cluster State API"]
2227    pub fn url(self) -> Cow<'static, str> {
2228        match self {
2229            ClusterStateParts::None => "/_cluster/state".into(),
2230            ClusterStateParts::Metric(metric) => {
2231                let metric_str = metric.join(",");
2232                let encoded_metric: Cow<str> =
2233                    percent_encode(metric_str.as_bytes(), PARTS_ENCODED).into();
2234                let mut p = String::with_capacity(16usize + encoded_metric.len());
2235                p.push_str("/_cluster/state/");
2236                p.push_str(encoded_metric.as_ref());
2237                p.into()
2238            }
2239            ClusterStateParts::MetricIndex(metric, index) => {
2240                let metric_str = metric.join(",");
2241                let index_str = index.join(",");
2242                let encoded_metric: Cow<str> =
2243                    percent_encode(metric_str.as_bytes(), PARTS_ENCODED).into();
2244                let encoded_index: Cow<str> =
2245                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
2246                let mut p =
2247                    String::with_capacity(17usize + encoded_metric.len() + encoded_index.len());
2248                p.push_str("/_cluster/state/");
2249                p.push_str(encoded_metric.as_ref());
2250                p.push('/');
2251                p.push_str(encoded_index.as_ref());
2252                p.into()
2253            }
2254        }
2255    }
2256}
2257#[doc = "Builder for the [Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."]
2258#[derive(Clone, Debug)]
2259pub struct ClusterState<'a, 'b> {
2260    transport: &'a Transport,
2261    parts: ClusterStateParts<'b>,
2262    allow_no_indices: Option<bool>,
2263    error_trace: Option<bool>,
2264    expand_wildcards: Option<&'b [ExpandWildcards]>,
2265    filter_path: Option<&'b [&'b str]>,
2266    flat_settings: Option<bool>,
2267    headers: HeaderMap,
2268    human: Option<bool>,
2269    ignore_unavailable: Option<bool>,
2270    local: Option<bool>,
2271    master_timeout: Option<&'b str>,
2272    pretty: Option<bool>,
2273    request_timeout: Option<Duration>,
2274    source: Option<&'b str>,
2275    wait_for_metadata_version: Option<i64>,
2276    wait_for_timeout: Option<&'b str>,
2277}
2278impl<'a, 'b> ClusterState<'a, 'b> {
2279    #[doc = "Creates a new instance of [ClusterState] with the specified API parts"]
2280    pub fn new(transport: &'a Transport, parts: ClusterStateParts<'b>) -> Self {
2281        let headers = HeaderMap::new();
2282        ClusterState {
2283            transport,
2284            parts,
2285            headers,
2286            allow_no_indices: None,
2287            error_trace: None,
2288            expand_wildcards: None,
2289            filter_path: None,
2290            flat_settings: None,
2291            human: None,
2292            ignore_unavailable: None,
2293            local: None,
2294            master_timeout: None,
2295            pretty: None,
2296            request_timeout: None,
2297            source: None,
2298            wait_for_metadata_version: None,
2299            wait_for_timeout: None,
2300        }
2301    }
2302    #[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)"]
2303    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
2304        self.allow_no_indices = Some(allow_no_indices);
2305        self
2306    }
2307    #[doc = "Include the stack trace of returned errors."]
2308    pub fn error_trace(mut self, error_trace: bool) -> Self {
2309        self.error_trace = Some(error_trace);
2310        self
2311    }
2312    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
2313    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
2314        self.expand_wildcards = Some(expand_wildcards);
2315        self
2316    }
2317    #[doc = "A comma-separated list of filters used to reduce the response."]
2318    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2319        self.filter_path = Some(filter_path);
2320        self
2321    }
2322    #[doc = "Return settings in flat format (default: false)"]
2323    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
2324        self.flat_settings = Some(flat_settings);
2325        self
2326    }
2327    #[doc = "Adds a HTTP header"]
2328    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2329        self.headers.insert(key, value);
2330        self
2331    }
2332    #[doc = "Return human readable values for statistics."]
2333    pub fn human(mut self, human: bool) -> Self {
2334        self.human = Some(human);
2335        self
2336    }
2337    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
2338    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
2339        self.ignore_unavailable = Some(ignore_unavailable);
2340        self
2341    }
2342    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
2343    pub fn local(mut self, local: bool) -> Self {
2344        self.local = Some(local);
2345        self
2346    }
2347    #[doc = "Specify timeout for connection to master"]
2348    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
2349        self.master_timeout = Some(master_timeout);
2350        self
2351    }
2352    #[doc = "Pretty format the returned JSON response."]
2353    pub fn pretty(mut self, pretty: bool) -> Self {
2354        self.pretty = Some(pretty);
2355        self
2356    }
2357    #[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."]
2358    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2359        self.request_timeout = Some(timeout);
2360        self
2361    }
2362    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2363    pub fn source(mut self, source: &'b str) -> Self {
2364        self.source = Some(source);
2365        self
2366    }
2367    #[doc = "Wait for the metadata version to be equal or greater than the specified metadata version"]
2368    pub fn wait_for_metadata_version(mut self, wait_for_metadata_version: i64) -> Self {
2369        self.wait_for_metadata_version = Some(wait_for_metadata_version);
2370        self
2371    }
2372    #[doc = "The maximum time to wait for wait_for_metadata_version before timing out"]
2373    pub fn wait_for_timeout(mut self, wait_for_timeout: &'b str) -> Self {
2374        self.wait_for_timeout = Some(wait_for_timeout);
2375        self
2376    }
2377    #[doc = "Creates an asynchronous call to the Cluster State API that can be awaited"]
2378    pub async fn send(self) -> Result<Response, Error> {
2379        let path = self.parts.url();
2380        let method = http::Method::Get;
2381        let headers = self.headers;
2382        let timeout = self.request_timeout;
2383        let query_string = {
2384            #[serde_with::skip_serializing_none]
2385            #[derive(Serialize)]
2386            struct QueryParams<'b> {
2387                allow_no_indices: Option<bool>,
2388                error_trace: Option<bool>,
2389                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2390                expand_wildcards: Option<&'b [ExpandWildcards]>,
2391                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2392                filter_path: Option<&'b [&'b str]>,
2393                flat_settings: Option<bool>,
2394                human: Option<bool>,
2395                ignore_unavailable: Option<bool>,
2396                local: Option<bool>,
2397                master_timeout: Option<&'b str>,
2398                pretty: Option<bool>,
2399                source: Option<&'b str>,
2400                wait_for_metadata_version: Option<i64>,
2401                wait_for_timeout: Option<&'b str>,
2402            }
2403            let query_params = QueryParams {
2404                allow_no_indices: self.allow_no_indices,
2405                error_trace: self.error_trace,
2406                expand_wildcards: self.expand_wildcards,
2407                filter_path: self.filter_path,
2408                flat_settings: self.flat_settings,
2409                human: self.human,
2410                ignore_unavailable: self.ignore_unavailable,
2411                local: self.local,
2412                master_timeout: self.master_timeout,
2413                pretty: self.pretty,
2414                source: self.source,
2415                wait_for_metadata_version: self.wait_for_metadata_version,
2416                wait_for_timeout: self.wait_for_timeout,
2417            };
2418            Some(query_params)
2419        };
2420        let body = Option::<()>::None;
2421        let response = self
2422            .transport
2423            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2424            .await?;
2425        Ok(response)
2426    }
2427}
2428#[derive(Debug, Clone, PartialEq, Eq)]
2429#[doc = "API parts for the Cluster Stats API"]
2430pub enum ClusterStatsParts<'b> {
2431    #[doc = "No parts"]
2432    None,
2433    #[doc = "NodeId"]
2434    NodeId(&'b [&'b str]),
2435}
2436impl<'b> ClusterStatsParts<'b> {
2437    #[doc = "Builds a relative URL path to the Cluster Stats API"]
2438    pub fn url(self) -> Cow<'static, str> {
2439        match self {
2440            ClusterStatsParts::None => "/_cluster/stats".into(),
2441            ClusterStatsParts::NodeId(node_id) => {
2442                let node_id_str = node_id.join(",");
2443                let encoded_node_id: Cow<str> =
2444                    percent_encode(node_id_str.as_bytes(), PARTS_ENCODED).into();
2445                let mut p = String::with_capacity(22usize + encoded_node_id.len());
2446                p.push_str("/_cluster/stats/nodes/");
2447                p.push_str(encoded_node_id.as_ref());
2448                p.into()
2449            }
2450        }
2451    }
2452}
2453#[doc = "Builder for the [Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."]
2454#[derive(Clone, Debug)]
2455pub struct ClusterStats<'a, 'b> {
2456    transport: &'a Transport,
2457    parts: ClusterStatsParts<'b>,
2458    error_trace: Option<bool>,
2459    filter_path: Option<&'b [&'b str]>,
2460    headers: HeaderMap,
2461    human: Option<bool>,
2462    include_remotes: Option<bool>,
2463    pretty: Option<bool>,
2464    request_timeout: Option<Duration>,
2465    source: Option<&'b str>,
2466    timeout: Option<&'b str>,
2467}
2468impl<'a, 'b> ClusterStats<'a, 'b> {
2469    #[doc = "Creates a new instance of [ClusterStats] with the specified API parts"]
2470    pub fn new(transport: &'a Transport, parts: ClusterStatsParts<'b>) -> Self {
2471        let headers = HeaderMap::new();
2472        ClusterStats {
2473            transport,
2474            parts,
2475            headers,
2476            error_trace: None,
2477            filter_path: None,
2478            human: None,
2479            include_remotes: None,
2480            pretty: None,
2481            request_timeout: None,
2482            source: None,
2483            timeout: None,
2484        }
2485    }
2486    #[doc = "Include the stack trace of returned errors."]
2487    pub fn error_trace(mut self, error_trace: bool) -> Self {
2488        self.error_trace = Some(error_trace);
2489        self
2490    }
2491    #[doc = "A comma-separated list of filters used to reduce the response."]
2492    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2493        self.filter_path = Some(filter_path);
2494        self
2495    }
2496    #[doc = "Adds a HTTP header"]
2497    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2498        self.headers.insert(key, value);
2499        self
2500    }
2501    #[doc = "Return human readable values for statistics."]
2502    pub fn human(mut self, human: bool) -> Self {
2503        self.human = Some(human);
2504        self
2505    }
2506    #[doc = "Include remote cluster data into the response (default: false)"]
2507    pub fn include_remotes(mut self, include_remotes: bool) -> Self {
2508        self.include_remotes = Some(include_remotes);
2509        self
2510    }
2511    #[doc = "Pretty format the returned JSON response."]
2512    pub fn pretty(mut self, pretty: bool) -> Self {
2513        self.pretty = Some(pretty);
2514        self
2515    }
2516    #[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."]
2517    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2518        self.request_timeout = Some(timeout);
2519        self
2520    }
2521    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2522    pub fn source(mut self, source: &'b str) -> Self {
2523        self.source = Some(source);
2524        self
2525    }
2526    #[doc = "Explicit operation timeout"]
2527    pub fn timeout(mut self, timeout: &'b str) -> Self {
2528        self.timeout = Some(timeout);
2529        self
2530    }
2531    #[doc = "Creates an asynchronous call to the Cluster Stats API that can be awaited"]
2532    pub async fn send(self) -> Result<Response, Error> {
2533        let path = self.parts.url();
2534        let method = http::Method::Get;
2535        let headers = self.headers;
2536        let timeout = self.request_timeout;
2537        let query_string = {
2538            #[serde_with::skip_serializing_none]
2539            #[derive(Serialize)]
2540            struct QueryParams<'b> {
2541                error_trace: Option<bool>,
2542                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2543                filter_path: Option<&'b [&'b str]>,
2544                human: Option<bool>,
2545                include_remotes: Option<bool>,
2546                pretty: Option<bool>,
2547                source: Option<&'b str>,
2548                timeout: Option<&'b str>,
2549            }
2550            let query_params = QueryParams {
2551                error_trace: self.error_trace,
2552                filter_path: self.filter_path,
2553                human: self.human,
2554                include_remotes: self.include_remotes,
2555                pretty: self.pretty,
2556                source: self.source,
2557                timeout: self.timeout,
2558            };
2559            Some(query_params)
2560        };
2561        let body = Option::<()>::None;
2562        let response = self
2563            .transport
2564            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2565            .await?;
2566        Ok(response)
2567    }
2568}
2569#[doc = "Namespace client for Cluster APIs"]
2570pub struct Cluster<'a> {
2571    transport: &'a Transport,
2572}
2573impl<'a> Cluster<'a> {
2574    #[doc = "Creates a new instance of [Cluster]"]
2575    pub fn new(transport: &'a Transport) -> Self {
2576        Self { transport }
2577    }
2578    pub fn transport(&self) -> &Transport {
2579        self.transport
2580    }
2581    #[doc = "[Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-allocation-explain.html)\n\nProvides explanations for shard allocations in the cluster."]
2582    pub fn allocation_explain<'b>(&'a self) -> ClusterAllocationExplain<'a, 'b, ()> {
2583        ClusterAllocationExplain::new(self.transport())
2584    }
2585    #[doc = "[Cluster Delete Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nDeletes a component template"]
2586    pub fn delete_component_template<'b>(
2587        &'a self,
2588        parts: ClusterDeleteComponentTemplateParts<'b>,
2589    ) -> ClusterDeleteComponentTemplate<'a, 'b> {
2590        ClusterDeleteComponentTemplate::new(self.transport(), parts)
2591    }
2592    #[doc = "[Cluster Delete Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/voting-config-exclusions.html)\n\nClears cluster voting config exclusions."]
2593    pub fn delete_voting_config_exclusions<'b>(
2594        &'a self,
2595    ) -> ClusterDeleteVotingConfigExclusions<'a, 'b> {
2596        ClusterDeleteVotingConfigExclusions::new(self.transport())
2597    }
2598    #[doc = "[Cluster Exists Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nReturns information about whether a particular component template exist"]
2599    pub fn exists_component_template<'b>(
2600        &'a self,
2601        parts: ClusterExistsComponentTemplateParts<'b>,
2602    ) -> ClusterExistsComponentTemplate<'a, 'b> {
2603        ClusterExistsComponentTemplate::new(self.transport(), parts)
2604    }
2605    #[doc = "[Cluster Get Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nReturns one or more component templates"]
2606    pub fn get_component_template<'b>(
2607        &'a self,
2608        parts: ClusterGetComponentTemplateParts<'b>,
2609    ) -> ClusterGetComponentTemplate<'a, 'b> {
2610        ClusterGetComponentTemplate::new(self.transport(), parts)
2611    }
2612    #[doc = "[Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-get-settings.html)\n\nReturns cluster settings."]
2613    pub fn get_settings<'b>(&'a self) -> ClusterGetSettings<'a, 'b> {
2614        ClusterGetSettings::new(self.transport())
2615    }
2616    #[doc = "[Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-health.html)\n\nReturns basic information about the health of the cluster."]
2617    pub fn health<'b>(&'a self, parts: ClusterHealthParts<'b>) -> ClusterHealth<'a, 'b> {
2618        ClusterHealth::new(self.transport(), parts)
2619    }
2620    #[doc = "[Cluster Info API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-info.html)\n\nReturns different information about the cluster."]
2621    pub fn info<'b>(&'a self, parts: ClusterInfoParts<'b>) -> ClusterInfo<'a, 'b> {
2622        ClusterInfo::new(self.transport(), parts)
2623    }
2624    #[doc = "[Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/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."]
2625    pub fn pending_tasks<'b>(&'a self) -> ClusterPendingTasks<'a, 'b> {
2626        ClusterPendingTasks::new(self.transport())
2627    }
2628    #[doc = "[Cluster Post Voting Config Exclusions API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/voting-config-exclusions.html)\n\nUpdates the cluster voting config exclusions by node ids or node names."]
2629    pub fn post_voting_config_exclusions<'b>(
2630        &'a self,
2631    ) -> ClusterPostVotingConfigExclusions<'a, 'b, ()> {
2632        ClusterPostVotingConfigExclusions::new(self.transport())
2633    }
2634    #[doc = "[Cluster Put Component Template API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/indices-component-template.html)\n\nCreates or updates a component template"]
2635    pub fn put_component_template<'b>(
2636        &'a self,
2637        parts: ClusterPutComponentTemplateParts<'b>,
2638    ) -> ClusterPutComponentTemplate<'a, 'b, ()> {
2639        ClusterPutComponentTemplate::new(self.transport(), parts)
2640    }
2641    #[doc = "[Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-update-settings.html)\n\nUpdates the cluster settings."]
2642    pub fn put_settings<'b>(&'a self) -> ClusterPutSettings<'a, 'b, ()> {
2643        ClusterPutSettings::new(self.transport())
2644    }
2645    #[doc = "[Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-remote-info.html)\n\nReturns the information about configured remote clusters."]
2646    pub fn remote_info<'b>(&'a self) -> ClusterRemoteInfo<'a, 'b> {
2647        ClusterRemoteInfo::new(self.transport())
2648    }
2649    #[doc = "[Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-reroute.html)\n\nAllows to manually change the allocation of individual shards in the cluster."]
2650    pub fn reroute<'b>(&'a self) -> ClusterReroute<'a, 'b, ()> {
2651        ClusterReroute::new(self.transport())
2652    }
2653    #[doc = "[Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-state.html)\n\nReturns a comprehensive information about the state of the cluster."]
2654    pub fn state<'b>(&'a self, parts: ClusterStateParts<'b>) -> ClusterState<'a, 'b> {
2655        ClusterState::new(self.transport(), parts)
2656    }
2657    #[doc = "[Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cluster-stats.html)\n\nReturns high-level overview of cluster statistics."]
2658    pub fn stats<'b>(&'a self, parts: ClusterStatsParts<'b>) -> ClusterStats<'a, 'b> {
2659        ClusterStats::new(self.transport(), parts)
2660    }
2661}
2662impl Elasticsearch {
2663    #[doc = "Creates a namespace client for Cluster APIs"]
2664    pub fn cluster(&self) -> Cluster {
2665        Cluster::new(self.transport())
2666    }
2667}