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