elasticsearch/
license.rs

1/*
2 * Licensed to Elasticsearch B.V. under one or more contributor
3 * license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright
5 * ownership. Elasticsearch B.V. licenses this file to you under
6 * the Apache License, Version 2.0 (the "License"); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *	http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20// -----------------------------------------------
21// This file is generated, Please do not edit it manually.
22// Run the following in the root of the repo to regenerate:
23//
24// cargo make generate-api
25// -----------------------------------------------
26
27//! Licensing APIs
28//!
29//! [Manage Elastic Stack license](https://www.elastic.co/guide/en/elasticsearch/reference/master/licensing-apis.html), including
30//!
31//! - Retrieve, update or delete a license
32//! - Start a 30 day trial of the Platinum license features
33//! - Start indefinite use of the Basic license features
34//! - Get the status of trial and basic license features
35
36#![allow(unused_imports)]
37use crate::{
38    client::Elasticsearch,
39    error::Error,
40    http::{
41        self,
42        headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE},
43        request::{Body, JsonBody, NdBody, PARTS_ENCODED},
44        response::Response,
45        transport::Transport,
46    },
47    params::*,
48};
49use percent_encoding::percent_encode;
50use serde::Serialize;
51use std::{borrow::Cow, time::Duration};
52#[derive(Debug, Clone, PartialEq, Eq)]
53#[doc = "API parts for the License Delete API"]
54pub enum LicenseDeleteParts {
55    #[doc = "No parts"]
56    None,
57}
58impl LicenseDeleteParts {
59    #[doc = "Builds a relative URL path to the License Delete API"]
60    pub fn url(self) -> Cow<'static, str> {
61        match self {
62            LicenseDeleteParts::None => "/_license".into(),
63        }
64    }
65}
66#[doc = "Builder for the [License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/delete-license.html)\n\nDeletes licensing information for the cluster"]
67#[derive(Clone, Debug)]
68pub struct LicenseDelete<'a, 'b> {
69    transport: &'a Transport,
70    parts: LicenseDeleteParts,
71    error_trace: Option<bool>,
72    filter_path: Option<&'b [&'b str]>,
73    headers: HeaderMap,
74    human: Option<bool>,
75    master_timeout: Option<&'b str>,
76    pretty: Option<bool>,
77    request_timeout: Option<Duration>,
78    source: Option<&'b str>,
79    timeout: Option<&'b str>,
80}
81impl<'a, 'b> LicenseDelete<'a, 'b> {
82    #[doc = "Creates a new instance of [LicenseDelete]"]
83    pub fn new(transport: &'a Transport) -> Self {
84        let headers = HeaderMap::new();
85        LicenseDelete {
86            transport,
87            parts: LicenseDeleteParts::None,
88            headers,
89            error_trace: None,
90            filter_path: None,
91            human: None,
92            master_timeout: None,
93            pretty: None,
94            request_timeout: None,
95            source: None,
96            timeout: None,
97        }
98    }
99    #[doc = "Include the stack trace of returned errors."]
100    pub fn error_trace(mut self, error_trace: bool) -> Self {
101        self.error_trace = Some(error_trace);
102        self
103    }
104    #[doc = "A comma-separated list of filters used to reduce the response."]
105    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
106        self.filter_path = Some(filter_path);
107        self
108    }
109    #[doc = "Adds a HTTP header"]
110    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
111        self.headers.insert(key, value);
112        self
113    }
114    #[doc = "Return human readable values for statistics."]
115    pub fn human(mut self, human: bool) -> Self {
116        self.human = Some(human);
117        self
118    }
119    #[doc = "Timeout for processing on master node"]
120    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
121        self.master_timeout = Some(master_timeout);
122        self
123    }
124    #[doc = "Pretty format the returned JSON response."]
125    pub fn pretty(mut self, pretty: bool) -> Self {
126        self.pretty = Some(pretty);
127        self
128    }
129    #[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."]
130    pub fn request_timeout(mut self, timeout: Duration) -> Self {
131        self.request_timeout = Some(timeout);
132        self
133    }
134    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
135    pub fn source(mut self, source: &'b str) -> Self {
136        self.source = Some(source);
137        self
138    }
139    #[doc = "Timeout for acknowledgement of update from all nodes in cluster"]
140    pub fn timeout(mut self, timeout: &'b str) -> Self {
141        self.timeout = Some(timeout);
142        self
143    }
144    #[doc = "Creates an asynchronous call to the License Delete API that can be awaited"]
145    pub async fn send(self) -> Result<Response, Error> {
146        let path = self.parts.url();
147        let method = http::Method::Delete;
148        let headers = self.headers;
149        let timeout = self.request_timeout;
150        let query_string = {
151            #[serde_with::skip_serializing_none]
152            #[derive(Serialize)]
153            struct QueryParams<'b> {
154                error_trace: Option<bool>,
155                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
156                filter_path: Option<&'b [&'b str]>,
157                human: Option<bool>,
158                master_timeout: Option<&'b str>,
159                pretty: Option<bool>,
160                source: Option<&'b str>,
161                timeout: Option<&'b str>,
162            }
163            let query_params = QueryParams {
164                error_trace: self.error_trace,
165                filter_path: self.filter_path,
166                human: self.human,
167                master_timeout: self.master_timeout,
168                pretty: self.pretty,
169                source: self.source,
170                timeout: self.timeout,
171            };
172            Some(query_params)
173        };
174        let body = Option::<()>::None;
175        let response = self
176            .transport
177            .send(method, &path, headers, query_string.as_ref(), body, timeout)
178            .await?;
179        Ok(response)
180    }
181}
182#[derive(Debug, Clone, PartialEq, Eq)]
183#[doc = "API parts for the License Get API"]
184pub enum LicenseGetParts {
185    #[doc = "No parts"]
186    None,
187}
188impl LicenseGetParts {
189    #[doc = "Builds a relative URL path to the License Get API"]
190    pub fn url(self) -> Cow<'static, str> {
191        match self {
192            LicenseGetParts::None => "/_license".into(),
193        }
194    }
195}
196#[doc = "Builder for the [License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/get-license.html)\n\nRetrieves licensing information for the cluster"]
197#[derive(Clone, Debug)]
198pub struct LicenseGet<'a, 'b> {
199    transport: &'a Transport,
200    parts: LicenseGetParts,
201    accept_enterprise: Option<bool>,
202    error_trace: Option<bool>,
203    filter_path: Option<&'b [&'b str]>,
204    headers: HeaderMap,
205    human: Option<bool>,
206    local: Option<bool>,
207    pretty: Option<bool>,
208    request_timeout: Option<Duration>,
209    source: Option<&'b str>,
210}
211impl<'a, 'b> LicenseGet<'a, 'b> {
212    #[doc = "Creates a new instance of [LicenseGet]"]
213    pub fn new(transport: &'a Transport) -> Self {
214        let headers = HeaderMap::new();
215        LicenseGet {
216            transport,
217            parts: LicenseGetParts::None,
218            headers,
219            accept_enterprise: None,
220            error_trace: None,
221            filter_path: None,
222            human: None,
223            local: None,
224            pretty: None,
225            request_timeout: None,
226            source: None,
227        }
228    }
229    #[doc = "Supported for backwards compatibility with 7.x. If this param is used it must be set to true"]
230    pub fn accept_enterprise(mut self, accept_enterprise: bool) -> Self {
231        self.accept_enterprise = Some(accept_enterprise);
232        self
233    }
234    #[doc = "Include the stack trace of returned errors."]
235    pub fn error_trace(mut self, error_trace: bool) -> Self {
236        self.error_trace = Some(error_trace);
237        self
238    }
239    #[doc = "A comma-separated list of filters used to reduce the response."]
240    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
241        self.filter_path = Some(filter_path);
242        self
243    }
244    #[doc = "Adds a HTTP header"]
245    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
246        self.headers.insert(key, value);
247        self
248    }
249    #[doc = "Return human readable values for statistics."]
250    pub fn human(mut self, human: bool) -> Self {
251        self.human = Some(human);
252        self
253    }
254    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
255    pub fn local(mut self, local: bool) -> Self {
256        self.local = Some(local);
257        self
258    }
259    #[doc = "Pretty format the returned JSON response."]
260    pub fn pretty(mut self, pretty: bool) -> Self {
261        self.pretty = Some(pretty);
262        self
263    }
264    #[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."]
265    pub fn request_timeout(mut self, timeout: Duration) -> Self {
266        self.request_timeout = Some(timeout);
267        self
268    }
269    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
270    pub fn source(mut self, source: &'b str) -> Self {
271        self.source = Some(source);
272        self
273    }
274    #[doc = "Creates an asynchronous call to the License Get API that can be awaited"]
275    pub async fn send(self) -> Result<Response, Error> {
276        let path = self.parts.url();
277        let method = http::Method::Get;
278        let headers = self.headers;
279        let timeout = self.request_timeout;
280        let query_string = {
281            #[serde_with::skip_serializing_none]
282            #[derive(Serialize)]
283            struct QueryParams<'b> {
284                accept_enterprise: Option<bool>,
285                error_trace: Option<bool>,
286                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
287                filter_path: Option<&'b [&'b str]>,
288                human: Option<bool>,
289                local: Option<bool>,
290                pretty: Option<bool>,
291                source: Option<&'b str>,
292            }
293            let query_params = QueryParams {
294                accept_enterprise: self.accept_enterprise,
295                error_trace: self.error_trace,
296                filter_path: self.filter_path,
297                human: self.human,
298                local: self.local,
299                pretty: self.pretty,
300                source: self.source,
301            };
302            Some(query_params)
303        };
304        let body = Option::<()>::None;
305        let response = self
306            .transport
307            .send(method, &path, headers, query_string.as_ref(), body, timeout)
308            .await?;
309        Ok(response)
310    }
311}
312#[derive(Debug, Clone, PartialEq, Eq)]
313#[doc = "API parts for the License Get Basic Status API"]
314pub enum LicenseGetBasicStatusParts {
315    #[doc = "No parts"]
316    None,
317}
318impl LicenseGetBasicStatusParts {
319    #[doc = "Builds a relative URL path to the License Get Basic Status API"]
320    pub fn url(self) -> Cow<'static, str> {
321        match self {
322            LicenseGetBasicStatusParts::None => "/_license/basic_status".into(),
323        }
324    }
325}
326#[doc = "Builder for the [License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/get-basic-status.html)\n\nRetrieves information about the status of the basic license."]
327#[derive(Clone, Debug)]
328pub struct LicenseGetBasicStatus<'a, 'b> {
329    transport: &'a Transport,
330    parts: LicenseGetBasicStatusParts,
331    error_trace: Option<bool>,
332    filter_path: Option<&'b [&'b str]>,
333    headers: HeaderMap,
334    human: Option<bool>,
335    pretty: Option<bool>,
336    request_timeout: Option<Duration>,
337    source: Option<&'b str>,
338}
339impl<'a, 'b> LicenseGetBasicStatus<'a, 'b> {
340    #[doc = "Creates a new instance of [LicenseGetBasicStatus]"]
341    pub fn new(transport: &'a Transport) -> Self {
342        let headers = HeaderMap::new();
343        LicenseGetBasicStatus {
344            transport,
345            parts: LicenseGetBasicStatusParts::None,
346            headers,
347            error_trace: None,
348            filter_path: None,
349            human: None,
350            pretty: None,
351            request_timeout: None,
352            source: None,
353        }
354    }
355    #[doc = "Include the stack trace of returned errors."]
356    pub fn error_trace(mut self, error_trace: bool) -> Self {
357        self.error_trace = Some(error_trace);
358        self
359    }
360    #[doc = "A comma-separated list of filters used to reduce the response."]
361    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
362        self.filter_path = Some(filter_path);
363        self
364    }
365    #[doc = "Adds a HTTP header"]
366    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
367        self.headers.insert(key, value);
368        self
369    }
370    #[doc = "Return human readable values for statistics."]
371    pub fn human(mut self, human: bool) -> Self {
372        self.human = Some(human);
373        self
374    }
375    #[doc = "Pretty format the returned JSON response."]
376    pub fn pretty(mut self, pretty: bool) -> Self {
377        self.pretty = Some(pretty);
378        self
379    }
380    #[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."]
381    pub fn request_timeout(mut self, timeout: Duration) -> Self {
382        self.request_timeout = Some(timeout);
383        self
384    }
385    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
386    pub fn source(mut self, source: &'b str) -> Self {
387        self.source = Some(source);
388        self
389    }
390    #[doc = "Creates an asynchronous call to the License Get Basic Status API that can be awaited"]
391    pub async fn send(self) -> Result<Response, Error> {
392        let path = self.parts.url();
393        let method = http::Method::Get;
394        let headers = self.headers;
395        let timeout = self.request_timeout;
396        let query_string = {
397            #[serde_with::skip_serializing_none]
398            #[derive(Serialize)]
399            struct QueryParams<'b> {
400                error_trace: Option<bool>,
401                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
402                filter_path: Option<&'b [&'b str]>,
403                human: Option<bool>,
404                pretty: Option<bool>,
405                source: Option<&'b str>,
406            }
407            let query_params = QueryParams {
408                error_trace: self.error_trace,
409                filter_path: self.filter_path,
410                human: self.human,
411                pretty: self.pretty,
412                source: self.source,
413            };
414            Some(query_params)
415        };
416        let body = Option::<()>::None;
417        let response = self
418            .transport
419            .send(method, &path, headers, query_string.as_ref(), body, timeout)
420            .await?;
421        Ok(response)
422    }
423}
424#[derive(Debug, Clone, PartialEq, Eq)]
425#[doc = "API parts for the License Get Trial Status API"]
426pub enum LicenseGetTrialStatusParts {
427    #[doc = "No parts"]
428    None,
429}
430impl LicenseGetTrialStatusParts {
431    #[doc = "Builds a relative URL path to the License Get Trial Status API"]
432    pub fn url(self) -> Cow<'static, str> {
433        match self {
434            LicenseGetTrialStatusParts::None => "/_license/trial_status".into(),
435        }
436    }
437}
438#[doc = "Builder for the [License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/get-trial-status.html)\n\nRetrieves information about the status of the trial license."]
439#[derive(Clone, Debug)]
440pub struct LicenseGetTrialStatus<'a, 'b> {
441    transport: &'a Transport,
442    parts: LicenseGetTrialStatusParts,
443    error_trace: Option<bool>,
444    filter_path: Option<&'b [&'b str]>,
445    headers: HeaderMap,
446    human: Option<bool>,
447    pretty: Option<bool>,
448    request_timeout: Option<Duration>,
449    source: Option<&'b str>,
450}
451impl<'a, 'b> LicenseGetTrialStatus<'a, 'b> {
452    #[doc = "Creates a new instance of [LicenseGetTrialStatus]"]
453    pub fn new(transport: &'a Transport) -> Self {
454        let headers = HeaderMap::new();
455        LicenseGetTrialStatus {
456            transport,
457            parts: LicenseGetTrialStatusParts::None,
458            headers,
459            error_trace: None,
460            filter_path: None,
461            human: None,
462            pretty: None,
463            request_timeout: None,
464            source: None,
465        }
466    }
467    #[doc = "Include the stack trace of returned errors."]
468    pub fn error_trace(mut self, error_trace: bool) -> Self {
469        self.error_trace = Some(error_trace);
470        self
471    }
472    #[doc = "A comma-separated list of filters used to reduce the response."]
473    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
474        self.filter_path = Some(filter_path);
475        self
476    }
477    #[doc = "Adds a HTTP header"]
478    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
479        self.headers.insert(key, value);
480        self
481    }
482    #[doc = "Return human readable values for statistics."]
483    pub fn human(mut self, human: bool) -> Self {
484        self.human = Some(human);
485        self
486    }
487    #[doc = "Pretty format the returned JSON response."]
488    pub fn pretty(mut self, pretty: bool) -> Self {
489        self.pretty = Some(pretty);
490        self
491    }
492    #[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."]
493    pub fn request_timeout(mut self, timeout: Duration) -> Self {
494        self.request_timeout = Some(timeout);
495        self
496    }
497    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
498    pub fn source(mut self, source: &'b str) -> Self {
499        self.source = Some(source);
500        self
501    }
502    #[doc = "Creates an asynchronous call to the License Get Trial Status API that can be awaited"]
503    pub async fn send(self) -> Result<Response, Error> {
504        let path = self.parts.url();
505        let method = http::Method::Get;
506        let headers = self.headers;
507        let timeout = self.request_timeout;
508        let query_string = {
509            #[serde_with::skip_serializing_none]
510            #[derive(Serialize)]
511            struct QueryParams<'b> {
512                error_trace: Option<bool>,
513                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
514                filter_path: Option<&'b [&'b str]>,
515                human: Option<bool>,
516                pretty: Option<bool>,
517                source: Option<&'b str>,
518            }
519            let query_params = QueryParams {
520                error_trace: self.error_trace,
521                filter_path: self.filter_path,
522                human: self.human,
523                pretty: self.pretty,
524                source: self.source,
525            };
526            Some(query_params)
527        };
528        let body = Option::<()>::None;
529        let response = self
530            .transport
531            .send(method, &path, headers, query_string.as_ref(), body, timeout)
532            .await?;
533        Ok(response)
534    }
535}
536#[derive(Debug, Clone, PartialEq, Eq)]
537#[doc = "API parts for the License Post API"]
538pub enum LicensePostParts {
539    #[doc = "No parts"]
540    None,
541}
542impl LicensePostParts {
543    #[doc = "Builds a relative URL path to the License Post API"]
544    pub fn url(self) -> Cow<'static, str> {
545        match self {
546            LicensePostParts::None => "/_license".into(),
547        }
548    }
549}
550#[doc = "Builder for the [License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/update-license.html)\n\nUpdates the license for the cluster."]
551#[derive(Clone, Debug)]
552pub struct LicensePost<'a, 'b, B> {
553    transport: &'a Transport,
554    parts: LicensePostParts,
555    acknowledge: Option<bool>,
556    body: Option<B>,
557    error_trace: Option<bool>,
558    filter_path: Option<&'b [&'b str]>,
559    headers: HeaderMap,
560    human: Option<bool>,
561    master_timeout: Option<&'b str>,
562    pretty: Option<bool>,
563    request_timeout: Option<Duration>,
564    source: Option<&'b str>,
565    timeout: Option<&'b str>,
566}
567impl<'a, 'b, B> LicensePost<'a, 'b, B>
568where
569    B: Body,
570{
571    #[doc = "Creates a new instance of [LicensePost]"]
572    pub fn new(transport: &'a Transport) -> Self {
573        let headers = HeaderMap::new();
574        LicensePost {
575            transport,
576            parts: LicensePostParts::None,
577            headers,
578            acknowledge: None,
579            body: None,
580            error_trace: None,
581            filter_path: None,
582            human: None,
583            master_timeout: None,
584            pretty: None,
585            request_timeout: None,
586            source: None,
587            timeout: None,
588        }
589    }
590    #[doc = "whether the user has acknowledged acknowledge messages (default: false)"]
591    pub fn acknowledge(mut self, acknowledge: bool) -> Self {
592        self.acknowledge = Some(acknowledge);
593        self
594    }
595    #[doc = "The body for the API call"]
596    pub fn body<T>(self, body: T) -> LicensePost<'a, 'b, JsonBody<T>>
597    where
598        T: Serialize,
599    {
600        LicensePost {
601            transport: self.transport,
602            parts: self.parts,
603            body: Some(body.into()),
604            acknowledge: self.acknowledge,
605            error_trace: self.error_trace,
606            filter_path: self.filter_path,
607            headers: self.headers,
608            human: self.human,
609            master_timeout: self.master_timeout,
610            pretty: self.pretty,
611            request_timeout: self.request_timeout,
612            source: self.source,
613            timeout: self.timeout,
614        }
615    }
616    #[doc = "Include the stack trace of returned errors."]
617    pub fn error_trace(mut self, error_trace: bool) -> Self {
618        self.error_trace = Some(error_trace);
619        self
620    }
621    #[doc = "A comma-separated list of filters used to reduce the response."]
622    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
623        self.filter_path = Some(filter_path);
624        self
625    }
626    #[doc = "Adds a HTTP header"]
627    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
628        self.headers.insert(key, value);
629        self
630    }
631    #[doc = "Return human readable values for statistics."]
632    pub fn human(mut self, human: bool) -> Self {
633        self.human = Some(human);
634        self
635    }
636    #[doc = "Timeout for processing on master node"]
637    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
638        self.master_timeout = Some(master_timeout);
639        self
640    }
641    #[doc = "Pretty format the returned JSON response."]
642    pub fn pretty(mut self, pretty: bool) -> Self {
643        self.pretty = Some(pretty);
644        self
645    }
646    #[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."]
647    pub fn request_timeout(mut self, timeout: Duration) -> Self {
648        self.request_timeout = Some(timeout);
649        self
650    }
651    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
652    pub fn source(mut self, source: &'b str) -> Self {
653        self.source = Some(source);
654        self
655    }
656    #[doc = "Timeout for acknowledgement of update from all nodes in cluster"]
657    pub fn timeout(mut self, timeout: &'b str) -> Self {
658        self.timeout = Some(timeout);
659        self
660    }
661    #[doc = "Creates an asynchronous call to the License Post API that can be awaited"]
662    pub async fn send(self) -> Result<Response, Error> {
663        let path = self.parts.url();
664        let method = http::Method::Post;
665        let headers = self.headers;
666        let timeout = self.request_timeout;
667        let query_string = {
668            #[serde_with::skip_serializing_none]
669            #[derive(Serialize)]
670            struct QueryParams<'b> {
671                acknowledge: Option<bool>,
672                error_trace: Option<bool>,
673                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
674                filter_path: Option<&'b [&'b str]>,
675                human: Option<bool>,
676                master_timeout: Option<&'b str>,
677                pretty: Option<bool>,
678                source: Option<&'b str>,
679                timeout: Option<&'b str>,
680            }
681            let query_params = QueryParams {
682                acknowledge: self.acknowledge,
683                error_trace: self.error_trace,
684                filter_path: self.filter_path,
685                human: self.human,
686                master_timeout: self.master_timeout,
687                pretty: self.pretty,
688                source: self.source,
689                timeout: self.timeout,
690            };
691            Some(query_params)
692        };
693        let body = self.body;
694        let response = self
695            .transport
696            .send(method, &path, headers, query_string.as_ref(), body, timeout)
697            .await?;
698        Ok(response)
699    }
700}
701#[derive(Debug, Clone, PartialEq, Eq)]
702#[doc = "API parts for the License Post Start Basic API"]
703pub enum LicensePostStartBasicParts {
704    #[doc = "No parts"]
705    None,
706}
707impl LicensePostStartBasicParts {
708    #[doc = "Builds a relative URL path to the License Post Start Basic API"]
709    pub fn url(self) -> Cow<'static, str> {
710        match self {
711            LicensePostStartBasicParts::None => "/_license/start_basic".into(),
712        }
713    }
714}
715#[doc = "Builder for the [License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/start-basic.html)\n\nStarts an indefinite basic license."]
716#[derive(Clone, Debug)]
717pub struct LicensePostStartBasic<'a, 'b, B> {
718    transport: &'a Transport,
719    parts: LicensePostStartBasicParts,
720    acknowledge: Option<bool>,
721    body: Option<B>,
722    error_trace: Option<bool>,
723    filter_path: Option<&'b [&'b str]>,
724    headers: HeaderMap,
725    human: Option<bool>,
726    master_timeout: Option<&'b str>,
727    pretty: Option<bool>,
728    request_timeout: Option<Duration>,
729    source: Option<&'b str>,
730    timeout: Option<&'b str>,
731}
732impl<'a, 'b, B> LicensePostStartBasic<'a, 'b, B>
733where
734    B: Body,
735{
736    #[doc = "Creates a new instance of [LicensePostStartBasic]"]
737    pub fn new(transport: &'a Transport) -> Self {
738        let headers = HeaderMap::new();
739        LicensePostStartBasic {
740            transport,
741            parts: LicensePostStartBasicParts::None,
742            headers,
743            acknowledge: None,
744            body: None,
745            error_trace: None,
746            filter_path: None,
747            human: None,
748            master_timeout: None,
749            pretty: None,
750            request_timeout: None,
751            source: None,
752            timeout: None,
753        }
754    }
755    #[doc = "whether the user has acknowledged acknowledge messages (default: false)"]
756    pub fn acknowledge(mut self, acknowledge: bool) -> Self {
757        self.acknowledge = Some(acknowledge);
758        self
759    }
760    #[doc = "The body for the API call"]
761    pub fn body<T>(self, body: T) -> LicensePostStartBasic<'a, 'b, JsonBody<T>>
762    where
763        T: Serialize,
764    {
765        LicensePostStartBasic {
766            transport: self.transport,
767            parts: self.parts,
768            body: Some(body.into()),
769            acknowledge: self.acknowledge,
770            error_trace: self.error_trace,
771            filter_path: self.filter_path,
772            headers: self.headers,
773            human: self.human,
774            master_timeout: self.master_timeout,
775            pretty: self.pretty,
776            request_timeout: self.request_timeout,
777            source: self.source,
778            timeout: self.timeout,
779        }
780    }
781    #[doc = "Include the stack trace of returned errors."]
782    pub fn error_trace(mut self, error_trace: bool) -> Self {
783        self.error_trace = Some(error_trace);
784        self
785    }
786    #[doc = "A comma-separated list of filters used to reduce the response."]
787    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
788        self.filter_path = Some(filter_path);
789        self
790    }
791    #[doc = "Adds a HTTP header"]
792    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
793        self.headers.insert(key, value);
794        self
795    }
796    #[doc = "Return human readable values for statistics."]
797    pub fn human(mut self, human: bool) -> Self {
798        self.human = Some(human);
799        self
800    }
801    #[doc = "Timeout for processing on master node"]
802    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
803        self.master_timeout = Some(master_timeout);
804        self
805    }
806    #[doc = "Pretty format the returned JSON response."]
807    pub fn pretty(mut self, pretty: bool) -> Self {
808        self.pretty = Some(pretty);
809        self
810    }
811    #[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."]
812    pub fn request_timeout(mut self, timeout: Duration) -> Self {
813        self.request_timeout = Some(timeout);
814        self
815    }
816    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
817    pub fn source(mut self, source: &'b str) -> Self {
818        self.source = Some(source);
819        self
820    }
821    #[doc = "Timeout for acknowledgement of update from all nodes in cluster"]
822    pub fn timeout(mut self, timeout: &'b str) -> Self {
823        self.timeout = Some(timeout);
824        self
825    }
826    #[doc = "Creates an asynchronous call to the License Post Start Basic API that can be awaited"]
827    pub async fn send(self) -> Result<Response, Error> {
828        let path = self.parts.url();
829        let method = http::Method::Post;
830        let headers = self.headers;
831        let timeout = self.request_timeout;
832        let query_string = {
833            #[serde_with::skip_serializing_none]
834            #[derive(Serialize)]
835            struct QueryParams<'b> {
836                acknowledge: Option<bool>,
837                error_trace: Option<bool>,
838                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
839                filter_path: Option<&'b [&'b str]>,
840                human: Option<bool>,
841                master_timeout: Option<&'b str>,
842                pretty: Option<bool>,
843                source: Option<&'b str>,
844                timeout: Option<&'b str>,
845            }
846            let query_params = QueryParams {
847                acknowledge: self.acknowledge,
848                error_trace: self.error_trace,
849                filter_path: self.filter_path,
850                human: self.human,
851                master_timeout: self.master_timeout,
852                pretty: self.pretty,
853                source: self.source,
854                timeout: self.timeout,
855            };
856            Some(query_params)
857        };
858        let body = self.body;
859        let response = self
860            .transport
861            .send(method, &path, headers, query_string.as_ref(), body, timeout)
862            .await?;
863        Ok(response)
864    }
865}
866#[derive(Debug, Clone, PartialEq, Eq)]
867#[doc = "API parts for the License Post Start Trial API"]
868pub enum LicensePostStartTrialParts {
869    #[doc = "No parts"]
870    None,
871}
872impl LicensePostStartTrialParts {
873    #[doc = "Builds a relative URL path to the License Post Start Trial API"]
874    pub fn url(self) -> Cow<'static, str> {
875        match self {
876            LicensePostStartTrialParts::None => "/_license/start_trial".into(),
877        }
878    }
879}
880#[doc = "Builder for the [License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/start-trial.html)\n\nstarts a limited time trial license."]
881#[derive(Clone, Debug)]
882pub struct LicensePostStartTrial<'a, 'b, B> {
883    transport: &'a Transport,
884    parts: LicensePostStartTrialParts,
885    acknowledge: Option<bool>,
886    body: Option<B>,
887    error_trace: Option<bool>,
888    filter_path: Option<&'b [&'b str]>,
889    headers: HeaderMap,
890    human: Option<bool>,
891    master_timeout: Option<&'b str>,
892    pretty: Option<bool>,
893    request_timeout: Option<Duration>,
894    source: Option<&'b str>,
895    ty: Option<&'b str>,
896}
897impl<'a, 'b, B> LicensePostStartTrial<'a, 'b, B>
898where
899    B: Body,
900{
901    #[doc = "Creates a new instance of [LicensePostStartTrial]"]
902    pub fn new(transport: &'a Transport) -> Self {
903        let headers = HeaderMap::new();
904        LicensePostStartTrial {
905            transport,
906            parts: LicensePostStartTrialParts::None,
907            headers,
908            acknowledge: None,
909            body: None,
910            error_trace: None,
911            filter_path: None,
912            human: None,
913            master_timeout: None,
914            pretty: None,
915            request_timeout: None,
916            source: None,
917            ty: None,
918        }
919    }
920    #[doc = "whether the user has acknowledged acknowledge messages (default: false)"]
921    pub fn acknowledge(mut self, acknowledge: bool) -> Self {
922        self.acknowledge = Some(acknowledge);
923        self
924    }
925    #[doc = "The body for the API call"]
926    pub fn body<T>(self, body: T) -> LicensePostStartTrial<'a, 'b, JsonBody<T>>
927    where
928        T: Serialize,
929    {
930        LicensePostStartTrial {
931            transport: self.transport,
932            parts: self.parts,
933            body: Some(body.into()),
934            acknowledge: self.acknowledge,
935            error_trace: self.error_trace,
936            filter_path: self.filter_path,
937            headers: self.headers,
938            human: self.human,
939            master_timeout: self.master_timeout,
940            pretty: self.pretty,
941            request_timeout: self.request_timeout,
942            source: self.source,
943            ty: self.ty,
944        }
945    }
946    #[doc = "Include the stack trace of returned errors."]
947    pub fn error_trace(mut self, error_trace: bool) -> Self {
948        self.error_trace = Some(error_trace);
949        self
950    }
951    #[doc = "A comma-separated list of filters used to reduce the response."]
952    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
953        self.filter_path = Some(filter_path);
954        self
955    }
956    #[doc = "Adds a HTTP header"]
957    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
958        self.headers.insert(key, value);
959        self
960    }
961    #[doc = "Return human readable values for statistics."]
962    pub fn human(mut self, human: bool) -> Self {
963        self.human = Some(human);
964        self
965    }
966    #[doc = "Timeout for processing on master node"]
967    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
968        self.master_timeout = Some(master_timeout);
969        self
970    }
971    #[doc = "Pretty format the returned JSON response."]
972    pub fn pretty(mut self, pretty: bool) -> Self {
973        self.pretty = Some(pretty);
974        self
975    }
976    #[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."]
977    pub fn request_timeout(mut self, timeout: Duration) -> Self {
978        self.request_timeout = Some(timeout);
979        self
980    }
981    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
982    pub fn source(mut self, source: &'b str) -> Self {
983        self.source = Some(source);
984        self
985    }
986    #[doc = "The type of trial license to generate (default: \"trial\")"]
987    pub fn ty(mut self, ty: &'b str) -> Self {
988        self.ty = Some(ty);
989        self
990    }
991    #[doc = "Creates an asynchronous call to the License Post Start Trial API that can be awaited"]
992    pub async fn send(self) -> Result<Response, Error> {
993        let path = self.parts.url();
994        let method = http::Method::Post;
995        let headers = self.headers;
996        let timeout = self.request_timeout;
997        let query_string = {
998            #[serde_with::skip_serializing_none]
999            #[derive(Serialize)]
1000            struct QueryParams<'b> {
1001                acknowledge: Option<bool>,
1002                error_trace: Option<bool>,
1003                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1004                filter_path: Option<&'b [&'b str]>,
1005                human: Option<bool>,
1006                master_timeout: Option<&'b str>,
1007                pretty: Option<bool>,
1008                source: Option<&'b str>,
1009                #[serde(rename = "type")]
1010                ty: Option<&'b str>,
1011            }
1012            let query_params = QueryParams {
1013                acknowledge: self.acknowledge,
1014                error_trace: self.error_trace,
1015                filter_path: self.filter_path,
1016                human: self.human,
1017                master_timeout: self.master_timeout,
1018                pretty: self.pretty,
1019                source: self.source,
1020                ty: self.ty,
1021            };
1022            Some(query_params)
1023        };
1024        let body = self.body;
1025        let response = self
1026            .transport
1027            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1028            .await?;
1029        Ok(response)
1030    }
1031}
1032#[doc = "Namespace client for License APIs"]
1033pub struct License<'a> {
1034    transport: &'a Transport,
1035}
1036impl<'a> License<'a> {
1037    #[doc = "Creates a new instance of [License]"]
1038    pub fn new(transport: &'a Transport) -> Self {
1039        Self { transport }
1040    }
1041    pub fn transport(&self) -> &Transport {
1042        self.transport
1043    }
1044    #[doc = "[License Delete API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/delete-license.html)\n\nDeletes licensing information for the cluster"]
1045    pub fn delete<'b>(&'a self) -> LicenseDelete<'a, 'b> {
1046        LicenseDelete::new(self.transport())
1047    }
1048    #[doc = "[License Get API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/get-license.html)\n\nRetrieves licensing information for the cluster"]
1049    pub fn get<'b>(&'a self) -> LicenseGet<'a, 'b> {
1050        LicenseGet::new(self.transport())
1051    }
1052    #[doc = "[License Get Basic Status API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/get-basic-status.html)\n\nRetrieves information about the status of the basic license."]
1053    pub fn get_basic_status<'b>(&'a self) -> LicenseGetBasicStatus<'a, 'b> {
1054        LicenseGetBasicStatus::new(self.transport())
1055    }
1056    #[doc = "[License Get Trial Status API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/get-trial-status.html)\n\nRetrieves information about the status of the trial license."]
1057    pub fn get_trial_status<'b>(&'a self) -> LicenseGetTrialStatus<'a, 'b> {
1058        LicenseGetTrialStatus::new(self.transport())
1059    }
1060    #[doc = "[License Post API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/update-license.html)\n\nUpdates the license for the cluster."]
1061    pub fn post<'b>(&'a self) -> LicensePost<'a, 'b, ()> {
1062        LicensePost::new(self.transport())
1063    }
1064    #[doc = "[License Post Start Basic API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/start-basic.html)\n\nStarts an indefinite basic license."]
1065    pub fn post_start_basic<'b>(&'a self) -> LicensePostStartBasic<'a, 'b, ()> {
1066        LicensePostStartBasic::new(self.transport())
1067    }
1068    #[doc = "[License Post Start Trial API](https://www.elastic.co/guide/en/elasticsearch/reference/9.1/start-trial.html)\n\nstarts a limited time trial license."]
1069    pub fn post_start_trial<'b>(&'a self) -> LicensePostStartTrial<'a, 'b, ()> {
1070        LicensePostStartTrial::new(self.transport())
1071    }
1072}
1073impl Elasticsearch {
1074    #[doc = "Creates a namespace client for License APIs"]
1075    pub fn license(&self) -> License {
1076        License::new(self.transport())
1077    }
1078}