fastly_api/apis/
logging_elasticsearch_api.rs

1/*
2 * Fastly API
3 *
4 * Via the Fastly API you can perform any of the operations that are possible within the management console,  including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/) 
5 *
6 */
7
8
9use reqwest;
10
11use crate::apis::ResponseContent;
12use super::{Error, configuration};
13
14/// struct for passing parameters to the method [`create_log_elasticsearch`]
15#[derive(Clone, Debug, Default)]
16pub struct CreateLogElasticsearchParams {
17    /// Alphanumeric string identifying the service.
18    pub service_id: String,
19    /// Integer identifying a service version.
20    pub version_id: i32,
21    /// The name for the real-time logging configuration.
22    pub name: Option<String>,
23    /// Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. 
24    pub placement: Option<String>,
25    /// The name of an existing condition in the configured endpoint, or leave blank to always execute.
26    pub response_condition: Option<String>,
27    /// A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). Must produce valid JSON that Elasticsearch can ingest.
28    pub format: Option<String>,
29    /// The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. 
30    pub format_version: Option<i32>,
31    /// A secure certificate to authenticate a server with. Must be in PEM format.
32    pub tls_ca_cert: Option<String>,
33    /// The client certificate used to make authenticated requests. Must be in PEM format.
34    pub tls_client_cert: Option<String>,
35    /// The client private key used to make authenticated requests. Must be in PEM format.
36    pub tls_client_key: Option<String>,
37    /// The hostname to verify the server's certificate. This should be one of the Subject Alternative Name (SAN) fields for the certificate. Common Names (CN) are not supported.
38    pub tls_hostname: Option<String>,
39    /// The maximum number of logs sent in one request. Defaults `0` for unbounded.
40    pub request_max_entries: Option<i32>,
41    /// The maximum number of bytes sent in one request. Defaults `0` for unbounded.
42    pub request_max_bytes: Option<i32>,
43    /// The name of the Elasticsearch index to send documents (logs) to. The index must follow the Elasticsearch [index format rules](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html). We support [strftime](https://www.man7.org/linux/man-pages/man3/strftime.3.html) interpolated variables inside braces prefixed with a pound symbol. For example, `#{%F}` will interpolate as `YYYY-MM-DD` with today's date.
44    pub index: Option<String>,
45    /// The URL to stream logs to. Must use HTTPS.
46    pub url: Option<String>,
47    /// The ID of the Elasticsearch ingest pipeline to apply pre-process transformations to before indexing. Learn more about creating a pipeline in the [Elasticsearch docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html).
48    pub pipeline: Option<String>,
49    /// Basic Auth username.
50    pub user: Option<String>,
51    /// Basic Auth password.
52    pub password: Option<String>
53}
54
55/// struct for passing parameters to the method [`delete_log_elasticsearch`]
56#[derive(Clone, Debug, Default)]
57pub struct DeleteLogElasticsearchParams {
58    /// Alphanumeric string identifying the service.
59    pub service_id: String,
60    /// Integer identifying a service version.
61    pub version_id: i32,
62    /// The name for the real-time logging configuration.
63    pub logging_elasticsearch_name: String
64}
65
66/// struct for passing parameters to the method [`get_log_elasticsearch`]
67#[derive(Clone, Debug, Default)]
68pub struct GetLogElasticsearchParams {
69    /// Alphanumeric string identifying the service.
70    pub service_id: String,
71    /// Integer identifying a service version.
72    pub version_id: i32,
73    /// The name for the real-time logging configuration.
74    pub logging_elasticsearch_name: String
75}
76
77/// struct for passing parameters to the method [`list_log_elasticsearch`]
78#[derive(Clone, Debug, Default)]
79pub struct ListLogElasticsearchParams {
80    /// Alphanumeric string identifying the service.
81    pub service_id: String,
82    /// Integer identifying a service version.
83    pub version_id: i32
84}
85
86/// struct for passing parameters to the method [`update_log_elasticsearch`]
87#[derive(Clone, Debug, Default)]
88pub struct UpdateLogElasticsearchParams {
89    /// Alphanumeric string identifying the service.
90    pub service_id: String,
91    /// Integer identifying a service version.
92    pub version_id: i32,
93    /// The name for the real-time logging configuration.
94    pub logging_elasticsearch_name: String,
95    /// The name for the real-time logging configuration.
96    pub name: Option<String>,
97    /// Where in the generated VCL the logging call should be placed. If not set, endpoints with `format_version` of 2 are placed in `vcl_log` and those with `format_version` of 1 are placed in `vcl_deliver`. 
98    pub placement: Option<String>,
99    /// The name of an existing condition in the configured endpoint, or leave blank to always execute.
100    pub response_condition: Option<String>,
101    /// A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats). Must produce valid JSON that Elasticsearch can ingest.
102    pub format: Option<String>,
103    /// The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. 
104    pub format_version: Option<i32>,
105    /// A secure certificate to authenticate a server with. Must be in PEM format.
106    pub tls_ca_cert: Option<String>,
107    /// The client certificate used to make authenticated requests. Must be in PEM format.
108    pub tls_client_cert: Option<String>,
109    /// The client private key used to make authenticated requests. Must be in PEM format.
110    pub tls_client_key: Option<String>,
111    /// The hostname to verify the server's certificate. This should be one of the Subject Alternative Name (SAN) fields for the certificate. Common Names (CN) are not supported.
112    pub tls_hostname: Option<String>,
113    /// The maximum number of logs sent in one request. Defaults `0` for unbounded.
114    pub request_max_entries: Option<i32>,
115    /// The maximum number of bytes sent in one request. Defaults `0` for unbounded.
116    pub request_max_bytes: Option<i32>,
117    /// The name of the Elasticsearch index to send documents (logs) to. The index must follow the Elasticsearch [index format rules](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html). We support [strftime](https://www.man7.org/linux/man-pages/man3/strftime.3.html) interpolated variables inside braces prefixed with a pound symbol. For example, `#{%F}` will interpolate as `YYYY-MM-DD` with today's date.
118    pub index: Option<String>,
119    /// The URL to stream logs to. Must use HTTPS.
120    pub url: Option<String>,
121    /// The ID of the Elasticsearch ingest pipeline to apply pre-process transformations to before indexing. Learn more about creating a pipeline in the [Elasticsearch docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html).
122    pub pipeline: Option<String>,
123    /// Basic Auth username.
124    pub user: Option<String>,
125    /// Basic Auth password.
126    pub password: Option<String>
127}
128
129
130/// struct for typed errors of method [`create_log_elasticsearch`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum CreateLogElasticsearchError {
134    UnknownValue(serde_json::Value),
135}
136
137/// struct for typed errors of method [`delete_log_elasticsearch`]
138#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum DeleteLogElasticsearchError {
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`get_log_elasticsearch`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetLogElasticsearchError {
148    UnknownValue(serde_json::Value),
149}
150
151/// struct for typed errors of method [`list_log_elasticsearch`]
152#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum ListLogElasticsearchError {
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`update_log_elasticsearch`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum UpdateLogElasticsearchError {
162    UnknownValue(serde_json::Value),
163}
164
165
166/// Create a Elasticsearch logging endpoint for a particular service and version.
167pub async fn create_log_elasticsearch(configuration: &mut configuration::Configuration, params: CreateLogElasticsearchParams) -> Result<crate::models::LoggingElasticsearchResponse, Error<CreateLogElasticsearchError>> {
168    let local_var_configuration = configuration;
169
170    // unbox the parameters
171    let service_id = params.service_id;
172    let version_id = params.version_id;
173    let name = params.name;
174    let placement = params.placement;
175    let response_condition = params.response_condition;
176    let format = params.format;
177    let format_version = params.format_version;
178    let tls_ca_cert = params.tls_ca_cert;
179    let tls_client_cert = params.tls_client_cert;
180    let tls_client_key = params.tls_client_key;
181    let tls_hostname = params.tls_hostname;
182    let request_max_entries = params.request_max_entries;
183    let request_max_bytes = params.request_max_bytes;
184    let index = params.index;
185    let url = params.url;
186    let pipeline = params.pipeline;
187    let user = params.user;
188    let password = params.password;
189
190
191    let local_var_client = &local_var_configuration.client;
192
193    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/elasticsearch", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id);
194    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
195
196    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
197        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
198    }
199    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
200        let local_var_key = local_var_apikey.key.clone();
201        let local_var_value = match local_var_apikey.prefix {
202            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
203            None => local_var_key,
204        };
205        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
206    };
207    let mut local_var_form_params = std::collections::HashMap::new();
208    if let Some(local_var_param_value) = name {
209        local_var_form_params.insert("name", local_var_param_value.to_string());
210    }
211    if let Some(local_var_param_value) = placement {
212        local_var_form_params.insert("placement", local_var_param_value.to_string());
213    }
214    if let Some(local_var_param_value) = response_condition {
215        local_var_form_params.insert("response_condition", local_var_param_value.to_string());
216    }
217    if let Some(local_var_param_value) = format {
218        local_var_form_params.insert("format", local_var_param_value.to_string());
219    }
220    if let Some(local_var_param_value) = format_version {
221        local_var_form_params.insert("format_version", local_var_param_value.to_string());
222    }
223    if let Some(local_var_param_value) = tls_ca_cert {
224        local_var_form_params.insert("tls_ca_cert", local_var_param_value.to_string());
225    }
226    if let Some(local_var_param_value) = tls_client_cert {
227        local_var_form_params.insert("tls_client_cert", local_var_param_value.to_string());
228    }
229    if let Some(local_var_param_value) = tls_client_key {
230        local_var_form_params.insert("tls_client_key", local_var_param_value.to_string());
231    }
232    if let Some(local_var_param_value) = tls_hostname {
233        local_var_form_params.insert("tls_hostname", local_var_param_value.to_string());
234    }
235    if let Some(local_var_param_value) = request_max_entries {
236        local_var_form_params.insert("request_max_entries", local_var_param_value.to_string());
237    }
238    if let Some(local_var_param_value) = request_max_bytes {
239        local_var_form_params.insert("request_max_bytes", local_var_param_value.to_string());
240    }
241    if let Some(local_var_param_value) = index {
242        local_var_form_params.insert("index", local_var_param_value.to_string());
243    }
244    if let Some(local_var_param_value) = url {
245        local_var_form_params.insert("url", local_var_param_value.to_string());
246    }
247    if let Some(local_var_param_value) = pipeline {
248        local_var_form_params.insert("pipeline", local_var_param_value.to_string());
249    }
250    if let Some(local_var_param_value) = user {
251        local_var_form_params.insert("user", local_var_param_value.to_string());
252    }
253    if let Some(local_var_param_value) = password {
254        local_var_form_params.insert("password", local_var_param_value.to_string());
255    }
256    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
257
258    let local_var_req = local_var_req_builder.build()?;
259    let local_var_resp = local_var_client.execute(local_var_req).await?;
260
261    if "POST" != "GET" && "POST" != "HEAD" {
262      let headers = local_var_resp.headers();
263      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
264          Some(v) => v.to_str().unwrap().parse().unwrap(),
265          None => configuration::DEFAULT_RATELIMIT,
266      };
267      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
268          Some(v) => v.to_str().unwrap().parse().unwrap(),
269          None => 0,
270      };
271    }
272
273    let local_var_status = local_var_resp.status();
274    let local_var_content = local_var_resp.text().await?;
275
276    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
277        serde_json::from_str(&local_var_content).map_err(Error::from)
278    } else {
279        let local_var_entity: Option<CreateLogElasticsearchError> = serde_json::from_str(&local_var_content).ok();
280        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
281        Err(Error::ResponseError(local_var_error))
282    }
283}
284
285/// Delete the Elasticsearch logging endpoint for a particular service and version.
286pub async fn delete_log_elasticsearch(configuration: &mut configuration::Configuration, params: DeleteLogElasticsearchParams) -> Result<crate::models::InlineResponse200, Error<DeleteLogElasticsearchError>> {
287    let local_var_configuration = configuration;
288
289    // unbox the parameters
290    let service_id = params.service_id;
291    let version_id = params.version_id;
292    let logging_elasticsearch_name = params.logging_elasticsearch_name;
293
294
295    let local_var_client = &local_var_configuration.client;
296
297    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/elasticsearch/{logging_elasticsearch_name}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id, logging_elasticsearch_name=crate::apis::urlencode(logging_elasticsearch_name));
298    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
299
300    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
301        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
302    }
303    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
304        let local_var_key = local_var_apikey.key.clone();
305        let local_var_value = match local_var_apikey.prefix {
306            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
307            None => local_var_key,
308        };
309        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
310    };
311
312    let local_var_req = local_var_req_builder.build()?;
313    let local_var_resp = local_var_client.execute(local_var_req).await?;
314
315    if "DELETE" != "GET" && "DELETE" != "HEAD" {
316      let headers = local_var_resp.headers();
317      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
318          Some(v) => v.to_str().unwrap().parse().unwrap(),
319          None => configuration::DEFAULT_RATELIMIT,
320      };
321      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
322          Some(v) => v.to_str().unwrap().parse().unwrap(),
323          None => 0,
324      };
325    }
326
327    let local_var_status = local_var_resp.status();
328    let local_var_content = local_var_resp.text().await?;
329
330    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
331        serde_json::from_str(&local_var_content).map_err(Error::from)
332    } else {
333        let local_var_entity: Option<DeleteLogElasticsearchError> = serde_json::from_str(&local_var_content).ok();
334        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
335        Err(Error::ResponseError(local_var_error))
336    }
337}
338
339/// Get the Elasticsearch logging endpoint for a particular service and version.
340pub async fn get_log_elasticsearch(configuration: &mut configuration::Configuration, params: GetLogElasticsearchParams) -> Result<crate::models::LoggingElasticsearchResponse, Error<GetLogElasticsearchError>> {
341    let local_var_configuration = configuration;
342
343    // unbox the parameters
344    let service_id = params.service_id;
345    let version_id = params.version_id;
346    let logging_elasticsearch_name = params.logging_elasticsearch_name;
347
348
349    let local_var_client = &local_var_configuration.client;
350
351    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/elasticsearch/{logging_elasticsearch_name}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id, logging_elasticsearch_name=crate::apis::urlencode(logging_elasticsearch_name));
352    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
353
354    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
355        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
356    }
357    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
358        let local_var_key = local_var_apikey.key.clone();
359        let local_var_value = match local_var_apikey.prefix {
360            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
361            None => local_var_key,
362        };
363        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
364    };
365
366    let local_var_req = local_var_req_builder.build()?;
367    let local_var_resp = local_var_client.execute(local_var_req).await?;
368
369    if "GET" != "GET" && "GET" != "HEAD" {
370      let headers = local_var_resp.headers();
371      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
372          Some(v) => v.to_str().unwrap().parse().unwrap(),
373          None => configuration::DEFAULT_RATELIMIT,
374      };
375      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
376          Some(v) => v.to_str().unwrap().parse().unwrap(),
377          None => 0,
378      };
379    }
380
381    let local_var_status = local_var_resp.status();
382    let local_var_content = local_var_resp.text().await?;
383
384    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
385        serde_json::from_str(&local_var_content).map_err(Error::from)
386    } else {
387        let local_var_entity: Option<GetLogElasticsearchError> = serde_json::from_str(&local_var_content).ok();
388        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
389        Err(Error::ResponseError(local_var_error))
390    }
391}
392
393/// List all of the Elasticsearch logging endpoints for a particular service and version.
394pub async fn list_log_elasticsearch(configuration: &mut configuration::Configuration, params: ListLogElasticsearchParams) -> Result<Vec<crate::models::LoggingElasticsearchResponse>, Error<ListLogElasticsearchError>> {
395    let local_var_configuration = configuration;
396
397    // unbox the parameters
398    let service_id = params.service_id;
399    let version_id = params.version_id;
400
401
402    let local_var_client = &local_var_configuration.client;
403
404    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/elasticsearch", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id);
405    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
406
407    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
408        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
409    }
410    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
411        let local_var_key = local_var_apikey.key.clone();
412        let local_var_value = match local_var_apikey.prefix {
413            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
414            None => local_var_key,
415        };
416        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
417    };
418
419    let local_var_req = local_var_req_builder.build()?;
420    let local_var_resp = local_var_client.execute(local_var_req).await?;
421
422    if "GET" != "GET" && "GET" != "HEAD" {
423      let headers = local_var_resp.headers();
424      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
425          Some(v) => v.to_str().unwrap().parse().unwrap(),
426          None => configuration::DEFAULT_RATELIMIT,
427      };
428      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
429          Some(v) => v.to_str().unwrap().parse().unwrap(),
430          None => 0,
431      };
432    }
433
434    let local_var_status = local_var_resp.status();
435    let local_var_content = local_var_resp.text().await?;
436
437    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
438        serde_json::from_str(&local_var_content).map_err(Error::from)
439    } else {
440        let local_var_entity: Option<ListLogElasticsearchError> = serde_json::from_str(&local_var_content).ok();
441        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
442        Err(Error::ResponseError(local_var_error))
443    }
444}
445
446/// Update the Elasticsearch logging endpoint for a particular service and version.
447pub async fn update_log_elasticsearch(configuration: &mut configuration::Configuration, params: UpdateLogElasticsearchParams) -> Result<crate::models::LoggingElasticsearchResponse, Error<UpdateLogElasticsearchError>> {
448    let local_var_configuration = configuration;
449
450    // unbox the parameters
451    let service_id = params.service_id;
452    let version_id = params.version_id;
453    let logging_elasticsearch_name = params.logging_elasticsearch_name;
454    let name = params.name;
455    let placement = params.placement;
456    let response_condition = params.response_condition;
457    let format = params.format;
458    let format_version = params.format_version;
459    let tls_ca_cert = params.tls_ca_cert;
460    let tls_client_cert = params.tls_client_cert;
461    let tls_client_key = params.tls_client_key;
462    let tls_hostname = params.tls_hostname;
463    let request_max_entries = params.request_max_entries;
464    let request_max_bytes = params.request_max_bytes;
465    let index = params.index;
466    let url = params.url;
467    let pipeline = params.pipeline;
468    let user = params.user;
469    let password = params.password;
470
471
472    let local_var_client = &local_var_configuration.client;
473
474    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/elasticsearch/{logging_elasticsearch_name}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id, logging_elasticsearch_name=crate::apis::urlencode(logging_elasticsearch_name));
475    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
476
477    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
478        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
479    }
480    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
481        let local_var_key = local_var_apikey.key.clone();
482        let local_var_value = match local_var_apikey.prefix {
483            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
484            None => local_var_key,
485        };
486        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
487    };
488    let mut local_var_form_params = std::collections::HashMap::new();
489    if let Some(local_var_param_value) = name {
490        local_var_form_params.insert("name", local_var_param_value.to_string());
491    }
492    if let Some(local_var_param_value) = placement {
493        local_var_form_params.insert("placement", local_var_param_value.to_string());
494    }
495    if let Some(local_var_param_value) = response_condition {
496        local_var_form_params.insert("response_condition", local_var_param_value.to_string());
497    }
498    if let Some(local_var_param_value) = format {
499        local_var_form_params.insert("format", local_var_param_value.to_string());
500    }
501    if let Some(local_var_param_value) = format_version {
502        local_var_form_params.insert("format_version", local_var_param_value.to_string());
503    }
504    if let Some(local_var_param_value) = tls_ca_cert {
505        local_var_form_params.insert("tls_ca_cert", local_var_param_value.to_string());
506    }
507    if let Some(local_var_param_value) = tls_client_cert {
508        local_var_form_params.insert("tls_client_cert", local_var_param_value.to_string());
509    }
510    if let Some(local_var_param_value) = tls_client_key {
511        local_var_form_params.insert("tls_client_key", local_var_param_value.to_string());
512    }
513    if let Some(local_var_param_value) = tls_hostname {
514        local_var_form_params.insert("tls_hostname", local_var_param_value.to_string());
515    }
516    if let Some(local_var_param_value) = request_max_entries {
517        local_var_form_params.insert("request_max_entries", local_var_param_value.to_string());
518    }
519    if let Some(local_var_param_value) = request_max_bytes {
520        local_var_form_params.insert("request_max_bytes", local_var_param_value.to_string());
521    }
522    if let Some(local_var_param_value) = index {
523        local_var_form_params.insert("index", local_var_param_value.to_string());
524    }
525    if let Some(local_var_param_value) = url {
526        local_var_form_params.insert("url", local_var_param_value.to_string());
527    }
528    if let Some(local_var_param_value) = pipeline {
529        local_var_form_params.insert("pipeline", local_var_param_value.to_string());
530    }
531    if let Some(local_var_param_value) = user {
532        local_var_form_params.insert("user", local_var_param_value.to_string());
533    }
534    if let Some(local_var_param_value) = password {
535        local_var_form_params.insert("password", local_var_param_value.to_string());
536    }
537    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
538
539    let local_var_req = local_var_req_builder.build()?;
540    let local_var_resp = local_var_client.execute(local_var_req).await?;
541
542    if "PUT" != "GET" && "PUT" != "HEAD" {
543      let headers = local_var_resp.headers();
544      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
545          Some(v) => v.to_str().unwrap().parse().unwrap(),
546          None => configuration::DEFAULT_RATELIMIT,
547      };
548      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
549          Some(v) => v.to_str().unwrap().parse().unwrap(),
550          None => 0,
551      };
552    }
553
554    let local_var_status = local_var_resp.status();
555    let local_var_content = local_var_resp.text().await?;
556
557    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
558        serde_json::from_str(&local_var_content).map_err(Error::from)
559    } else {
560        let local_var_entity: Option<UpdateLogElasticsearchError> = serde_json::from_str(&local_var_content).ok();
561        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
562        Err(Error::ResponseError(local_var_error))
563    }
564}
565