fastly_api/apis/
logging_syslog_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_syslog`]
15#[derive(Clone, Debug, Default)]
16pub struct CreateLogSyslogParams {
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).
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    /// A hostname or IPv4 address.
40    pub address: Option<String>,
41    /// The port number.
42    pub port: Option<i32>,
43    pub message_type: Option<crate::models::LoggingMessageType>,
44    /// The hostname used for the syslog endpoint.
45    pub hostname: Option<String>,
46    /// The IPv4 address used for the syslog endpoint.
47    pub ipv4: Option<String>,
48    /// Whether to prepend each message with a specific token.
49    pub token: Option<String>,
50    pub use_tls: Option<crate::models::LoggingUseTlsString>
51}
52
53/// struct for passing parameters to the method [`delete_log_syslog`]
54#[derive(Clone, Debug, Default)]
55pub struct DeleteLogSyslogParams {
56    /// Alphanumeric string identifying the service.
57    pub service_id: String,
58    /// Integer identifying a service version.
59    pub version_id: i32,
60    /// The name for the real-time logging configuration.
61    pub logging_syslog_name: String
62}
63
64/// struct for passing parameters to the method [`get_log_syslog`]
65#[derive(Clone, Debug, Default)]
66pub struct GetLogSyslogParams {
67    /// Alphanumeric string identifying the service.
68    pub service_id: String,
69    /// Integer identifying a service version.
70    pub version_id: i32,
71    /// The name for the real-time logging configuration.
72    pub logging_syslog_name: String
73}
74
75/// struct for passing parameters to the method [`list_log_syslog`]
76#[derive(Clone, Debug, Default)]
77pub struct ListLogSyslogParams {
78    /// Alphanumeric string identifying the service.
79    pub service_id: String,
80    /// Integer identifying a service version.
81    pub version_id: i32
82}
83
84/// struct for passing parameters to the method [`update_log_syslog`]
85#[derive(Clone, Debug, Default)]
86pub struct UpdateLogSyslogParams {
87    /// Alphanumeric string identifying the service.
88    pub service_id: String,
89    /// Integer identifying a service version.
90    pub version_id: i32,
91    /// The name for the real-time logging configuration.
92    pub logging_syslog_name: String,
93    /// The name for the real-time logging configuration.
94    pub name: Option<String>,
95    /// 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`. 
96    pub placement: Option<String>,
97    /// The name of an existing condition in the configured endpoint, or leave blank to always execute.
98    pub response_condition: Option<String>,
99    /// A Fastly [log format string](https://docs.fastly.com/en/guides/custom-log-formats).
100    pub format: Option<String>,
101    /// 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`. 
102    pub format_version: Option<i32>,
103    /// A secure certificate to authenticate a server with. Must be in PEM format.
104    pub tls_ca_cert: Option<String>,
105    /// The client certificate used to make authenticated requests. Must be in PEM format.
106    pub tls_client_cert: Option<String>,
107    /// The client private key used to make authenticated requests. Must be in PEM format.
108    pub tls_client_key: Option<String>,
109    /// 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.
110    pub tls_hostname: Option<String>,
111    /// A hostname or IPv4 address.
112    pub address: Option<String>,
113    /// The port number.
114    pub port: Option<i32>,
115    pub message_type: Option<crate::models::LoggingMessageType>,
116    /// The hostname used for the syslog endpoint.
117    pub hostname: Option<String>,
118    /// The IPv4 address used for the syslog endpoint.
119    pub ipv4: Option<String>,
120    /// Whether to prepend each message with a specific token.
121    pub token: Option<String>,
122    pub use_tls: Option<crate::models::LoggingUseTlsString>
123}
124
125
126/// struct for typed errors of method [`create_log_syslog`]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum CreateLogSyslogError {
130    UnknownValue(serde_json::Value),
131}
132
133/// struct for typed errors of method [`delete_log_syslog`]
134#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum DeleteLogSyslogError {
137    UnknownValue(serde_json::Value),
138}
139
140/// struct for typed errors of method [`get_log_syslog`]
141#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum GetLogSyslogError {
144    UnknownValue(serde_json::Value),
145}
146
147/// struct for typed errors of method [`list_log_syslog`]
148#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum ListLogSyslogError {
151    UnknownValue(serde_json::Value),
152}
153
154/// struct for typed errors of method [`update_log_syslog`]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum UpdateLogSyslogError {
158    UnknownValue(serde_json::Value),
159}
160
161
162/// Create a Syslog for a particular service and version.
163pub async fn create_log_syslog(configuration: &mut configuration::Configuration, params: CreateLogSyslogParams) -> Result<crate::models::LoggingSyslogResponse, Error<CreateLogSyslogError>> {
164    let local_var_configuration = configuration;
165
166    // unbox the parameters
167    let service_id = params.service_id;
168    let version_id = params.version_id;
169    let name = params.name;
170    let placement = params.placement;
171    let response_condition = params.response_condition;
172    let format = params.format;
173    let format_version = params.format_version;
174    let tls_ca_cert = params.tls_ca_cert;
175    let tls_client_cert = params.tls_client_cert;
176    let tls_client_key = params.tls_client_key;
177    let tls_hostname = params.tls_hostname;
178    let address = params.address;
179    let port = params.port;
180    let message_type = params.message_type;
181    let hostname = params.hostname;
182    let ipv4 = params.ipv4;
183    let token = params.token;
184    let use_tls = params.use_tls;
185
186
187    let local_var_client = &local_var_configuration.client;
188
189    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/syslog", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id);
190    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
191
192    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
193        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
194    }
195    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
196        let local_var_key = local_var_apikey.key.clone();
197        let local_var_value = match local_var_apikey.prefix {
198            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
199            None => local_var_key,
200        };
201        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
202    };
203    let mut local_var_form_params = std::collections::HashMap::new();
204    if let Some(local_var_param_value) = name {
205        local_var_form_params.insert("name", local_var_param_value.to_string());
206    }
207    if let Some(local_var_param_value) = placement {
208        local_var_form_params.insert("placement", local_var_param_value.to_string());
209    }
210    if let Some(local_var_param_value) = response_condition {
211        local_var_form_params.insert("response_condition", local_var_param_value.to_string());
212    }
213    if let Some(local_var_param_value) = format {
214        local_var_form_params.insert("format", local_var_param_value.to_string());
215    }
216    if let Some(local_var_param_value) = format_version {
217        local_var_form_params.insert("format_version", local_var_param_value.to_string());
218    }
219    if let Some(local_var_param_value) = tls_ca_cert {
220        local_var_form_params.insert("tls_ca_cert", local_var_param_value.to_string());
221    }
222    if let Some(local_var_param_value) = tls_client_cert {
223        local_var_form_params.insert("tls_client_cert", local_var_param_value.to_string());
224    }
225    if let Some(local_var_param_value) = tls_client_key {
226        local_var_form_params.insert("tls_client_key", local_var_param_value.to_string());
227    }
228    if let Some(local_var_param_value) = tls_hostname {
229        local_var_form_params.insert("tls_hostname", local_var_param_value.to_string());
230    }
231    if let Some(local_var_param_value) = address {
232        local_var_form_params.insert("address", local_var_param_value.to_string());
233    }
234    if let Some(local_var_param_value) = port {
235        local_var_form_params.insert("port", local_var_param_value.to_string());
236    }
237    if let Some(local_var_param_value) = message_type {
238        local_var_form_params.insert("message_type", local_var_param_value.to_string());
239    }
240    if let Some(local_var_param_value) = hostname {
241        local_var_form_params.insert("hostname", local_var_param_value.to_string());
242    }
243    if let Some(local_var_param_value) = ipv4 {
244        local_var_form_params.insert("ipv4", local_var_param_value.to_string());
245    }
246    if let Some(local_var_param_value) = token {
247        local_var_form_params.insert("token", local_var_param_value.to_string());
248    }
249    if let Some(local_var_param_value) = use_tls {
250        local_var_form_params.insert("use_tls", local_var_param_value.to_string());
251    }
252    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
253
254    let local_var_req = local_var_req_builder.build()?;
255    let local_var_resp = local_var_client.execute(local_var_req).await?;
256
257    if "POST" != "GET" && "POST" != "HEAD" {
258      let headers = local_var_resp.headers();
259      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
260          Some(v) => v.to_str().unwrap().parse().unwrap(),
261          None => configuration::DEFAULT_RATELIMIT,
262      };
263      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
264          Some(v) => v.to_str().unwrap().parse().unwrap(),
265          None => 0,
266      };
267    }
268
269    let local_var_status = local_var_resp.status();
270    let local_var_content = local_var_resp.text().await?;
271
272    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
273        serde_json::from_str(&local_var_content).map_err(Error::from)
274    } else {
275        let local_var_entity: Option<CreateLogSyslogError> = serde_json::from_str(&local_var_content).ok();
276        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
277        Err(Error::ResponseError(local_var_error))
278    }
279}
280
281/// Delete the Syslog for a particular service and version.
282pub async fn delete_log_syslog(configuration: &mut configuration::Configuration, params: DeleteLogSyslogParams) -> Result<crate::models::InlineResponse200, Error<DeleteLogSyslogError>> {
283    let local_var_configuration = configuration;
284
285    // unbox the parameters
286    let service_id = params.service_id;
287    let version_id = params.version_id;
288    let logging_syslog_name = params.logging_syslog_name;
289
290
291    let local_var_client = &local_var_configuration.client;
292
293    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/syslog/{logging_syslog_name}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id, logging_syslog_name=crate::apis::urlencode(logging_syslog_name));
294    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
295
296    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
297        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
298    }
299    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
300        let local_var_key = local_var_apikey.key.clone();
301        let local_var_value = match local_var_apikey.prefix {
302            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
303            None => local_var_key,
304        };
305        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
306    };
307
308    let local_var_req = local_var_req_builder.build()?;
309    let local_var_resp = local_var_client.execute(local_var_req).await?;
310
311    if "DELETE" != "GET" && "DELETE" != "HEAD" {
312      let headers = local_var_resp.headers();
313      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
314          Some(v) => v.to_str().unwrap().parse().unwrap(),
315          None => configuration::DEFAULT_RATELIMIT,
316      };
317      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
318          Some(v) => v.to_str().unwrap().parse().unwrap(),
319          None => 0,
320      };
321    }
322
323    let local_var_status = local_var_resp.status();
324    let local_var_content = local_var_resp.text().await?;
325
326    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
327        serde_json::from_str(&local_var_content).map_err(Error::from)
328    } else {
329        let local_var_entity: Option<DeleteLogSyslogError> = serde_json::from_str(&local_var_content).ok();
330        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
331        Err(Error::ResponseError(local_var_error))
332    }
333}
334
335/// Get the Syslog for a particular service and version.
336pub async fn get_log_syslog(configuration: &mut configuration::Configuration, params: GetLogSyslogParams) -> Result<crate::models::LoggingSyslogResponse, Error<GetLogSyslogError>> {
337    let local_var_configuration = configuration;
338
339    // unbox the parameters
340    let service_id = params.service_id;
341    let version_id = params.version_id;
342    let logging_syslog_name = params.logging_syslog_name;
343
344
345    let local_var_client = &local_var_configuration.client;
346
347    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/syslog/{logging_syslog_name}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id, logging_syslog_name=crate::apis::urlencode(logging_syslog_name));
348    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
349
350    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
351        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
352    }
353    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
354        let local_var_key = local_var_apikey.key.clone();
355        let local_var_value = match local_var_apikey.prefix {
356            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
357            None => local_var_key,
358        };
359        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
360    };
361
362    let local_var_req = local_var_req_builder.build()?;
363    let local_var_resp = local_var_client.execute(local_var_req).await?;
364
365    if "GET" != "GET" && "GET" != "HEAD" {
366      let headers = local_var_resp.headers();
367      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
368          Some(v) => v.to_str().unwrap().parse().unwrap(),
369          None => configuration::DEFAULT_RATELIMIT,
370      };
371      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
372          Some(v) => v.to_str().unwrap().parse().unwrap(),
373          None => 0,
374      };
375    }
376
377    let local_var_status = local_var_resp.status();
378    let local_var_content = local_var_resp.text().await?;
379
380    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
381        serde_json::from_str(&local_var_content).map_err(Error::from)
382    } else {
383        let local_var_entity: Option<GetLogSyslogError> = serde_json::from_str(&local_var_content).ok();
384        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
385        Err(Error::ResponseError(local_var_error))
386    }
387}
388
389/// List all of the Syslogs for a particular service and version.
390pub async fn list_log_syslog(configuration: &mut configuration::Configuration, params: ListLogSyslogParams) -> Result<Vec<crate::models::LoggingSyslogResponse>, Error<ListLogSyslogError>> {
391    let local_var_configuration = configuration;
392
393    // unbox the parameters
394    let service_id = params.service_id;
395    let version_id = params.version_id;
396
397
398    let local_var_client = &local_var_configuration.client;
399
400    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/syslog", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id);
401    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
402
403    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
404        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
405    }
406    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
407        let local_var_key = local_var_apikey.key.clone();
408        let local_var_value = match local_var_apikey.prefix {
409            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
410            None => local_var_key,
411        };
412        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
413    };
414
415    let local_var_req = local_var_req_builder.build()?;
416    let local_var_resp = local_var_client.execute(local_var_req).await?;
417
418    if "GET" != "GET" && "GET" != "HEAD" {
419      let headers = local_var_resp.headers();
420      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
421          Some(v) => v.to_str().unwrap().parse().unwrap(),
422          None => configuration::DEFAULT_RATELIMIT,
423      };
424      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
425          Some(v) => v.to_str().unwrap().parse().unwrap(),
426          None => 0,
427      };
428    }
429
430    let local_var_status = local_var_resp.status();
431    let local_var_content = local_var_resp.text().await?;
432
433    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
434        serde_json::from_str(&local_var_content).map_err(Error::from)
435    } else {
436        let local_var_entity: Option<ListLogSyslogError> = serde_json::from_str(&local_var_content).ok();
437        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
438        Err(Error::ResponseError(local_var_error))
439    }
440}
441
442/// Update the Syslog for a particular service and version.
443pub async fn update_log_syslog(configuration: &mut configuration::Configuration, params: UpdateLogSyslogParams) -> Result<crate::models::LoggingSyslogResponse, Error<UpdateLogSyslogError>> {
444    let local_var_configuration = configuration;
445
446    // unbox the parameters
447    let service_id = params.service_id;
448    let version_id = params.version_id;
449    let logging_syslog_name = params.logging_syslog_name;
450    let name = params.name;
451    let placement = params.placement;
452    let response_condition = params.response_condition;
453    let format = params.format;
454    let format_version = params.format_version;
455    let tls_ca_cert = params.tls_ca_cert;
456    let tls_client_cert = params.tls_client_cert;
457    let tls_client_key = params.tls_client_key;
458    let tls_hostname = params.tls_hostname;
459    let address = params.address;
460    let port = params.port;
461    let message_type = params.message_type;
462    let hostname = params.hostname;
463    let ipv4 = params.ipv4;
464    let token = params.token;
465    let use_tls = params.use_tls;
466
467
468    let local_var_client = &local_var_configuration.client;
469
470    let local_var_uri_str = format!("{}/service/{service_id}/version/{version_id}/logging/syslog/{logging_syslog_name}", local_var_configuration.base_path, service_id=crate::apis::urlencode(service_id), version_id=version_id, logging_syslog_name=crate::apis::urlencode(logging_syslog_name));
471    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
472
473    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
474        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
475    }
476    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
477        let local_var_key = local_var_apikey.key.clone();
478        let local_var_value = match local_var_apikey.prefix {
479            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
480            None => local_var_key,
481        };
482        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
483    };
484    let mut local_var_form_params = std::collections::HashMap::new();
485    if let Some(local_var_param_value) = name {
486        local_var_form_params.insert("name", local_var_param_value.to_string());
487    }
488    if let Some(local_var_param_value) = placement {
489        local_var_form_params.insert("placement", local_var_param_value.to_string());
490    }
491    if let Some(local_var_param_value) = response_condition {
492        local_var_form_params.insert("response_condition", local_var_param_value.to_string());
493    }
494    if let Some(local_var_param_value) = format {
495        local_var_form_params.insert("format", local_var_param_value.to_string());
496    }
497    if let Some(local_var_param_value) = format_version {
498        local_var_form_params.insert("format_version", local_var_param_value.to_string());
499    }
500    if let Some(local_var_param_value) = tls_ca_cert {
501        local_var_form_params.insert("tls_ca_cert", local_var_param_value.to_string());
502    }
503    if let Some(local_var_param_value) = tls_client_cert {
504        local_var_form_params.insert("tls_client_cert", local_var_param_value.to_string());
505    }
506    if let Some(local_var_param_value) = tls_client_key {
507        local_var_form_params.insert("tls_client_key", local_var_param_value.to_string());
508    }
509    if let Some(local_var_param_value) = tls_hostname {
510        local_var_form_params.insert("tls_hostname", local_var_param_value.to_string());
511    }
512    if let Some(local_var_param_value) = address {
513        local_var_form_params.insert("address", local_var_param_value.to_string());
514    }
515    if let Some(local_var_param_value) = port {
516        local_var_form_params.insert("port", local_var_param_value.to_string());
517    }
518    if let Some(local_var_param_value) = message_type {
519        local_var_form_params.insert("message_type", local_var_param_value.to_string());
520    }
521    if let Some(local_var_param_value) = hostname {
522        local_var_form_params.insert("hostname", local_var_param_value.to_string());
523    }
524    if let Some(local_var_param_value) = ipv4 {
525        local_var_form_params.insert("ipv4", local_var_param_value.to_string());
526    }
527    if let Some(local_var_param_value) = token {
528        local_var_form_params.insert("token", local_var_param_value.to_string());
529    }
530    if let Some(local_var_param_value) = use_tls {
531        local_var_form_params.insert("use_tls", local_var_param_value.to_string());
532    }
533    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
534
535    let local_var_req = local_var_req_builder.build()?;
536    let local_var_resp = local_var_client.execute(local_var_req).await?;
537
538    if "PUT" != "GET" && "PUT" != "HEAD" {
539      let headers = local_var_resp.headers();
540      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
541          Some(v) => v.to_str().unwrap().parse().unwrap(),
542          None => configuration::DEFAULT_RATELIMIT,
543      };
544      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
545          Some(v) => v.to_str().unwrap().parse().unwrap(),
546          None => 0,
547      };
548    }
549
550    let local_var_status = local_var_resp.status();
551    let local_var_content = local_var_resp.text().await?;
552
553    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
554        serde_json::from_str(&local_var_content).map_err(Error::from)
555    } else {
556        let local_var_entity: Option<UpdateLogSyslogError> = serde_json::from_str(&local_var_content).ok();
557        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
558        Err(Error::ResponseError(local_var_error))
559    }
560}
561