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