Skip to content

Commit eb59c6a

Browse files
committed
Update generated code
1 parent 4d07875 commit eb59c6a

File tree

6 files changed

+197
-130
lines changed

6 files changed

+197
-130
lines changed

api_generator/rest_specs/snapshot.get_features.json renamed to api_generator/rest_specs/features.get_features.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"snapshot.get_features":{
2+
"features.get_features":{
33
"documentation":{
4-
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html",
5-
"description":"Returns a list of features which can be snapshotted in this cluster."
4+
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/get-features-api.html",
5+
"description":"Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot"
66
},
77
"stability":"stable",
88
"visibility":"public",
@@ -12,7 +12,7 @@
1212
"url":{
1313
"paths":[
1414
{
15-
"path":"/_snapshottable_features",
15+
"path":"/_features",
1616
"methods":[
1717
"GET"
1818
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.x
1+
7.12

elasticsearch/src/.generated.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ written = [
77
'dangling_indices.rs',
88
'enrich.rs',
99
'eql.rs',
10+
'features.rs',
1011
'graph.rs',
1112
'ilm.rs',
1213
'indices.rs',

elasticsearch/src/features.rs

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
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+
//! Features APIs
28+
//!
29+
//! Allows [introspecting and managing features](https://www.elastic.co/guide/en/elasticsearch/reference/current/features-apis.html) provided by Elasticsearch and Elasticsearch plugins.
30+
31+
#![allow(unused_imports)]
32+
use crate::{
33+
client::Elasticsearch,
34+
error::Error,
35+
http::{
36+
headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE},
37+
request::{Body, JsonBody, NdBody, PARTS_ENCODED},
38+
response::Response,
39+
transport::Transport,
40+
Method,
41+
},
42+
params::*,
43+
};
44+
use percent_encoding::percent_encode;
45+
use serde::Serialize;
46+
use std::{borrow::Cow, time::Duration};
47+
#[derive(Debug, Clone, PartialEq)]
48+
#[doc = "API parts for the Features Get Features API"]
49+
pub enum FeaturesGetFeaturesParts {
50+
#[doc = "No parts"]
51+
None,
52+
}
53+
impl FeaturesGetFeaturesParts {
54+
#[doc = "Builds a relative URL path to the Features Get Features API"]
55+
pub fn url(self) -> Cow<'static, str> {
56+
match self {
57+
FeaturesGetFeaturesParts::None => "/_features".into(),
58+
}
59+
}
60+
}
61+
#[doc = "Builder for the [Features Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-features-api.html)\n\nGets a list of features which can be included in snapshots using the feature_states field when creating a snapshot"]
62+
#[derive(Clone, Debug)]
63+
pub struct FeaturesGetFeatures<'a, 'b> {
64+
transport: &'a Transport,
65+
parts: FeaturesGetFeaturesParts,
66+
error_trace: Option<bool>,
67+
filter_path: Option<&'b [&'b str]>,
68+
headers: HeaderMap,
69+
human: Option<bool>,
70+
master_timeout: Option<&'b str>,
71+
pretty: Option<bool>,
72+
request_timeout: Option<Duration>,
73+
source: Option<&'b str>,
74+
}
75+
impl<'a, 'b> FeaturesGetFeatures<'a, 'b> {
76+
#[doc = "Creates a new instance of [FeaturesGetFeatures]"]
77+
pub fn new(transport: &'a Transport) -> Self {
78+
let headers = HeaderMap::new();
79+
FeaturesGetFeatures {
80+
transport,
81+
parts: FeaturesGetFeaturesParts::None,
82+
headers,
83+
error_trace: None,
84+
filter_path: None,
85+
human: None,
86+
master_timeout: None,
87+
pretty: None,
88+
request_timeout: None,
89+
source: None,
90+
}
91+
}
92+
#[doc = "Include the stack trace of returned errors."]
93+
pub fn error_trace(mut self, error_trace: bool) -> Self {
94+
self.error_trace = Some(error_trace);
95+
self
96+
}
97+
#[doc = "A comma-separated list of filters used to reduce the response."]
98+
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
99+
self.filter_path = Some(filter_path);
100+
self
101+
}
102+
#[doc = "Adds a HTTP header"]
103+
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
104+
self.headers.insert(key, value);
105+
self
106+
}
107+
#[doc = "Return human readable values for statistics."]
108+
pub fn human(mut self, human: bool) -> Self {
109+
self.human = Some(human);
110+
self
111+
}
112+
#[doc = "Explicit operation timeout for connection to master node"]
113+
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
114+
self.master_timeout = Some(master_timeout);
115+
self
116+
}
117+
#[doc = "Pretty format the returned JSON response."]
118+
pub fn pretty(mut self, pretty: bool) -> Self {
119+
self.pretty = Some(pretty);
120+
self
121+
}
122+
#[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."]
123+
pub fn request_timeout(mut self, timeout: Duration) -> Self {
124+
self.request_timeout = Some(timeout);
125+
self
126+
}
127+
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
128+
pub fn source(mut self, source: &'b str) -> Self {
129+
self.source = Some(source);
130+
self
131+
}
132+
#[doc = "Creates an asynchronous call to the Features Get Features API that can be awaited"]
133+
pub async fn send(self) -> Result<Response, Error> {
134+
let path = self.parts.url();
135+
let method = Method::Get;
136+
let headers = self.headers;
137+
let timeout = self.request_timeout;
138+
let query_string = {
139+
#[serde_with::skip_serializing_none]
140+
#[derive(Serialize)]
141+
struct QueryParams<'b> {
142+
error_trace: Option<bool>,
143+
#[serde(serialize_with = "crate::client::serialize_coll_qs")]
144+
filter_path: Option<&'b [&'b str]>,
145+
human: Option<bool>,
146+
master_timeout: Option<&'b str>,
147+
pretty: Option<bool>,
148+
source: Option<&'b str>,
149+
}
150+
let query_params = QueryParams {
151+
error_trace: self.error_trace,
152+
filter_path: self.filter_path,
153+
human: self.human,
154+
master_timeout: self.master_timeout,
155+
pretty: self.pretty,
156+
source: self.source,
157+
};
158+
Some(query_params)
159+
};
160+
let body = Option::<()>::None;
161+
let response = self
162+
.transport
163+
.send(method, &path, headers, query_string.as_ref(), body, timeout)
164+
.await?;
165+
Ok(response)
166+
}
167+
}
168+
#[doc = "Namespace client for Features APIs"]
169+
pub struct Features<'a> {
170+
transport: &'a Transport,
171+
}
172+
impl<'a> Features<'a> {
173+
#[doc = "Creates a new instance of [Features]"]
174+
pub fn new(transport: &'a Transport) -> Self {
175+
Self { transport }
176+
}
177+
pub fn transport(&self) -> &Transport {
178+
self.transport
179+
}
180+
#[doc = "[Features Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/get-features-api.html)\n\nGets a list of features which can be included in snapshots using the feature_states field when creating a snapshot"]
181+
pub fn get_features<'b>(&'a self) -> FeaturesGetFeatures<'a, 'b> {
182+
FeaturesGetFeatures::new(self.transport())
183+
}
184+
}
185+
impl Elasticsearch {
186+
#[doc = "Creates a namespace client for Features APIs"]
187+
pub fn features(&self) -> Features {
188+
Features::new(self.transport())
189+
}
190+
}

