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