elasticsearch/
ccr.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//! Cross-cluster Replication APIs
28//!
29//! [Enable replication of indices in remote clusters to a local cluster](https://www.elastic.co/guide/en/elasticsearch/reference/master/xpack-ccr.html).
30//! This functionality can be used in some common production use cases:
31//!
32//! - Disaster recovery in case a primary cluster fails. A secondary cluster can serve as a hot backup
33//! - Geo-proximity so that reads can be served locally
34
35#![allow(unused_imports)]
36use crate::{
37    client::Elasticsearch,
38    error::Error,
39    http::{
40        self,
41        headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE},
42        request::{Body, JsonBody, NdBody, PARTS_ENCODED},
43        response::Response,
44        transport::Transport,
45    },
46    params::*,
47};
48use percent_encoding::percent_encode;
49use serde::Serialize;
50use std::{borrow::Cow, time::Duration};
51#[derive(Debug, Clone, PartialEq, Eq)]
52#[doc = "API parts for the Ccr Delete Auto Follow Pattern API"]
53pub enum CcrDeleteAutoFollowPatternParts<'b> {
54    #[doc = "Name"]
55    Name(&'b str),
56}
57impl<'b> CcrDeleteAutoFollowPatternParts<'b> {
58    #[doc = "Builds a relative URL path to the Ccr Delete Auto Follow Pattern API"]
59    pub fn url(self) -> Cow<'static, str> {
60        match self {
61            CcrDeleteAutoFollowPatternParts::Name(name) => {
62                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
63                let mut p = String::with_capacity(18usize + encoded_name.len());
64                p.push_str("/_ccr/auto_follow/");
65                p.push_str(encoded_name.as_ref());
66                p.into()
67            }
68        }
69    }
70}
71#[doc = "Builder for the [Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."]
72#[derive(Clone, Debug)]
73pub struct CcrDeleteAutoFollowPattern<'a, 'b> {
74    transport: &'a Transport,
75    parts: CcrDeleteAutoFollowPatternParts<'b>,
76    error_trace: Option<bool>,
77    filter_path: Option<&'b [&'b str]>,
78    headers: HeaderMap,
79    human: Option<bool>,
80    master_timeout: Option<&'b str>,
81    pretty: Option<bool>,
82    request_timeout: Option<Duration>,
83    source: Option<&'b str>,
84}
85impl<'a, 'b> CcrDeleteAutoFollowPattern<'a, 'b> {
86    #[doc = "Creates a new instance of [CcrDeleteAutoFollowPattern] with the specified API parts"]
87    pub fn new(transport: &'a Transport, parts: CcrDeleteAutoFollowPatternParts<'b>) -> Self {
88        let headers = HeaderMap::new();
89        CcrDeleteAutoFollowPattern {
90            transport,
91            parts,
92            headers,
93            error_trace: None,
94            filter_path: None,
95            human: None,
96            master_timeout: None,
97            pretty: None,
98            request_timeout: None,
99            source: None,
100        }
101    }
102    #[doc = "Include the stack trace of returned errors."]
103    pub fn error_trace(mut self, error_trace: bool) -> Self {
104        self.error_trace = Some(error_trace);
105        self
106    }
107    #[doc = "A comma-separated list of filters used to reduce the response."]
108    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
109        self.filter_path = Some(filter_path);
110        self
111    }
112    #[doc = "Adds a HTTP header"]
113    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
114        self.headers.insert(key, value);
115        self
116    }
117    #[doc = "Return human readable values for statistics."]
118    pub fn human(mut self, human: bool) -> Self {
119        self.human = Some(human);
120        self
121    }
122    #[doc = "Explicit operation timeout for connection to master node"]
123    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
124        self.master_timeout = Some(master_timeout);
125        self
126    }
127    #[doc = "Pretty format the returned JSON response."]
128    pub fn pretty(mut self, pretty: bool) -> Self {
129        self.pretty = Some(pretty);
130        self
131    }
132    #[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."]
133    pub fn request_timeout(mut self, timeout: Duration) -> Self {
134        self.request_timeout = Some(timeout);
135        self
136    }
137    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
138    pub fn source(mut self, source: &'b str) -> Self {
139        self.source = Some(source);
140        self
141    }
142    #[doc = "Creates an asynchronous call to the Ccr Delete Auto Follow Pattern API that can be awaited"]
143    pub async fn send(self) -> Result<Response, Error> {
144        let path = self.parts.url();
145        let method = http::Method::Delete;
146        let headers = self.headers;
147        let timeout = self.request_timeout;
148        let query_string = {
149            #[serde_with::skip_serializing_none]
150            #[derive(Serialize)]
151            struct QueryParams<'b> {
152                error_trace: Option<bool>,
153                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
154                filter_path: Option<&'b [&'b str]>,
155                human: Option<bool>,
156                master_timeout: Option<&'b str>,
157                pretty: Option<bool>,
158                source: Option<&'b str>,
159            }
160            let query_params = QueryParams {
161                error_trace: self.error_trace,
162                filter_path: self.filter_path,
163                human: self.human,
164                master_timeout: self.master_timeout,
165                pretty: self.pretty,
166                source: self.source,
167            };
168            Some(query_params)
169        };
170        let body = Option::<()>::None;
171        let response = self
172            .transport
173            .send(method, &path, headers, query_string.as_ref(), body, timeout)
174            .await?;
175        Ok(response)
176    }
177}
178#[derive(Debug, Clone, PartialEq, Eq)]
179#[doc = "API parts for the Ccr Follow API"]
180pub enum CcrFollowParts<'b> {
181    #[doc = "Index"]
182    Index(&'b str),
183}
184impl<'b> CcrFollowParts<'b> {
185    #[doc = "Builds a relative URL path to the Ccr Follow API"]
186    pub fn url(self) -> Cow<'static, str> {
187        match self {
188            CcrFollowParts::Index(index) => {
189                let encoded_index: Cow<str> =
190                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
191                let mut p = String::with_capacity(13usize + encoded_index.len());
192                p.push('/');
193                p.push_str(encoded_index.as_ref());
194                p.push_str("/_ccr/follow");
195                p.into()
196            }
197        }
198    }
199}
200#[doc = "Builder for the [Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."]
201#[derive(Clone, Debug)]
202pub struct CcrFollow<'a, 'b, B> {
203    transport: &'a Transport,
204    parts: CcrFollowParts<'b>,
205    body: Option<B>,
206    error_trace: Option<bool>,
207    filter_path: Option<&'b [&'b str]>,
208    headers: HeaderMap,
209    human: Option<bool>,
210    master_timeout: Option<&'b str>,
211    pretty: Option<bool>,
212    request_timeout: Option<Duration>,
213    source: Option<&'b str>,
214    wait_for_active_shards: Option<&'b str>,
215}
216impl<'a, 'b, B> CcrFollow<'a, 'b, B>
217where
218    B: Body,
219{
220    #[doc = "Creates a new instance of [CcrFollow] with the specified API parts"]
221    pub fn new(transport: &'a Transport, parts: CcrFollowParts<'b>) -> Self {
222        let headers = HeaderMap::new();
223        CcrFollow {
224            transport,
225            parts,
226            headers,
227            body: None,
228            error_trace: None,
229            filter_path: None,
230            human: None,
231            master_timeout: None,
232            pretty: None,
233            request_timeout: None,
234            source: None,
235            wait_for_active_shards: None,
236        }
237    }
238    #[doc = "The body for the API call"]
239    pub fn body<T>(self, body: T) -> CcrFollow<'a, 'b, JsonBody<T>>
240    where
241        T: Serialize,
242    {
243        CcrFollow {
244            transport: self.transport,
245            parts: self.parts,
246            body: Some(body.into()),
247            error_trace: self.error_trace,
248            filter_path: self.filter_path,
249            headers: self.headers,
250            human: self.human,
251            master_timeout: self.master_timeout,
252            pretty: self.pretty,
253            request_timeout: self.request_timeout,
254            source: self.source,
255            wait_for_active_shards: self.wait_for_active_shards,
256        }
257    }
258    #[doc = "Include the stack trace of returned errors."]
259    pub fn error_trace(mut self, error_trace: bool) -> Self {
260        self.error_trace = Some(error_trace);
261        self
262    }
263    #[doc = "A comma-separated list of filters used to reduce the response."]
264    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
265        self.filter_path = Some(filter_path);
266        self
267    }
268    #[doc = "Adds a HTTP header"]
269    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
270        self.headers.insert(key, value);
271        self
272    }
273    #[doc = "Return human readable values for statistics."]
274    pub fn human(mut self, human: bool) -> Self {
275        self.human = Some(human);
276        self
277    }
278    #[doc = "Explicit operation timeout for connection to master node"]
279    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
280        self.master_timeout = Some(master_timeout);
281        self
282    }
283    #[doc = "Pretty format the returned JSON response."]
284    pub fn pretty(mut self, pretty: bool) -> Self {
285        self.pretty = Some(pretty);
286        self
287    }
288    #[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."]
289    pub fn request_timeout(mut self, timeout: Duration) -> Self {
290        self.request_timeout = Some(timeout);
291        self
292    }
293    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
294    pub fn source(mut self, source: &'b str) -> Self {
295        self.source = Some(source);
296        self
297    }
298    #[doc = "Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)"]
299    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
300        self.wait_for_active_shards = Some(wait_for_active_shards);
301        self
302    }
303    #[doc = "Creates an asynchronous call to the Ccr Follow API that can be awaited"]
304    pub async fn send(self) -> Result<Response, Error> {
305        let path = self.parts.url();
306        let method = http::Method::Put;
307        let headers = self.headers;
308        let timeout = self.request_timeout;
309        let query_string = {
310            #[serde_with::skip_serializing_none]
311            #[derive(Serialize)]
312            struct QueryParams<'b> {
313                error_trace: Option<bool>,
314                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
315                filter_path: Option<&'b [&'b str]>,
316                human: Option<bool>,
317                master_timeout: Option<&'b str>,
318                pretty: Option<bool>,
319                source: Option<&'b str>,
320                wait_for_active_shards: Option<&'b str>,
321            }
322            let query_params = QueryParams {
323                error_trace: self.error_trace,
324                filter_path: self.filter_path,
325                human: self.human,
326                master_timeout: self.master_timeout,
327                pretty: self.pretty,
328                source: self.source,
329                wait_for_active_shards: self.wait_for_active_shards,
330            };
331            Some(query_params)
332        };
333        let body = self.body;
334        let response = self
335            .transport
336            .send(method, &path, headers, query_string.as_ref(), body, timeout)
337            .await?;
338        Ok(response)
339    }
340}
341#[derive(Debug, Clone, PartialEq, Eq)]
342#[doc = "API parts for the Ccr Follow Info API"]
343pub enum CcrFollowInfoParts<'b> {
344    #[doc = "Index"]
345    Index(&'b [&'b str]),
346}
347impl<'b> CcrFollowInfoParts<'b> {
348    #[doc = "Builds a relative URL path to the Ccr Follow Info API"]
349    pub fn url(self) -> Cow<'static, str> {
350        match self {
351            CcrFollowInfoParts::Index(index) => {
352                let index_str = index.join(",");
353                let encoded_index: Cow<str> =
354                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
355                let mut p = String::with_capacity(11usize + encoded_index.len());
356                p.push('/');
357                p.push_str(encoded_index.as_ref());
358                p.push_str("/_ccr/info");
359                p.into()
360            }
361        }
362    }
363}
364#[doc = "Builder for the [Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"]
365#[derive(Clone, Debug)]
366pub struct CcrFollowInfo<'a, 'b> {
367    transport: &'a Transport,
368    parts: CcrFollowInfoParts<'b>,
369    error_trace: Option<bool>,
370    filter_path: Option<&'b [&'b str]>,
371    headers: HeaderMap,
372    human: Option<bool>,
373    master_timeout: Option<&'b str>,
374    pretty: Option<bool>,
375    request_timeout: Option<Duration>,
376    source: Option<&'b str>,
377}
378impl<'a, 'b> CcrFollowInfo<'a, 'b> {
379    #[doc = "Creates a new instance of [CcrFollowInfo] with the specified API parts"]
380    pub fn new(transport: &'a Transport, parts: CcrFollowInfoParts<'b>) -> Self {
381        let headers = HeaderMap::new();
382        CcrFollowInfo {
383            transport,
384            parts,
385            headers,
386            error_trace: None,
387            filter_path: None,
388            human: None,
389            master_timeout: None,
390            pretty: None,
391            request_timeout: None,
392            source: None,
393        }
394    }
395    #[doc = "Include the stack trace of returned errors."]
396    pub fn error_trace(mut self, error_trace: bool) -> Self {
397        self.error_trace = Some(error_trace);
398        self
399    }
400    #[doc = "A comma-separated list of filters used to reduce the response."]
401    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
402        self.filter_path = Some(filter_path);
403        self
404    }
405    #[doc = "Adds a HTTP header"]
406    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
407        self.headers.insert(key, value);
408        self
409    }
410    #[doc = "Return human readable values for statistics."]
411    pub fn human(mut self, human: bool) -> Self {
412        self.human = Some(human);
413        self
414    }
415    #[doc = "Explicit operation timeout for connection to master node"]
416    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
417        self.master_timeout = Some(master_timeout);
418        self
419    }
420    #[doc = "Pretty format the returned JSON response."]
421    pub fn pretty(mut self, pretty: bool) -> Self {
422        self.pretty = Some(pretty);
423        self
424    }
425    #[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."]
426    pub fn request_timeout(mut self, timeout: Duration) -> Self {
427        self.request_timeout = Some(timeout);
428        self
429    }
430    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
431    pub fn source(mut self, source: &'b str) -> Self {
432        self.source = Some(source);
433        self
434    }
435    #[doc = "Creates an asynchronous call to the Ccr Follow Info API that can be awaited"]
436    pub async fn send(self) -> Result<Response, Error> {
437        let path = self.parts.url();
438        let method = http::Method::Get;
439        let headers = self.headers;
440        let timeout = self.request_timeout;
441        let query_string = {
442            #[serde_with::skip_serializing_none]
443            #[derive(Serialize)]
444            struct QueryParams<'b> {
445                error_trace: Option<bool>,
446                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
447                filter_path: Option<&'b [&'b str]>,
448                human: Option<bool>,
449                master_timeout: Option<&'b str>,
450                pretty: Option<bool>,
451                source: Option<&'b str>,
452            }
453            let query_params = QueryParams {
454                error_trace: self.error_trace,
455                filter_path: self.filter_path,
456                human: self.human,
457                master_timeout: self.master_timeout,
458                pretty: self.pretty,
459                source: self.source,
460            };
461            Some(query_params)
462        };
463        let body = Option::<()>::None;
464        let response = self
465            .transport
466            .send(method, &path, headers, query_string.as_ref(), body, timeout)
467            .await?;
468        Ok(response)
469    }
470}
471#[derive(Debug, Clone, PartialEq, Eq)]
472#[doc = "API parts for the Ccr Follow Stats API"]
473pub enum CcrFollowStatsParts<'b> {
474    #[doc = "Index"]
475    Index(&'b [&'b str]),
476}
477impl<'b> CcrFollowStatsParts<'b> {
478    #[doc = "Builds a relative URL path to the Ccr Follow Stats API"]
479    pub fn url(self) -> Cow<'static, str> {
480        match self {
481            CcrFollowStatsParts::Index(index) => {
482                let index_str = index.join(",");
483                let encoded_index: Cow<str> =
484                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
485                let mut p = String::with_capacity(12usize + encoded_index.len());
486                p.push('/');
487                p.push_str(encoded_index.as_ref());
488                p.push_str("/_ccr/stats");
489                p.into()
490            }
491        }
492    }
493}
494#[doc = "Builder for the [Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."]
495#[derive(Clone, Debug)]
496pub struct CcrFollowStats<'a, 'b> {
497    transport: &'a Transport,
498    parts: CcrFollowStatsParts<'b>,
499    error_trace: Option<bool>,
500    filter_path: Option<&'b [&'b str]>,
501    headers: HeaderMap,
502    human: Option<bool>,
503    pretty: Option<bool>,
504    request_timeout: Option<Duration>,
505    source: Option<&'b str>,
506    timeout: Option<&'b str>,
507}
508impl<'a, 'b> CcrFollowStats<'a, 'b> {
509    #[doc = "Creates a new instance of [CcrFollowStats] with the specified API parts"]
510    pub fn new(transport: &'a Transport, parts: CcrFollowStatsParts<'b>) -> Self {
511        let headers = HeaderMap::new();
512        CcrFollowStats {
513            transport,
514            parts,
515            headers,
516            error_trace: None,
517            filter_path: None,
518            human: None,
519            pretty: None,
520            request_timeout: None,
521            source: None,
522            timeout: None,
523        }
524    }
525    #[doc = "Include the stack trace of returned errors."]
526    pub fn error_trace(mut self, error_trace: bool) -> Self {
527        self.error_trace = Some(error_trace);
528        self
529    }
530    #[doc = "A comma-separated list of filters used to reduce the response."]
531    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
532        self.filter_path = Some(filter_path);
533        self
534    }
535    #[doc = "Adds a HTTP header"]
536    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
537        self.headers.insert(key, value);
538        self
539    }
540    #[doc = "Return human readable values for statistics."]
541    pub fn human(mut self, human: bool) -> Self {
542        self.human = Some(human);
543        self
544    }
545    #[doc = "Pretty format the returned JSON response."]
546    pub fn pretty(mut self, pretty: bool) -> Self {
547        self.pretty = Some(pretty);
548        self
549    }
550    #[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."]
551    pub fn request_timeout(mut self, timeout: Duration) -> Self {
552        self.request_timeout = Some(timeout);
553        self
554    }
555    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
556    pub fn source(mut self, source: &'b str) -> Self {
557        self.source = Some(source);
558        self
559    }
560    #[doc = "Explicit operation timeout"]
561    pub fn timeout(mut self, timeout: &'b str) -> Self {
562        self.timeout = Some(timeout);
563        self
564    }
565    #[doc = "Creates an asynchronous call to the Ccr Follow Stats API that can be awaited"]
566    pub async fn send(self) -> Result<Response, Error> {
567        let path = self.parts.url();
568        let method = http::Method::Get;
569        let headers = self.headers;
570        let timeout = self.request_timeout;
571        let query_string = {
572            #[serde_with::skip_serializing_none]
573            #[derive(Serialize)]
574            struct QueryParams<'b> {
575                error_trace: Option<bool>,
576                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
577                filter_path: Option<&'b [&'b str]>,
578                human: Option<bool>,
579                pretty: Option<bool>,
580                source: Option<&'b str>,
581                timeout: Option<&'b str>,
582            }
583            let query_params = QueryParams {
584                error_trace: self.error_trace,
585                filter_path: self.filter_path,
586                human: self.human,
587                pretty: self.pretty,
588                source: self.source,
589                timeout: self.timeout,
590            };
591            Some(query_params)
592        };
593        let body = Option::<()>::None;
594        let response = self
595            .transport
596            .send(method, &path, headers, query_string.as_ref(), body, timeout)
597            .await?;
598        Ok(response)
599    }
600}
601#[derive(Debug, Clone, PartialEq, Eq)]
602#[doc = "API parts for the Ccr Forget Follower API"]
603pub enum CcrForgetFollowerParts<'b> {
604    #[doc = "Index"]
605    Index(&'b str),
606}
607impl<'b> CcrForgetFollowerParts<'b> {
608    #[doc = "Builds a relative URL path to the Ccr Forget Follower API"]
609    pub fn url(self) -> Cow<'static, str> {
610        match self {
611            CcrForgetFollowerParts::Index(index) => {
612                let encoded_index: Cow<str> =
613                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
614                let mut p = String::with_capacity(22usize + encoded_index.len());
615                p.push('/');
616                p.push_str(encoded_index.as_ref());
617                p.push_str("/_ccr/forget_follower");
618                p.into()
619            }
620        }
621    }
622}
623#[doc = "Builder for the [Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."]
624#[derive(Clone, Debug)]
625pub struct CcrForgetFollower<'a, 'b, B> {
626    transport: &'a Transport,
627    parts: CcrForgetFollowerParts<'b>,
628    body: Option<B>,
629    error_trace: Option<bool>,
630    filter_path: Option<&'b [&'b str]>,
631    headers: HeaderMap,
632    human: Option<bool>,
633    pretty: Option<bool>,
634    request_timeout: Option<Duration>,
635    source: Option<&'b str>,
636    timeout: Option<&'b str>,
637}
638impl<'a, 'b, B> CcrForgetFollower<'a, 'b, B>
639where
640    B: Body,
641{
642    #[doc = "Creates a new instance of [CcrForgetFollower] with the specified API parts"]
643    pub fn new(transport: &'a Transport, parts: CcrForgetFollowerParts<'b>) -> Self {
644        let headers = HeaderMap::new();
645        CcrForgetFollower {
646            transport,
647            parts,
648            headers,
649            body: None,
650            error_trace: None,
651            filter_path: None,
652            human: None,
653            pretty: None,
654            request_timeout: None,
655            source: None,
656            timeout: None,
657        }
658    }
659    #[doc = "The body for the API call"]
660    pub fn body<T>(self, body: T) -> CcrForgetFollower<'a, 'b, JsonBody<T>>
661    where
662        T: Serialize,
663    {
664        CcrForgetFollower {
665            transport: self.transport,
666            parts: self.parts,
667            body: Some(body.into()),
668            error_trace: self.error_trace,
669            filter_path: self.filter_path,
670            headers: self.headers,
671            human: self.human,
672            pretty: self.pretty,
673            request_timeout: self.request_timeout,
674            source: self.source,
675            timeout: self.timeout,
676        }
677    }
678    #[doc = "Include the stack trace of returned errors."]
679    pub fn error_trace(mut self, error_trace: bool) -> Self {
680        self.error_trace = Some(error_trace);
681        self
682    }
683    #[doc = "A comma-separated list of filters used to reduce the response."]
684    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
685        self.filter_path = Some(filter_path);
686        self
687    }
688    #[doc = "Adds a HTTP header"]
689    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
690        self.headers.insert(key, value);
691        self
692    }
693    #[doc = "Return human readable values for statistics."]
694    pub fn human(mut self, human: bool) -> Self {
695        self.human = Some(human);
696        self
697    }
698    #[doc = "Pretty format the returned JSON response."]
699    pub fn pretty(mut self, pretty: bool) -> Self {
700        self.pretty = Some(pretty);
701        self
702    }
703    #[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."]
704    pub fn request_timeout(mut self, timeout: Duration) -> Self {
705        self.request_timeout = Some(timeout);
706        self
707    }
708    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
709    pub fn source(mut self, source: &'b str) -> Self {
710        self.source = Some(source);
711        self
712    }
713    #[doc = "Explicit operation timeout"]
714    pub fn timeout(mut self, timeout: &'b str) -> Self {
715        self.timeout = Some(timeout);
716        self
717    }
718    #[doc = "Creates an asynchronous call to the Ccr Forget Follower API that can be awaited"]
719    pub async fn send(self) -> Result<Response, Error> {
720        let path = self.parts.url();
721        let method = http::Method::Post;
722        let headers = self.headers;
723        let timeout = self.request_timeout;
724        let query_string = {
725            #[serde_with::skip_serializing_none]
726            #[derive(Serialize)]
727            struct QueryParams<'b> {
728                error_trace: Option<bool>,
729                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
730                filter_path: Option<&'b [&'b str]>,
731                human: Option<bool>,
732                pretty: Option<bool>,
733                source: Option<&'b str>,
734                timeout: Option<&'b str>,
735            }
736            let query_params = QueryParams {
737                error_trace: self.error_trace,
738                filter_path: self.filter_path,
739                human: self.human,
740                pretty: self.pretty,
741                source: self.source,
742                timeout: self.timeout,
743            };
744            Some(query_params)
745        };
746        let body = self.body;
747        let response = self
748            .transport
749            .send(method, &path, headers, query_string.as_ref(), body, timeout)
750            .await?;
751        Ok(response)
752    }
753}
754#[derive(Debug, Clone, PartialEq, Eq)]
755#[doc = "API parts for the Ccr Get Auto Follow Pattern API"]
756pub enum CcrGetAutoFollowPatternParts<'b> {
757    #[doc = "No parts"]
758    None,
759    #[doc = "Name"]
760    Name(&'b str),
761}
762impl<'b> CcrGetAutoFollowPatternParts<'b> {
763    #[doc = "Builds a relative URL path to the Ccr Get Auto Follow Pattern API"]
764    pub fn url(self) -> Cow<'static, str> {
765        match self {
766            CcrGetAutoFollowPatternParts::None => "/_ccr/auto_follow".into(),
767            CcrGetAutoFollowPatternParts::Name(name) => {
768                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
769                let mut p = String::with_capacity(18usize + encoded_name.len());
770                p.push_str("/_ccr/auto_follow/");
771                p.push_str(encoded_name.as_ref());
772                p.into()
773            }
774        }
775    }
776}
777#[doc = "Builder for the [Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."]
778#[derive(Clone, Debug)]
779pub struct CcrGetAutoFollowPattern<'a, 'b> {
780    transport: &'a Transport,
781    parts: CcrGetAutoFollowPatternParts<'b>,
782    error_trace: Option<bool>,
783    filter_path: Option<&'b [&'b str]>,
784    headers: HeaderMap,
785    human: Option<bool>,
786    master_timeout: Option<&'b str>,
787    pretty: Option<bool>,
788    request_timeout: Option<Duration>,
789    source: Option<&'b str>,
790}
791impl<'a, 'b> CcrGetAutoFollowPattern<'a, 'b> {
792    #[doc = "Creates a new instance of [CcrGetAutoFollowPattern] with the specified API parts"]
793    pub fn new(transport: &'a Transport, parts: CcrGetAutoFollowPatternParts<'b>) -> Self {
794        let headers = HeaderMap::new();
795        CcrGetAutoFollowPattern {
796            transport,
797            parts,
798            headers,
799            error_trace: None,
800            filter_path: None,
801            human: None,
802            master_timeout: None,
803            pretty: None,
804            request_timeout: None,
805            source: None,
806        }
807    }
808    #[doc = "Include the stack trace of returned errors."]
809    pub fn error_trace(mut self, error_trace: bool) -> Self {
810        self.error_trace = Some(error_trace);
811        self
812    }
813    #[doc = "A comma-separated list of filters used to reduce the response."]
814    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
815        self.filter_path = Some(filter_path);
816        self
817    }
818    #[doc = "Adds a HTTP header"]
819    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
820        self.headers.insert(key, value);
821        self
822    }
823    #[doc = "Return human readable values for statistics."]
824    pub fn human(mut self, human: bool) -> Self {
825        self.human = Some(human);
826        self
827    }
828    #[doc = "Explicit operation timeout for connection to master node"]
829    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
830        self.master_timeout = Some(master_timeout);
831        self
832    }
833    #[doc = "Pretty format the returned JSON response."]
834    pub fn pretty(mut self, pretty: bool) -> Self {
835        self.pretty = Some(pretty);
836        self
837    }
838    #[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."]
839    pub fn request_timeout(mut self, timeout: Duration) -> Self {
840        self.request_timeout = Some(timeout);
841        self
842    }
843    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
844    pub fn source(mut self, source: &'b str) -> Self {
845        self.source = Some(source);
846        self
847    }
848    #[doc = "Creates an asynchronous call to the Ccr Get Auto Follow Pattern API that can be awaited"]
849    pub async fn send(self) -> Result<Response, Error> {
850        let path = self.parts.url();
851        let method = http::Method::Get;
852        let headers = self.headers;
853        let timeout = self.request_timeout;
854        let query_string = {
855            #[serde_with::skip_serializing_none]
856            #[derive(Serialize)]
857            struct QueryParams<'b> {
858                error_trace: Option<bool>,
859                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
860                filter_path: Option<&'b [&'b str]>,
861                human: Option<bool>,
862                master_timeout: Option<&'b str>,
863                pretty: Option<bool>,
864                source: Option<&'b str>,
865            }
866            let query_params = QueryParams {
867                error_trace: self.error_trace,
868                filter_path: self.filter_path,
869                human: self.human,
870                master_timeout: self.master_timeout,
871                pretty: self.pretty,
872                source: self.source,
873            };
874            Some(query_params)
875        };
876        let body = Option::<()>::None;
877        let response = self
878            .transport
879            .send(method, &path, headers, query_string.as_ref(), body, timeout)
880            .await?;
881        Ok(response)
882    }
883}
884#[derive(Debug, Clone, PartialEq, Eq)]
885#[doc = "API parts for the Ccr Pause Auto Follow Pattern API"]
886pub enum CcrPauseAutoFollowPatternParts<'b> {
887    #[doc = "Name"]
888    Name(&'b str),
889}
890impl<'b> CcrPauseAutoFollowPatternParts<'b> {
891    #[doc = "Builds a relative URL path to the Ccr Pause Auto Follow Pattern API"]
892    pub fn url(self) -> Cow<'static, str> {
893        match self {
894            CcrPauseAutoFollowPatternParts::Name(name) => {
895                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
896                let mut p = String::with_capacity(24usize + encoded_name.len());
897                p.push_str("/_ccr/auto_follow/");
898                p.push_str(encoded_name.as_ref());
899                p.push_str("/pause");
900                p.into()
901            }
902        }
903    }
904}
905#[doc = "Builder for the [Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"]
906#[derive(Clone, Debug)]
907pub struct CcrPauseAutoFollowPattern<'a, 'b, B> {
908    transport: &'a Transport,
909    parts: CcrPauseAutoFollowPatternParts<'b>,
910    body: Option<B>,
911    error_trace: Option<bool>,
912    filter_path: Option<&'b [&'b str]>,
913    headers: HeaderMap,
914    human: Option<bool>,
915    master_timeout: Option<&'b str>,
916    pretty: Option<bool>,
917    request_timeout: Option<Duration>,
918    source: Option<&'b str>,
919}
920impl<'a, 'b, B> CcrPauseAutoFollowPattern<'a, 'b, B>
921where
922    B: Body,
923{
924    #[doc = "Creates a new instance of [CcrPauseAutoFollowPattern] with the specified API parts"]
925    pub fn new(transport: &'a Transport, parts: CcrPauseAutoFollowPatternParts<'b>) -> Self {
926        let headers = HeaderMap::new();
927        CcrPauseAutoFollowPattern {
928            transport,
929            parts,
930            headers,
931            body: None,
932            error_trace: None,
933            filter_path: None,
934            human: None,
935            master_timeout: None,
936            pretty: None,
937            request_timeout: None,
938            source: None,
939        }
940    }
941    #[doc = "The body for the API call"]
942    pub fn body<T>(self, body: T) -> CcrPauseAutoFollowPattern<'a, 'b, JsonBody<T>>
943    where
944        T: Serialize,
945    {
946        CcrPauseAutoFollowPattern {
947            transport: self.transport,
948            parts: self.parts,
949            body: Some(body.into()),
950            error_trace: self.error_trace,
951            filter_path: self.filter_path,
952            headers: self.headers,
953            human: self.human,
954            master_timeout: self.master_timeout,
955            pretty: self.pretty,
956            request_timeout: self.request_timeout,
957            source: self.source,
958        }
959    }
960    #[doc = "Include the stack trace of returned errors."]
961    pub fn error_trace(mut self, error_trace: bool) -> Self {
962        self.error_trace = Some(error_trace);
963        self
964    }
965    #[doc = "A comma-separated list of filters used to reduce the response."]
966    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
967        self.filter_path = Some(filter_path);
968        self
969    }
970    #[doc = "Adds a HTTP header"]
971    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
972        self.headers.insert(key, value);
973        self
974    }
975    #[doc = "Return human readable values for statistics."]
976    pub fn human(mut self, human: bool) -> Self {
977        self.human = Some(human);
978        self
979    }
980    #[doc = "Explicit operation timeout for connection to master node"]
981    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
982        self.master_timeout = Some(master_timeout);
983        self
984    }
985    #[doc = "Pretty format the returned JSON response."]
986    pub fn pretty(mut self, pretty: bool) -> Self {
987        self.pretty = Some(pretty);
988        self
989    }
990    #[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."]
991    pub fn request_timeout(mut self, timeout: Duration) -> Self {
992        self.request_timeout = Some(timeout);
993        self
994    }
995    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
996    pub fn source(mut self, source: &'b str) -> Self {
997        self.source = Some(source);
998        self
999    }
1000    #[doc = "Creates an asynchronous call to the Ccr Pause Auto Follow Pattern API that can be awaited"]
1001    pub async fn send(self) -> Result<Response, Error> {
1002        let path = self.parts.url();
1003        let method = http::Method::Post;
1004        let headers = self.headers;
1005        let timeout = self.request_timeout;
1006        let query_string = {
1007            #[serde_with::skip_serializing_none]
1008            #[derive(Serialize)]
1009            struct QueryParams<'b> {
1010                error_trace: Option<bool>,
1011                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1012                filter_path: Option<&'b [&'b str]>,
1013                human: Option<bool>,
1014                master_timeout: Option<&'b str>,
1015                pretty: Option<bool>,
1016                source: Option<&'b str>,
1017            }
1018            let query_params = QueryParams {
1019                error_trace: self.error_trace,
1020                filter_path: self.filter_path,
1021                human: self.human,
1022                master_timeout: self.master_timeout,
1023                pretty: self.pretty,
1024                source: self.source,
1025            };
1026            Some(query_params)
1027        };
1028        let body = self.body;
1029        let response = self
1030            .transport
1031            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1032            .await?;
1033        Ok(response)
1034    }
1035}
1036#[derive(Debug, Clone, PartialEq, Eq)]
1037#[doc = "API parts for the Ccr Pause Follow API"]
1038pub enum CcrPauseFollowParts<'b> {
1039    #[doc = "Index"]
1040    Index(&'b str),
1041}
1042impl<'b> CcrPauseFollowParts<'b> {
1043    #[doc = "Builds a relative URL path to the Ccr Pause Follow API"]
1044    pub fn url(self) -> Cow<'static, str> {
1045        match self {
1046            CcrPauseFollowParts::Index(index) => {
1047                let encoded_index: Cow<str> =
1048                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
1049                let mut p = String::with_capacity(19usize + encoded_index.len());
1050                p.push('/');
1051                p.push_str(encoded_index.as_ref());
1052                p.push_str("/_ccr/pause_follow");
1053                p.into()
1054            }
1055        }
1056    }
1057}
1058#[doc = "Builder for the [Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."]
1059#[derive(Clone, Debug)]
1060pub struct CcrPauseFollow<'a, 'b, B> {
1061    transport: &'a Transport,
1062    parts: CcrPauseFollowParts<'b>,
1063    body: Option<B>,
1064    error_trace: Option<bool>,
1065    filter_path: Option<&'b [&'b str]>,
1066    headers: HeaderMap,
1067    human: Option<bool>,
1068    master_timeout: Option<&'b str>,
1069    pretty: Option<bool>,
1070    request_timeout: Option<Duration>,
1071    source: Option<&'b str>,
1072}
1073impl<'a, 'b, B> CcrPauseFollow<'a, 'b, B>
1074where
1075    B: Body,
1076{
1077    #[doc = "Creates a new instance of [CcrPauseFollow] with the specified API parts"]
1078    pub fn new(transport: &'a Transport, parts: CcrPauseFollowParts<'b>) -> Self {
1079        let headers = HeaderMap::new();
1080        CcrPauseFollow {
1081            transport,
1082            parts,
1083            headers,
1084            body: None,
1085            error_trace: None,
1086            filter_path: None,
1087            human: None,
1088            master_timeout: None,
1089            pretty: None,
1090            request_timeout: None,
1091            source: None,
1092        }
1093    }
1094    #[doc = "The body for the API call"]
1095    pub fn body<T>(self, body: T) -> CcrPauseFollow<'a, 'b, JsonBody<T>>
1096    where
1097        T: Serialize,
1098    {
1099        CcrPauseFollow {
1100            transport: self.transport,
1101            parts: self.parts,
1102            body: Some(body.into()),
1103            error_trace: self.error_trace,
1104            filter_path: self.filter_path,
1105            headers: self.headers,
1106            human: self.human,
1107            master_timeout: self.master_timeout,
1108            pretty: self.pretty,
1109            request_timeout: self.request_timeout,
1110            source: self.source,
1111        }
1112    }
1113    #[doc = "Include the stack trace of returned errors."]
1114    pub fn error_trace(mut self, error_trace: bool) -> Self {
1115        self.error_trace = Some(error_trace);
1116        self
1117    }
1118    #[doc = "A comma-separated list of filters used to reduce the response."]
1119    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1120        self.filter_path = Some(filter_path);
1121        self
1122    }
1123    #[doc = "Adds a HTTP header"]
1124    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1125        self.headers.insert(key, value);
1126        self
1127    }
1128    #[doc = "Return human readable values for statistics."]
1129    pub fn human(mut self, human: bool) -> Self {
1130        self.human = Some(human);
1131        self
1132    }
1133    #[doc = "Explicit operation timeout for connection to master node"]
1134    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1135        self.master_timeout = Some(master_timeout);
1136        self
1137    }
1138    #[doc = "Pretty format the returned JSON response."]
1139    pub fn pretty(mut self, pretty: bool) -> Self {
1140        self.pretty = Some(pretty);
1141        self
1142    }
1143    #[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."]
1144    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1145        self.request_timeout = Some(timeout);
1146        self
1147    }
1148    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1149    pub fn source(mut self, source: &'b str) -> Self {
1150        self.source = Some(source);
1151        self
1152    }
1153    #[doc = "Creates an asynchronous call to the Ccr Pause Follow API that can be awaited"]
1154    pub async fn send(self) -> Result<Response, Error> {
1155        let path = self.parts.url();
1156        let method = http::Method::Post;
1157        let headers = self.headers;
1158        let timeout = self.request_timeout;
1159        let query_string = {
1160            #[serde_with::skip_serializing_none]
1161            #[derive(Serialize)]
1162            struct QueryParams<'b> {
1163                error_trace: Option<bool>,
1164                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1165                filter_path: Option<&'b [&'b str]>,
1166                human: Option<bool>,
1167                master_timeout: Option<&'b str>,
1168                pretty: Option<bool>,
1169                source: Option<&'b str>,
1170            }
1171            let query_params = QueryParams {
1172                error_trace: self.error_trace,
1173                filter_path: self.filter_path,
1174                human: self.human,
1175                master_timeout: self.master_timeout,
1176                pretty: self.pretty,
1177                source: self.source,
1178            };
1179            Some(query_params)
1180        };
1181        let body = self.body;
1182        let response = self
1183            .transport
1184            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1185            .await?;
1186        Ok(response)
1187    }
1188}
1189#[derive(Debug, Clone, PartialEq, Eq)]
1190#[doc = "API parts for the Ccr Put Auto Follow Pattern API"]
1191pub enum CcrPutAutoFollowPatternParts<'b> {
1192    #[doc = "Name"]
1193    Name(&'b str),
1194}
1195impl<'b> CcrPutAutoFollowPatternParts<'b> {
1196    #[doc = "Builds a relative URL path to the Ccr Put Auto Follow Pattern API"]
1197    pub fn url(self) -> Cow<'static, str> {
1198        match self {
1199            CcrPutAutoFollowPatternParts::Name(name) => {
1200                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
1201                let mut p = String::with_capacity(18usize + encoded_name.len());
1202                p.push_str("/_ccr/auto_follow/");
1203                p.push_str(encoded_name.as_ref());
1204                p.into()
1205            }
1206        }
1207    }
1208}
1209#[doc = "Builder for the [Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."]
1210#[derive(Clone, Debug)]
1211pub struct CcrPutAutoFollowPattern<'a, 'b, B> {
1212    transport: &'a Transport,
1213    parts: CcrPutAutoFollowPatternParts<'b>,
1214    body: Option<B>,
1215    error_trace: Option<bool>,
1216    filter_path: Option<&'b [&'b str]>,
1217    headers: HeaderMap,
1218    human: Option<bool>,
1219    master_timeout: Option<&'b str>,
1220    pretty: Option<bool>,
1221    request_timeout: Option<Duration>,
1222    source: Option<&'b str>,
1223}
1224impl<'a, 'b, B> CcrPutAutoFollowPattern<'a, 'b, B>
1225where
1226    B: Body,
1227{
1228    #[doc = "Creates a new instance of [CcrPutAutoFollowPattern] with the specified API parts"]
1229    pub fn new(transport: &'a Transport, parts: CcrPutAutoFollowPatternParts<'b>) -> Self {
1230        let headers = HeaderMap::new();
1231        CcrPutAutoFollowPattern {
1232            transport,
1233            parts,
1234            headers,
1235            body: None,
1236            error_trace: None,
1237            filter_path: None,
1238            human: None,
1239            master_timeout: None,
1240            pretty: None,
1241            request_timeout: None,
1242            source: None,
1243        }
1244    }
1245    #[doc = "The body for the API call"]
1246    pub fn body<T>(self, body: T) -> CcrPutAutoFollowPattern<'a, 'b, JsonBody<T>>
1247    where
1248        T: Serialize,
1249    {
1250        CcrPutAutoFollowPattern {
1251            transport: self.transport,
1252            parts: self.parts,
1253            body: Some(body.into()),
1254            error_trace: self.error_trace,
1255            filter_path: self.filter_path,
1256            headers: self.headers,
1257            human: self.human,
1258            master_timeout: self.master_timeout,
1259            pretty: self.pretty,
1260            request_timeout: self.request_timeout,
1261            source: self.source,
1262        }
1263    }
1264    #[doc = "Include the stack trace of returned errors."]
1265    pub fn error_trace(mut self, error_trace: bool) -> Self {
1266        self.error_trace = Some(error_trace);
1267        self
1268    }
1269    #[doc = "A comma-separated list of filters used to reduce the response."]
1270    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1271        self.filter_path = Some(filter_path);
1272        self
1273    }
1274    #[doc = "Adds a HTTP header"]
1275    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1276        self.headers.insert(key, value);
1277        self
1278    }
1279    #[doc = "Return human readable values for statistics."]
1280    pub fn human(mut self, human: bool) -> Self {
1281        self.human = Some(human);
1282        self
1283    }
1284    #[doc = "Explicit operation timeout for connection to master node"]
1285    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1286        self.master_timeout = Some(master_timeout);
1287        self
1288    }
1289    #[doc = "Pretty format the returned JSON response."]
1290    pub fn pretty(mut self, pretty: bool) -> Self {
1291        self.pretty = Some(pretty);
1292        self
1293    }
1294    #[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."]
1295    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1296        self.request_timeout = Some(timeout);
1297        self
1298    }
1299    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1300    pub fn source(mut self, source: &'b str) -> Self {
1301        self.source = Some(source);
1302        self
1303    }
1304    #[doc = "Creates an asynchronous call to the Ccr Put Auto Follow Pattern API that can be awaited"]
1305    pub async fn send(self) -> Result<Response, Error> {
1306        let path = self.parts.url();
1307        let method = http::Method::Put;
1308        let headers = self.headers;
1309        let timeout = self.request_timeout;
1310        let query_string = {
1311            #[serde_with::skip_serializing_none]
1312            #[derive(Serialize)]
1313            struct QueryParams<'b> {
1314                error_trace: Option<bool>,
1315                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1316                filter_path: Option<&'b [&'b str]>,
1317                human: Option<bool>,
1318                master_timeout: Option<&'b str>,
1319                pretty: Option<bool>,
1320                source: Option<&'b str>,
1321            }
1322            let query_params = QueryParams {
1323                error_trace: self.error_trace,
1324                filter_path: self.filter_path,
1325                human: self.human,
1326                master_timeout: self.master_timeout,
1327                pretty: self.pretty,
1328                source: self.source,
1329            };
1330            Some(query_params)
1331        };
1332        let body = self.body;
1333        let response = self
1334            .transport
1335            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1336            .await?;
1337        Ok(response)
1338    }
1339}
1340#[derive(Debug, Clone, PartialEq, Eq)]
1341#[doc = "API parts for the Ccr Resume Auto Follow Pattern API"]
1342pub enum CcrResumeAutoFollowPatternParts<'b> {
1343    #[doc = "Name"]
1344    Name(&'b str),
1345}
1346impl<'b> CcrResumeAutoFollowPatternParts<'b> {
1347    #[doc = "Builds a relative URL path to the Ccr Resume Auto Follow Pattern API"]
1348    pub fn url(self) -> Cow<'static, str> {
1349        match self {
1350            CcrResumeAutoFollowPatternParts::Name(name) => {
1351                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
1352                let mut p = String::with_capacity(25usize + encoded_name.len());
1353                p.push_str("/_ccr/auto_follow/");
1354                p.push_str(encoded_name.as_ref());
1355                p.push_str("/resume");
1356                p.into()
1357            }
1358        }
1359    }
1360}
1361#[doc = "Builder for the [Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"]
1362#[derive(Clone, Debug)]
1363pub struct CcrResumeAutoFollowPattern<'a, 'b, B> {
1364    transport: &'a Transport,
1365    parts: CcrResumeAutoFollowPatternParts<'b>,
1366    body: Option<B>,
1367    error_trace: Option<bool>,
1368    filter_path: Option<&'b [&'b str]>,
1369    headers: HeaderMap,
1370    human: Option<bool>,
1371    master_timeout: Option<&'b str>,
1372    pretty: Option<bool>,
1373    request_timeout: Option<Duration>,
1374    source: Option<&'b str>,
1375}
1376impl<'a, 'b, B> CcrResumeAutoFollowPattern<'a, 'b, B>
1377where
1378    B: Body,
1379{
1380    #[doc = "Creates a new instance of [CcrResumeAutoFollowPattern] with the specified API parts"]
1381    pub fn new(transport: &'a Transport, parts: CcrResumeAutoFollowPatternParts<'b>) -> Self {
1382        let headers = HeaderMap::new();
1383        CcrResumeAutoFollowPattern {
1384            transport,
1385            parts,
1386            headers,
1387            body: None,
1388            error_trace: None,
1389            filter_path: None,
1390            human: None,
1391            master_timeout: None,
1392            pretty: None,
1393            request_timeout: None,
1394            source: None,
1395        }
1396    }
1397    #[doc = "The body for the API call"]
1398    pub fn body<T>(self, body: T) -> CcrResumeAutoFollowPattern<'a, 'b, JsonBody<T>>
1399    where
1400        T: Serialize,
1401    {
1402        CcrResumeAutoFollowPattern {
1403            transport: self.transport,
1404            parts: self.parts,
1405            body: Some(body.into()),
1406            error_trace: self.error_trace,
1407            filter_path: self.filter_path,
1408            headers: self.headers,
1409            human: self.human,
1410            master_timeout: self.master_timeout,
1411            pretty: self.pretty,
1412            request_timeout: self.request_timeout,
1413            source: self.source,
1414        }
1415    }
1416    #[doc = "Include the stack trace of returned errors."]
1417    pub fn error_trace(mut self, error_trace: bool) -> Self {
1418        self.error_trace = Some(error_trace);
1419        self
1420    }
1421    #[doc = "A comma-separated list of filters used to reduce the response."]
1422    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1423        self.filter_path = Some(filter_path);
1424        self
1425    }
1426    #[doc = "Adds a HTTP header"]
1427    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1428        self.headers.insert(key, value);
1429        self
1430    }
1431    #[doc = "Return human readable values for statistics."]
1432    pub fn human(mut self, human: bool) -> Self {
1433        self.human = Some(human);
1434        self
1435    }
1436    #[doc = "Explicit operation timeout for connection to master node"]
1437    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1438        self.master_timeout = Some(master_timeout);
1439        self
1440    }
1441    #[doc = "Pretty format the returned JSON response."]
1442    pub fn pretty(mut self, pretty: bool) -> Self {
1443        self.pretty = Some(pretty);
1444        self
1445    }
1446    #[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."]
1447    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1448        self.request_timeout = Some(timeout);
1449        self
1450    }
1451    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1452    pub fn source(mut self, source: &'b str) -> Self {
1453        self.source = Some(source);
1454        self
1455    }
1456    #[doc = "Creates an asynchronous call to the Ccr Resume Auto Follow Pattern API that can be awaited"]
1457    pub async fn send(self) -> Result<Response, Error> {
1458        let path = self.parts.url();
1459        let method = http::Method::Post;
1460        let headers = self.headers;
1461        let timeout = self.request_timeout;
1462        let query_string = {
1463            #[serde_with::skip_serializing_none]
1464            #[derive(Serialize)]
1465            struct QueryParams<'b> {
1466                error_trace: Option<bool>,
1467                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1468                filter_path: Option<&'b [&'b str]>,
1469                human: Option<bool>,
1470                master_timeout: Option<&'b str>,
1471                pretty: Option<bool>,
1472                source: Option<&'b str>,
1473            }
1474            let query_params = QueryParams {
1475                error_trace: self.error_trace,
1476                filter_path: self.filter_path,
1477                human: self.human,
1478                master_timeout: self.master_timeout,
1479                pretty: self.pretty,
1480                source: self.source,
1481            };
1482            Some(query_params)
1483        };
1484        let body = self.body;
1485        let response = self
1486            .transport
1487            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1488            .await?;
1489        Ok(response)
1490    }
1491}
1492#[derive(Debug, Clone, PartialEq, Eq)]
1493#[doc = "API parts for the Ccr Resume Follow API"]
1494pub enum CcrResumeFollowParts<'b> {
1495    #[doc = "Index"]
1496    Index(&'b str),
1497}
1498impl<'b> CcrResumeFollowParts<'b> {
1499    #[doc = "Builds a relative URL path to the Ccr Resume Follow API"]
1500    pub fn url(self) -> Cow<'static, str> {
1501        match self {
1502            CcrResumeFollowParts::Index(index) => {
1503                let encoded_index: Cow<str> =
1504                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
1505                let mut p = String::with_capacity(20usize + encoded_index.len());
1506                p.push('/');
1507                p.push_str(encoded_index.as_ref());
1508                p.push_str("/_ccr/resume_follow");
1509                p.into()
1510            }
1511        }
1512    }
1513}
1514#[doc = "Builder for the [Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"]
1515#[derive(Clone, Debug)]
1516pub struct CcrResumeFollow<'a, 'b, B> {
1517    transport: &'a Transport,
1518    parts: CcrResumeFollowParts<'b>,
1519    body: Option<B>,
1520    error_trace: Option<bool>,
1521    filter_path: Option<&'b [&'b str]>,
1522    headers: HeaderMap,
1523    human: Option<bool>,
1524    master_timeout: Option<&'b str>,
1525    pretty: Option<bool>,
1526    request_timeout: Option<Duration>,
1527    source: Option<&'b str>,
1528}
1529impl<'a, 'b, B> CcrResumeFollow<'a, 'b, B>
1530where
1531    B: Body,
1532{
1533    #[doc = "Creates a new instance of [CcrResumeFollow] with the specified API parts"]
1534    pub fn new(transport: &'a Transport, parts: CcrResumeFollowParts<'b>) -> Self {
1535        let headers = HeaderMap::new();
1536        CcrResumeFollow {
1537            transport,
1538            parts,
1539            headers,
1540            body: None,
1541            error_trace: None,
1542            filter_path: None,
1543            human: None,
1544            master_timeout: None,
1545            pretty: None,
1546            request_timeout: None,
1547            source: None,
1548        }
1549    }
1550    #[doc = "The body for the API call"]
1551    pub fn body<T>(self, body: T) -> CcrResumeFollow<'a, 'b, JsonBody<T>>
1552    where
1553        T: Serialize,
1554    {
1555        CcrResumeFollow {
1556            transport: self.transport,
1557            parts: self.parts,
1558            body: Some(body.into()),
1559            error_trace: self.error_trace,
1560            filter_path: self.filter_path,
1561            headers: self.headers,
1562            human: self.human,
1563            master_timeout: self.master_timeout,
1564            pretty: self.pretty,
1565            request_timeout: self.request_timeout,
1566            source: self.source,
1567        }
1568    }
1569    #[doc = "Include the stack trace of returned errors."]
1570    pub fn error_trace(mut self, error_trace: bool) -> Self {
1571        self.error_trace = Some(error_trace);
1572        self
1573    }
1574    #[doc = "A comma-separated list of filters used to reduce the response."]
1575    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1576        self.filter_path = Some(filter_path);
1577        self
1578    }
1579    #[doc = "Adds a HTTP header"]
1580    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1581        self.headers.insert(key, value);
1582        self
1583    }
1584    #[doc = "Return human readable values for statistics."]
1585    pub fn human(mut self, human: bool) -> Self {
1586        self.human = Some(human);
1587        self
1588    }
1589    #[doc = "Explicit operation timeout for connection to master node"]
1590    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1591        self.master_timeout = Some(master_timeout);
1592        self
1593    }
1594    #[doc = "Pretty format the returned JSON response."]
1595    pub fn pretty(mut self, pretty: bool) -> Self {
1596        self.pretty = Some(pretty);
1597        self
1598    }
1599    #[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."]
1600    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1601        self.request_timeout = Some(timeout);
1602        self
1603    }
1604    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1605    pub fn source(mut self, source: &'b str) -> Self {
1606        self.source = Some(source);
1607        self
1608    }
1609    #[doc = "Creates an asynchronous call to the Ccr Resume Follow API that can be awaited"]
1610    pub async fn send(self) -> Result<Response, Error> {
1611        let path = self.parts.url();
1612        let method = http::Method::Post;
1613        let headers = self.headers;
1614        let timeout = self.request_timeout;
1615        let query_string = {
1616            #[serde_with::skip_serializing_none]
1617            #[derive(Serialize)]
1618            struct QueryParams<'b> {
1619                error_trace: Option<bool>,
1620                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1621                filter_path: Option<&'b [&'b str]>,
1622                human: Option<bool>,
1623                master_timeout: Option<&'b str>,
1624                pretty: Option<bool>,
1625                source: Option<&'b str>,
1626            }
1627            let query_params = QueryParams {
1628                error_trace: self.error_trace,
1629                filter_path: self.filter_path,
1630                human: self.human,
1631                master_timeout: self.master_timeout,
1632                pretty: self.pretty,
1633                source: self.source,
1634            };
1635            Some(query_params)
1636        };
1637        let body = self.body;
1638        let response = self
1639            .transport
1640            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1641            .await?;
1642        Ok(response)
1643    }
1644}
1645#[derive(Debug, Clone, PartialEq, Eq)]
1646#[doc = "API parts for the Ccr Stats API"]
1647pub enum CcrStatsParts {
1648    #[doc = "No parts"]
1649    None,
1650}
1651impl CcrStatsParts {
1652    #[doc = "Builds a relative URL path to the Ccr Stats API"]
1653    pub fn url(self) -> Cow<'static, str> {
1654        match self {
1655            CcrStatsParts::None => "/_ccr/stats".into(),
1656        }
1657    }
1658}
1659#[doc = "Builder for the [Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."]
1660#[derive(Clone, Debug)]
1661pub struct CcrStats<'a, 'b> {
1662    transport: &'a Transport,
1663    parts: CcrStatsParts,
1664    error_trace: Option<bool>,
1665    filter_path: Option<&'b [&'b str]>,
1666    headers: HeaderMap,
1667    human: Option<bool>,
1668    master_timeout: Option<&'b str>,
1669    pretty: Option<bool>,
1670    request_timeout: Option<Duration>,
1671    source: Option<&'b str>,
1672    timeout: Option<&'b str>,
1673}
1674impl<'a, 'b> CcrStats<'a, 'b> {
1675    #[doc = "Creates a new instance of [CcrStats]"]
1676    pub fn new(transport: &'a Transport) -> Self {
1677        let headers = HeaderMap::new();
1678        CcrStats {
1679            transport,
1680            parts: CcrStatsParts::None,
1681            headers,
1682            error_trace: None,
1683            filter_path: None,
1684            human: None,
1685            master_timeout: None,
1686            pretty: None,
1687            request_timeout: None,
1688            source: None,
1689            timeout: None,
1690        }
1691    }
1692    #[doc = "Include the stack trace of returned errors."]
1693    pub fn error_trace(mut self, error_trace: bool) -> Self {
1694        self.error_trace = Some(error_trace);
1695        self
1696    }
1697    #[doc = "A comma-separated list of filters used to reduce the response."]
1698    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1699        self.filter_path = Some(filter_path);
1700        self
1701    }
1702    #[doc = "Adds a HTTP header"]
1703    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1704        self.headers.insert(key, value);
1705        self
1706    }
1707    #[doc = "Return human readable values for statistics."]
1708    pub fn human(mut self, human: bool) -> Self {
1709        self.human = Some(human);
1710        self
1711    }
1712    #[doc = "Explicit operation timeout for connection to master node"]
1713    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1714        self.master_timeout = Some(master_timeout);
1715        self
1716    }
1717    #[doc = "Pretty format the returned JSON response."]
1718    pub fn pretty(mut self, pretty: bool) -> Self {
1719        self.pretty = Some(pretty);
1720        self
1721    }
1722    #[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."]
1723    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1724        self.request_timeout = Some(timeout);
1725        self
1726    }
1727    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1728    pub fn source(mut self, source: &'b str) -> Self {
1729        self.source = Some(source);
1730        self
1731    }
1732    #[doc = "Explicit operation timeout"]
1733    pub fn timeout(mut self, timeout: &'b str) -> Self {
1734        self.timeout = Some(timeout);
1735        self
1736    }
1737    #[doc = "Creates an asynchronous call to the Ccr Stats API that can be awaited"]
1738    pub async fn send(self) -> Result<Response, Error> {
1739        let path = self.parts.url();
1740        let method = http::Method::Get;
1741        let headers = self.headers;
1742        let timeout = self.request_timeout;
1743        let query_string = {
1744            #[serde_with::skip_serializing_none]
1745            #[derive(Serialize)]
1746            struct QueryParams<'b> {
1747                error_trace: Option<bool>,
1748                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1749                filter_path: Option<&'b [&'b str]>,
1750                human: Option<bool>,
1751                master_timeout: Option<&'b str>,
1752                pretty: Option<bool>,
1753                source: Option<&'b str>,
1754                timeout: Option<&'b str>,
1755            }
1756            let query_params = QueryParams {
1757                error_trace: self.error_trace,
1758                filter_path: self.filter_path,
1759                human: self.human,
1760                master_timeout: self.master_timeout,
1761                pretty: self.pretty,
1762                source: self.source,
1763                timeout: self.timeout,
1764            };
1765            Some(query_params)
1766        };
1767        let body = Option::<()>::None;
1768        let response = self
1769            .transport
1770            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1771            .await?;
1772        Ok(response)
1773    }
1774}
1775#[derive(Debug, Clone, PartialEq, Eq)]
1776#[doc = "API parts for the Ccr Unfollow API"]
1777pub enum CcrUnfollowParts<'b> {
1778    #[doc = "Index"]
1779    Index(&'b str),
1780}
1781impl<'b> CcrUnfollowParts<'b> {
1782    #[doc = "Builds a relative URL path to the Ccr Unfollow API"]
1783    pub fn url(self) -> Cow<'static, str> {
1784        match self {
1785            CcrUnfollowParts::Index(index) => {
1786                let encoded_index: Cow<str> =
1787                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
1788                let mut p = String::with_capacity(15usize + encoded_index.len());
1789                p.push('/');
1790                p.push_str(encoded_index.as_ref());
1791                p.push_str("/_ccr/unfollow");
1792                p.into()
1793            }
1794        }
1795    }
1796}
1797#[doc = "Builder for the [Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."]
1798#[derive(Clone, Debug)]
1799pub struct CcrUnfollow<'a, 'b, B> {
1800    transport: &'a Transport,
1801    parts: CcrUnfollowParts<'b>,
1802    body: Option<B>,
1803    error_trace: Option<bool>,
1804    filter_path: Option<&'b [&'b str]>,
1805    headers: HeaderMap,
1806    human: Option<bool>,
1807    master_timeout: Option<&'b str>,
1808    pretty: Option<bool>,
1809    request_timeout: Option<Duration>,
1810    source: Option<&'b str>,
1811}
1812impl<'a, 'b, B> CcrUnfollow<'a, 'b, B>
1813where
1814    B: Body,
1815{
1816    #[doc = "Creates a new instance of [CcrUnfollow] with the specified API parts"]
1817    pub fn new(transport: &'a Transport, parts: CcrUnfollowParts<'b>) -> Self {
1818        let headers = HeaderMap::new();
1819        CcrUnfollow {
1820            transport,
1821            parts,
1822            headers,
1823            body: None,
1824            error_trace: None,
1825            filter_path: None,
1826            human: None,
1827            master_timeout: None,
1828            pretty: None,
1829            request_timeout: None,
1830            source: None,
1831        }
1832    }
1833    #[doc = "The body for the API call"]
1834    pub fn body<T>(self, body: T) -> CcrUnfollow<'a, 'b, JsonBody<T>>
1835    where
1836        T: Serialize,
1837    {
1838        CcrUnfollow {
1839            transport: self.transport,
1840            parts: self.parts,
1841            body: Some(body.into()),
1842            error_trace: self.error_trace,
1843            filter_path: self.filter_path,
1844            headers: self.headers,
1845            human: self.human,
1846            master_timeout: self.master_timeout,
1847            pretty: self.pretty,
1848            request_timeout: self.request_timeout,
1849            source: self.source,
1850        }
1851    }
1852    #[doc = "Include the stack trace of returned errors."]
1853    pub fn error_trace(mut self, error_trace: bool) -> Self {
1854        self.error_trace = Some(error_trace);
1855        self
1856    }
1857    #[doc = "A comma-separated list of filters used to reduce the response."]
1858    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1859        self.filter_path = Some(filter_path);
1860        self
1861    }
1862    #[doc = "Adds a HTTP header"]
1863    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1864        self.headers.insert(key, value);
1865        self
1866    }
1867    #[doc = "Return human readable values for statistics."]
1868    pub fn human(mut self, human: bool) -> Self {
1869        self.human = Some(human);
1870        self
1871    }
1872    #[doc = "Explicit operation timeout for connection to master node"]
1873    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1874        self.master_timeout = Some(master_timeout);
1875        self
1876    }
1877    #[doc = "Pretty format the returned JSON response."]
1878    pub fn pretty(mut self, pretty: bool) -> Self {
1879        self.pretty = Some(pretty);
1880        self
1881    }
1882    #[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."]
1883    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1884        self.request_timeout = Some(timeout);
1885        self
1886    }
1887    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1888    pub fn source(mut self, source: &'b str) -> Self {
1889        self.source = Some(source);
1890        self
1891    }
1892    #[doc = "Creates an asynchronous call to the Ccr Unfollow API that can be awaited"]
1893    pub async fn send(self) -> Result<Response, Error> {
1894        let path = self.parts.url();
1895        let method = http::Method::Post;
1896        let headers = self.headers;
1897        let timeout = self.request_timeout;
1898        let query_string = {
1899            #[serde_with::skip_serializing_none]
1900            #[derive(Serialize)]
1901            struct QueryParams<'b> {
1902                error_trace: Option<bool>,
1903                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1904                filter_path: Option<&'b [&'b str]>,
1905                human: Option<bool>,
1906                master_timeout: Option<&'b str>,
1907                pretty: Option<bool>,
1908                source: Option<&'b str>,
1909            }
1910            let query_params = QueryParams {
1911                error_trace: self.error_trace,
1912                filter_path: self.filter_path,
1913                human: self.human,
1914                master_timeout: self.master_timeout,
1915                pretty: self.pretty,
1916                source: self.source,
1917            };
1918            Some(query_params)
1919        };
1920        let body = self.body;
1921        let response = self
1922            .transport
1923            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1924            .await?;
1925        Ok(response)
1926    }
1927}
1928#[doc = "Namespace client for Cross Cluster Replication APIs"]
1929pub struct Ccr<'a> {
1930    transport: &'a Transport,
1931}
1932impl<'a> Ccr<'a> {
1933    #[doc = "Creates a new instance of [Ccr]"]
1934    pub fn new(transport: &'a Transport) -> Self {
1935        Self { transport }
1936    }
1937    pub fn transport(&self) -> &Transport {
1938        self.transport
1939    }
1940    #[doc = "[Ccr Delete Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-delete-auto-follow-pattern.html)\n\nDeletes auto-follow patterns."]
1941    pub fn delete_auto_follow_pattern<'b>(
1942        &'a self,
1943        parts: CcrDeleteAutoFollowPatternParts<'b>,
1944    ) -> CcrDeleteAutoFollowPattern<'a, 'b> {
1945        CcrDeleteAutoFollowPattern::new(self.transport(), parts)
1946    }
1947    #[doc = "[Ccr Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-put-follow.html)\n\nCreates a new follower index configured to follow the referenced leader index."]
1948    pub fn follow<'b>(&'a self, parts: CcrFollowParts<'b>) -> CcrFollow<'a, 'b, ()> {
1949        CcrFollow::new(self.transport(), parts)
1950    }
1951    #[doc = "[Ccr Follow Info API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-follow-info.html)\n\nRetrieves information about all follower indices, including parameters and status for each follower index"]
1952    pub fn follow_info<'b>(&'a self, parts: CcrFollowInfoParts<'b>) -> CcrFollowInfo<'a, 'b> {
1953        CcrFollowInfo::new(self.transport(), parts)
1954    }
1955    #[doc = "[Ccr Follow Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-follow-stats.html)\n\nRetrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices."]
1956    pub fn follow_stats<'b>(&'a self, parts: CcrFollowStatsParts<'b>) -> CcrFollowStats<'a, 'b> {
1957        CcrFollowStats::new(self.transport(), parts)
1958    }
1959    #[doc = "[Ccr Forget Follower API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-forget-follower.html)\n\nRemoves the follower retention leases from the leader."]
1960    pub fn forget_follower<'b>(
1961        &'a self,
1962        parts: CcrForgetFollowerParts<'b>,
1963    ) -> CcrForgetFollower<'a, 'b, ()> {
1964        CcrForgetFollower::new(self.transport(), parts)
1965    }
1966    #[doc = "[Ccr Get Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-auto-follow-pattern.html)\n\nGets configured auto-follow patterns. Returns the specified auto-follow pattern collection."]
1967    pub fn get_auto_follow_pattern<'b>(
1968        &'a self,
1969        parts: CcrGetAutoFollowPatternParts<'b>,
1970    ) -> CcrGetAutoFollowPattern<'a, 'b> {
1971        CcrGetAutoFollowPattern::new(self.transport(), parts)
1972    }
1973    #[doc = "[Ccr Pause Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-pause-auto-follow-pattern.html)\n\nPauses an auto-follow pattern"]
1974    pub fn pause_auto_follow_pattern<'b>(
1975        &'a self,
1976        parts: CcrPauseAutoFollowPatternParts<'b>,
1977    ) -> CcrPauseAutoFollowPattern<'a, 'b, ()> {
1978        CcrPauseAutoFollowPattern::new(self.transport(), parts)
1979    }
1980    #[doc = "[Ccr Pause Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-pause-follow.html)\n\nPauses a follower index. The follower index will not fetch any additional operations from the leader index."]
1981    pub fn pause_follow<'b>(
1982        &'a self,
1983        parts: CcrPauseFollowParts<'b>,
1984    ) -> CcrPauseFollow<'a, 'b, ()> {
1985        CcrPauseFollow::new(self.transport(), parts)
1986    }
1987    #[doc = "[Ccr Put Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-put-auto-follow-pattern.html)\n\nCreates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices."]
1988    pub fn put_auto_follow_pattern<'b>(
1989        &'a self,
1990        parts: CcrPutAutoFollowPatternParts<'b>,
1991    ) -> CcrPutAutoFollowPattern<'a, 'b, ()> {
1992        CcrPutAutoFollowPattern::new(self.transport(), parts)
1993    }
1994    #[doc = "[Ccr Resume Auto Follow Pattern API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-resume-auto-follow-pattern.html)\n\nResumes an auto-follow pattern that has been paused"]
1995    pub fn resume_auto_follow_pattern<'b>(
1996        &'a self,
1997        parts: CcrResumeAutoFollowPatternParts<'b>,
1998    ) -> CcrResumeAutoFollowPattern<'a, 'b, ()> {
1999        CcrResumeAutoFollowPattern::new(self.transport(), parts)
2000    }
2001    #[doc = "[Ccr Resume Follow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-resume-follow.html)\n\nResumes a follower index that has been paused"]
2002    pub fn resume_follow<'b>(
2003        &'a self,
2004        parts: CcrResumeFollowParts<'b>,
2005    ) -> CcrResumeFollow<'a, 'b, ()> {
2006        CcrResumeFollow::new(self.transport(), parts)
2007    }
2008    #[doc = "[Ccr Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-get-stats.html)\n\nGets all stats related to cross-cluster replication."]
2009    pub fn stats<'b>(&'a self) -> CcrStats<'a, 'b> {
2010        CcrStats::new(self.transport())
2011    }
2012    #[doc = "[Ccr Unfollow API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/ccr-post-unfollow.html)\n\nStops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication."]
2013    pub fn unfollow<'b>(&'a self, parts: CcrUnfollowParts<'b>) -> CcrUnfollow<'a, 'b, ()> {
2014        CcrUnfollow::new(self.transport(), parts)
2015    }
2016}
2017impl Elasticsearch {
2018    #[doc = "Creates a namespace client for Cross Cluster Replication APIs"]
2019    pub fn ccr(&self) -> Ccr {
2020        Ccr::new(self.transport())
2021    }
2022}