elasticsearch/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ pub mod cluster;
372372
pub mod dangling_indices;
373373
pub mod enrich;
374374
pub mod eql;
375+
pub mod features;
375376
pub mod graph;
376377
pub mod ilm;
377378
pub mod indices;

elasticsearch/src/snapshot.rs

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,127 +1145,6 @@ impl<'a, 'b> SnapshotGet<'a, 'b> {
11451145
}
11461146
}
11471147
#[derive(Debug, Clone, PartialEq)]
1148-
#[doc = "API parts for the Snapshot Get Features API"]
1149-
pub enum SnapshotGetFeaturesParts {
1150-
#[doc = "No parts"]
1151-
None,
1152-
}
1153-
impl SnapshotGetFeaturesParts {
1154-
#[doc = "Builds a relative URL path to the Snapshot Get Features API"]
1155-
pub fn url(self) -> Cow<'static, str> {
1156-
match self {
1157-
SnapshotGetFeaturesParts::None => "/_snapshottable_features".into(),
1158-
}
1159-
}
1160-
}
1161-
#[doc = "Builder for the [Snapshot Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns a list of features which can be snapshotted in this cluster."]
1162-
#[derive(Clone, Debug)]
1163-
pub struct SnapshotGetFeatures<'a, 'b> {
1164-
transport: &'a Transport,
1165-
parts: SnapshotGetFeaturesParts,
1166-
error_trace: Option<bool>,
1167-
filter_path: Option<&'b [&'b str]>,
1168-
headers: HeaderMap,
1169-
human: Option<bool>,
1170-
master_timeout: Option<&'b str>,
1171-
pretty: Option<bool>,
1172-
request_timeout: Option<Duration>,
1173-
source: Option<&'b str>,
1174-
}
1175-
impl<'a, 'b> SnapshotGetFeatures<'a, 'b> {
1176-
#[doc = "Creates a new instance of [SnapshotGetFeatures]"]
1177-
pub fn new(transport: &'a Transport) -> Self {
1178-
let headers = HeaderMap::new();
1179-
SnapshotGetFeatures {
1180-
transport,
1181-
parts: SnapshotGetFeaturesParts::None,
1182-
headers,
1183-
error_trace: None,
1184-
filter_path: None,
1185-
human: None,
1186-
master_timeout: None,
1187-
pretty: None,
1188-
request_timeout: None,
1189-
source: None,
1190-
}
1191-
}
1192-
#[doc = "Include the stack trace of returned errors."]
1193-
pub fn error_trace(mut self, error_trace: bool) -> Self {
1194-
self.error_trace = Some(error_trace);
1195-
self
1196-
}
1197-
#[doc = "A comma-separated list of filters used to reduce the response."]
1198-
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1199-
self.filter_path = Some(filter_path);
1200-
self
1201-
}
1202-
#[doc = "Adds a HTTP header"]
1203-
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1204-
self.headers.insert(key, value);
1205-
self
1206-
}
1207-
#[doc = "Return human readable values for statistics."]
1208-
pub fn human(mut self, human: bool) -> Self {
1209-
self.human = Some(human);
1210-
self
1211-
}
1212-
#[doc = "Explicit operation timeout for connection to master node"]
1213-
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1214-
self.master_timeout = Some(master_timeout);
1215-
self
1216-
}
1217-
#[doc = "Pretty format the returned JSON response."]
1218-
pub fn pretty(mut self, pretty: bool) -> Self {
1219-
self.pretty = Some(pretty);
1220-
self
1221-
}
1222-
#[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."]
1223-
pub fn request_timeout(mut self, timeout: Duration) -> Self {
1224-
self.request_timeout = Some(timeout);
1225-
self
1226-
}
1227-
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1228-
pub fn source(mut self, source: &'b str) -> Self {
1229-
self.source = Some(source);
1230-
self
1231-
}
1232-
#[doc = "Creates an asynchronous call to the Snapshot Get Features API that can be awaited"]
1233-
pub async fn send(self) -> Result<Response, Error> {
1234-
let path = self.parts.url();
1235-
let method = Method::Get;
1236-
let headers = self.headers;
1237-
let timeout = self.request_timeout;
1238-
let query_string = {
1239-
#[serde_with::skip_serializing_none]
1240-
#[derive(Serialize)]
1241-
struct QueryParams<'b> {
1242-
error_trace: Option<bool>,
1243-
#[serde(serialize_with = "crate::client::serialize_coll_qs")]
1244-
filter_path: Option<&'b [&'b str]>,
1245-
human: Option<bool>,
1246-
master_timeout: Option<&'b str>,
1247-
pretty: Option<bool>,
1248-
source: Option<&'b str>,
1249-
}
1250-
let query_params = QueryParams {
1251-
error_trace: self.error_trace,
1252-
filter_path: self.filter_path,
1253-
human: self.human,
1254-
master_timeout: self.master_timeout,
1255-
pretty: self.pretty,
1256-
source: self.source,
1257-
};
1258-
Some(query_params)
1259-
};
1260-
let body = Option::<()>::None;
1261-
let response = self
1262-
.transport
1263-
.send(method, &path, headers, query_string.as_ref(), body, timeout)
1264-
.await?;
1265-
Ok(response)
1266-
}
1267-
}
1268-
#[derive(Debug, Clone, PartialEq)]
12691148
#[doc = "API parts for the Snapshot Get Repository API"]
12701149
pub enum SnapshotGetRepositoryParts<'b> {
12711150
#[doc = "No parts"]
@@ -1946,10 +1825,6 @@ impl<'a> Snapshot<'a> {
19461825
pub fn get<'b>(&'a self, parts: SnapshotGetParts<'b>) -> SnapshotGet<'a, 'b> {
19471826
SnapshotGet::new(self.transport(), parts)
19481827
}
1949-
#[doc = "[Snapshot Get Features API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns a list of features which can be snapshotted in this cluster."]
1950-
pub fn get_features<'b>(&'a self) -> SnapshotGetFeatures<'a, 'b> {
1951-
SnapshotGetFeatures::new(self.transport())
1952-
}
19531828
#[doc = "[Snapshot Get Repository API](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/modules-snapshots.html)\n\nReturns information about a repository."]
19541829
pub fn get_repository<'b>(
19551830
&'a self,

0 commit comments

Comments
 (0)