fastly_api/apis/
user_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_user`]
15#[derive(Clone, Debug, Default)]
16pub struct CreateUserParams {
17    pub login: Option<String>,
18    /// The real life name of the user.
19    pub name: Option<String>,
20    /// Indicates that the user has limited access to the customer's services.
21    pub limit_services: Option<bool>,
22    /// Indicates whether the is account is locked for editing or not.
23    pub locked: Option<bool>,
24    /// Indicates if a new password is required at next login.
25    pub require_new_password: Option<bool>,
26    pub role: Option<crate::models::RoleUser>,
27    /// Indicates if 2FA is enabled on the user.
28    pub two_factor_auth_enabled: Option<bool>,
29    /// Indicates if 2FA is required by the user's customer account.
30    pub two_factor_setup_required: Option<bool>
31}
32
33/// struct for passing parameters to the method [`delete_user`]
34#[derive(Clone, Debug, Default)]
35pub struct DeleteUserParams {
36    /// Alphanumeric string identifying the user.
37    pub user_id: String
38}
39
40/// struct for passing parameters to the method [`get_user`]
41#[derive(Clone, Debug, Default)]
42pub struct GetUserParams {
43    /// Alphanumeric string identifying the user.
44    pub user_id: String
45}
46
47/// struct for passing parameters to the method [`request_password_reset`]
48#[derive(Clone, Debug, Default)]
49pub struct RequestPasswordResetParams {
50    /// The login associated with the user (typically, an email address).
51    pub user_login: String
52}
53
54/// struct for passing parameters to the method [`update_user`]
55#[derive(Clone, Debug, Default)]
56pub struct UpdateUserParams {
57    /// Alphanumeric string identifying the user.
58    pub user_id: String,
59    pub login: Option<String>,
60    /// The real life name of the user.
61    pub name: Option<String>,
62    /// Indicates that the user has limited access to the customer's services.
63    pub limit_services: Option<bool>,
64    /// Indicates whether the is account is locked for editing or not.
65    pub locked: Option<bool>,
66    /// Indicates if a new password is required at next login.
67    pub require_new_password: Option<bool>,
68    pub role: Option<crate::models::RoleUser>,
69    /// Indicates if 2FA is enabled on the user.
70    pub two_factor_auth_enabled: Option<bool>,
71    /// Indicates if 2FA is required by the user's customer account.
72    pub two_factor_setup_required: Option<bool>
73}
74
75/// struct for passing parameters to the method [`update_user_password`]
76#[derive(Clone, Debug, Default)]
77pub struct UpdateUserPasswordParams {
78    /// The user's current password.
79    pub old_password: Option<String>,
80    /// The user's new password.
81    pub new_password: Option<String>
82}
83
84
85/// struct for typed errors of method [`create_user`]
86#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum CreateUserError {
89    UnknownValue(serde_json::Value),
90}
91
92/// struct for typed errors of method [`delete_user`]
93#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum DeleteUserError {
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`get_current_user`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum GetCurrentUserError {
103    UnknownValue(serde_json::Value),
104}
105
106/// struct for typed errors of method [`get_user`]
107#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GetUserError {
110    UnknownValue(serde_json::Value),
111}
112
113/// struct for typed errors of method [`request_password_reset`]
114#[derive(Debug, Clone, Serialize, Deserialize)]
115#[serde(untagged)]
116pub enum RequestPasswordResetError {
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`update_user`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum UpdateUserError {
124    UnknownValue(serde_json::Value),
125}
126
127/// struct for typed errors of method [`update_user_password`]
128#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum UpdateUserPasswordError {
131    UnknownValue(serde_json::Value),
132}
133
134
135/// Create a user.
136pub async fn create_user(configuration: &mut configuration::Configuration, params: CreateUserParams) -> Result<crate::models::UserResponse, Error<CreateUserError>> {
137    let local_var_configuration = configuration;
138
139    // unbox the parameters
140    let login = params.login;
141    let name = params.name;
142    let limit_services = params.limit_services;
143    let locked = params.locked;
144    let require_new_password = params.require_new_password;
145    let role = params.role;
146    let two_factor_auth_enabled = params.two_factor_auth_enabled;
147    let two_factor_setup_required = params.two_factor_setup_required;
148
149
150    let local_var_client = &local_var_configuration.client;
151
152    let local_var_uri_str = format!("{}/user", local_var_configuration.base_path);
153    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
154
155    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
156        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
157    }
158    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
159        let local_var_key = local_var_apikey.key.clone();
160        let local_var_value = match local_var_apikey.prefix {
161            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
162            None => local_var_key,
163        };
164        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
165    };
166    let mut local_var_form_params = std::collections::HashMap::new();
167    if let Some(local_var_param_value) = login {
168        local_var_form_params.insert("login", local_var_param_value.to_string());
169    }
170    if let Some(local_var_param_value) = name {
171        local_var_form_params.insert("name", local_var_param_value.to_string());
172    }
173    if let Some(local_var_param_value) = limit_services {
174        local_var_form_params.insert("limit_services", local_var_param_value.to_string());
175    }
176    if let Some(local_var_param_value) = locked {
177        local_var_form_params.insert("locked", local_var_param_value.to_string());
178    }
179    if let Some(local_var_param_value) = require_new_password {
180        local_var_form_params.insert("require_new_password", local_var_param_value.to_string());
181    }
182    if let Some(local_var_param_value) = role {
183        local_var_form_params.insert("role", local_var_param_value.to_string());
184    }
185    if let Some(local_var_param_value) = two_factor_auth_enabled {
186        local_var_form_params.insert("two_factor_auth_enabled", local_var_param_value.to_string());
187    }
188    if let Some(local_var_param_value) = two_factor_setup_required {
189        local_var_form_params.insert("two_factor_setup_required", local_var_param_value.to_string());
190    }
191    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
192
193    let local_var_req = local_var_req_builder.build()?;
194    let local_var_resp = local_var_client.execute(local_var_req).await?;
195
196    if "POST" != "GET" && "POST" != "HEAD" {
197      let headers = local_var_resp.headers();
198      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
199          Some(v) => v.to_str().unwrap().parse().unwrap(),
200          None => configuration::DEFAULT_RATELIMIT,
201      };
202      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
203          Some(v) => v.to_str().unwrap().parse().unwrap(),
204          None => 0,
205      };
206    }
207
208    let local_var_status = local_var_resp.status();
209    let local_var_content = local_var_resp.text().await?;
210
211    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
212        serde_json::from_str(&local_var_content).map_err(Error::from)
213    } else {
214        let local_var_entity: Option<CreateUserError> = serde_json::from_str(&local_var_content).ok();
215        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
216        Err(Error::ResponseError(local_var_error))
217    }
218}
219
220/// Delete a user.
221pub async fn delete_user(configuration: &mut configuration::Configuration, params: DeleteUserParams) -> Result<crate::models::InlineResponse200, Error<DeleteUserError>> {
222    let local_var_configuration = configuration;
223
224    // unbox the parameters
225    let user_id = params.user_id;
226
227
228    let local_var_client = &local_var_configuration.client;
229
230    let local_var_uri_str = format!("{}/user/{user_id}", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
231    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
232
233    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
234        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
235    }
236    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
237        let local_var_key = local_var_apikey.key.clone();
238        let local_var_value = match local_var_apikey.prefix {
239            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
240            None => local_var_key,
241        };
242        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
243    };
244
245    let local_var_req = local_var_req_builder.build()?;
246    let local_var_resp = local_var_client.execute(local_var_req).await?;
247
248    if "DELETE" != "GET" && "DELETE" != "HEAD" {
249      let headers = local_var_resp.headers();
250      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
251          Some(v) => v.to_str().unwrap().parse().unwrap(),
252          None => configuration::DEFAULT_RATELIMIT,
253      };
254      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
255          Some(v) => v.to_str().unwrap().parse().unwrap(),
256          None => 0,
257      };
258    }
259
260    let local_var_status = local_var_resp.status();
261    let local_var_content = local_var_resp.text().await?;
262
263    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
264        serde_json::from_str(&local_var_content).map_err(Error::from)
265    } else {
266        let local_var_entity: Option<DeleteUserError> = serde_json::from_str(&local_var_content).ok();
267        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
268        Err(Error::ResponseError(local_var_error))
269    }
270}
271
272/// Get the logged in user.
273pub async fn get_current_user(configuration: &mut configuration::Configuration) -> Result<crate::models::UserResponse, Error<GetCurrentUserError>> {
274    let local_var_configuration = configuration;
275
276    // unbox the parameters
277
278
279    let local_var_client = &local_var_configuration.client;
280
281    let local_var_uri_str = format!("{}/current_user", local_var_configuration.base_path);
282    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
283
284    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
285        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
286    }
287    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
288        let local_var_key = local_var_apikey.key.clone();
289        let local_var_value = match local_var_apikey.prefix {
290            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
291            None => local_var_key,
292        };
293        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
294    };
295
296    let local_var_req = local_var_req_builder.build()?;
297    let local_var_resp = local_var_client.execute(local_var_req).await?;
298
299    if "GET" != "GET" && "GET" != "HEAD" {
300      let headers = local_var_resp.headers();
301      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
302          Some(v) => v.to_str().unwrap().parse().unwrap(),
303          None => configuration::DEFAULT_RATELIMIT,
304      };
305      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
306          Some(v) => v.to_str().unwrap().parse().unwrap(),
307          None => 0,
308      };
309    }
310
311    let local_var_status = local_var_resp.status();
312    let local_var_content = local_var_resp.text().await?;
313
314    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
315        serde_json::from_str(&local_var_content).map_err(Error::from)
316    } else {
317        let local_var_entity: Option<GetCurrentUserError> = serde_json::from_str(&local_var_content).ok();
318        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
319        Err(Error::ResponseError(local_var_error))
320    }
321}
322
323/// Get a specific user.
324pub async fn get_user(configuration: &mut configuration::Configuration, params: GetUserParams) -> Result<crate::models::UserResponse, Error<GetUserError>> {
325    let local_var_configuration = configuration;
326
327    // unbox the parameters
328    let user_id = params.user_id;
329
330
331    let local_var_client = &local_var_configuration.client;
332
333    let local_var_uri_str = format!("{}/user/{user_id}", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
334    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
335
336    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
337        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
338    }
339    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
340        let local_var_key = local_var_apikey.key.clone();
341        let local_var_value = match local_var_apikey.prefix {
342            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
343            None => local_var_key,
344        };
345        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
346    };
347
348    let local_var_req = local_var_req_builder.build()?;
349    let local_var_resp = local_var_client.execute(local_var_req).await?;
350
351    if "GET" != "GET" && "GET" != "HEAD" {
352      let headers = local_var_resp.headers();
353      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
354          Some(v) => v.to_str().unwrap().parse().unwrap(),
355          None => configuration::DEFAULT_RATELIMIT,
356      };
357      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
358          Some(v) => v.to_str().unwrap().parse().unwrap(),
359          None => 0,
360      };
361    }
362
363    let local_var_status = local_var_resp.status();
364    let local_var_content = local_var_resp.text().await?;
365
366    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
367        serde_json::from_str(&local_var_content).map_err(Error::from)
368    } else {
369        let local_var_entity: Option<GetUserError> = serde_json::from_str(&local_var_content).ok();
370        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
371        Err(Error::ResponseError(local_var_error))
372    }
373}
374
375/// Requests a password reset for the specified user.
376pub async fn request_password_reset(configuration: &mut configuration::Configuration, params: RequestPasswordResetParams) -> Result<crate::models::InlineResponse200, Error<RequestPasswordResetError>> {
377    let local_var_configuration = configuration;
378
379    // unbox the parameters
380    let user_login = params.user_login;
381
382
383    let local_var_client = &local_var_configuration.client;
384
385    let local_var_uri_str = format!("{}/user/{user_login}/password/request_reset", local_var_configuration.base_path, user_login=crate::apis::urlencode(user_login));
386    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
387
388    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
389        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
390    }
391    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
392        let local_var_key = local_var_apikey.key.clone();
393        let local_var_value = match local_var_apikey.prefix {
394            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
395            None => local_var_key,
396        };
397        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
398    };
399
400    let local_var_req = local_var_req_builder.build()?;
401    let local_var_resp = local_var_client.execute(local_var_req).await?;
402
403    if "POST" != "GET" && "POST" != "HEAD" {
404      let headers = local_var_resp.headers();
405      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
406          Some(v) => v.to_str().unwrap().parse().unwrap(),
407          None => configuration::DEFAULT_RATELIMIT,
408      };
409      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
410          Some(v) => v.to_str().unwrap().parse().unwrap(),
411          None => 0,
412      };
413    }
414
415    let local_var_status = local_var_resp.status();
416    let local_var_content = local_var_resp.text().await?;
417
418    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
419        serde_json::from_str(&local_var_content).map_err(Error::from)
420    } else {
421        let local_var_entity: Option<RequestPasswordResetError> = serde_json::from_str(&local_var_content).ok();
422        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
423        Err(Error::ResponseError(local_var_error))
424    }
425}
426
427/// Update a user. Only users with the role of `superuser` can make changes to other users on the account. Non-superusers may use this endpoint to make changes to their own account. Two-factor attributes are not editable via this endpoint.
428pub async fn update_user(configuration: &mut configuration::Configuration, params: UpdateUserParams) -> Result<crate::models::UserResponse, Error<UpdateUserError>> {
429    let local_var_configuration = configuration;
430
431    // unbox the parameters
432    let user_id = params.user_id;
433    let login = params.login;
434    let name = params.name;
435    let limit_services = params.limit_services;
436    let locked = params.locked;
437    let require_new_password = params.require_new_password;
438    let role = params.role;
439    let two_factor_auth_enabled = params.two_factor_auth_enabled;
440    let two_factor_setup_required = params.two_factor_setup_required;
441
442
443    let local_var_client = &local_var_configuration.client;
444
445    let local_var_uri_str = format!("{}/user/{user_id}", local_var_configuration.base_path, user_id=crate::apis::urlencode(user_id));
446    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
447
448    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
449        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
450    }
451    if let Some(ref local_var_apikey) = local_var_configuration.api_key {
452        let local_var_key = local_var_apikey.key.clone();
453        let local_var_value = match local_var_apikey.prefix {
454            Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
455            None => local_var_key,
456        };
457        local_var_req_builder = local_var_req_builder.header("Fastly-Key", local_var_value);
458    };
459    let mut local_var_form_params = std::collections::HashMap::new();
460    if let Some(local_var_param_value) = login {
461        local_var_form_params.insert("login", local_var_param_value.to_string());
462    }
463    if let Some(local_var_param_value) = name {
464        local_var_form_params.insert("name", local_var_param_value.to_string());
465    }
466    if let Some(local_var_param_value) = limit_services {
467        local_var_form_params.insert("limit_services", local_var_param_value.to_string());
468    }
469    if let Some(local_var_param_value) = locked {
470        local_var_form_params.insert("locked", local_var_param_value.to_string());
471    }
472    if let Some(local_var_param_value) = require_new_password {
473        local_var_form_params.insert("require_new_password", local_var_param_value.to_string());
474    }
475    if let Some(local_var_param_value) = role {
476        local_var_form_params.insert("role", local_var_param_value.to_string());
477    }
478    if let Some(local_var_param_value) = two_factor_auth_enabled {
479        local_var_form_params.insert("two_factor_auth_enabled", local_var_param_value.to_string());
480    }
481    if let Some(local_var_param_value) = two_factor_setup_required {
482        local_var_form_params.insert("two_factor_setup_required", local_var_param_value.to_string());
483    }
484    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
485
486    let local_var_req = local_var_req_builder.build()?;
487    let local_var_resp = local_var_client.execute(local_var_req).await?;
488
489    if "PUT" != "GET" && "PUT" != "HEAD" {
490      let headers = local_var_resp.headers();
491      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
492          Some(v) => v.to_str().unwrap().parse().unwrap(),
493          None => configuration::DEFAULT_RATELIMIT,
494      };
495      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
496          Some(v) => v.to_str().unwrap().parse().unwrap(),
497          None => 0,
498      };
499    }
500
501    let local_var_status = local_var_resp.status();
502    let local_var_content = local_var_resp.text().await?;
503
504    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
505        serde_json::from_str(&local_var_content).map_err(Error::from)
506    } else {
507        let local_var_entity: Option<UpdateUserError> = serde_json::from_str(&local_var_content).ok();
508        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
509        Err(Error::ResponseError(local_var_error))
510    }
511}
512
513/// Update the user's password to a new one.
514pub async fn update_user_password(configuration: &mut configuration::Configuration, params: UpdateUserPasswordParams) -> Result<crate::models::UserResponse, Error<UpdateUserPasswordError>> {
515    let local_var_configuration = configuration;
516
517    // unbox the parameters
518    let old_password = params.old_password;
519    let new_password = params.new_password;
520
521
522    let local_var_client = &local_var_configuration.client;
523
524    let local_var_uri_str = format!("{}/current_user/password", local_var_configuration.base_path);
525    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
526
527    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
528        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
529    }
530    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
531        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
532    };
533    let mut local_var_form_params = std::collections::HashMap::new();
534    if let Some(local_var_param_value) = old_password {
535        local_var_form_params.insert("old_password", local_var_param_value.to_string());
536    }
537    if let Some(local_var_param_value) = new_password {
538        local_var_form_params.insert("new_password", local_var_param_value.to_string());
539    }
540    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
541
542    let local_var_req = local_var_req_builder.build()?;
543    let local_var_resp = local_var_client.execute(local_var_req).await?;
544
545    if "POST" != "GET" && "POST" != "HEAD" {
546      let headers = local_var_resp.headers();
547      local_var_configuration.rate_limit_remaining = match headers.get("Fastly-RateLimit-Remaining") {
548          Some(v) => v.to_str().unwrap().parse().unwrap(),
549          None => configuration::DEFAULT_RATELIMIT,
550      };
551      local_var_configuration.rate_limit_reset = match headers.get("Fastly-RateLimit-Reset") {
552          Some(v) => v.to_str().unwrap().parse().unwrap(),
553          None => 0,
554      };
555    }
556
557    let local_var_status = local_var_resp.status();
558    let local_var_content = local_var_resp.text().await?;
559
560    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
561        serde_json::from_str(&local_var_content).map_err(Error::from)
562    } else {
563        let local_var_entity: Option<UpdateUserPasswordError> = serde_json::from_str(&local_var_content).ok();
564        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
565        Err(Error::ResponseError(local_var_error))
566    }
567}
568