elasticsearch/
snapshot.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//! Snapshot APIs
28//!
29//! [Manage snapshots taken from a running Elasticsearch cluster](https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html).
30//! A snapshot is a backup of individual
31//! indices or the entire cluster, stored in a repository on a shared filesystem or a remote repository
32//! on S3, HDFS, Azure, Google Cloud storage, and more.
33
34#![allow(unused_imports)]
35use crate::{
36    client::Elasticsearch,
37    error::Error,
38    http::{
39        self,
40        headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE},
41        request::{Body, JsonBody, NdBody, PARTS_ENCODED},
42        response::Response,
43        transport::Transport,
44    },
45    params::*,
46};
47use percent_encoding::percent_encode;
48use serde::Serialize;
49use std::{borrow::Cow, time::Duration};
50#[derive(Debug, Clone, PartialEq, Eq)]
51#[doc = "API parts for the Snapshot Cleanup Repository API"]
52pub enum SnapshotCleanupRepositoryParts<'b> {
53    #[doc = "Repository"]
54    Repository(&'b str),
55}
56impl<'b> SnapshotCleanupRepositoryParts<'b> {
57    #[doc = "Builds a relative URL path to the Snapshot Cleanup Repository API"]
58    pub fn url(self) -> Cow<'static, str> {
59        match self {
60            SnapshotCleanupRepositoryParts::Repository(repository) => {
61                let encoded_repository: Cow<str> =
62                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
63                let mut p = String::with_capacity(20usize + encoded_repository.len());
64                p.push_str("/_snapshot/");
65                p.push_str(encoded_repository.as_ref());
66                p.push_str("/_cleanup");
67                p.into()
68            }
69        }
70    }
71}
72#[doc = "Builder for the [Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."]
73#[derive(Clone, Debug)]
74pub struct SnapshotCleanupRepository<'a, 'b, B> {
75    transport: &'a Transport,
76    parts: SnapshotCleanupRepositoryParts<'b>,
77    body: Option<B>,
78    error_trace: Option<bool>,
79    filter_path: Option<&'b [&'b str]>,
80    headers: HeaderMap,
81    human: Option<bool>,
82    master_timeout: Option<&'b str>,
83    pretty: Option<bool>,
84    request_timeout: Option<Duration>,
85    source: Option<&'b str>,
86    timeout: Option<&'b str>,
87}
88impl<'a, 'b, B> SnapshotCleanupRepository<'a, 'b, B>
89where
90    B: Body,
91{
92    #[doc = "Creates a new instance of [SnapshotCleanupRepository] with the specified API parts"]
93    pub fn new(transport: &'a Transport, parts: SnapshotCleanupRepositoryParts<'b>) -> Self {
94        let headers = HeaderMap::new();
95        SnapshotCleanupRepository {
96            transport,
97            parts,
98            headers,
99            body: None,
100            error_trace: None,
101            filter_path: None,
102            human: None,
103            master_timeout: None,
104            pretty: None,
105            request_timeout: None,
106            source: None,
107            timeout: None,
108        }
109    }
110    #[doc = "The body for the API call"]
111    pub fn body<T>(self, body: T) -> SnapshotCleanupRepository<'a, 'b, JsonBody<T>>
112    where
113        T: Serialize,
114    {
115        SnapshotCleanupRepository {
116            transport: self.transport,
117            parts: self.parts,
118            body: Some(body.into()),
119            error_trace: self.error_trace,
120            filter_path: self.filter_path,
121            headers: self.headers,
122            human: self.human,
123            master_timeout: self.master_timeout,
124            pretty: self.pretty,
125            request_timeout: self.request_timeout,
126            source: self.source,
127            timeout: self.timeout,
128        }
129    }
130    #[doc = "Include the stack trace of returned errors."]
131    pub fn error_trace(mut self, error_trace: bool) -> Self {
132        self.error_trace = Some(error_trace);
133        self
134    }
135    #[doc = "A comma-separated list of filters used to reduce the response."]
136    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
137        self.filter_path = Some(filter_path);
138        self
139    }
140    #[doc = "Adds a HTTP header"]
141    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
142        self.headers.insert(key, value);
143        self
144    }
145    #[doc = "Return human readable values for statistics."]
146    pub fn human(mut self, human: bool) -> Self {
147        self.human = Some(human);
148        self
149    }
150    #[doc = "Explicit operation timeout for connection to master node"]
151    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
152        self.master_timeout = Some(master_timeout);
153        self
154    }
155    #[doc = "Pretty format the returned JSON response."]
156    pub fn pretty(mut self, pretty: bool) -> Self {
157        self.pretty = Some(pretty);
158        self
159    }
160    #[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."]
161    pub fn request_timeout(mut self, timeout: Duration) -> Self {
162        self.request_timeout = Some(timeout);
163        self
164    }
165    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
166    pub fn source(mut self, source: &'b str) -> Self {
167        self.source = Some(source);
168        self
169    }
170    #[doc = "Explicit operation timeout"]
171    pub fn timeout(mut self, timeout: &'b str) -> Self {
172        self.timeout = Some(timeout);
173        self
174    }
175    #[doc = "Creates an asynchronous call to the Snapshot Cleanup Repository API that can be awaited"]
176    pub async fn send(self) -> Result<Response, Error> {
177        let path = self.parts.url();
178        let method = http::Method::Post;
179        let headers = self.headers;
180        let timeout = self.request_timeout;
181        let query_string = {
182            #[serde_with::skip_serializing_none]
183            #[derive(Serialize)]
184            struct QueryParams<'b> {
185                error_trace: Option<bool>,
186                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
187                filter_path: Option<&'b [&'b str]>,
188                human: Option<bool>,
189                master_timeout: Option<&'b str>,
190                pretty: Option<bool>,
191                source: Option<&'b str>,
192                timeout: Option<&'b str>,
193            }
194            let query_params = QueryParams {
195                error_trace: self.error_trace,
196                filter_path: self.filter_path,
197                human: self.human,
198                master_timeout: self.master_timeout,
199                pretty: self.pretty,
200                source: self.source,
201                timeout: self.timeout,
202            };
203            Some(query_params)
204        };
205        let body = self.body;
206        let response = self
207            .transport
208            .send(method, &path, headers, query_string.as_ref(), body, timeout)
209            .await?;
210        Ok(response)
211    }
212}
213#[derive(Debug, Clone, PartialEq, Eq)]
214#[doc = "API parts for the Snapshot Clone API"]
215pub enum SnapshotCloneParts<'b> {
216    #[doc = "Repository, Snapshot and TargetSnapshot"]
217    RepositorySnapshotTargetSnapshot(&'b str, &'b str, &'b str),
218}
219impl<'b> SnapshotCloneParts<'b> {
220    #[doc = "Builds a relative URL path to the Snapshot Clone API"]
221    pub fn url(self) -> Cow<'static, str> {
222        match self {
223            SnapshotCloneParts::RepositorySnapshotTargetSnapshot(
224                repository,
225                snapshot,
226                target_snapshot,
227            ) => {
228                let encoded_repository: Cow<str> =
229                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
230                let encoded_snapshot: Cow<str> =
231                    percent_encode(snapshot.as_bytes(), PARTS_ENCODED).into();
232                let encoded_target_snapshot: Cow<str> =
233                    percent_encode(target_snapshot.as_bytes(), PARTS_ENCODED).into();
234                let mut p = String::with_capacity(
235                    20usize
236                        + encoded_repository.len()
237                        + encoded_snapshot.len()
238                        + encoded_target_snapshot.len(),
239                );
240                p.push_str("/_snapshot/");
241                p.push_str(encoded_repository.as_ref());
242                p.push('/');
243                p.push_str(encoded_snapshot.as_ref());
244                p.push_str("/_clone/");
245                p.push_str(encoded_target_snapshot.as_ref());
246                p.into()
247            }
248        }
249    }
250}
251#[doc = "Builder for the [Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."]
252#[derive(Clone, Debug)]
253pub struct SnapshotClone<'a, 'b, B> {
254    transport: &'a Transport,
255    parts: SnapshotCloneParts<'b>,
256    body: Option<B>,
257    error_trace: Option<bool>,
258    filter_path: Option<&'b [&'b str]>,
259    headers: HeaderMap,
260    human: Option<bool>,
261    master_timeout: Option<&'b str>,
262    pretty: Option<bool>,
263    request_timeout: Option<Duration>,
264    source: Option<&'b str>,
265}
266impl<'a, 'b, B> SnapshotClone<'a, 'b, B>
267where
268    B: Body,
269{
270    #[doc = "Creates a new instance of [SnapshotClone] with the specified API parts"]
271    pub fn new(transport: &'a Transport, parts: SnapshotCloneParts<'b>) -> Self {
272        let headers = HeaderMap::new();
273        SnapshotClone {
274            transport,
275            parts,
276            headers,
277            body: None,
278            error_trace: None,
279            filter_path: None,
280            human: None,
281            master_timeout: None,
282            pretty: None,
283            request_timeout: None,
284            source: None,
285        }
286    }
287    #[doc = "The body for the API call"]
288    pub fn body<T>(self, body: T) -> SnapshotClone<'a, 'b, JsonBody<T>>
289    where
290        T: Serialize,
291    {
292        SnapshotClone {
293            transport: self.transport,
294            parts: self.parts,
295            body: Some(body.into()),
296            error_trace: self.error_trace,
297            filter_path: self.filter_path,
298            headers: self.headers,
299            human: self.human,
300            master_timeout: self.master_timeout,
301            pretty: self.pretty,
302            request_timeout: self.request_timeout,
303            source: self.source,
304        }
305    }
306    #[doc = "Include the stack trace of returned errors."]
307    pub fn error_trace(mut self, error_trace: bool) -> Self {
308        self.error_trace = Some(error_trace);
309        self
310    }
311    #[doc = "A comma-separated list of filters used to reduce the response."]
312    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
313        self.filter_path = Some(filter_path);
314        self
315    }
316    #[doc = "Adds a HTTP header"]
317    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
318        self.headers.insert(key, value);
319        self
320    }
321    #[doc = "Return human readable values for statistics."]
322    pub fn human(mut self, human: bool) -> Self {
323        self.human = Some(human);
324        self
325    }
326    #[doc = "Explicit operation timeout for connection to master node"]
327    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
328        self.master_timeout = Some(master_timeout);
329        self
330    }
331    #[doc = "Pretty format the returned JSON response."]
332    pub fn pretty(mut self, pretty: bool) -> Self {
333        self.pretty = Some(pretty);
334        self
335    }
336    #[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."]
337    pub fn request_timeout(mut self, timeout: Duration) -> Self {
338        self.request_timeout = Some(timeout);
339        self
340    }
341    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
342    pub fn source(mut self, source: &'b str) -> Self {
343        self.source = Some(source);
344        self
345    }
346    #[doc = "Creates an asynchronous call to the Snapshot Clone API that can be awaited"]
347    pub async fn send(self) -> Result<Response, Error> {
348        let path = self.parts.url();
349        let method = http::Method::Put;
350        let headers = self.headers;
351        let timeout = self.request_timeout;
352        let query_string = {
353            #[serde_with::skip_serializing_none]
354            #[derive(Serialize)]
355            struct QueryParams<'b> {
356                error_trace: Option<bool>,
357                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
358                filter_path: Option<&'b [&'b str]>,
359                human: Option<bool>,
360                master_timeout: Option<&'b str>,
361                pretty: Option<bool>,
362                source: Option<&'b str>,
363            }
364            let query_params = QueryParams {
365                error_trace: self.error_trace,
366                filter_path: self.filter_path,
367                human: self.human,
368                master_timeout: self.master_timeout,
369                pretty: self.pretty,
370                source: self.source,
371            };
372            Some(query_params)
373        };
374        let body = self.body;
375        let response = self
376            .transport
377            .send(method, &path, headers, query_string.as_ref(), body, timeout)
378            .await?;
379        Ok(response)
380    }
381}
382#[derive(Debug, Clone, PartialEq, Eq)]
383#[doc = "API parts for the Snapshot Create API"]
384pub enum SnapshotCreateParts<'b> {
385    #[doc = "Repository and Snapshot"]
386    RepositorySnapshot(&'b str, &'b str),
387}
388impl<'b> SnapshotCreateParts<'b> {
389    #[doc = "Builds a relative URL path to the Snapshot Create API"]
390    pub fn url(self) -> Cow<'static, str> {
391        match self {
392            SnapshotCreateParts::RepositorySnapshot(repository, snapshot) => {
393                let encoded_repository: Cow<str> =
394                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
395                let encoded_snapshot: Cow<str> =
396                    percent_encode(snapshot.as_bytes(), PARTS_ENCODED).into();
397                let mut p = String::with_capacity(
398                    12usize + encoded_repository.len() + encoded_snapshot.len(),
399                );
400                p.push_str("/_snapshot/");
401                p.push_str(encoded_repository.as_ref());
402                p.push('/');
403                p.push_str(encoded_snapshot.as_ref());
404                p.into()
405            }
406        }
407    }
408}
409#[doc = "Builder for the [Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nCreates a snapshot in a repository."]
410#[derive(Clone, Debug)]
411pub struct SnapshotCreate<'a, 'b, B> {
412    transport: &'a Transport,
413    parts: SnapshotCreateParts<'b>,
414    body: Option<B>,
415    error_trace: Option<bool>,
416    filter_path: Option<&'b [&'b str]>,
417    headers: HeaderMap,
418    human: Option<bool>,
419    master_timeout: Option<&'b str>,
420    pretty: Option<bool>,
421    request_timeout: Option<Duration>,
422    source: Option<&'b str>,
423    wait_for_completion: Option<bool>,
424}
425impl<'a, 'b, B> SnapshotCreate<'a, 'b, B>
426where
427    B: Body,
428{
429    #[doc = "Creates a new instance of [SnapshotCreate] with the specified API parts"]
430    pub fn new(transport: &'a Transport, parts: SnapshotCreateParts<'b>) -> Self {
431        let headers = HeaderMap::new();
432        SnapshotCreate {
433            transport,
434            parts,
435            headers,
436            body: None,
437            error_trace: None,
438            filter_path: None,
439            human: None,
440            master_timeout: None,
441            pretty: None,
442            request_timeout: None,
443            source: None,
444            wait_for_completion: None,
445        }
446    }
447    #[doc = "The body for the API call"]
448    pub fn body<T>(self, body: T) -> SnapshotCreate<'a, 'b, JsonBody<T>>
449    where
450        T: Serialize,
451    {
452        SnapshotCreate {
453            transport: self.transport,
454            parts: self.parts,
455            body: Some(body.into()),
456            error_trace: self.error_trace,
457            filter_path: self.filter_path,
458            headers: self.headers,
459            human: self.human,
460            master_timeout: self.master_timeout,
461            pretty: self.pretty,
462            request_timeout: self.request_timeout,
463            source: self.source,
464            wait_for_completion: self.wait_for_completion,
465        }
466    }
467    #[doc = "Include the stack trace of returned errors."]
468    pub fn error_trace(mut self, error_trace: bool) -> Self {
469        self.error_trace = Some(error_trace);
470        self
471    }
472    #[doc = "A comma-separated list of filters used to reduce the response."]
473    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
474        self.filter_path = Some(filter_path);
475        self
476    }
477    #[doc = "Adds a HTTP header"]
478    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
479        self.headers.insert(key, value);
480        self
481    }
482    #[doc = "Return human readable values for statistics."]
483    pub fn human(mut self, human: bool) -> Self {
484        self.human = Some(human);
485        self
486    }
487    #[doc = "Explicit operation timeout for connection to master node"]
488    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
489        self.master_timeout = Some(master_timeout);
490        self
491    }
492    #[doc = "Pretty format the returned JSON response."]
493    pub fn pretty(mut self, pretty: bool) -> Self {
494        self.pretty = Some(pretty);
495        self
496    }
497    #[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."]
498    pub fn request_timeout(mut self, timeout: Duration) -> Self {
499        self.request_timeout = Some(timeout);
500        self
501    }
502    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
503    pub fn source(mut self, source: &'b str) -> Self {
504        self.source = Some(source);
505        self
506    }
507    #[doc = "Should this request wait until the operation has completed before returning"]
508    pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self {
509        self.wait_for_completion = Some(wait_for_completion);
510        self
511    }
512    #[doc = "Creates an asynchronous call to the Snapshot Create API that can be awaited"]
513    pub async fn send(self) -> Result<Response, Error> {
514        let path = self.parts.url();
515        let method = http::Method::Post;
516        let headers = self.headers;
517        let timeout = self.request_timeout;
518        let query_string = {
519            #[serde_with::skip_serializing_none]
520            #[derive(Serialize)]
521            struct QueryParams<'b> {
522                error_trace: Option<bool>,
523                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
524                filter_path: Option<&'b [&'b str]>,
525                human: Option<bool>,
526                master_timeout: Option<&'b str>,
527                pretty: Option<bool>,
528                source: Option<&'b str>,
529                wait_for_completion: Option<bool>,
530            }
531            let query_params = QueryParams {
532                error_trace: self.error_trace,
533                filter_path: self.filter_path,
534                human: self.human,
535                master_timeout: self.master_timeout,
536                pretty: self.pretty,
537                source: self.source,
538                wait_for_completion: self.wait_for_completion,
539            };
540            Some(query_params)
541        };
542        let body = self.body;
543        let response = self
544            .transport
545            .send(method, &path, headers, query_string.as_ref(), body, timeout)
546            .await?;
547        Ok(response)
548    }
549}
550#[derive(Debug, Clone, PartialEq, Eq)]
551#[doc = "API parts for the Snapshot Create Repository API"]
552pub enum SnapshotCreateRepositoryParts<'b> {
553    #[doc = "Repository"]
554    Repository(&'b str),
555}
556impl<'b> SnapshotCreateRepositoryParts<'b> {
557    #[doc = "Builds a relative URL path to the Snapshot Create Repository API"]
558    pub fn url(self) -> Cow<'static, str> {
559        match self {
560            SnapshotCreateRepositoryParts::Repository(repository) => {
561                let encoded_repository: Cow<str> =
562                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
563                let mut p = String::with_capacity(11usize + encoded_repository.len());
564                p.push_str("/_snapshot/");
565                p.push_str(encoded_repository.as_ref());
566                p.into()
567            }
568        }
569    }
570}
571#[doc = "Builder for the [Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nCreates a repository."]
572#[derive(Clone, Debug)]
573pub struct SnapshotCreateRepository<'a, 'b, B> {
574    transport: &'a Transport,
575    parts: SnapshotCreateRepositoryParts<'b>,
576    body: Option<B>,
577    error_trace: Option<bool>,
578    filter_path: Option<&'b [&'b str]>,
579    headers: HeaderMap,
580    human: Option<bool>,
581    master_timeout: Option<&'b str>,
582    pretty: Option<bool>,
583    request_timeout: Option<Duration>,
584    source: Option<&'b str>,
585    timeout: Option<&'b str>,
586    verify: Option<bool>,
587}
588impl<'a, 'b, B> SnapshotCreateRepository<'a, 'b, B>
589where
590    B: Body,
591{
592    #[doc = "Creates a new instance of [SnapshotCreateRepository] with the specified API parts"]
593    pub fn new(transport: &'a Transport, parts: SnapshotCreateRepositoryParts<'b>) -> Self {
594        let headers = HeaderMap::new();
595        SnapshotCreateRepository {
596            transport,
597            parts,
598            headers,
599            body: None,
600            error_trace: None,
601            filter_path: None,
602            human: None,
603            master_timeout: None,
604            pretty: None,
605            request_timeout: None,
606            source: None,
607            timeout: None,
608            verify: None,
609        }
610    }
611    #[doc = "The body for the API call"]
612    pub fn body<T>(self, body: T) -> SnapshotCreateRepository<'a, 'b, JsonBody<T>>
613    where
614        T: Serialize,
615    {
616        SnapshotCreateRepository {
617            transport: self.transport,
618            parts: self.parts,
619            body: Some(body.into()),
620            error_trace: self.error_trace,
621            filter_path: self.filter_path,
622            headers: self.headers,
623            human: self.human,
624            master_timeout: self.master_timeout,
625            pretty: self.pretty,
626            request_timeout: self.request_timeout,
627            source: self.source,
628            timeout: self.timeout,
629            verify: self.verify,
630        }
631    }
632    #[doc = "Include the stack trace of returned errors."]
633    pub fn error_trace(mut self, error_trace: bool) -> Self {
634        self.error_trace = Some(error_trace);
635        self
636    }
637    #[doc = "A comma-separated list of filters used to reduce the response."]
638    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
639        self.filter_path = Some(filter_path);
640        self
641    }
642    #[doc = "Adds a HTTP header"]
643    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
644        self.headers.insert(key, value);
645        self
646    }
647    #[doc = "Return human readable values for statistics."]
648    pub fn human(mut self, human: bool) -> Self {
649        self.human = Some(human);
650        self
651    }
652    #[doc = "Explicit operation timeout for connection to master node"]
653    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
654        self.master_timeout = Some(master_timeout);
655        self
656    }
657    #[doc = "Pretty format the returned JSON response."]
658    pub fn pretty(mut self, pretty: bool) -> Self {
659        self.pretty = Some(pretty);
660        self
661    }
662    #[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."]
663    pub fn request_timeout(mut self, timeout: Duration) -> Self {
664        self.request_timeout = Some(timeout);
665        self
666    }
667    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
668    pub fn source(mut self, source: &'b str) -> Self {
669        self.source = Some(source);
670        self
671    }
672    #[doc = "Explicit operation timeout"]
673    pub fn timeout(mut self, timeout: &'b str) -> Self {
674        self.timeout = Some(timeout);
675        self
676    }
677    #[doc = "Whether to verify the repository after creation"]
678    pub fn verify(mut self, verify: bool) -> Self {
679        self.verify = Some(verify);
680        self
681    }
682    #[doc = "Creates an asynchronous call to the Snapshot Create Repository API that can be awaited"]
683    pub async fn send(self) -> Result<Response, Error> {
684        let path = self.parts.url();
685        let method = http::Method::Post;
686        let headers = self.headers;
687        let timeout = self.request_timeout;
688        let query_string = {
689            #[serde_with::skip_serializing_none]
690            #[derive(Serialize)]
691            struct QueryParams<'b> {
692                error_trace: Option<bool>,
693                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
694                filter_path: Option<&'b [&'b str]>,
695                human: Option<bool>,
696                master_timeout: Option<&'b str>,
697                pretty: Option<bool>,
698                source: Option<&'b str>,
699                timeout: Option<&'b str>,
700                verify: Option<bool>,
701            }
702            let query_params = QueryParams {
703                error_trace: self.error_trace,
704                filter_path: self.filter_path,
705                human: self.human,
706                master_timeout: self.master_timeout,
707                pretty: self.pretty,
708                source: self.source,
709                timeout: self.timeout,
710                verify: self.verify,
711            };
712            Some(query_params)
713        };
714        let body = self.body;
715        let response = self
716            .transport
717            .send(method, &path, headers, query_string.as_ref(), body, timeout)
718            .await?;
719        Ok(response)
720    }
721}
722#[derive(Debug, Clone, PartialEq, Eq)]
723#[doc = "API parts for the Snapshot Delete API"]
724pub enum SnapshotDeleteParts<'b> {
725    #[doc = "Repository and Snapshot"]
726    RepositorySnapshot(&'b str, &'b [&'b str]),
727}
728impl<'b> SnapshotDeleteParts<'b> {
729    #[doc = "Builds a relative URL path to the Snapshot Delete API"]
730    pub fn url(self) -> Cow<'static, str> {
731        match self {
732            SnapshotDeleteParts::RepositorySnapshot(repository, snapshot) => {
733                let snapshot_str = snapshot.join(",");
734                let encoded_repository: Cow<str> =
735                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
736                let encoded_snapshot: Cow<str> =
737                    percent_encode(snapshot_str.as_bytes(), PARTS_ENCODED).into();
738                let mut p = String::with_capacity(
739                    12usize + encoded_repository.len() + encoded_snapshot.len(),
740                );
741                p.push_str("/_snapshot/");
742                p.push_str(encoded_repository.as_ref());
743                p.push('/');
744                p.push_str(encoded_snapshot.as_ref());
745                p.into()
746            }
747        }
748    }
749}
750#[doc = "Builder for the [Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nDeletes one or more snapshots."]
751#[derive(Clone, Debug)]
752pub struct SnapshotDelete<'a, 'b> {
753    transport: &'a Transport,
754    parts: SnapshotDeleteParts<'b>,
755    error_trace: Option<bool>,
756    filter_path: Option<&'b [&'b str]>,
757    headers: HeaderMap,
758    human: Option<bool>,
759    master_timeout: Option<&'b str>,
760    pretty: Option<bool>,
761    request_timeout: Option<Duration>,
762    source: Option<&'b str>,
763    wait_for_completion: Option<bool>,
764}
765impl<'a, 'b> SnapshotDelete<'a, 'b> {
766    #[doc = "Creates a new instance of [SnapshotDelete] with the specified API parts"]
767    pub fn new(transport: &'a Transport, parts: SnapshotDeleteParts<'b>) -> Self {
768        let headers = HeaderMap::new();
769        SnapshotDelete {
770            transport,
771            parts,
772            headers,
773            error_trace: None,
774            filter_path: None,
775            human: None,
776            master_timeout: None,
777            pretty: None,
778            request_timeout: None,
779            source: None,
780            wait_for_completion: None,
781        }
782    }
783    #[doc = "Include the stack trace of returned errors."]
784    pub fn error_trace(mut self, error_trace: bool) -> Self {
785        self.error_trace = Some(error_trace);
786        self
787    }
788    #[doc = "A comma-separated list of filters used to reduce the response."]
789    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
790        self.filter_path = Some(filter_path);
791        self
792    }
793    #[doc = "Adds a HTTP header"]
794    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
795        self.headers.insert(key, value);
796        self
797    }
798    #[doc = "Return human readable values for statistics."]
799    pub fn human(mut self, human: bool) -> Self {
800        self.human = Some(human);
801        self
802    }
803    #[doc = "Explicit operation timeout for connection to master node"]
804    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
805        self.master_timeout = Some(master_timeout);
806        self
807    }
808    #[doc = "Pretty format the returned JSON response."]
809    pub fn pretty(mut self, pretty: bool) -> Self {
810        self.pretty = Some(pretty);
811        self
812    }
813    #[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."]
814    pub fn request_timeout(mut self, timeout: Duration) -> Self {
815        self.request_timeout = Some(timeout);
816        self
817    }
818    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
819    pub fn source(mut self, source: &'b str) -> Self {
820        self.source = Some(source);
821        self
822    }
823    #[doc = "Should this request wait until the operation has completed before returning"]
824    pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self {
825        self.wait_for_completion = Some(wait_for_completion);
826        self
827    }
828    #[doc = "Creates an asynchronous call to the Snapshot Delete API that can be awaited"]
829    pub async fn send(self) -> Result<Response, Error> {
830        let path = self.parts.url();
831        let method = http::Method::Delete;
832        let headers = self.headers;
833        let timeout = self.request_timeout;
834        let query_string = {
835            #[serde_with::skip_serializing_none]
836            #[derive(Serialize)]
837            struct QueryParams<'b> {
838                error_trace: Option<bool>,
839                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
840                filter_path: Option<&'b [&'b str]>,
841                human: Option<bool>,
842                master_timeout: Option<&'b str>,
843                pretty: Option<bool>,
844                source: Option<&'b str>,
845                wait_for_completion: Option<bool>,
846            }
847            let query_params = QueryParams {
848                error_trace: self.error_trace,
849                filter_path: self.filter_path,
850                human: self.human,
851                master_timeout: self.master_timeout,
852                pretty: self.pretty,
853                source: self.source,
854                wait_for_completion: self.wait_for_completion,
855            };
856            Some(query_params)
857        };
858        let body = Option::<()>::None;
859        let response = self
860            .transport
861            .send(method, &path, headers, query_string.as_ref(), body, timeout)
862            .await?;
863        Ok(response)
864    }
865}
866#[derive(Debug, Clone, PartialEq, Eq)]
867#[doc = "API parts for the Snapshot Delete Repository API"]
868pub enum SnapshotDeleteRepositoryParts<'b> {
869    #[doc = "Repository"]
870    Repository(&'b [&'b str]),
871}
872impl<'b> SnapshotDeleteRepositoryParts<'b> {
873    #[doc = "Builds a relative URL path to the Snapshot Delete Repository API"]
874    pub fn url(self) -> Cow<'static, str> {
875        match self {
876            SnapshotDeleteRepositoryParts::Repository(repository) => {
877                let repository_str = repository.join(",");
878                let encoded_repository: Cow<str> =
879                    percent_encode(repository_str.as_bytes(), PARTS_ENCODED).into();
880                let mut p = String::with_capacity(11usize + encoded_repository.len());
881                p.push_str("/_snapshot/");
882                p.push_str(encoded_repository.as_ref());
883                p.into()
884            }
885        }
886    }
887}
888#[doc = "Builder for the [Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nDeletes a repository."]
889#[derive(Clone, Debug)]
890pub struct SnapshotDeleteRepository<'a, 'b> {
891    transport: &'a Transport,
892    parts: SnapshotDeleteRepositoryParts<'b>,
893    error_trace: Option<bool>,
894    filter_path: Option<&'b [&'b str]>,
895    headers: HeaderMap,
896    human: Option<bool>,
897    master_timeout: Option<&'b str>,
898    pretty: Option<bool>,
899    request_timeout: Option<Duration>,
900    source: Option<&'b str>,
901    timeout: Option<&'b str>,
902}
903impl<'a, 'b> SnapshotDeleteRepository<'a, 'b> {
904    #[doc = "Creates a new instance of [SnapshotDeleteRepository] with the specified API parts"]
905    pub fn new(transport: &'a Transport, parts: SnapshotDeleteRepositoryParts<'b>) -> Self {
906        let headers = HeaderMap::new();
907        SnapshotDeleteRepository {
908            transport,
909            parts,
910            headers,
911            error_trace: None,
912            filter_path: None,
913            human: None,
914            master_timeout: None,
915            pretty: None,
916            request_timeout: None,
917            source: None,
918            timeout: None,
919        }
920    }
921    #[doc = "Include the stack trace of returned errors."]
922    pub fn error_trace(mut self, error_trace: bool) -> Self {
923        self.error_trace = Some(error_trace);
924        self
925    }
926    #[doc = "A comma-separated list of filters used to reduce the response."]
927    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
928        self.filter_path = Some(filter_path);
929        self
930    }
931    #[doc = "Adds a HTTP header"]
932    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
933        self.headers.insert(key, value);
934        self
935    }
936    #[doc = "Return human readable values for statistics."]
937    pub fn human(mut self, human: bool) -> Self {
938        self.human = Some(human);
939        self
940    }
941    #[doc = "Explicit operation timeout for connection to master node"]
942    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
943        self.master_timeout = Some(master_timeout);
944        self
945    }
946    #[doc = "Pretty format the returned JSON response."]
947    pub fn pretty(mut self, pretty: bool) -> Self {
948        self.pretty = Some(pretty);
949        self
950    }
951    #[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."]
952    pub fn request_timeout(mut self, timeout: Duration) -> Self {
953        self.request_timeout = Some(timeout);
954        self
955    }
956    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
957    pub fn source(mut self, source: &'b str) -> Self {
958        self.source = Some(source);
959        self
960    }
961    #[doc = "Explicit operation timeout"]
962    pub fn timeout(mut self, timeout: &'b str) -> Self {
963        self.timeout = Some(timeout);
964        self
965    }
966    #[doc = "Creates an asynchronous call to the Snapshot Delete Repository API that can be awaited"]
967    pub async fn send(self) -> Result<Response, Error> {
968        let path = self.parts.url();
969        let method = http::Method::Delete;
970        let headers = self.headers;
971        let timeout = self.request_timeout;
972        let query_string = {
973            #[serde_with::skip_serializing_none]
974            #[derive(Serialize)]
975            struct QueryParams<'b> {
976                error_trace: Option<bool>,
977                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
978                filter_path: Option<&'b [&'b str]>,
979                human: Option<bool>,
980                master_timeout: Option<&'b str>,
981                pretty: Option<bool>,
982                source: Option<&'b str>,
983                timeout: Option<&'b str>,
984            }
985            let query_params = QueryParams {
986                error_trace: self.error_trace,
987                filter_path: self.filter_path,
988                human: self.human,
989                master_timeout: self.master_timeout,
990                pretty: self.pretty,
991                source: self.source,
992                timeout: self.timeout,
993            };
994            Some(query_params)
995        };
996        let body = Option::<()>::None;
997        let response = self
998            .transport
999            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1000            .await?;
1001        Ok(response)
1002    }
1003}
1004#[derive(Debug, Clone, PartialEq, Eq)]
1005#[doc = "API parts for the Snapshot Get API"]
1006pub enum SnapshotGetParts<'b> {
1007    #[doc = "Repository and Snapshot"]
1008    RepositorySnapshot(&'b str, &'b [&'b str]),
1009}
1010impl<'b> SnapshotGetParts<'b> {
1011    #[doc = "Builds a relative URL path to the Snapshot Get API"]
1012    pub fn url(self) -> Cow<'static, str> {
1013        match self {
1014            SnapshotGetParts::RepositorySnapshot(repository, snapshot) => {
1015                let snapshot_str = snapshot.join(",");
1016                let encoded_repository: Cow<str> =
1017                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
1018                let encoded_snapshot: Cow<str> =
1019                    percent_encode(snapshot_str.as_bytes(), PARTS_ENCODED).into();
1020                let mut p = String::with_capacity(
1021                    12usize + encoded_repository.len() + encoded_snapshot.len(),
1022                );
1023                p.push_str("/_snapshot/");
1024                p.push_str(encoded_repository.as_ref());
1025                p.push('/');
1026                p.push_str(encoded_snapshot.as_ref());
1027                p.into()
1028            }
1029        }
1030    }
1031}
1032#[doc = "Builder for the [Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nReturns information about a snapshot."]
1033#[derive(Clone, Debug)]
1034pub struct SnapshotGet<'a, 'b> {
1035    transport: &'a Transport,
1036    parts: SnapshotGetParts<'b>,
1037    after: Option<&'b str>,
1038    error_trace: Option<bool>,
1039    filter_path: Option<&'b [&'b str]>,
1040    from_sort_value: Option<&'b str>,
1041    headers: HeaderMap,
1042    human: Option<bool>,
1043    ignore_unavailable: Option<bool>,
1044    include_repository: Option<bool>,
1045    index_details: Option<bool>,
1046    index_names: Option<bool>,
1047    master_timeout: Option<&'b str>,
1048    offset: Option<&'b str>,
1049    order: Option<Order>,
1050    pretty: Option<bool>,
1051    request_timeout: Option<Duration>,
1052    size: Option<&'b str>,
1053    slm_policy_filter: Option<&'b str>,
1054    sort: Option<Sort>,
1055    source: Option<&'b str>,
1056    verbose: Option<bool>,
1057}
1058impl<'a, 'b> SnapshotGet<'a, 'b> {
1059    #[doc = "Creates a new instance of [SnapshotGet] with the specified API parts"]
1060    pub fn new(transport: &'a Transport, parts: SnapshotGetParts<'b>) -> Self {
1061        let headers = HeaderMap::new();
1062        SnapshotGet {
1063            transport,
1064            parts,
1065            headers,
1066            after: None,
1067            error_trace: None,
1068            filter_path: None,
1069            from_sort_value: None,
1070            human: None,
1071            ignore_unavailable: None,
1072            include_repository: None,
1073            index_details: None,
1074            index_names: None,
1075            master_timeout: None,
1076            offset: None,
1077            order: None,
1078            pretty: None,
1079            request_timeout: None,
1080            size: None,
1081            slm_policy_filter: None,
1082            sort: None,
1083            source: None,
1084            verbose: None,
1085        }
1086    }
1087    #[doc = "Offset identifier to start pagination from as returned by the 'next' field in the response body."]
1088    pub fn after(mut self, after: &'b str) -> Self {
1089        self.after = Some(after);
1090        self
1091    }
1092    #[doc = "Include the stack trace of returned errors."]
1093    pub fn error_trace(mut self, error_trace: bool) -> Self {
1094        self.error_trace = Some(error_trace);
1095        self
1096    }
1097    #[doc = "A comma-separated list of filters used to reduce the response."]
1098    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1099        self.filter_path = Some(filter_path);
1100        self
1101    }
1102    #[doc = "Value of the current sort column at which to start retrieval."]
1103    pub fn from_sort_value(mut self, from_sort_value: &'b str) -> Self {
1104        self.from_sort_value = Some(from_sort_value);
1105        self
1106    }
1107    #[doc = "Adds a HTTP header"]
1108    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1109        self.headers.insert(key, value);
1110        self
1111    }
1112    #[doc = "Return human readable values for statistics."]
1113    pub fn human(mut self, human: bool) -> Self {
1114        self.human = Some(human);
1115        self
1116    }
1117    #[doc = "Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown"]
1118    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
1119        self.ignore_unavailable = Some(ignore_unavailable);
1120        self
1121    }
1122    #[doc = "Whether to include the repository name in the snapshot info. Defaults to true."]
1123    pub fn include_repository(mut self, include_repository: bool) -> Self {
1124        self.include_repository = Some(include_repository);
1125        self
1126    }
1127    #[doc = "Whether to include details of each index in the snapshot, if those details are available. Defaults to false."]
1128    pub fn index_details(mut self, index_details: bool) -> Self {
1129        self.index_details = Some(index_details);
1130        self
1131    }
1132    #[doc = "Whether to include the name of each index in the snapshot. Defaults to true."]
1133    pub fn index_names(mut self, index_names: bool) -> Self {
1134        self.index_names = Some(index_names);
1135        self
1136    }
1137    #[doc = "Explicit operation timeout for connection to master node"]
1138    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1139        self.master_timeout = Some(master_timeout);
1140        self
1141    }
1142    #[doc = "Numeric offset to start pagination based on the snapshots matching the request. Defaults to 0"]
1143    pub fn offset(mut self, offset: &'b str) -> Self {
1144        self.offset = Some(offset);
1145        self
1146    }
1147    #[doc = "Sort order"]
1148    pub fn order(mut self, order: Order) -> Self {
1149        self.order = Some(order);
1150        self
1151    }
1152    #[doc = "Pretty format the returned JSON response."]
1153    pub fn pretty(mut self, pretty: bool) -> Self {
1154        self.pretty = Some(pretty);
1155        self
1156    }
1157    #[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."]
1158    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1159        self.request_timeout = Some(timeout);
1160        self
1161    }
1162    #[doc = "Maximum number of snapshots to return. Defaults to 0 which means return all that match without limit."]
1163    pub fn size(mut self, size: &'b str) -> Self {
1164        self.size = Some(size);
1165        self
1166    }
1167    #[doc = "Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Accepts wildcards. Use the special pattern '_none' to match snapshots without an SLM policy"]
1168    pub fn slm_policy_filter(mut self, slm_policy_filter: &'b str) -> Self {
1169        self.slm_policy_filter = Some(slm_policy_filter);
1170        self
1171    }
1172    #[doc = "Allows setting a sort order for the result. Defaults to start_time"]
1173    pub fn sort(mut self, sort: Sort) -> Self {
1174        self.sort = Some(sort);
1175        self
1176    }
1177    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1178    pub fn source(mut self, source: &'b str) -> Self {
1179        self.source = Some(source);
1180        self
1181    }
1182    #[doc = "Whether to show verbose snapshot info or only show the basic info found in the repository index blob"]
1183    pub fn verbose(mut self, verbose: bool) -> Self {
1184        self.verbose = Some(verbose);
1185        self
1186    }
1187    #[doc = "Creates an asynchronous call to the Snapshot Get API that can be awaited"]
1188    pub async fn send(self) -> Result<Response, Error> {
1189        let path = self.parts.url();
1190        let method = http::Method::Get;
1191        let headers = self.headers;
1192        let timeout = self.request_timeout;
1193        let query_string = {
1194            #[serde_with::skip_serializing_none]
1195            #[derive(Serialize)]
1196            struct QueryParams<'b> {
1197                after: Option<&'b str>,
1198                error_trace: Option<bool>,
1199                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1200                filter_path: Option<&'b [&'b str]>,
1201                from_sort_value: Option<&'b str>,
1202                human: Option<bool>,
1203                ignore_unavailable: Option<bool>,
1204                include_repository: Option<bool>,
1205                index_details: Option<bool>,
1206                index_names: Option<bool>,
1207                master_timeout: Option<&'b str>,
1208                offset: Option<&'b str>,
1209                order: Option<Order>,
1210                pretty: Option<bool>,
1211                size: Option<&'b str>,
1212                slm_policy_filter: Option<&'b str>,
1213                sort: Option<Sort>,
1214                source: Option<&'b str>,
1215                verbose: Option<bool>,
1216            }
1217            let query_params = QueryParams {
1218                after: self.after,
1219                error_trace: self.error_trace,
1220                filter_path: self.filter_path,
1221                from_sort_value: self.from_sort_value,
1222                human: self.human,
1223                ignore_unavailable: self.ignore_unavailable,
1224                include_repository: self.include_repository,
1225                index_details: self.index_details,
1226                index_names: self.index_names,
1227                master_timeout: self.master_timeout,
1228                offset: self.offset,
1229                order: self.order,
1230                pretty: self.pretty,
1231                size: self.size,
1232                slm_policy_filter: self.slm_policy_filter,
1233                sort: self.sort,
1234                source: self.source,
1235                verbose: self.verbose,
1236            };
1237            Some(query_params)
1238        };
1239        let body = Option::<()>::None;
1240        let response = self
1241            .transport
1242            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1243            .await?;
1244        Ok(response)
1245    }
1246}
1247#[derive(Debug, Clone, PartialEq, Eq)]
1248#[doc = "API parts for the Snapshot Get Repository API"]
1249pub enum SnapshotGetRepositoryParts<'b> {
1250    #[doc = "No parts"]
1251    None,
1252    #[doc = "Repository"]
1253    Repository(&'b [&'b str]),
1254}
1255impl<'b> SnapshotGetRepositoryParts<'b> {
1256    #[doc = "Builds a relative URL path to the Snapshot Get Repository API"]
1257    pub fn url(self) -> Cow<'static, str> {
1258        match self {
1259            SnapshotGetRepositoryParts::None => "/_snapshot".into(),
1260            SnapshotGetRepositoryParts::Repository(repository) => {
1261                let repository_str = repository.join(",");
1262                let encoded_repository: Cow<str> =
1263                    percent_encode(repository_str.as_bytes(), PARTS_ENCODED).into();
1264                let mut p = String::with_capacity(11usize + encoded_repository.len());
1265                p.push_str("/_snapshot/");
1266                p.push_str(encoded_repository.as_ref());
1267                p.into()
1268            }
1269        }
1270    }
1271}
1272#[doc = "Builder for the [Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nReturns information about a repository."]
1273#[derive(Clone, Debug)]
1274pub struct SnapshotGetRepository<'a, 'b> {
1275    transport: &'a Transport,
1276    parts: SnapshotGetRepositoryParts<'b>,
1277    error_trace: Option<bool>,
1278    filter_path: Option<&'b [&'b str]>,
1279    headers: HeaderMap,
1280    human: Option<bool>,
1281    local: Option<bool>,
1282    master_timeout: Option<&'b str>,
1283    pretty: Option<bool>,
1284    request_timeout: Option<Duration>,
1285    source: Option<&'b str>,
1286}
1287impl<'a, 'b> SnapshotGetRepository<'a, 'b> {
1288    #[doc = "Creates a new instance of [SnapshotGetRepository] with the specified API parts"]
1289    pub fn new(transport: &'a Transport, parts: SnapshotGetRepositoryParts<'b>) -> Self {
1290        let headers = HeaderMap::new();
1291        SnapshotGetRepository {
1292            transport,
1293            parts,
1294            headers,
1295            error_trace: None,
1296            filter_path: None,
1297            human: None,
1298            local: None,
1299            master_timeout: None,
1300            pretty: None,
1301            request_timeout: None,
1302            source: None,
1303        }
1304    }
1305    #[doc = "Include the stack trace of returned errors."]
1306    pub fn error_trace(mut self, error_trace: bool) -> Self {
1307        self.error_trace = Some(error_trace);
1308        self
1309    }
1310    #[doc = "A comma-separated list of filters used to reduce the response."]
1311    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1312        self.filter_path = Some(filter_path);
1313        self
1314    }
1315    #[doc = "Adds a HTTP header"]
1316    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1317        self.headers.insert(key, value);
1318        self
1319    }
1320    #[doc = "Return human readable values for statistics."]
1321    pub fn human(mut self, human: bool) -> Self {
1322        self.human = Some(human);
1323        self
1324    }
1325    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
1326    pub fn local(mut self, local: bool) -> Self {
1327        self.local = Some(local);
1328        self
1329    }
1330    #[doc = "Explicit operation timeout for connection to master node"]
1331    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1332        self.master_timeout = Some(master_timeout);
1333        self
1334    }
1335    #[doc = "Pretty format the returned JSON response."]
1336    pub fn pretty(mut self, pretty: bool) -> Self {
1337        self.pretty = Some(pretty);
1338        self
1339    }
1340    #[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."]
1341    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1342        self.request_timeout = Some(timeout);
1343        self
1344    }
1345    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1346    pub fn source(mut self, source: &'b str) -> Self {
1347        self.source = Some(source);
1348        self
1349    }
1350    #[doc = "Creates an asynchronous call to the Snapshot Get Repository API that can be awaited"]
1351    pub async fn send(self) -> Result<Response, Error> {
1352        let path = self.parts.url();
1353        let method = http::Method::Get;
1354        let headers = self.headers;
1355        let timeout = self.request_timeout;
1356        let query_string = {
1357            #[serde_with::skip_serializing_none]
1358            #[derive(Serialize)]
1359            struct QueryParams<'b> {
1360                error_trace: Option<bool>,
1361                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1362                filter_path: Option<&'b [&'b str]>,
1363                human: Option<bool>,
1364                local: Option<bool>,
1365                master_timeout: Option<&'b str>,
1366                pretty: Option<bool>,
1367                source: Option<&'b str>,
1368            }
1369            let query_params = QueryParams {
1370                error_trace: self.error_trace,
1371                filter_path: self.filter_path,
1372                human: self.human,
1373                local: self.local,
1374                master_timeout: self.master_timeout,
1375                pretty: self.pretty,
1376                source: self.source,
1377            };
1378            Some(query_params)
1379        };
1380        let body = Option::<()>::None;
1381        let response = self
1382            .transport
1383            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1384            .await?;
1385        Ok(response)
1386    }
1387}
1388#[derive(Debug, Clone, PartialEq, Eq)]
1389#[doc = "API parts for the Snapshot Repository Analyze API"]
1390pub enum SnapshotRepositoryAnalyzeParts<'b> {
1391    #[doc = "Repository"]
1392    Repository(&'b str),
1393}
1394impl<'b> SnapshotRepositoryAnalyzeParts<'b> {
1395    #[doc = "Builds a relative URL path to the Snapshot Repository Analyze API"]
1396    pub fn url(self) -> Cow<'static, str> {
1397        match self {
1398            SnapshotRepositoryAnalyzeParts::Repository(repository) => {
1399                let encoded_repository: Cow<str> =
1400                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
1401                let mut p = String::with_capacity(20usize + encoded_repository.len());
1402                p.push_str("/_snapshot/");
1403                p.push_str(encoded_repository.as_ref());
1404                p.push_str("/_analyze");
1405                p.into()
1406            }
1407        }
1408    }
1409}
1410#[doc = "Builder for the [Snapshot Repository Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nAnalyzes a repository for correctness and performance"]
1411#[derive(Clone, Debug)]
1412pub struct SnapshotRepositoryAnalyze<'a, 'b, B> {
1413    transport: &'a Transport,
1414    parts: SnapshotRepositoryAnalyzeParts<'b>,
1415    blob_count: Option<i64>,
1416    body: Option<B>,
1417    concurrency: Option<i64>,
1418    detailed: Option<bool>,
1419    early_read_node_count: Option<i64>,
1420    error_trace: Option<bool>,
1421    filter_path: Option<&'b [&'b str]>,
1422    headers: HeaderMap,
1423    human: Option<bool>,
1424    max_blob_size: Option<&'b str>,
1425    max_total_data_size: Option<&'b str>,
1426    pretty: Option<bool>,
1427    rare_action_probability: Option<i64>,
1428    rarely_abort_writes: Option<bool>,
1429    read_node_count: Option<i64>,
1430    request_timeout: Option<Duration>,
1431    seed: Option<i64>,
1432    source: Option<&'b str>,
1433    timeout: Option<&'b str>,
1434}
1435impl<'a, 'b, B> SnapshotRepositoryAnalyze<'a, 'b, B>
1436where
1437    B: Body,
1438{
1439    #[doc = "Creates a new instance of [SnapshotRepositoryAnalyze] with the specified API parts"]
1440    pub fn new(transport: &'a Transport, parts: SnapshotRepositoryAnalyzeParts<'b>) -> Self {
1441        let headers = HeaderMap::new();
1442        SnapshotRepositoryAnalyze {
1443            transport,
1444            parts,
1445            headers,
1446            blob_count: None,
1447            body: None,
1448            concurrency: None,
1449            detailed: None,
1450            early_read_node_count: None,
1451            error_trace: None,
1452            filter_path: None,
1453            human: None,
1454            max_blob_size: None,
1455            max_total_data_size: None,
1456            pretty: None,
1457            rare_action_probability: None,
1458            rarely_abort_writes: None,
1459            read_node_count: None,
1460            request_timeout: None,
1461            seed: None,
1462            source: None,
1463            timeout: None,
1464        }
1465    }
1466    #[doc = "Number of blobs to create during the test. Defaults to 100."]
1467    pub fn blob_count(mut self, blob_count: i64) -> Self {
1468        self.blob_count = Some(blob_count);
1469        self
1470    }
1471    #[doc = "The body for the API call"]
1472    pub fn body<T>(self, body: T) -> SnapshotRepositoryAnalyze<'a, 'b, JsonBody<T>>
1473    where
1474        T: Serialize,
1475    {
1476        SnapshotRepositoryAnalyze {
1477            transport: self.transport,
1478            parts: self.parts,
1479            body: Some(body.into()),
1480            blob_count: self.blob_count,
1481            concurrency: self.concurrency,
1482            detailed: self.detailed,
1483            early_read_node_count: self.early_read_node_count,
1484            error_trace: self.error_trace,
1485            filter_path: self.filter_path,
1486            headers: self.headers,
1487            human: self.human,
1488            max_blob_size: self.max_blob_size,
1489            max_total_data_size: self.max_total_data_size,
1490            pretty: self.pretty,
1491            rare_action_probability: self.rare_action_probability,
1492            rarely_abort_writes: self.rarely_abort_writes,
1493            read_node_count: self.read_node_count,
1494            request_timeout: self.request_timeout,
1495            seed: self.seed,
1496            source: self.source,
1497            timeout: self.timeout,
1498        }
1499    }
1500    #[doc = "Number of operations to run concurrently during the test. Defaults to 10."]
1501    pub fn concurrency(mut self, concurrency: i64) -> Self {
1502        self.concurrency = Some(concurrency);
1503        self
1504    }
1505    #[doc = "Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned."]
1506    pub fn detailed(mut self, detailed: bool) -> Self {
1507        self.detailed = Some(detailed);
1508        self
1509    }
1510    #[doc = "Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2."]
1511    pub fn early_read_node_count(mut self, early_read_node_count: i64) -> Self {
1512        self.early_read_node_count = Some(early_read_node_count);
1513        self
1514    }
1515    #[doc = "Include the stack trace of returned errors."]
1516    pub fn error_trace(mut self, error_trace: bool) -> Self {
1517        self.error_trace = Some(error_trace);
1518        self
1519    }
1520    #[doc = "A comma-separated list of filters used to reduce the response."]
1521    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1522        self.filter_path = Some(filter_path);
1523        self
1524    }
1525    #[doc = "Adds a HTTP header"]
1526    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1527        self.headers.insert(key, value);
1528        self
1529    }
1530    #[doc = "Return human readable values for statistics."]
1531    pub fn human(mut self, human: bool) -> Self {
1532        self.human = Some(human);
1533        self
1534    }
1535    #[doc = "Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'."]
1536    pub fn max_blob_size(mut self, max_blob_size: &'b str) -> Self {
1537        self.max_blob_size = Some(max_blob_size);
1538        self
1539    }
1540    #[doc = "Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'."]
1541    pub fn max_total_data_size(mut self, max_total_data_size: &'b str) -> Self {
1542        self.max_total_data_size = Some(max_total_data_size);
1543        self
1544    }
1545    #[doc = "Pretty format the returned JSON response."]
1546    pub fn pretty(mut self, pretty: bool) -> Self {
1547        self.pretty = Some(pretty);
1548        self
1549    }
1550    #[doc = "Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02."]
1551    pub fn rare_action_probability(mut self, rare_action_probability: i64) -> Self {
1552        self.rare_action_probability = Some(rare_action_probability);
1553        self
1554    }
1555    #[doc = "Whether to rarely abort writes before they complete. Defaults to 'true'."]
1556    pub fn rarely_abort_writes(mut self, rarely_abort_writes: bool) -> Self {
1557        self.rarely_abort_writes = Some(rarely_abort_writes);
1558        self
1559    }
1560    #[doc = "Number of nodes on which to read a blob after writing. Defaults to 10."]
1561    pub fn read_node_count(mut self, read_node_count: i64) -> Self {
1562        self.read_node_count = Some(read_node_count);
1563        self
1564    }
1565    #[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."]
1566    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1567        self.request_timeout = Some(timeout);
1568        self
1569    }
1570    #[doc = "Seed for the random number generator used to create the test workload. Defaults to a random value."]
1571    pub fn seed(mut self, seed: i64) -> Self {
1572        self.seed = Some(seed);
1573        self
1574    }
1575    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1576    pub fn source(mut self, source: &'b str) -> Self {
1577        self.source = Some(source);
1578        self
1579    }
1580    #[doc = "Explicit operation timeout. Defaults to '30s'."]
1581    pub fn timeout(mut self, timeout: &'b str) -> Self {
1582        self.timeout = Some(timeout);
1583        self
1584    }
1585    #[doc = "Creates an asynchronous call to the Snapshot Repository Analyze API that can be awaited"]
1586    pub async fn send(self) -> Result<Response, Error> {
1587        let path = self.parts.url();
1588        let method = http::Method::Post;
1589        let headers = self.headers;
1590        let timeout = self.request_timeout;
1591        let query_string = {
1592            #[serde_with::skip_serializing_none]
1593            #[derive(Serialize)]
1594            struct QueryParams<'b> {
1595                blob_count: Option<i64>,
1596                concurrency: Option<i64>,
1597                detailed: Option<bool>,
1598                early_read_node_count: Option<i64>,
1599                error_trace: Option<bool>,
1600                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1601                filter_path: Option<&'b [&'b str]>,
1602                human: Option<bool>,
1603                max_blob_size: Option<&'b str>,
1604                max_total_data_size: Option<&'b str>,
1605                pretty: Option<bool>,
1606                rare_action_probability: Option<i64>,
1607                rarely_abort_writes: Option<bool>,
1608                read_node_count: Option<i64>,
1609                seed: Option<i64>,
1610                source: Option<&'b str>,
1611                timeout: Option<&'b str>,
1612            }
1613            let query_params = QueryParams {
1614                blob_count: self.blob_count,
1615                concurrency: self.concurrency,
1616                detailed: self.detailed,
1617                early_read_node_count: self.early_read_node_count,
1618                error_trace: self.error_trace,
1619                filter_path: self.filter_path,
1620                human: self.human,
1621                max_blob_size: self.max_blob_size,
1622                max_total_data_size: self.max_total_data_size,
1623                pretty: self.pretty,
1624                rare_action_probability: self.rare_action_probability,
1625                rarely_abort_writes: self.rarely_abort_writes,
1626                read_node_count: self.read_node_count,
1627                seed: self.seed,
1628                source: self.source,
1629                timeout: self.timeout,
1630            };
1631            Some(query_params)
1632        };
1633        let body = self.body;
1634        let response = self
1635            .transport
1636            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1637            .await?;
1638        Ok(response)
1639    }
1640}
1641#[cfg(feature = "experimental-apis")]
1642#[derive(Debug, Clone, PartialEq, Eq)]
1643#[doc = "API parts for the Snapshot Repository Verify Integrity API"]
1644pub enum SnapshotRepositoryVerifyIntegrityParts<'b> {
1645    #[doc = "Repository"]
1646    Repository(&'b str),
1647}
1648#[cfg(feature = "experimental-apis")]
1649impl<'b> SnapshotRepositoryVerifyIntegrityParts<'b> {
1650    #[doc = "Builds a relative URL path to the Snapshot Repository Verify Integrity API"]
1651    pub fn url(self) -> Cow<'static, str> {
1652        match self {
1653            SnapshotRepositoryVerifyIntegrityParts::Repository(repository) => {
1654                let encoded_repository: Cow<str> =
1655                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
1656                let mut p = String::with_capacity(29usize + encoded_repository.len());
1657                p.push_str("/_snapshot/");
1658                p.push_str(encoded_repository.as_ref());
1659                p.push_str("/_verify_integrity");
1660                p.into()
1661            }
1662        }
1663    }
1664}
1665#[doc = "Builder for the [Snapshot Repository Verify Integrity API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nVerifies the integrity of the contents of a snapshot repository"]
1666#[doc = "&nbsp;\n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n        "]
1667#[cfg(feature = "experimental-apis")]
1668#[derive(Clone, Debug)]
1669pub struct SnapshotRepositoryVerifyIntegrity<'a, 'b, B> {
1670    transport: &'a Transport,
1671    parts: SnapshotRepositoryVerifyIntegrityParts<'b>,
1672    blob_thread_pool_concurrency: Option<i64>,
1673    body: Option<B>,
1674    error_trace: Option<bool>,
1675    filter_path: Option<&'b [&'b str]>,
1676    headers: HeaderMap,
1677    human: Option<bool>,
1678    index_snapshot_verification_concurrency: Option<i64>,
1679    index_verification_concurrency: Option<i64>,
1680    max_bytes_per_sec: Option<&'b str>,
1681    max_failed_shard_snapshots: Option<i64>,
1682    meta_thread_pool_concurrency: Option<i64>,
1683    pretty: Option<bool>,
1684    request_timeout: Option<Duration>,
1685    snapshot_verification_concurrency: Option<i64>,
1686    source: Option<&'b str>,
1687    verify_blob_contents: Option<bool>,
1688}
1689#[cfg(feature = "experimental-apis")]
1690impl<'a, 'b, B> SnapshotRepositoryVerifyIntegrity<'a, 'b, B>
1691where
1692    B: Body,
1693{
1694    #[doc = "Creates a new instance of [SnapshotRepositoryVerifyIntegrity] with the specified API parts"]
1695    pub fn new(
1696        transport: &'a Transport,
1697        parts: SnapshotRepositoryVerifyIntegrityParts<'b>,
1698    ) -> Self {
1699        let headers = HeaderMap::new();
1700        SnapshotRepositoryVerifyIntegrity {
1701            transport,
1702            parts,
1703            headers,
1704            blob_thread_pool_concurrency: None,
1705            body: None,
1706            error_trace: None,
1707            filter_path: None,
1708            human: None,
1709            index_snapshot_verification_concurrency: None,
1710            index_verification_concurrency: None,
1711            max_bytes_per_sec: None,
1712            max_failed_shard_snapshots: None,
1713            meta_thread_pool_concurrency: None,
1714            pretty: None,
1715            request_timeout: None,
1716            snapshot_verification_concurrency: None,
1717            source: None,
1718            verify_blob_contents: None,
1719        }
1720    }
1721    #[doc = "Number of threads to use for reading blob contents"]
1722    pub fn blob_thread_pool_concurrency(mut self, blob_thread_pool_concurrency: i64) -> Self {
1723        self.blob_thread_pool_concurrency = Some(blob_thread_pool_concurrency);
1724        self
1725    }
1726    #[doc = "The body for the API call"]
1727    pub fn body<T>(self, body: T) -> SnapshotRepositoryVerifyIntegrity<'a, 'b, JsonBody<T>>
1728    where
1729        T: Serialize,
1730    {
1731        SnapshotRepositoryVerifyIntegrity {
1732            transport: self.transport,
1733            parts: self.parts,
1734            body: Some(body.into()),
1735            blob_thread_pool_concurrency: self.blob_thread_pool_concurrency,
1736            error_trace: self.error_trace,
1737            filter_path: self.filter_path,
1738            headers: self.headers,
1739            human: self.human,
1740            index_snapshot_verification_concurrency: self.index_snapshot_verification_concurrency,
1741            index_verification_concurrency: self.index_verification_concurrency,
1742            max_bytes_per_sec: self.max_bytes_per_sec,
1743            max_failed_shard_snapshots: self.max_failed_shard_snapshots,
1744            meta_thread_pool_concurrency: self.meta_thread_pool_concurrency,
1745            pretty: self.pretty,
1746            request_timeout: self.request_timeout,
1747            snapshot_verification_concurrency: self.snapshot_verification_concurrency,
1748            source: self.source,
1749            verify_blob_contents: self.verify_blob_contents,
1750        }
1751    }
1752    #[doc = "Include the stack trace of returned errors."]
1753    pub fn error_trace(mut self, error_trace: bool) -> Self {
1754        self.error_trace = Some(error_trace);
1755        self
1756    }
1757    #[doc = "A comma-separated list of filters used to reduce the response."]
1758    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1759        self.filter_path = Some(filter_path);
1760        self
1761    }
1762    #[doc = "Adds a HTTP header"]
1763    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1764        self.headers.insert(key, value);
1765        self
1766    }
1767    #[doc = "Return human readable values for statistics."]
1768    pub fn human(mut self, human: bool) -> Self {
1769        self.human = Some(human);
1770        self
1771    }
1772    #[doc = "Number of snapshots to verify concurrently within each index"]
1773    pub fn index_snapshot_verification_concurrency(
1774        mut self,
1775        index_snapshot_verification_concurrency: i64,
1776    ) -> Self {
1777        self.index_snapshot_verification_concurrency =
1778            Some(index_snapshot_verification_concurrency);
1779        self
1780    }
1781    #[doc = "Number of indices to verify concurrently"]
1782    pub fn index_verification_concurrency(mut self, index_verification_concurrency: i64) -> Self {
1783        self.index_verification_concurrency = Some(index_verification_concurrency);
1784        self
1785    }
1786    #[doc = "Rate limit for individual blob verification"]
1787    pub fn max_bytes_per_sec(mut self, max_bytes_per_sec: &'b str) -> Self {
1788        self.max_bytes_per_sec = Some(max_bytes_per_sec);
1789        self
1790    }
1791    #[doc = "Maximum permitted number of failed shard snapshots"]
1792    pub fn max_failed_shard_snapshots(mut self, max_failed_shard_snapshots: i64) -> Self {
1793        self.max_failed_shard_snapshots = Some(max_failed_shard_snapshots);
1794        self
1795    }
1796    #[doc = "Number of threads to use for reading metadata"]
1797    pub fn meta_thread_pool_concurrency(mut self, meta_thread_pool_concurrency: i64) -> Self {
1798        self.meta_thread_pool_concurrency = Some(meta_thread_pool_concurrency);
1799        self
1800    }
1801    #[doc = "Pretty format the returned JSON response."]
1802    pub fn pretty(mut self, pretty: bool) -> Self {
1803        self.pretty = Some(pretty);
1804        self
1805    }
1806    #[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."]
1807    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1808        self.request_timeout = Some(timeout);
1809        self
1810    }
1811    #[doc = "Number of snapshots to verify concurrently"]
1812    pub fn snapshot_verification_concurrency(
1813        mut self,
1814        snapshot_verification_concurrency: i64,
1815    ) -> Self {
1816        self.snapshot_verification_concurrency = Some(snapshot_verification_concurrency);
1817        self
1818    }
1819    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1820    pub fn source(mut self, source: &'b str) -> Self {
1821        self.source = Some(source);
1822        self
1823    }
1824    #[doc = "Whether to verify the contents of individual blobs"]
1825    pub fn verify_blob_contents(mut self, verify_blob_contents: bool) -> Self {
1826        self.verify_blob_contents = Some(verify_blob_contents);
1827        self
1828    }
1829    #[doc = "Creates an asynchronous call to the Snapshot Repository Verify Integrity API that can be awaited"]
1830    pub async fn send(self) -> Result<Response, Error> {
1831        let path = self.parts.url();
1832        let method = http::Method::Post;
1833        let headers = self.headers;
1834        let timeout = self.request_timeout;
1835        let query_string = {
1836            #[serde_with::skip_serializing_none]
1837            #[derive(Serialize)]
1838            struct QueryParams<'b> {
1839                blob_thread_pool_concurrency: Option<i64>,
1840                error_trace: Option<bool>,
1841                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1842                filter_path: Option<&'b [&'b str]>,
1843                human: Option<bool>,
1844                index_snapshot_verification_concurrency: Option<i64>,
1845                index_verification_concurrency: Option<i64>,
1846                max_bytes_per_sec: Option<&'b str>,
1847                max_failed_shard_snapshots: Option<i64>,
1848                meta_thread_pool_concurrency: Option<i64>,
1849                pretty: Option<bool>,
1850                snapshot_verification_concurrency: Option<i64>,
1851                source: Option<&'b str>,
1852                verify_blob_contents: Option<bool>,
1853            }
1854            let query_params = QueryParams {
1855                blob_thread_pool_concurrency: self.blob_thread_pool_concurrency,
1856                error_trace: self.error_trace,
1857                filter_path: self.filter_path,
1858                human: self.human,
1859                index_snapshot_verification_concurrency: self
1860                    .index_snapshot_verification_concurrency,
1861                index_verification_concurrency: self.index_verification_concurrency,
1862                max_bytes_per_sec: self.max_bytes_per_sec,
1863                max_failed_shard_snapshots: self.max_failed_shard_snapshots,
1864                meta_thread_pool_concurrency: self.meta_thread_pool_concurrency,
1865                pretty: self.pretty,
1866                snapshot_verification_concurrency: self.snapshot_verification_concurrency,
1867                source: self.source,
1868                verify_blob_contents: self.verify_blob_contents,
1869            };
1870            Some(query_params)
1871        };
1872        let body = self.body;
1873        let response = self
1874            .transport
1875            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1876            .await?;
1877        Ok(response)
1878    }
1879}
1880#[derive(Debug, Clone, PartialEq, Eq)]
1881#[doc = "API parts for the Snapshot Restore API"]
1882pub enum SnapshotRestoreParts<'b> {
1883    #[doc = "Repository and Snapshot"]
1884    RepositorySnapshot(&'b str, &'b str),
1885}
1886impl<'b> SnapshotRestoreParts<'b> {
1887    #[doc = "Builds a relative URL path to the Snapshot Restore API"]
1888    pub fn url(self) -> Cow<'static, str> {
1889        match self {
1890            SnapshotRestoreParts::RepositorySnapshot(repository, snapshot) => {
1891                let encoded_repository: Cow<str> =
1892                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
1893                let encoded_snapshot: Cow<str> =
1894                    percent_encode(snapshot.as_bytes(), PARTS_ENCODED).into();
1895                let mut p = String::with_capacity(
1896                    21usize + encoded_repository.len() + encoded_snapshot.len(),
1897                );
1898                p.push_str("/_snapshot/");
1899                p.push_str(encoded_repository.as_ref());
1900                p.push('/');
1901                p.push_str(encoded_snapshot.as_ref());
1902                p.push_str("/_restore");
1903                p.into()
1904            }
1905        }
1906    }
1907}
1908#[doc = "Builder for the [Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nRestores a snapshot."]
1909#[derive(Clone, Debug)]
1910pub struct SnapshotRestore<'a, 'b, B> {
1911    transport: &'a Transport,
1912    parts: SnapshotRestoreParts<'b>,
1913    body: Option<B>,
1914    error_trace: Option<bool>,
1915    filter_path: Option<&'b [&'b str]>,
1916    headers: HeaderMap,
1917    human: Option<bool>,
1918    master_timeout: Option<&'b str>,
1919    pretty: Option<bool>,
1920    request_timeout: Option<Duration>,
1921    source: Option<&'b str>,
1922    wait_for_completion: Option<bool>,
1923}
1924impl<'a, 'b, B> SnapshotRestore<'a, 'b, B>
1925where
1926    B: Body,
1927{
1928    #[doc = "Creates a new instance of [SnapshotRestore] with the specified API parts"]
1929    pub fn new(transport: &'a Transport, parts: SnapshotRestoreParts<'b>) -> Self {
1930        let headers = HeaderMap::new();
1931        SnapshotRestore {
1932            transport,
1933            parts,
1934            headers,
1935            body: None,
1936            error_trace: None,
1937            filter_path: None,
1938            human: None,
1939            master_timeout: None,
1940            pretty: None,
1941            request_timeout: None,
1942            source: None,
1943            wait_for_completion: None,
1944        }
1945    }
1946    #[doc = "The body for the API call"]
1947    pub fn body<T>(self, body: T) -> SnapshotRestore<'a, 'b, JsonBody<T>>
1948    where
1949        T: Serialize,
1950    {
1951        SnapshotRestore {
1952            transport: self.transport,
1953            parts: self.parts,
1954            body: Some(body.into()),
1955            error_trace: self.error_trace,
1956            filter_path: self.filter_path,
1957            headers: self.headers,
1958            human: self.human,
1959            master_timeout: self.master_timeout,
1960            pretty: self.pretty,
1961            request_timeout: self.request_timeout,
1962            source: self.source,
1963            wait_for_completion: self.wait_for_completion,
1964        }
1965    }
1966    #[doc = "Include the stack trace of returned errors."]
1967    pub fn error_trace(mut self, error_trace: bool) -> Self {
1968        self.error_trace = Some(error_trace);
1969        self
1970    }
1971    #[doc = "A comma-separated list of filters used to reduce the response."]
1972    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1973        self.filter_path = Some(filter_path);
1974        self
1975    }
1976    #[doc = "Adds a HTTP header"]
1977    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1978        self.headers.insert(key, value);
1979        self
1980    }
1981    #[doc = "Return human readable values for statistics."]
1982    pub fn human(mut self, human: bool) -> Self {
1983        self.human = Some(human);
1984        self
1985    }
1986    #[doc = "Explicit operation timeout for connection to master node"]
1987    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1988        self.master_timeout = Some(master_timeout);
1989        self
1990    }
1991    #[doc = "Pretty format the returned JSON response."]
1992    pub fn pretty(mut self, pretty: bool) -> Self {
1993        self.pretty = Some(pretty);
1994        self
1995    }
1996    #[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."]
1997    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1998        self.request_timeout = Some(timeout);
1999        self
2000    }
2001    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2002    pub fn source(mut self, source: &'b str) -> Self {
2003        self.source = Some(source);
2004        self
2005    }
2006    #[doc = "Should this request wait until the operation has completed before returning"]
2007    pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self {
2008        self.wait_for_completion = Some(wait_for_completion);
2009        self
2010    }
2011    #[doc = "Creates an asynchronous call to the Snapshot Restore API that can be awaited"]
2012    pub async fn send(self) -> Result<Response, Error> {
2013        let path = self.parts.url();
2014        let method = http::Method::Post;
2015        let headers = self.headers;
2016        let timeout = self.request_timeout;
2017        let query_string = {
2018            #[serde_with::skip_serializing_none]
2019            #[derive(Serialize)]
2020            struct QueryParams<'b> {
2021                error_trace: Option<bool>,
2022                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2023                filter_path: Option<&'b [&'b str]>,
2024                human: Option<bool>,
2025                master_timeout: Option<&'b str>,
2026                pretty: Option<bool>,
2027                source: Option<&'b str>,
2028                wait_for_completion: Option<bool>,
2029            }
2030            let query_params = QueryParams {
2031                error_trace: self.error_trace,
2032                filter_path: self.filter_path,
2033                human: self.human,
2034                master_timeout: self.master_timeout,
2035                pretty: self.pretty,
2036                source: self.source,
2037                wait_for_completion: self.wait_for_completion,
2038            };
2039            Some(query_params)
2040        };
2041        let body = self.body;
2042        let response = self
2043            .transport
2044            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2045            .await?;
2046        Ok(response)
2047    }
2048}
2049#[derive(Debug, Clone, PartialEq, Eq)]
2050#[doc = "API parts for the Snapshot Status API"]
2051pub enum SnapshotStatusParts<'b> {
2052    #[doc = "No parts"]
2053    None,
2054    #[doc = "Repository"]
2055    Repository(&'b str),
2056    #[doc = "Repository and Snapshot"]
2057    RepositorySnapshot(&'b str, &'b [&'b str]),
2058}
2059impl<'b> SnapshotStatusParts<'b> {
2060    #[doc = "Builds a relative URL path to the Snapshot Status API"]
2061    pub fn url(self) -> Cow<'static, str> {
2062        match self {
2063            SnapshotStatusParts::None => "/_snapshot/_status".into(),
2064            SnapshotStatusParts::Repository(repository) => {
2065                let encoded_repository: Cow<str> =
2066                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
2067                let mut p = String::with_capacity(19usize + encoded_repository.len());
2068                p.push_str("/_snapshot/");
2069                p.push_str(encoded_repository.as_ref());
2070                p.push_str("/_status");
2071                p.into()
2072            }
2073            SnapshotStatusParts::RepositorySnapshot(repository, snapshot) => {
2074                let snapshot_str = snapshot.join(",");
2075                let encoded_repository: Cow<str> =
2076                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
2077                let encoded_snapshot: Cow<str> =
2078                    percent_encode(snapshot_str.as_bytes(), PARTS_ENCODED).into();
2079                let mut p = String::with_capacity(
2080                    20usize + encoded_repository.len() + encoded_snapshot.len(),
2081                );
2082                p.push_str("/_snapshot/");
2083                p.push_str(encoded_repository.as_ref());
2084                p.push('/');
2085                p.push_str(encoded_snapshot.as_ref());
2086                p.push_str("/_status");
2087                p.into()
2088            }
2089        }
2090    }
2091}
2092#[doc = "Builder for the [Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nReturns information about the status of a snapshot."]
2093#[derive(Clone, Debug)]
2094pub struct SnapshotStatus<'a, 'b> {
2095    transport: &'a Transport,
2096    parts: SnapshotStatusParts<'b>,
2097    error_trace: Option<bool>,
2098    filter_path: Option<&'b [&'b str]>,
2099    headers: HeaderMap,
2100    human: Option<bool>,
2101    ignore_unavailable: Option<bool>,
2102    master_timeout: Option<&'b str>,
2103    pretty: Option<bool>,
2104    request_timeout: Option<Duration>,
2105    source: Option<&'b str>,
2106}
2107impl<'a, 'b> SnapshotStatus<'a, 'b> {
2108    #[doc = "Creates a new instance of [SnapshotStatus] with the specified API parts"]
2109    pub fn new(transport: &'a Transport, parts: SnapshotStatusParts<'b>) -> Self {
2110        let headers = HeaderMap::new();
2111        SnapshotStatus {
2112            transport,
2113            parts,
2114            headers,
2115            error_trace: None,
2116            filter_path: None,
2117            human: None,
2118            ignore_unavailable: None,
2119            master_timeout: None,
2120            pretty: None,
2121            request_timeout: None,
2122            source: None,
2123        }
2124    }
2125    #[doc = "Include the stack trace of returned errors."]
2126    pub fn error_trace(mut self, error_trace: bool) -> Self {
2127        self.error_trace = Some(error_trace);
2128        self
2129    }
2130    #[doc = "A comma-separated list of filters used to reduce the response."]
2131    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2132        self.filter_path = Some(filter_path);
2133        self
2134    }
2135    #[doc = "Adds a HTTP header"]
2136    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2137        self.headers.insert(key, value);
2138        self
2139    }
2140    #[doc = "Return human readable values for statistics."]
2141    pub fn human(mut self, human: bool) -> Self {
2142        self.human = Some(human);
2143        self
2144    }
2145    #[doc = "Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown"]
2146    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
2147        self.ignore_unavailable = Some(ignore_unavailable);
2148        self
2149    }
2150    #[doc = "Explicit operation timeout for connection to master node"]
2151    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
2152        self.master_timeout = Some(master_timeout);
2153        self
2154    }
2155    #[doc = "Pretty format the returned JSON response."]
2156    pub fn pretty(mut self, pretty: bool) -> Self {
2157        self.pretty = Some(pretty);
2158        self
2159    }
2160    #[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."]
2161    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2162        self.request_timeout = Some(timeout);
2163        self
2164    }
2165    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2166    pub fn source(mut self, source: &'b str) -> Self {
2167        self.source = Some(source);
2168        self
2169    }
2170    #[doc = "Creates an asynchronous call to the Snapshot Status API that can be awaited"]
2171    pub async fn send(self) -> Result<Response, Error> {
2172        let path = self.parts.url();
2173        let method = http::Method::Get;
2174        let headers = self.headers;
2175        let timeout = self.request_timeout;
2176        let query_string = {
2177            #[serde_with::skip_serializing_none]
2178            #[derive(Serialize)]
2179            struct QueryParams<'b> {
2180                error_trace: Option<bool>,
2181                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2182                filter_path: Option<&'b [&'b str]>,
2183                human: Option<bool>,
2184                ignore_unavailable: Option<bool>,
2185                master_timeout: Option<&'b str>,
2186                pretty: Option<bool>,
2187                source: Option<&'b str>,
2188            }
2189            let query_params = QueryParams {
2190                error_trace: self.error_trace,
2191                filter_path: self.filter_path,
2192                human: self.human,
2193                ignore_unavailable: self.ignore_unavailable,
2194                master_timeout: self.master_timeout,
2195                pretty: self.pretty,
2196                source: self.source,
2197            };
2198            Some(query_params)
2199        };
2200        let body = Option::<()>::None;
2201        let response = self
2202            .transport
2203            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2204            .await?;
2205        Ok(response)
2206    }
2207}
2208#[derive(Debug, Clone, PartialEq, Eq)]
2209#[doc = "API parts for the Snapshot Verify Repository API"]
2210pub enum SnapshotVerifyRepositoryParts<'b> {
2211    #[doc = "Repository"]
2212    Repository(&'b str),
2213}
2214impl<'b> SnapshotVerifyRepositoryParts<'b> {
2215    #[doc = "Builds a relative URL path to the Snapshot Verify Repository API"]
2216    pub fn url(self) -> Cow<'static, str> {
2217        match self {
2218            SnapshotVerifyRepositoryParts::Repository(repository) => {
2219                let encoded_repository: Cow<str> =
2220                    percent_encode(repository.as_bytes(), PARTS_ENCODED).into();
2221                let mut p = String::with_capacity(19usize + encoded_repository.len());
2222                p.push_str("/_snapshot/");
2223                p.push_str(encoded_repository.as_ref());
2224                p.push_str("/_verify");
2225                p.into()
2226            }
2227        }
2228    }
2229}
2230#[doc = "Builder for the [Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nVerifies a repository."]
2231#[derive(Clone, Debug)]
2232pub struct SnapshotVerifyRepository<'a, 'b, B> {
2233    transport: &'a Transport,
2234    parts: SnapshotVerifyRepositoryParts<'b>,
2235    body: Option<B>,
2236    error_trace: Option<bool>,
2237    filter_path: Option<&'b [&'b str]>,
2238    headers: HeaderMap,
2239    human: Option<bool>,
2240    master_timeout: Option<&'b str>,
2241    pretty: Option<bool>,
2242    request_timeout: Option<Duration>,
2243    source: Option<&'b str>,
2244    timeout: Option<&'b str>,
2245}
2246impl<'a, 'b, B> SnapshotVerifyRepository<'a, 'b, B>
2247where
2248    B: Body,
2249{
2250    #[doc = "Creates a new instance of [SnapshotVerifyRepository] with the specified API parts"]
2251    pub fn new(transport: &'a Transport, parts: SnapshotVerifyRepositoryParts<'b>) -> Self {
2252        let headers = HeaderMap::new();
2253        SnapshotVerifyRepository {
2254            transport,
2255            parts,
2256            headers,
2257            body: None,
2258            error_trace: None,
2259            filter_path: None,
2260            human: None,
2261            master_timeout: None,
2262            pretty: None,
2263            request_timeout: None,
2264            source: None,
2265            timeout: None,
2266        }
2267    }
2268    #[doc = "The body for the API call"]
2269    pub fn body<T>(self, body: T) -> SnapshotVerifyRepository<'a, 'b, JsonBody<T>>
2270    where
2271        T: Serialize,
2272    {
2273        SnapshotVerifyRepository {
2274            transport: self.transport,
2275            parts: self.parts,
2276            body: Some(body.into()),
2277            error_trace: self.error_trace,
2278            filter_path: self.filter_path,
2279            headers: self.headers,
2280            human: self.human,
2281            master_timeout: self.master_timeout,
2282            pretty: self.pretty,
2283            request_timeout: self.request_timeout,
2284            source: self.source,
2285            timeout: self.timeout,
2286        }
2287    }
2288    #[doc = "Include the stack trace of returned errors."]
2289    pub fn error_trace(mut self, error_trace: bool) -> Self {
2290        self.error_trace = Some(error_trace);
2291        self
2292    }
2293    #[doc = "A comma-separated list of filters used to reduce the response."]
2294    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2295        self.filter_path = Some(filter_path);
2296        self
2297    }
2298    #[doc = "Adds a HTTP header"]
2299    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2300        self.headers.insert(key, value);
2301        self
2302    }
2303    #[doc = "Return human readable values for statistics."]
2304    pub fn human(mut self, human: bool) -> Self {
2305        self.human = Some(human);
2306        self
2307    }
2308    #[doc = "Explicit operation timeout for connection to master node"]
2309    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
2310        self.master_timeout = Some(master_timeout);
2311        self
2312    }
2313    #[doc = "Pretty format the returned JSON response."]
2314    pub fn pretty(mut self, pretty: bool) -> Self {
2315        self.pretty = Some(pretty);
2316        self
2317    }
2318    #[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."]
2319    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2320        self.request_timeout = Some(timeout);
2321        self
2322    }
2323    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2324    pub fn source(mut self, source: &'b str) -> Self {
2325        self.source = Some(source);
2326        self
2327    }
2328    #[doc = "Explicit operation timeout"]
2329    pub fn timeout(mut self, timeout: &'b str) -> Self {
2330        self.timeout = Some(timeout);
2331        self
2332    }
2333    #[doc = "Creates an asynchronous call to the Snapshot Verify Repository API that can be awaited"]
2334    pub async fn send(self) -> Result<Response, Error> {
2335        let path = self.parts.url();
2336        let method = http::Method::Post;
2337        let headers = self.headers;
2338        let timeout = self.request_timeout;
2339        let query_string = {
2340            #[serde_with::skip_serializing_none]
2341            #[derive(Serialize)]
2342            struct QueryParams<'b> {
2343                error_trace: Option<bool>,
2344                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2345                filter_path: Option<&'b [&'b str]>,
2346                human: Option<bool>,
2347                master_timeout: Option<&'b str>,
2348                pretty: Option<bool>,
2349                source: Option<&'b str>,
2350                timeout: Option<&'b str>,
2351            }
2352            let query_params = QueryParams {
2353                error_trace: self.error_trace,
2354                filter_path: self.filter_path,
2355                human: self.human,
2356                master_timeout: self.master_timeout,
2357                pretty: self.pretty,
2358                source: self.source,
2359                timeout: self.timeout,
2360            };
2361            Some(query_params)
2362        };
2363        let body = self.body;
2364        let response = self
2365            .transport
2366            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2367            .await?;
2368        Ok(response)
2369    }
2370}
2371#[doc = "Namespace client for Snapshot APIs"]
2372pub struct Snapshot<'a> {
2373    transport: &'a Transport,
2374}
2375impl<'a> Snapshot<'a> {
2376    #[doc = "Creates a new instance of [Snapshot]"]
2377    pub fn new(transport: &'a Transport) -> Self {
2378        Self { transport }
2379    }
2380    pub fn transport(&self) -> &Transport {
2381        self.transport
2382    }
2383    #[doc = "[Snapshot Cleanup Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/clean-up-snapshot-repo-api.html)\n\nRemoves stale data from repository."]
2384    pub fn cleanup_repository<'b>(
2385        &'a self,
2386        parts: SnapshotCleanupRepositoryParts<'b>,
2387    ) -> SnapshotCleanupRepository<'a, 'b, ()> {
2388        SnapshotCleanupRepository::new(self.transport(), parts)
2389    }
2390    #[doc = "[Snapshot Clone API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nClones indices from one snapshot into another snapshot in the same repository."]
2391    pub fn clone<'b>(&'a self, parts: SnapshotCloneParts<'b>) -> SnapshotClone<'a, 'b, ()> {
2392        SnapshotClone::new(self.transport(), parts)
2393    }
2394    #[doc = "[Snapshot Create API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nCreates a snapshot in a repository."]
2395    pub fn create<'b>(&'a self, parts: SnapshotCreateParts<'b>) -> SnapshotCreate<'a, 'b, ()> {
2396        SnapshotCreate::new(self.transport(), parts)
2397    }
2398    #[doc = "[Snapshot Create Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nCreates a repository."]
2399    pub fn create_repository<'b>(
2400        &'a self,
2401        parts: SnapshotCreateRepositoryParts<'b>,
2402    ) -> SnapshotCreateRepository<'a, 'b, ()> {
2403        SnapshotCreateRepository::new(self.transport(), parts)
2404    }
2405    #[doc = "[Snapshot Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nDeletes one or more snapshots."]
2406    pub fn delete<'b>(&'a self, parts: SnapshotDeleteParts<'b>) -> SnapshotDelete<'a, 'b> {
2407        SnapshotDelete::new(self.transport(), parts)
2408    }
2409    #[doc = "[Snapshot Delete Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nDeletes a repository."]
2410    pub fn delete_repository<'b>(
2411        &'a self,
2412        parts: SnapshotDeleteRepositoryParts<'b>,
2413    ) -> SnapshotDeleteRepository<'a, 'b> {
2414        SnapshotDeleteRepository::new(self.transport(), parts)
2415    }
2416    #[doc = "[Snapshot Get API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nReturns information about a snapshot."]
2417    pub fn get<'b>(&'a self, parts: SnapshotGetParts<'b>) -> SnapshotGet<'a, 'b> {
2418        SnapshotGet::new(self.transport(), parts)
2419    }
2420    #[doc = "[Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nReturns information about a repository."]
2421    pub fn get_repository<'b>(
2422        &'a self,
2423        parts: SnapshotGetRepositoryParts<'b>,
2424    ) -> SnapshotGetRepository<'a, 'b> {
2425        SnapshotGetRepository::new(self.transport(), parts)
2426    }
2427    #[doc = "[Snapshot Repository Analyze API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nAnalyzes a repository for correctness and performance"]
2428    pub fn repository_analyze<'b>(
2429        &'a self,
2430        parts: SnapshotRepositoryAnalyzeParts<'b>,
2431    ) -> SnapshotRepositoryAnalyze<'a, 'b, ()> {
2432        SnapshotRepositoryAnalyze::new(self.transport(), parts)
2433    }
2434    #[doc = "[Snapshot Repository Verify Integrity API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nVerifies the integrity of the contents of a snapshot repository"]
2435    #[doc = "&nbsp;\n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n        "]
2436    #[cfg(feature = "experimental-apis")]
2437    pub fn repository_verify_integrity<'b>(
2438        &'a self,
2439        parts: SnapshotRepositoryVerifyIntegrityParts<'b>,
2440    ) -> SnapshotRepositoryVerifyIntegrity<'a, 'b, ()> {
2441        SnapshotRepositoryVerifyIntegrity::new(self.transport(), parts)
2442    }
2443    #[doc = "[Snapshot Restore API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nRestores a snapshot."]
2444    pub fn restore<'b>(&'a self, parts: SnapshotRestoreParts<'b>) -> SnapshotRestore<'a, 'b, ()> {
2445        SnapshotRestore::new(self.transport(), parts)
2446    }
2447    #[doc = "[Snapshot Status API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nReturns information about the status of a snapshot."]
2448    pub fn status<'b>(&'a self, parts: SnapshotStatusParts<'b>) -> SnapshotStatus<'a, 'b> {
2449        SnapshotStatus::new(self.transport(), parts)
2450    }
2451    #[doc = "[Snapshot Verify Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/9.0/modules-snapshots.html)\n\nVerifies a repository."]
2452    pub fn verify_repository<'b>(
2453        &'a self,
2454        parts: SnapshotVerifyRepositoryParts<'b>,
2455    ) -> SnapshotVerifyRepository<'a, 'b, ()> {
2456        SnapshotVerifyRepository::new(self.transport(), parts)
2457    }
2458}
2459impl Elasticsearch {
2460    #[doc = "Creates a namespace client for Snapshot APIs"]
2461    pub fn snapshot(&self) -> Snapshot {
2462        Snapshot::new(self.transport())
2463    }
2464}