fastly_api/apis/
config_store_item_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 [`bulk_update_config_store_item`]
15#[derive(Clone, Debug, Default)]
16pub struct BulkUpdateConfigStoreItemParams {
17    /// An alphanumeric string identifying the config store.
18    pub config_store_id: String,
19    pub bulk_update_config_store_list_request: Option<crate::models::BulkUpdateConfigStoreListRequest>
20}
21
22/// struct for passing parameters to the method [`create_config_store_item`]
23#[derive(Clone, Debug, Default)]
24pub struct CreateConfigStoreItemParams {
25    /// An alphanumeric string identifying the config store.
26    pub config_store_id: String,
27    /// Item key, maximum 256 characters.
28    pub item_key: Option<String>,
29    /// Item value, maximum 8000 characters.
30    pub item_value: Option<String>
31}
32
33/// struct for passing parameters to the method [`delete_config_store_item`]
34#[derive(Clone, Debug, Default)]
35pub struct DeleteConfigStoreItemParams {
36    /// An alphanumeric string identifying the config store.
37    pub config_store_id: String,
38    /// Item key, maximum 256 characters.
39    pub config_store_item_key: String
40}
41
42/// struct for passing parameters to the method [`get_config_store_item`]
43#[derive(Clone, Debug, Default)]
44pub struct GetConfigStoreItemParams {
45    /// An alphanumeric string identifying the config store.
46    pub config_store_id: String,
47    /// Item key, maximum 256 characters.
48    pub config_store_item_key: String
49}
50
51/// struct for passing parameters to the method [`list_config_store_items`]
52#[derive(Clone, Debug, Default)]
53pub struct ListConfigStoreItemsParams {
54    /// An alphanumeric string identifying the config store.
55    pub config_store_id: String
56}
57
58/// struct for passing parameters to the method [`update_config_store_item`]
59#[derive(Clone, Debug, Default)]
60pub struct UpdateConfigStoreItemParams {
61    /// An alphanumeric string identifying the config store.
62    pub config_store_id: String,
63    /// Item key, maximum 256 characters.
64    pub config_store_item_key: String,
65    /// Item key, maximum 256 characters.
66    pub item_key: Option<String>,
67    /// Item value, maximum 8000 characters.
68    pub item_value: Option<String>
69}
70
71/// struct for passing parameters to the method [`upsert_config_store_item`]
72#[derive(Clone, Debug, Default)]
73pub struct UpsertConfigStoreItemParams {
74    /// An alphanumeric string identifying the config store.
75    pub config_store_id: String,
76    /// Item key, maximum 256 characters.
77    pub config_store_item_key: String,
78    /// Item key, maximum 256 characters.
79    pub item_key: Option<String>,
80    /// Item value, maximum 8000 characters.
81    pub item_value: Option<String>
82}
83
84
85/// struct for typed errors of method [`bulk_update_config_store_item`]
86#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum BulkUpdateConfigStoreItemError {
89    UnknownValue(serde_json::Value),
90}
91
92/// struct for typed errors of method [`create_config_store_item`]
93#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum CreateConfigStoreItemError {
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`delete_config_store_item`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum DeleteConfigStoreItemError {
103    UnknownValue(serde_json::Value),
104}
105
106/// struct for typed errors of method [`get_config_store_item`]
107#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GetConfigStoreItemError {
110    UnknownValue(serde_json::Value),
111}
112
113/// struct for typed errors of method [`list_config_store_items`]
114#[derive(Debug, Clone, Serialize, Deserialize)]
115#[serde(untagged)]
116pub enum ListConfigStoreItemsError {
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`update_config_store_item`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum UpdateConfigStoreItemError {
124    UnknownValue(serde_json::Value),
125}
126
127/// struct for typed errors of method [`upsert_config_store_item`]
128#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum UpsertConfigStoreItemError {
131    UnknownValue(serde_json::Value),
132}
133
134
135/// Add multiple key-value pairs to an individual config store, specified by ID.
136pub async fn bulk_update_config_store_item(configuration: &mut configuration::Configuration, params: BulkUpdateConfigStoreItemParams) -> Result<crate::models::InlineResponse200, Error<BulkUpdateConfigStoreItemError>> {
137    let local_var_configuration = configuration;
138
139    // unbox the parameters
140    let config_store_id = params.config_store_id;
141    let bulk_update_config_store_list_request = params.bulk_update_config_store_list_request;
142
143
144    let local_var_client = &local_var_configuration.client;
145
146    let local_var_uri_str = format!("{}/resources/stores/config/{config_store_id}/items", local_var_configuration.base_path, config_store_id=crate::apis::urlencode(config_store_id));
147    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
148
149    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
150        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
151    }
152    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
153        let local_var_key = local_var_apikey.key.clone();
154        let local_var_value = match local_var_apikey.prefix {
155            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
156            None => local_var_key,
157        };
158        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
159    };
160    local_var_req_builder = local_var_req_builder.json(&bulk_update_config_store_list_request);
161
162    let local_var_req = local_var_req_builder.build()?;
163    let local_var_resp = local_var_client.execute(local_var_req).await?;
164
165    if "PATCH" != "GET" && "PATCH" != "HEAD" {
166      let headers = local_var_resp.headers();
167      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
168          Some(v) => v.to_str().unwrap().parse().unwrap(),
169          None => configuration::DEFAULT_RATELIMIT,
170      };
171      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
172          Some(v) => v.to_str().unwrap().parse().unwrap(),
173          None => 0,
174      };
175    }
176
177    let local_var_status = local_var_resp.status();
178    let local_var_content = local_var_resp.text().await?;
179
180    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
181        serde_json::from_str(&local_var_content).map_err(Error::from)
182    } else {
183        let local_var_entity: Option<BulkUpdateConfigStoreItemError> = serde_json::from_str(&local_var_content).ok();
184        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
185        Err(Error::ResponseError(local_var_error))
186    }
187}
188
189/// Add a single key-value pair to an individual config store, specified by ID.
190pub async fn create_config_store_item(configuration: &mut configuration::Configuration, params: CreateConfigStoreItemParams) -> Result<crate::models::ConfigStoreItemResponse, Error<CreateConfigStoreItemError>> {
191    let local_var_configuration = configuration;
192
193    // unbox the parameters
194    let config_store_id = params.config_store_id;
195    let item_key = params.item_key;
196    let item_value = params.item_value;
197
198
199    let local_var_client = &local_var_configuration.client;
200
201    let local_var_uri_str = format!("{}/resources/stores/config/{config_store_id}/item", local_var_configuration.base_path, config_store_id=crate::apis::urlencode(config_store_id));
202    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
203
204    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
205        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
206    }
207    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
208        let local_var_key = local_var_apikey.key.clone();
209        let local_var_value = match local_var_apikey.prefix {
210            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
211            None => local_var_key,
212        };
213        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
214    };
215    let mut local_var_form_params = std::collections::HashMap::new();
216    if let Some(local_var_param_value) = item_key {
217        local_var_form_params.insert("item_key", local_var_param_value.to_string());
218    }
219    if let Some(local_var_param_value) = item_value {
220        local_var_form_params.insert("item_value", local_var_param_value.to_string());
221    }
222    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
223
224    let local_var_req = local_var_req_builder.build()?;
225    let local_var_resp = local_var_client.execute(local_var_req).await?;
226
227    if "POST" != "GET" && "POST" != "HEAD" {
228      let headers = local_var_resp.headers();
229      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
230          Some(v) => v.to_str().unwrap().parse().unwrap(),
231          None => configuration::DEFAULT_RATELIMIT,
232      };
233      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
234          Some(v) => v.to_str().unwrap().parse().unwrap(),
235          None => 0,
236      };
237    }
238
239    let local_var_status = local_var_resp.status();
240    let local_var_content = local_var_resp.text().await?;
241
242    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
243        serde_json::from_str(&local_var_content).map_err(Error::from)
244    } else {
245        let local_var_entity: Option<CreateConfigStoreItemError> = serde_json::from_str(&local_var_content).ok();
246        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
247        Err(Error::ResponseError(local_var_error))
248    }
249}
250
251/// Delete an entry in a config store given a config store ID, and item key.
252pub async fn delete_config_store_item(configuration: &mut configuration::Configuration, params: DeleteConfigStoreItemParams) -> Result<crate::models::InlineResponse200, Error<DeleteConfigStoreItemError>> {
253    let local_var_configuration = configuration;
254
255    // unbox the parameters
256    let config_store_id = params.config_store_id;
257    let config_store_item_key = params.config_store_item_key;
258
259
260    let local_var_client = &local_var_configuration.client;
261
262    let local_var_uri_str = format!("{}/resources/stores/config/{config_store_id}/item/{config_store_item_key}", local_var_configuration.base_path, config_store_id=crate::apis::urlencode(config_store_id), config_store_item_key=crate::apis::urlencode(config_store_item_key));
263    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
264
265    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
266        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
267    }
268    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
269        let local_var_key = local_var_apikey.key.clone();
270        let local_var_value = match local_var_apikey.prefix {
271            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
272            None => local_var_key,
273        };
274        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
275    };
276
277    let local_var_req = local_var_req_builder.build()?;
278    let local_var_resp = local_var_client.execute(local_var_req).await?;
279
280    if "DELETE" != "GET" && "DELETE" != "HEAD" {
281      let headers = local_var_resp.headers();
282      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
283          Some(v) => v.to_str().unwrap().parse().unwrap(),
284          None => configuration::DEFAULT_RATELIMIT,
285      };
286      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
287          Some(v) => v.to_str().unwrap().parse().unwrap(),
288          None => 0,
289      };
290    }
291
292    let local_var_status = local_var_resp.status();
293    let local_var_content = local_var_resp.text().await?;
294
295    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
296        serde_json::from_str(&local_var_content).map_err(Error::from)
297    } else {
298        let local_var_entity: Option<DeleteConfigStoreItemError> = serde_json::from_str(&local_var_content).ok();
299        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
300        Err(Error::ResponseError(local_var_error))
301    }
302}
303
304/// Retrieve a config store entry given a config store ID and item key.
305pub async fn get_config_store_item(configuration: &mut configuration::Configuration, params: GetConfigStoreItemParams) -> Result<crate::models::ConfigStoreItemResponse, Error<GetConfigStoreItemError>> {
306    let local_var_configuration = configuration;
307
308    // unbox the parameters
309    let config_store_id = params.config_store_id;
310    let config_store_item_key = params.config_store_item_key;
311
312
313    let local_var_client = &local_var_configuration.client;
314
315    let local_var_uri_str = format!("{}/resources/stores/config/{config_store_id}/item/{config_store_item_key}", local_var_configuration.base_path, config_store_id=crate::apis::urlencode(config_store_id), config_store_item_key=crate::apis::urlencode(config_store_item_key));
316    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
317
318    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
319        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
320    }
321    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
322        let local_var_key = local_var_apikey.key.clone();
323        let local_var_value = match local_var_apikey.prefix {
324            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
325            None => local_var_key,
326        };
327        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
328    };
329
330    let local_var_req = local_var_req_builder.build()?;
331    let local_var_resp = local_var_client.execute(local_var_req).await?;
332
333    if "GET" != "GET" && "GET" != "HEAD" {
334      let headers = local_var_resp.headers();
335      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
336          Some(v) => v.to_str().unwrap().parse().unwrap(),
337          None => configuration::DEFAULT_RATELIMIT,
338      };
339      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
340          Some(v) => v.to_str().unwrap().parse().unwrap(),
341          None => 0,
342      };
343    }
344
345    let local_var_status = local_var_resp.status();
346    let local_var_content = local_var_resp.text().await?;
347
348    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
349        serde_json::from_str(&local_var_content).map_err(Error::from)
350    } else {
351        let local_var_entity: Option<GetConfigStoreItemError> = serde_json::from_str(&local_var_content).ok();
352        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
353        Err(Error::ResponseError(local_var_error))
354    }
355}
356
357/// List the key-value pairs associated with a given config store ID.
358pub async fn list_config_store_items(configuration: &mut configuration::Configuration, params: ListConfigStoreItemsParams) -> Result<Vec<crate::models::ConfigStoreItemResponse>, Error<ListConfigStoreItemsError>> {
359    let local_var_configuration = configuration;
360
361    // unbox the parameters
362    let config_store_id = params.config_store_id;
363
364
365    let local_var_client = &local_var_configuration.client;
366
367    let local_var_uri_str = format!("{}/resources/stores/config/{config_store_id}/items", local_var_configuration.base_path, config_store_id=crate::apis::urlencode(config_store_id));
368    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
369
370    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
371        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
372    }
373    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
374        let local_var_key = local_var_apikey.key.clone();
375        let local_var_value = match local_var_apikey.prefix {
376            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
377            None => local_var_key,
378        };
379        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
380    };
381
382    let local_var_req = local_var_req_builder.build()?;
383    let local_var_resp = local_var_client.execute(local_var_req).await?;
384
385    if "GET" != "GET" && "GET" != "HEAD" {
386      let headers = local_var_resp.headers();
387      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
388          Some(v) => v.to_str().unwrap().parse().unwrap(),
389          None => configuration::DEFAULT_RATELIMIT,
390      };
391      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
392          Some(v) => v.to_str().unwrap().parse().unwrap(),
393          None => 0,
394      };
395    }
396
397    let local_var_status = local_var_resp.status();
398    let local_var_content = local_var_resp.text().await?;
399
400    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
401        serde_json::from_str(&local_var_content).map_err(Error::from)
402    } else {
403        let local_var_entity: Option<ListConfigStoreItemsError> = serde_json::from_str(&local_var_content).ok();
404        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
405        Err(Error::ResponseError(local_var_error))
406    }
407}
408
409/// Update an entry in a config store given a config store ID, item key, and item value.
410pub async fn update_config_store_item(configuration: &mut configuration::Configuration, params: UpdateConfigStoreItemParams) -> Result<crate::models::ConfigStoreItemResponse, Error<UpdateConfigStoreItemError>> {
411    let local_var_configuration = configuration;
412
413    // unbox the parameters
414    let config_store_id = params.config_store_id;
415    let config_store_item_key = params.config_store_item_key;
416    let item_key = params.item_key;
417    let item_value = params.item_value;
418
419
420    let local_var_client = &local_var_configuration.client;
421
422    let local_var_uri_str = format!("{}/resources/stores/config/{config_store_id}/item/{config_store_item_key}", local_var_configuration.base_path, config_store_id=crate::apis::urlencode(config_store_id), config_store_item_key=crate::apis::urlencode(config_store_item_key));
423    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
424
425    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
426        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
427    }
428    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
429        let local_var_key = local_var_apikey.key.clone();
430        let local_var_value = match local_var_apikey.prefix {
431            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
432            None => local_var_key,
433        };
434        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
435    };
436    let mut local_var_form_params = std::collections::HashMap::new();
437    if let Some(local_var_param_value) = item_key {
438        local_var_form_params.insert("item_key", local_var_param_value.to_string());
439    }
440    if let Some(local_var_param_value) = item_value {
441        local_var_form_params.insert("item_value", local_var_param_value.to_string());
442    }
443    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
444
445    let local_var_req = local_var_req_builder.build()?;
446    let local_var_resp = local_var_client.execute(local_var_req).await?;
447
448    if "PATCH" != "GET" && "PATCH" != "HEAD" {
449      let headers = local_var_resp.headers();
450      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
451          Some(v) => v.to_str().unwrap().parse().unwrap(),
452          None => configuration::DEFAULT_RATELIMIT,
453      };
454      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
455          Some(v) => v.to_str().unwrap().parse().unwrap(),
456          None => 0,
457      };
458    }
459
460    let local_var_status = local_var_resp.status();
461    let local_var_content = local_var_resp.text().await?;
462
463    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
464        serde_json::from_str(&local_var_content).map_err(Error::from)
465    } else {
466        let local_var_entity: Option<UpdateConfigStoreItemError> = serde_json::from_str(&local_var_content).ok();
467        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
468        Err(Error::ResponseError(local_var_error))
469    }
470}
471
472/// Insert or update an entry in a config store given a config store ID, item key, and item value.
473pub async fn upsert_config_store_item(configuration: &mut configuration::Configuration, params: UpsertConfigStoreItemParams) -> Result<crate::models::ConfigStoreItemResponse, Error<UpsertConfigStoreItemError>> {
474    let local_var_configuration = configuration;
475
476    // unbox the parameters
477    let config_store_id = params.config_store_id;
478    let config_store_item_key = params.config_store_item_key;
479    let item_key = params.item_key;
480    let item_value = params.item_value;
481
482
483    let local_var_client = &local_var_configuration.client;
484
485    let local_var_uri_str = format!("{}/resources/stores/config/{config_store_id}/item/{config_store_item_key}", local_var_configuration.base_path, config_store_id=crate::apis::urlencode(config_store_id), config_store_item_key=crate::apis::urlencode(config_store_item_key));
486    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
487
488    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
489        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
490    }
491    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
492        let local_var_key = local_var_apikey.key.clone();
493        let local_var_value = match local_var_apikey.prefix {
494            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
495            None => local_var_key,
496        };
497        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
498    };
499    let mut local_var_form_params = std::collections::HashMap::new();
500    if let Some(local_var_param_value) = item_key {
501        local_var_form_params.insert("item_key", local_var_param_value.to_string());
502    }
503    if let Some(local_var_param_value) = item_value {
504        local_var_form_params.insert("item_value", local_var_param_value.to_string());
505    }
506    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
507
508    let local_var_req = local_var_req_builder.build()?;
509    let local_var_resp = local_var_client.execute(local_var_req).await?;
510
511    if "PUT" != "GET" && "PUT" != "HEAD" {
512      let headers = local_var_resp.headers();
513      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
514          Some(v) => v.to_str().unwrap().parse().unwrap(),
515          None => configuration::DEFAULT_RATELIMIT,
516      };
517      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
518          Some(v) => v.to_str().unwrap().parse().unwrap(),
519          None => 0,
520      };
521    }
522
523    let local_var_status = local_var_resp.status();
524    let local_var_content = local_var_resp.text().await?;
525
526    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
527        serde_json::from_str(&local_var_content).map_err(Error::from)
528    } else {
529        let local_var_entity: Option<UpsertConfigStoreItemError> = serde_json::from_str(&local_var_content).ok();
530        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
531        Err(Error::ResponseError(local_var_error))
532    }
533}
534