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