1#![allow(unused_imports)]
44use crate::{
45 client::OpenSearch,
46 error::Error,
47 http::{
48 headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE},
49 request::{Body, JsonBody, NdBody, PARTS_ENCODED},
50 response::Response,
51 transport::Transport,
52 Method,
53 },
54 params::*,
55};
56use percent_encoding::percent_encode;
57use serde::Serialize;
58use std::{borrow::Cow, time::Duration};
59#[derive(Debug, Clone, PartialEq)]
60#[doc = "API parts for the Ingest Delete Pipeline API"]
61pub enum IngestDeletePipelineParts<'b> {
62 #[doc = "Id"]
63 Id(&'b str),
64}
65impl<'b> IngestDeletePipelineParts<'b> {
66 #[doc = "Builds a relative URL path to the Ingest Delete Pipeline API"]
67 pub fn url(self) -> Cow<'static, str> {
68 match self {
69 IngestDeletePipelineParts::Id(ref id) => {
70 let encoded_id: Cow<str> = percent_encode(id.as_bytes(), PARTS_ENCODED).into();
71 let mut p = String::with_capacity(18usize + encoded_id.len());
72 p.push_str("/_ingest/pipeline/");
73 p.push_str(encoded_id.as_ref());
74 p.into()
75 }
76 }
77 }
78}
79#[doc = "Builder for the [Ingest Delete Pipeline API](https://opensearch.org/docs/)\n\nDeletes a pipeline."]
80#[derive(Clone, Debug)]
81pub struct IngestDeletePipeline<'a, 'b> {
82 transport: &'a Transport,
83 parts: IngestDeletePipelineParts<'b>,
84 error_trace: Option<bool>,
85 filter_path: Option<&'b [&'b str]>,
86 headers: HeaderMap,
87 human: Option<bool>,
88 master_timeout: Option<&'b str>,
89 pretty: Option<bool>,
90 request_timeout: Option<Duration>,
91 source: Option<&'b str>,
92 timeout: Option<&'b str>,
93}
94impl<'a, 'b> IngestDeletePipeline<'a, 'b> {
95 #[doc = "Creates a new instance of [IngestDeletePipeline] with the specified API parts"]
96 pub fn new(transport: &'a Transport, parts: IngestDeletePipelineParts<'b>) -> Self {
97 let headers = HeaderMap::new();
98 IngestDeletePipeline {
99 transport,
100 parts,
101 headers,
102 error_trace: None,
103 filter_path: None,
104 human: None,
105 master_timeout: None,
106 pretty: None,
107 request_timeout: None,
108 source: None,
109 timeout: None,
110 }
111 }
112 #[doc = "Include the stack trace of returned errors."]
113 pub fn error_trace(mut self, error_trace: bool) -> Self {
114 self.error_trace = Some(error_trace);
115 self
116 }
117 #[doc = "A comma-separated list of filters used to reduce the response."]
118 pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
119 self.filter_path = Some(filter_path);
120 self
121 }
122 #[doc = "Adds a HTTP header"]
123 pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
124 self.headers.insert(key, value);
125 self
126 }
127 #[doc = "Return human readable values for statistics."]
128 pub fn human(mut self, human: bool) -> Self {
129 self.human = Some(human);
130 self
131 }
132 #[doc = "Explicit operation timeout for connection to master node"]
133 pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
134 self.master_timeout = Some(master_timeout);
135 self
136 }
137 #[doc = "Pretty format the returned JSON response."]
138 pub fn pretty(mut self, pretty: bool) -> Self {
139 self.pretty = Some(pretty);
140 self
141 }
142 #[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."]
143 pub fn request_timeout(mut self, timeout: Duration) -> Self {
144 self.request_timeout = Some(timeout);
145 self
146 }
147 #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
148 pub fn source(mut self, source: &'b str) -> Self {
149 self.source = Some(source);
150 self
151 }
152 #[doc = "Explicit operation timeout"]
153 pub fn timeout(mut self, timeout: &'b str) -> Self {
154 self.timeout = Some(timeout);
155 self
156 }
157 #[doc = "Creates an asynchronous call to the Ingest Delete Pipeline API that can be awaited"]
158 pub async fn send(self) -> Result<Response, Error> {
159 let path = self.parts.url();
160 let method = Method::Delete;
161 let headers = self.headers;
162 let timeout = self.request_timeout;
163 let query_string = {
164 #[serde_with::skip_serializing_none]
165 #[derive(Serialize)]
166 struct QueryParams<'b> {
167 error_trace: Option<bool>,
168 #[serde(serialize_with = "crate::client::serialize_coll_qs")]
169 filter_path: Option<&'b [&'b str]>,
170 human: Option<bool>,
171 master_timeout: Option<&'b str>,
172 pretty: Option<bool>,
173 source: Option<&'b str>,
174 timeout: Option<&'b str>,
175 }
176 let query_params = QueryParams {
177 error_trace: self.error_trace,
178 filter_path: self.filter_path,
179 human: self.human,
180 master_timeout: self.master_timeout,
181 pretty: self.pretty,
182 source: self.source,
183 timeout: self.timeout,
184 };
185 Some(query_params)
186 };
187 let body = Option::<()>::None;
188 let response = self
189 .transport
190 .send(method, &path, headers, query_string.as_ref(), body, timeout)
191 .await?;
192 Ok(response)
193 }
194}
195#[derive(Debug, Clone, PartialEq)]
196#[doc = "API parts for the Ingest Get Pipeline API"]
197pub enum IngestGetPipelineParts<'b> {
198 #[doc = "No parts"]
199 None,
200 #[doc = "Id"]
201 Id(&'b str),
202}
203impl<'b> IngestGetPipelineParts<'b> {
204 #[doc = "Builds a relative URL path to the Ingest Get Pipeline API"]
205 pub fn url(self) -> Cow<'static, str> {
206 match self {
207 IngestGetPipelineParts::None => "/_ingest/pipeline".into(),
208 IngestGetPipelineParts::Id(ref id) => {
209 let encoded_id: Cow<str> = percent_encode(id.as_bytes(), PARTS_ENCODED).into();
210 let mut p = String::with_capacity(18usize + encoded_id.len());
211 p.push_str("/_ingest/pipeline/");
212 p.push_str(encoded_id.as_ref());
213 p.into()
214 }
215 }
216 }
217}
218#[doc = "Builder for the [Ingest Get Pipeline API](https://opensearch.org/docs/)\n\nReturns a pipeline."]
219#[derive(Clone, Debug)]
220pub struct IngestGetPipeline<'a, 'b> {
221 transport: &'a Transport,
222 parts: IngestGetPipelineParts<'b>,
223 error_trace: Option<bool>,
224 filter_path: Option<&'b [&'b str]>,
225 headers: HeaderMap,
226 human: Option<bool>,
227 master_timeout: Option<&'b str>,
228 pretty: Option<bool>,
229 request_timeout: Option<Duration>,
230 source: Option<&'b str>,
231}
232impl<'a, 'b> IngestGetPipeline<'a, 'b> {
233 #[doc = "Creates a new instance of [IngestGetPipeline] with the specified API parts"]
234 pub fn new(transport: &'a Transport, parts: IngestGetPipelineParts<'b>) -> Self {
235 let headers = HeaderMap::new();
236 IngestGetPipeline {
237 transport,
238 parts,
239 headers,
240 error_trace: None,
241 filter_path: None,
242 human: None,
243 master_timeout: None,
244 pretty: None,
245 request_timeout: None,
246 source: None,
247 }
248 }
249 #[doc = "Include the stack trace of returned errors."]
250 pub fn error_trace(mut self, error_trace: bool) -> Self {
251 self.error_trace = Some(error_trace);
252 self
253 }
254 #[doc = "A comma-separated list of filters used to reduce the response."]
255 pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
256 self.filter_path = Some(filter_path);
257 self
258 }
259 #[doc = "Adds a HTTP header"]
260 pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
261 self.headers.insert(key, value);
262 self
263 }
264 #[doc = "Return human readable values for statistics."]
265 pub fn human(mut self, human: bool) -> Self {
266 self.human = Some(human);
267 self
268 }
269 #[doc = "Explicit operation timeout for connection to master node"]
270 pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
271 self.master_timeout = Some(master_timeout);
272 self
273 }
274 #[doc = "Pretty format the returned JSON response."]
275 pub fn pretty(mut self, pretty: bool) -> Self {
276 self.pretty = Some(pretty);
277 self
278 }
279 #[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."]
280 pub fn request_timeout(mut self, timeout: Duration) -> Self {
281 self.request_timeout = Some(timeout);
282 self
283 }
284 #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
285 pub fn source(mut self, source: &'b str) -> Self {
286 self.source = Some(source);
287 self
288 }
289 #[doc = "Creates an asynchronous call to the Ingest Get Pipeline API that can be awaited"]
290 pub async fn send(self) -> Result<Response, Error> {
291 let path = self.parts.url();
292 let method = Method::Get;
293 let headers = self.headers;
294 let timeout = self.request_timeout;
295 let query_string = {
296 #[serde_with::skip_serializing_none]
297 #[derive(Serialize)]
298 struct QueryParams<'b> {
299 error_trace: Option<bool>,
300 #[serde(serialize_with = "crate::client::serialize_coll_qs")]
301 filter_path: Option<&'b [&'b str]>,
302 human: Option<bool>,
303 master_timeout: Option<&'b str>,
304 pretty: Option<bool>,
305 source: Option<&'b str>,
306 }
307 let query_params = QueryParams {
308 error_trace: self.error_trace,
309 filter_path: self.filter_path,
310 human: self.human,
311 master_timeout: self.master_timeout,
312 pretty: self.pretty,
313 source: self.source,
314 };
315 Some(query_params)
316 };
317 let body = Option::<()>::None;
318 let response = self
319 .transport
320 .send(method, &path, headers, query_string.as_ref(), body, timeout)
321 .await?;
322 Ok(response)
323 }
324}
325#[derive(Debug, Clone, PartialEq)]
326#[doc = "API parts for the Ingest Processor Grok API"]
327pub enum IngestProcessorGrokParts {
328 #[doc = "No parts"]
329 None,
330}
331impl IngestProcessorGrokParts {
332 #[doc = "Builds a relative URL path to the Ingest Processor Grok API"]
333 pub fn url(self) -> Cow<'static, str> {
334 match self {
335 IngestProcessorGrokParts::None => "/_ingest/processor/grok".into(),
336 }
337 }
338}
339#[doc = "Builder for the [Ingest Processor Grok API](https://opensearch.org/docs/)\n\nReturns a list of the built-in patterns."]
340#[derive(Clone, Debug)]
341pub struct IngestProcessorGrok<'a, 'b> {
342 transport: &'a Transport,
343 parts: IngestProcessorGrokParts,
344 error_trace: Option<bool>,
345 filter_path: Option<&'b [&'b str]>,
346 headers: HeaderMap,
347 human: Option<bool>,
348 pretty: Option<bool>,
349 request_timeout: Option<Duration>,
350 source: Option<&'b str>,
351}
352impl<'a, 'b> IngestProcessorGrok<'a, 'b> {
353 #[doc = "Creates a new instance of [IngestProcessorGrok]"]
354 pub fn new(transport: &'a Transport) -> Self {
355 let headers = HeaderMap::new();
356 IngestProcessorGrok {
357 transport,
358 parts: IngestProcessorGrokParts::None,
359 headers,
360 error_trace: None,
361 filter_path: None,
362 human: None,
363 pretty: None,
364 request_timeout: None,
365 source: None,
366 }
367 }
368 #[doc = "Include the stack trace of returned errors."]
369 pub fn error_trace(mut self, error_trace: bool) -> Self {
370 self.error_trace = Some(error_trace);
371 self
372 }
373 #[doc = "A comma-separated list of filters used to reduce the response."]
374 pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
375 self.filter_path = Some(filter_path);
376 self
377 }
378 #[doc = "Adds a HTTP header"]
379 pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
380 self.headers.insert(key, value);
381 self
382 }
383 #[doc = "Return human readable values for statistics."]
384 pub fn human(mut self, human: bool) -> Self {
385 self.human = Some(human);
386 self
387 }
388 #[doc = "Pretty format the returned JSON response."]
389 pub fn pretty(mut self, pretty: bool) -> Self {
390 self.pretty = Some(pretty);
391 self
392 }
393 #[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."]
394 pub fn request_timeout(mut self, timeout: Duration) -> Self {
395 self.request_timeout = Some(timeout);
396 self
397 }
398 #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
399 pub fn source(mut self, source: &'b str) -> Self {
400 self.source = Some(source);
401 self
402 }
403 #[doc = "Creates an asynchronous call to the Ingest Processor Grok API that can be awaited"]
404 pub async fn send(self) -> Result<Response, Error> {
405 let path = self.parts.url();
406 let method = Method::Get;
407 let headers = self.headers;
408 let timeout = self.request_timeout;
409 let query_string = {
410 #[serde_with::skip_serializing_none]
411 #[derive(Serialize)]
412 struct QueryParams<'b> {
413 error_trace: Option<bool>,
414 #[serde(serialize_with = "crate::client::serialize_coll_qs")]
415 filter_path: Option<&'b [&'b str]>,
416 human: Option<bool>,
417 pretty: Option<bool>,
418 source: Option<&'b str>,
419 }
420 let query_params = QueryParams {
421 error_trace: self.error_trace,
422 filter_path: self.filter_path,
423 human: self.human,
424 pretty: self.pretty,
425 source: self.source,
426 };
427 Some(query_params)
428 };
429 let body = Option::<()>::None;
430 let response = self
431 .transport
432 .send(method, &path, headers, query_string.as_ref(), body, timeout)
433 .await?;
434 Ok(response)
435 }
436}
437#[derive(Debug, Clone, PartialEq)]
438#[doc = "API parts for the Ingest Put Pipeline API"]
439pub enum IngestPutPipelineParts<'b> {
440 #[doc = "Id"]
441 Id(&'b str),
442}
443impl<'b> IngestPutPipelineParts<'b> {
444 #[doc = "Builds a relative URL path to the Ingest Put Pipeline API"]
445 pub fn url(self) -> Cow<'static, str> {
446 match self {
447 IngestPutPipelineParts::Id(ref id) => {
448 let encoded_id: Cow<str> = percent_encode(id.as_bytes(), PARTS_ENCODED).into();
449 let mut p = String::with_capacity(18usize + encoded_id.len());
450 p.push_str("/_ingest/pipeline/");
451 p.push_str(encoded_id.as_ref());
452 p.into()
453 }
454 }
455 }
456}
457#[doc = "Builder for the [Ingest Put Pipeline API](https://opensearch.org/docs/)\n\nCreates or updates a pipeline."]
458#[derive(Clone, Debug)]
459pub struct IngestPutPipeline<'a, 'b, B> {
460 transport: &'a Transport,
461 parts: IngestPutPipelineParts<'b>,
462 body: Option<B>,
463 error_trace: Option<bool>,
464 filter_path: Option<&'b [&'b str]>,
465 headers: HeaderMap,
466 human: Option<bool>,
467 master_timeout: Option<&'b str>,
468 pretty: Option<bool>,
469 request_timeout: Option<Duration>,
470 source: Option<&'b str>,
471 timeout: Option<&'b str>,
472}
473impl<'a, 'b, B> IngestPutPipeline<'a, 'b, B>
474where
475 B: Body,
476{
477 #[doc = "Creates a new instance of [IngestPutPipeline] with the specified API parts"]
478 pub fn new(transport: &'a Transport, parts: IngestPutPipelineParts<'b>) -> Self {
479 let headers = HeaderMap::new();
480 IngestPutPipeline {
481 transport,
482 parts,
483 headers,
484 body: None,
485 error_trace: None,
486 filter_path: None,
487 human: None,
488 master_timeout: None,
489 pretty: None,
490 request_timeout: None,
491 source: None,
492 timeout: None,
493 }
494 }
495 #[doc = "The body for the API call"]
496 pub fn body<T>(self, body: T) -> IngestPutPipeline<'a, 'b, JsonBody<T>>
497 where
498 T: Serialize,
499 {
500 IngestPutPipeline {
501 transport: self.transport,
502 parts: self.parts,
503 body: Some(body.into()),
504 error_trace: self.error_trace,
505 filter_path: self.filter_path,
506 headers: self.headers,
507 human: self.human,
508 master_timeout: self.master_timeout,
509 pretty: self.pretty,
510 request_timeout: self.request_timeout,
511 source: self.source,
512 timeout: self.timeout,
513 }
514 }
515 #[doc = "Include the stack trace of returned errors."]
516 pub fn error_trace(mut self, error_trace: bool) -> Self {
517 self.error_trace = Some(error_trace);
518 self
519 }
520 #[doc = "A comma-separated list of filters used to reduce the response."]
521 pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
522 self.filter_path = Some(filter_path);
523 self
524 }
525 #[doc = "Adds a HTTP header"]
526 pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
527 self.headers.insert(key, value);
528 self
529 }
530 #[doc = "Return human readable values for statistics."]
531 pub fn human(mut self, human: bool) -> Self {
532 self.human = Some(human);
533 self
534 }
535 #[doc = "Explicit operation timeout for connection to master node"]
536 pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
537 self.master_timeout = Some(master_timeout);
538 self
539 }
540 #[doc = "Pretty format the returned JSON response."]
541 pub fn pretty(mut self, pretty: bool) -> Self {
542 self.pretty = Some(pretty);
543 self
544 }
545 #[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."]
546 pub fn request_timeout(mut self, timeout: Duration) -> Self {
547 self.request_timeout = Some(timeout);
548 self
549 }
550 #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
551 pub fn source(mut self, source: &'b str) -> Self {
552 self.source = Some(source);
553 self
554 }
555 #[doc = "Explicit operation timeout"]
556 pub fn timeout(mut self, timeout: &'b str) -> Self {
557 self.timeout = Some(timeout);
558 self
559 }
560 #[doc = "Creates an asynchronous call to the Ingest Put Pipeline API that can be awaited"]
561 pub async fn send(self) -> Result<Response, Error> {
562 let path = self.parts.url();
563 let method = Method::Put;
564 let headers = self.headers;
565 let timeout = self.request_timeout;
566 let query_string = {
567 #[serde_with::skip_serializing_none]
568 #[derive(Serialize)]
569 struct QueryParams<'b> {
570 error_trace: Option<bool>,
571 #[serde(serialize_with = "crate::client::serialize_coll_qs")]
572 filter_path: Option<&'b [&'b str]>,
573 human: Option<bool>,
574 master_timeout: Option<&'b str>,
575 pretty: Option<bool>,
576 source: Option<&'b str>,
577 timeout: Option<&'b str>,
578 }
579 let query_params = QueryParams {
580 error_trace: self.error_trace,
581 filter_path: self.filter_path,
582 human: self.human,
583 master_timeout: self.master_timeout,
584 pretty: self.pretty,
585 source: self.source,
586 timeout: self.timeout,
587 };
588 Some(query_params)
589 };
590 let body = self.body;
591 let response = self
592 .transport
593 .send(method, &path, headers, query_string.as_ref(), body, timeout)
594 .await?;
595 Ok(response)
596 }
597}
598#[derive(Debug, Clone, PartialEq)]
599#[doc = "API parts for the Ingest Simulate API"]
600pub enum IngestSimulateParts<'b> {
601 #[doc = "No parts"]
602 None,
603 #[doc = "Id"]
604 Id(&'b str),
605}
606impl<'b> IngestSimulateParts<'b> {
607 #[doc = "Builds a relative URL path to the Ingest Simulate API"]
608 pub fn url(self) -> Cow<'static, str> {
609 match self {
610 IngestSimulateParts::None => "/_ingest/pipeline/_simulate".into(),
611 IngestSimulateParts::Id(ref id) => {
612 let encoded_id: Cow<str> = percent_encode(id.as_bytes(), PARTS_ENCODED).into();
613 let mut p = String::with_capacity(28usize + encoded_id.len());
614 p.push_str("/_ingest/pipeline/");
615 p.push_str(encoded_id.as_ref());
616 p.push_str("/_simulate");
617 p.into()
618 }
619 }
620 }
621}
622#[doc = "Builder for the [Ingest Simulate API](https://opensearch.org/docs/)\n\nAllows to simulate a pipeline with example documents."]
623#[derive(Clone, Debug)]
624pub struct IngestSimulate<'a, 'b, B> {
625 transport: &'a Transport,
626 parts: IngestSimulateParts<'b>,
627 body: Option<B>,
628 error_trace: Option<bool>,
629 filter_path: Option<&'b [&'b str]>,
630 headers: HeaderMap,
631 human: Option<bool>,
632 pretty: Option<bool>,
633 request_timeout: Option<Duration>,
634 source: Option<&'b str>,
635 verbose: Option<bool>,
636}
637impl<'a, 'b, B> IngestSimulate<'a, 'b, B>
638where
639 B: Body,
640{
641 #[doc = "Creates a new instance of [IngestSimulate] with the specified API parts"]
642 pub fn new(transport: &'a Transport, parts: IngestSimulateParts<'b>) -> Self {
643 let headers = HeaderMap::new();
644 IngestSimulate {
645 transport,
646 parts,
647 headers,
648 body: None,
649 error_trace: None,
650 filter_path: None,
651 human: None,
652 pretty: None,
653 request_timeout: None,
654 source: None,
655 verbose: None,
656 }
657 }
658 #[doc = "The body for the API call"]
659 pub fn body<T>(self, body: T) -> IngestSimulate<'a, 'b, JsonBody<T>>
660 where
661 T: Serialize,
662 {
663 IngestSimulate {
664 transport: self.transport,
665 parts: self.parts,
666 body: Some(body.into()),
667 error_trace: self.error_trace,
668 filter_path: self.filter_path,
669 headers: self.headers,
670 human: self.human,
671 pretty: self.pretty,
672 request_timeout: self.request_timeout,
673 source: self.source,
674 verbose: self.verbose,
675 }
676 }
677 #[doc = "Include the stack trace of returned errors."]
678 pub fn error_trace(mut self, error_trace: bool) -> Self {
679 self.error_trace = Some(error_trace);
680 self
681 }
682 #[doc = "A comma-separated list of filters used to reduce the response."]
683 pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
684 self.filter_path = Some(filter_path);
685 self
686 }
687 #[doc = "Adds a HTTP header"]
688 pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
689 self.headers.insert(key, value);
690 self
691 }
692 #[doc = "Return human readable values for statistics."]
693 pub fn human(mut self, human: bool) -> Self {
694 self.human = Some(human);
695 self
696 }
697 #[doc = "Pretty format the returned JSON response."]
698 pub fn pretty(mut self, pretty: bool) -> Self {
699 self.pretty = Some(pretty);
700 self
701 }
702 #[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."]
703 pub fn request_timeout(mut self, timeout: Duration) -> Self {
704 self.request_timeout = Some(timeout);
705 self
706 }
707 #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
708 pub fn source(mut self, source: &'b str) -> Self {
709 self.source = Some(source);
710 self
711 }
712 #[doc = "Verbose mode. Display data output for each processor in executed pipeline"]
713 pub fn verbose(mut self, verbose: bool) -> Self {
714 self.verbose = Some(verbose);
715 self
716 }
717 #[doc = "Creates an asynchronous call to the Ingest Simulate API that can be awaited"]
718 pub async fn send(self) -> Result<Response, Error> {
719 let path = self.parts.url();
720 let method = match self.body {
721 Some(_) => Method::Post,
722 None => Method::Get,
723 };
724 let headers = self.headers;
725 let timeout = self.request_timeout;
726 let query_string = {
727 #[serde_with::skip_serializing_none]
728 #[derive(Serialize)]
729 struct QueryParams<'b> {
730 error_trace: Option<bool>,
731 #[serde(serialize_with = "crate::client::serialize_coll_qs")]
732 filter_path: Option<&'b [&'b str]>,
733 human: Option<bool>,
734 pretty: Option<bool>,
735 source: Option<&'b str>,
736 verbose: Option<bool>,
737 }
738 let query_params = QueryParams {
739 error_trace: self.error_trace,
740 filter_path: self.filter_path,
741 human: self.human,
742 pretty: self.pretty,
743 source: self.source,
744 verbose: self.verbose,
745 };
746 Some(query_params)
747 };
748 let body = self.body;
749 let response = self
750 .transport
751 .send(method, &path, headers, query_string.as_ref(), body, timeout)
752 .await?;
753 Ok(response)
754 }
755}
756#[doc = "Namespace client for Ingest APIs"]
757pub struct Ingest<'a> {
758 transport: &'a Transport,
759}
760impl<'a> Ingest<'a> {
761 #[doc = "Creates a new instance of [Ingest]"]
762 pub fn new(transport: &'a Transport) -> Self {
763 Self { transport }
764 }
765 pub fn transport(&self) -> &Transport {
766 self.transport
767 }
768 #[doc = "[Ingest Delete Pipeline API](https://opensearch.org/docs/)\n\nDeletes a pipeline."]
769 pub fn delete_pipeline<'b>(
770 &'a self,
771 parts: IngestDeletePipelineParts<'b>,
772 ) -> IngestDeletePipeline<'a, 'b> {
773 IngestDeletePipeline::new(self.transport(), parts)
774 }
775 #[doc = "[Ingest Get Pipeline API](https://opensearch.org/docs/)\n\nReturns a pipeline."]
776 pub fn get_pipeline<'b>(
777 &'a self,
778 parts: IngestGetPipelineParts<'b>,
779 ) -> IngestGetPipeline<'a, 'b> {
780 IngestGetPipeline::new(self.transport(), parts)
781 }
782 #[doc = "[Ingest Processor Grok API](https://opensearch.org/docs/)\n\nReturns a list of the built-in patterns."]
783 pub fn processor_grok<'b>(&'a self) -> IngestProcessorGrok<'a, 'b> {
784 IngestProcessorGrok::new(self.transport())
785 }
786 #[doc = "[Ingest Put Pipeline API](https://opensearch.org/docs/)\n\nCreates or updates a pipeline."]
787 pub fn put_pipeline<'b>(
788 &'a self,
789 parts: IngestPutPipelineParts<'b>,
790 ) -> IngestPutPipeline<'a, 'b, ()> {
791 IngestPutPipeline::new(self.transport(), parts)
792 }
793 #[doc = "[Ingest Simulate API](https://opensearch.org/docs/)\n\nAllows to simulate a pipeline with example documents."]
794 pub fn simulate<'b>(&'a self, parts: IngestSimulateParts<'b>) -> IngestSimulate<'a, 'b, ()> {
795 IngestSimulate::new(self.transport(), parts)
796 }
797}
798impl OpenSearch {
799 #[doc = "Creates a namespace client for Ingest APIs"]
800 pub fn ingest(&self) -> Ingest {
801 Ingest::new(self.transport())
802 }
803}