Skip to main content

openapi_service_fabric/apis/
partition_api.rs

1/*
2 * Service Fabric Client APIs
3 *
4 * Service Fabric REST Client APIs allows management of Service Fabric clusters, applications and services.
5 *
6 * The version of the OpenAPI document: 8.2
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for typed errors of method [`get_loaded_partition_info_list`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum GetLoadedPartitionInfoListError {
20    DefaultResponse(models::FabricError),
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`get_partition_health`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum GetPartitionHealthError {
28    DefaultResponse(models::FabricError),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_partition_health_using_policy`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetPartitionHealthUsingPolicyError {
36    DefaultResponse(models::FabricError),
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`get_partition_info`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum GetPartitionInfoError {
44    DefaultResponse(models::FabricError),
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`get_partition_info_list`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum GetPartitionInfoListError {
52    DefaultResponse(models::FabricError),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`get_partition_load_information`]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum GetPartitionLoadInformationError {
60    DefaultResponse(models::FabricError),
61    UnknownValue(serde_json::Value),
62}
63
64/// struct for typed errors of method [`get_service_name_info`]
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum GetServiceNameInfoError {
68    DefaultResponse(models::FabricError),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`move_auxiliary_replica`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum MoveAuxiliaryReplicaError {
76    DefaultResponse(models::FabricError),
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`move_instance`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum MoveInstanceError {
84    DefaultResponse(models::FabricError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`move_primary_replica`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum MovePrimaryReplicaError {
92    DefaultResponse(models::FabricError),
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`move_secondary_replica`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum MoveSecondaryReplicaError {
100    DefaultResponse(models::FabricError),
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`recover_all_partitions`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum RecoverAllPartitionsError {
108    DefaultResponse(models::FabricError),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`recover_partition`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum RecoverPartitionError {
116    DefaultResponse(models::FabricError),
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`recover_service_partitions`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum RecoverServicePartitionsError {
124    DefaultResponse(models::FabricError),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`recover_system_partitions`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum RecoverSystemPartitionsError {
132    DefaultResponse(models::FabricError),
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`report_partition_health`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum ReportPartitionHealthError {
140    DefaultResponse(models::FabricError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`reset_partition_load`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ResetPartitionLoadError {
148    DefaultResponse(models::FabricError),
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`update_partition_load`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum UpdatePartitionLoadError {
156    DefaultResponse(models::FabricError),
157    UnknownValue(serde_json::Value),
158}
159
160/// Retrieves partitions which are most/least loaded according to specified metric.
161pub async fn get_loaded_partition_info_list(
162    configuration: &configuration::Configuration,
163    api_version: &str,
164    metric_name: &str,
165    service_name: Option<&str>,
166    ordering: Option<&str>,
167    max_results: Option<i64>,
168    continuation_token: Option<&str>,
169) -> Result<models::LoadedPartitionInformationResultList, Error<GetLoadedPartitionInfoListError>> {
170    // add a prefix to parameters to efficiently prevent name collisions
171    let p_query_api_version = api_version;
172    let p_query_metric_name = metric_name;
173    let p_query_service_name = service_name;
174    let p_query_ordering = ordering;
175    let p_query_max_results = max_results;
176    let p_query_continuation_token = continuation_token;
177
178    let uri_str = format!("{}/$/GetLoadedPartitionInfoList", configuration.base_path);
179    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
180
181    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
182    req_builder = req_builder.query(&[("MetricName", &p_query_metric_name.to_string())]);
183    if let Some(ref param_value) = p_query_service_name {
184        req_builder = req_builder.query(&[("ServiceName", &param_value.to_string())]);
185    }
186    if let Some(ref param_value) = p_query_ordering {
187        req_builder = req_builder.query(&[("Ordering", &param_value.to_string())]);
188    }
189    if let Some(ref param_value) = p_query_max_results {
190        req_builder = req_builder.query(&[("MaxResults", &param_value.to_string())]);
191    }
192    if let Some(ref param_value) = p_query_continuation_token {
193        req_builder = req_builder.query(&[("ContinuationToken", &param_value.to_string())]);
194    }
195    if let Some(ref user_agent) = configuration.user_agent {
196        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
197    }
198
199    let req = req_builder.build()?;
200    let resp = configuration.client.execute(req).await?;
201
202    let status = resp.status();
203    let content_type = resp
204        .headers()
205        .get("content-type")
206        .and_then(|v| v.to_str().ok())
207        .unwrap_or("application/octet-stream");
208    let content_type = super::ContentType::from(content_type);
209
210    if !status.is_client_error() && !status.is_server_error() {
211        let content = resp.text().await?;
212        match content_type {
213            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
214            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LoadedPartitionInformationResultList`"))),
215            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LoadedPartitionInformationResultList`")))),
216        }
217    } else {
218        let content = resp.text().await?;
219        let entity: Option<GetLoadedPartitionInfoListError> = serde_json::from_str(&content).ok();
220        Err(Error::ResponseError(ResponseContent {
221            status,
222            content,
223            entity,
224        }))
225    }
226}
227
228/// Use EventsHealthStateFilter to filter the collection of health events reported on the service based on the health state. Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState objects on the partition. If you specify a partition that does not exist in the health store, this request returns an error.
229pub async fn get_partition_health(
230    configuration: &configuration::Configuration,
231    api_version: &str,
232    partition_id: &str,
233    events_health_state_filter: Option<i32>,
234    replicas_health_state_filter: Option<i32>,
235    exclude_health_statistics: Option<bool>,
236    timeout: Option<i64>,
237) -> Result<models::PartitionHealth, Error<GetPartitionHealthError>> {
238    // add a prefix to parameters to efficiently prevent name collisions
239    let p_query_api_version = api_version;
240    let p_path_partition_id = partition_id;
241    let p_query_events_health_state_filter = events_health_state_filter;
242    let p_query_replicas_health_state_filter = replicas_health_state_filter;
243    let p_query_exclude_health_statistics = exclude_health_statistics;
244    let p_query_timeout = timeout;
245
246    let uri_str = format!(
247        "{}/Partitions/{partitionId}/$/GetHealth",
248        configuration.base_path,
249        partitionId = crate::apis::urlencode(p_path_partition_id)
250    );
251    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
252
253    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
254    if let Some(ref param_value) = p_query_events_health_state_filter {
255        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
256    }
257    if let Some(ref param_value) = p_query_replicas_health_state_filter {
258        req_builder = req_builder.query(&[("ReplicasHealthStateFilter", &param_value.to_string())]);
259    }
260    if let Some(ref param_value) = p_query_exclude_health_statistics {
261        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
262    }
263    if let Some(ref param_value) = p_query_timeout {
264        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
265    }
266    if let Some(ref user_agent) = configuration.user_agent {
267        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
268    }
269
270    let req = req_builder.build()?;
271    let resp = configuration.client.execute(req).await?;
272
273    let status = resp.status();
274    let content_type = resp
275        .headers()
276        .get("content-type")
277        .and_then(|v| v.to_str().ok())
278        .unwrap_or("application/octet-stream");
279    let content_type = super::ContentType::from(content_type);
280
281    if !status.is_client_error() && !status.is_server_error() {
282        let content = resp.text().await?;
283        match content_type {
284            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
285            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PartitionHealth`"))),
286            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PartitionHealth`")))),
287        }
288    } else {
289        let content = resp.text().await?;
290        let entity: Option<GetPartitionHealthError> = serde_json::from_str(&content).ok();
291        Err(Error::ResponseError(ResponseContent {
292            status,
293            content,
294            entity,
295        }))
296    }
297}
298
299/// Gets the health information of the specified partition. If the application health policy is specified, the health evaluation uses it to get the aggregated health state. If the policy is not specified, the health evaluation uses the application health policy defined in the application manifest, or the default health policy, if no policy is defined in the manifest. Use EventsHealthStateFilter to filter the collection of health events reported on the partition based on the health state. Use ReplicasHealthStateFilter to filter the collection of ReplicaHealthState objects on the partition. Use ApplicationHealthPolicy in the POST body to override the health policies used to evaluate the health. If you specify a partition that does not exist in the health store, this request returns an error.
300pub async fn get_partition_health_using_policy(
301    configuration: &configuration::Configuration,
302    api_version: &str,
303    partition_id: &str,
304    events_health_state_filter: Option<i32>,
305    replicas_health_state_filter: Option<i32>,
306    exclude_health_statistics: Option<bool>,
307    timeout: Option<i64>,
308    application_health_policy: Option<models::ApplicationHealthPolicy>,
309) -> Result<models::PartitionHealth, Error<GetPartitionHealthUsingPolicyError>> {
310    // add a prefix to parameters to efficiently prevent name collisions
311    let p_query_api_version = api_version;
312    let p_path_partition_id = partition_id;
313    let p_query_events_health_state_filter = events_health_state_filter;
314    let p_query_replicas_health_state_filter = replicas_health_state_filter;
315    let p_query_exclude_health_statistics = exclude_health_statistics;
316    let p_query_timeout = timeout;
317    let p_body_application_health_policy = application_health_policy;
318
319    let uri_str = format!(
320        "{}/Partitions/{partitionId}/$/GetHealth",
321        configuration.base_path,
322        partitionId = crate::apis::urlencode(p_path_partition_id)
323    );
324    let mut req_builder = configuration
325        .client
326        .request(reqwest::Method::POST, &uri_str);
327
328    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
329    if let Some(ref param_value) = p_query_events_health_state_filter {
330        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
331    }
332    if let Some(ref param_value) = p_query_replicas_health_state_filter {
333        req_builder = req_builder.query(&[("ReplicasHealthStateFilter", &param_value.to_string())]);
334    }
335    if let Some(ref param_value) = p_query_exclude_health_statistics {
336        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
337    }
338    if let Some(ref param_value) = p_query_timeout {
339        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
340    }
341    if let Some(ref user_agent) = configuration.user_agent {
342        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
343    }
344    req_builder = req_builder.json(&p_body_application_health_policy);
345
346    let req = req_builder.build()?;
347    let resp = configuration.client.execute(req).await?;
348
349    let status = resp.status();
350    let content_type = resp
351        .headers()
352        .get("content-type")
353        .and_then(|v| v.to_str().ok())
354        .unwrap_or("application/octet-stream");
355    let content_type = super::ContentType::from(content_type);
356
357    if !status.is_client_error() && !status.is_server_error() {
358        let content = resp.text().await?;
359        match content_type {
360            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
361            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PartitionHealth`"))),
362            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PartitionHealth`")))),
363        }
364    } else {
365        let content = resp.text().await?;
366        let entity: Option<GetPartitionHealthUsingPolicyError> =
367            serde_json::from_str(&content).ok();
368        Err(Error::ResponseError(ResponseContent {
369            status,
370            content,
371            entity,
372        }))
373    }
374}
375
376/// Gets the information about the specified partition. The response includes the partition ID, partitioning scheme information, keys supported by the partition, status, health, and other details about the partition.
377pub async fn get_partition_info(
378    configuration: &configuration::Configuration,
379    api_version: &str,
380    partition_id: &str,
381    timeout: Option<i64>,
382) -> Result<models::ServicePartitionInfo, Error<GetPartitionInfoError>> {
383    // add a prefix to parameters to efficiently prevent name collisions
384    let p_query_api_version = api_version;
385    let p_path_partition_id = partition_id;
386    let p_query_timeout = timeout;
387
388    let uri_str = format!(
389        "{}/Partitions/{partitionId}",
390        configuration.base_path,
391        partitionId = crate::apis::urlencode(p_path_partition_id)
392    );
393    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
394
395    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
396    if let Some(ref param_value) = p_query_timeout {
397        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
398    }
399    if let Some(ref user_agent) = configuration.user_agent {
400        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
401    }
402
403    let req = req_builder.build()?;
404    let resp = configuration.client.execute(req).await?;
405
406    let status = resp.status();
407    let content_type = resp
408        .headers()
409        .get("content-type")
410        .and_then(|v| v.to_str().ok())
411        .unwrap_or("application/octet-stream");
412    let content_type = super::ContentType::from(content_type);
413
414    if !status.is_client_error() && !status.is_server_error() {
415        let content = resp.text().await?;
416        match content_type {
417            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
418            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ServicePartitionInfo`"))),
419            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ServicePartitionInfo`")))),
420        }
421    } else {
422        let content = resp.text().await?;
423        let entity: Option<GetPartitionInfoError> = serde_json::from_str(&content).ok();
424        Err(Error::ResponseError(ResponseContent {
425            status,
426            content,
427            entity,
428        }))
429    }
430}
431
432/// The response includes the partition ID, partitioning scheme information, keys supported by the partition, status, health, and other details about the partition.
433pub async fn get_partition_info_list(
434    configuration: &configuration::Configuration,
435    api_version: &str,
436    service_id: &str,
437    continuation_token: Option<&str>,
438    timeout: Option<i64>,
439) -> Result<models::PagedServicePartitionInfoList, Error<GetPartitionInfoListError>> {
440    // add a prefix to parameters to efficiently prevent name collisions
441    let p_query_api_version = api_version;
442    let p_path_service_id = service_id;
443    let p_query_continuation_token = continuation_token;
444    let p_query_timeout = timeout;
445
446    let uri_str = format!(
447        "{}/Services/{serviceId}/$/GetPartitions",
448        configuration.base_path,
449        serviceId = crate::apis::urlencode(p_path_service_id)
450    );
451    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
452
453    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
454    if let Some(ref param_value) = p_query_continuation_token {
455        req_builder = req_builder.query(&[("ContinuationToken", &param_value.to_string())]);
456    }
457    if let Some(ref param_value) = p_query_timeout {
458        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
459    }
460    if let Some(ref user_agent) = configuration.user_agent {
461        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
462    }
463
464    let req = req_builder.build()?;
465    let resp = configuration.client.execute(req).await?;
466
467    let status = resp.status();
468    let content_type = resp
469        .headers()
470        .get("content-type")
471        .and_then(|v| v.to_str().ok())
472        .unwrap_or("application/octet-stream");
473    let content_type = super::ContentType::from(content_type);
474
475    if !status.is_client_error() && !status.is_server_error() {
476        let content = resp.text().await?;
477        match content_type {
478            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
479            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedServicePartitionInfoList`"))),
480            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PagedServicePartitionInfoList`")))),
481        }
482    } else {
483        let content = resp.text().await?;
484        let entity: Option<GetPartitionInfoListError> = serde_json::from_str(&content).ok();
485        Err(Error::ResponseError(ResponseContent {
486            status,
487            content,
488            entity,
489        }))
490    }
491}
492
493/// Returns information about the load of a specified partition. The response includes a list of load reports for a Service Fabric partition. Each report includes the load metric name, value, and last reported time in UTC.
494pub async fn get_partition_load_information(
495    configuration: &configuration::Configuration,
496    api_version: &str,
497    partition_id: &str,
498    timeout: Option<i64>,
499) -> Result<models::PartitionLoadInformation, Error<GetPartitionLoadInformationError>> {
500    // add a prefix to parameters to efficiently prevent name collisions
501    let p_query_api_version = api_version;
502    let p_path_partition_id = partition_id;
503    let p_query_timeout = timeout;
504
505    let uri_str = format!(
506        "{}/Partitions/{partitionId}/$/GetLoadInformation",
507        configuration.base_path,
508        partitionId = crate::apis::urlencode(p_path_partition_id)
509    );
510    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
511
512    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
513    if let Some(ref param_value) = p_query_timeout {
514        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
515    }
516    if let Some(ref user_agent) = configuration.user_agent {
517        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
518    }
519
520    let req = req_builder.build()?;
521    let resp = configuration.client.execute(req).await?;
522
523    let status = resp.status();
524    let content_type = resp
525        .headers()
526        .get("content-type")
527        .and_then(|v| v.to_str().ok())
528        .unwrap_or("application/octet-stream");
529    let content_type = super::ContentType::from(content_type);
530
531    if !status.is_client_error() && !status.is_server_error() {
532        let content = resp.text().await?;
533        match content_type {
534            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
535            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PartitionLoadInformation`"))),
536            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PartitionLoadInformation`")))),
537        }
538    } else {
539        let content = resp.text().await?;
540        let entity: Option<GetPartitionLoadInformationError> = serde_json::from_str(&content).ok();
541        Err(Error::ResponseError(ResponseContent {
542            status,
543            content,
544            entity,
545        }))
546    }
547}
548
549/// Gets name of the service for the specified partition. A 404 error is returned if the partition ID does not exist in the cluster.
550pub async fn get_service_name_info(
551    configuration: &configuration::Configuration,
552    api_version: &str,
553    partition_id: &str,
554    timeout: Option<i64>,
555) -> Result<models::ServiceNameInfo, Error<GetServiceNameInfoError>> {
556    // add a prefix to parameters to efficiently prevent name collisions
557    let p_query_api_version = api_version;
558    let p_path_partition_id = partition_id;
559    let p_query_timeout = timeout;
560
561    let uri_str = format!(
562        "{}/Partitions/{partitionId}/$/GetServiceName",
563        configuration.base_path,
564        partitionId = crate::apis::urlencode(p_path_partition_id)
565    );
566    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
567
568    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
569    if let Some(ref param_value) = p_query_timeout {
570        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
571    }
572    if let Some(ref user_agent) = configuration.user_agent {
573        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
574    }
575
576    let req = req_builder.build()?;
577    let resp = configuration.client.execute(req).await?;
578
579    let status = resp.status();
580    let content_type = resp
581        .headers()
582        .get("content-type")
583        .and_then(|v| v.to_str().ok())
584        .unwrap_or("application/octet-stream");
585    let content_type = super::ContentType::from(content_type);
586
587    if !status.is_client_error() && !status.is_server_error() {
588        let content = resp.text().await?;
589        match content_type {
590            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
591            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ServiceNameInfo`"))),
592            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ServiceNameInfo`")))),
593        }
594    } else {
595        let content = resp.text().await?;
596        let entity: Option<GetServiceNameInfoError> = serde_json::from_str(&content).ok();
597        Err(Error::ResponseError(ResponseContent {
598            status,
599            content,
600            entity,
601        }))
602    }
603}
604
605/// This command moves the auxiliary replica of a partition of a stateful service, respecting all constraints. CurrentNodeName can be omitted, and in that case a random auxiliary replica is chosen. NewNodeName can be omitted, and in that case the auxiliary replica is moved to a random node. If IgnoreConstraints parameter is specified and set to true, then auxiliary will be moved regardless of the constraints.
606pub async fn move_auxiliary_replica(
607    configuration: &configuration::Configuration,
608    api_version: &str,
609    service_id: &str,
610    partition_id: &str,
611    current_node_name: Option<&str>,
612    new_node_name: Option<&str>,
613    ignore_constraints: Option<bool>,
614    timeout: Option<i64>,
615) -> Result<(), Error<MoveAuxiliaryReplicaError>> {
616    // add a prefix to parameters to efficiently prevent name collisions
617    let p_query_api_version = api_version;
618    let p_path_service_id = service_id;
619    let p_path_partition_id = partition_id;
620    let p_query_current_node_name = current_node_name;
621    let p_query_new_node_name = new_node_name;
622    let p_query_ignore_constraints = ignore_constraints;
623    let p_query_timeout = timeout;
624
625    let uri_str = format!(
626        "{}/Services/{serviceId}/$/GetPartitions/{partitionId}/$/MoveAuxiliaryReplica",
627        configuration.base_path,
628        serviceId = crate::apis::urlencode(p_path_service_id),
629        partitionId = crate::apis::urlencode(p_path_partition_id)
630    );
631    let mut req_builder = configuration
632        .client
633        .request(reqwest::Method::POST, &uri_str);
634
635    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
636    if let Some(ref param_value) = p_query_current_node_name {
637        req_builder = req_builder.query(&[("CurrentNodeName", &param_value.to_string())]);
638    }
639    if let Some(ref param_value) = p_query_new_node_name {
640        req_builder = req_builder.query(&[("NewNodeName", &param_value.to_string())]);
641    }
642    if let Some(ref param_value) = p_query_ignore_constraints {
643        req_builder = req_builder.query(&[("IgnoreConstraints", &param_value.to_string())]);
644    }
645    if let Some(ref param_value) = p_query_timeout {
646        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
647    }
648    if let Some(ref user_agent) = configuration.user_agent {
649        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
650    }
651
652    let req = req_builder.build()?;
653    let resp = configuration.client.execute(req).await?;
654
655    let status = resp.status();
656
657    if !status.is_client_error() && !status.is_server_error() {
658        Ok(())
659    } else {
660        let content = resp.text().await?;
661        let entity: Option<MoveAuxiliaryReplicaError> = serde_json::from_str(&content).ok();
662        Err(Error::ResponseError(ResponseContent {
663            status,
664            content,
665            entity,
666        }))
667    }
668}
669
670/// This command moves the instance of a partition of a stateless service, respecting all constraints. Partition id and service name must be specified to be able to move the instance. CurrentNodeName when specified identifies the instance that is moved. If not specified, random instance will be moved  New node name can be omitted, and in that case instance is moved to a random node. If IgnoreConstraints parameter is specified and set to true, then instance will be moved regardless of the constraints.
671pub async fn move_instance(
672    configuration: &configuration::Configuration,
673    api_version: &str,
674    service_id: &str,
675    partition_id: &str,
676    current_node_name: Option<&str>,
677    new_node_name: Option<&str>,
678    ignore_constraints: Option<bool>,
679    timeout: Option<i64>,
680) -> Result<(), Error<MoveInstanceError>> {
681    // add a prefix to parameters to efficiently prevent name collisions
682    let p_query_api_version = api_version;
683    let p_path_service_id = service_id;
684    let p_path_partition_id = partition_id;
685    let p_query_current_node_name = current_node_name;
686    let p_query_new_node_name = new_node_name;
687    let p_query_ignore_constraints = ignore_constraints;
688    let p_query_timeout = timeout;
689
690    let uri_str = format!(
691        "{}/Services/{serviceId}/$/GetPartitions/{partitionId}/$/MoveInstance",
692        configuration.base_path,
693        serviceId = crate::apis::urlencode(p_path_service_id),
694        partitionId = crate::apis::urlencode(p_path_partition_id)
695    );
696    let mut req_builder = configuration
697        .client
698        .request(reqwest::Method::POST, &uri_str);
699
700    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
701    if let Some(ref param_value) = p_query_current_node_name {
702        req_builder = req_builder.query(&[("CurrentNodeName", &param_value.to_string())]);
703    }
704    if let Some(ref param_value) = p_query_new_node_name {
705        req_builder = req_builder.query(&[("NewNodeName", &param_value.to_string())]);
706    }
707    if let Some(ref param_value) = p_query_ignore_constraints {
708        req_builder = req_builder.query(&[("IgnoreConstraints", &param_value.to_string())]);
709    }
710    if let Some(ref param_value) = p_query_timeout {
711        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
712    }
713    if let Some(ref user_agent) = configuration.user_agent {
714        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
715    }
716
717    let req = req_builder.build()?;
718    let resp = configuration.client.execute(req).await?;
719
720    let status = resp.status();
721
722    if !status.is_client_error() && !status.is_server_error() {
723        Ok(())
724    } else {
725        let content = resp.text().await?;
726        let entity: Option<MoveInstanceError> = serde_json::from_str(&content).ok();
727        Err(Error::ResponseError(ResponseContent {
728            status,
729            content,
730            entity,
731        }))
732    }
733}
734
735/// This command moves the primary replica of a partition of a stateful service, respecting all constraints. If NodeName parameter is specified, primary will be moved to the specified node (if constraints allow it). If NodeName parameter is not specified, primary replica will be moved to a random node in the cluster. If IgnoreConstraints parameter is specified and set to true, then primary will be moved regardless of the constraints.
736pub async fn move_primary_replica(
737    configuration: &configuration::Configuration,
738    api_version: &str,
739    partition_id: &str,
740    node_name: Option<&str>,
741    ignore_constraints: Option<bool>,
742    timeout: Option<i64>,
743) -> Result<(), Error<MovePrimaryReplicaError>> {
744    // add a prefix to parameters to efficiently prevent name collisions
745    let p_query_api_version = api_version;
746    let p_path_partition_id = partition_id;
747    let p_query_node_name = node_name;
748    let p_query_ignore_constraints = ignore_constraints;
749    let p_query_timeout = timeout;
750
751    let uri_str = format!(
752        "{}/Partitions/{partitionId}/$/MovePrimaryReplica",
753        configuration.base_path,
754        partitionId = crate::apis::urlencode(p_path_partition_id)
755    );
756    let mut req_builder = configuration
757        .client
758        .request(reqwest::Method::POST, &uri_str);
759
760    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
761    if let Some(ref param_value) = p_query_node_name {
762        req_builder = req_builder.query(&[("NodeName", &param_value.to_string())]);
763    }
764    if let Some(ref param_value) = p_query_ignore_constraints {
765        req_builder = req_builder.query(&[("IgnoreConstraints", &param_value.to_string())]);
766    }
767    if let Some(ref param_value) = p_query_timeout {
768        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
769    }
770    if let Some(ref user_agent) = configuration.user_agent {
771        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
772    }
773
774    let req = req_builder.build()?;
775    let resp = configuration.client.execute(req).await?;
776
777    let status = resp.status();
778
779    if !status.is_client_error() && !status.is_server_error() {
780        Ok(())
781    } else {
782        let content = resp.text().await?;
783        let entity: Option<MovePrimaryReplicaError> = serde_json::from_str(&content).ok();
784        Err(Error::ResponseError(ResponseContent {
785            status,
786            content,
787            entity,
788        }))
789    }
790}
791
792/// This command moves the secondary replica of a partition of a stateful service, respecting all constraints. CurrentNodeName parameter must be specified to identify the replica that is moved. Source node name must be specified, but new node name can be omitted, and in that case replica is moved to a random node. If IgnoreConstraints parameter is specified and set to true, then secondary will be moved regardless of the constraints.
793pub async fn move_secondary_replica(
794    configuration: &configuration::Configuration,
795    api_version: &str,
796    partition_id: &str,
797    current_node_name: &str,
798    new_node_name: Option<&str>,
799    ignore_constraints: Option<bool>,
800    timeout: Option<i64>,
801) -> Result<(), Error<MoveSecondaryReplicaError>> {
802    // add a prefix to parameters to efficiently prevent name collisions
803    let p_query_api_version = api_version;
804    let p_path_partition_id = partition_id;
805    let p_query_current_node_name = current_node_name;
806    let p_query_new_node_name = new_node_name;
807    let p_query_ignore_constraints = ignore_constraints;
808    let p_query_timeout = timeout;
809
810    let uri_str = format!(
811        "{}/Partitions/{partitionId}/$/MoveSecondaryReplica",
812        configuration.base_path,
813        partitionId = crate::apis::urlencode(p_path_partition_id)
814    );
815    let mut req_builder = configuration
816        .client
817        .request(reqwest::Method::POST, &uri_str);
818
819    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
820    req_builder = req_builder.query(&[("CurrentNodeName", &p_query_current_node_name.to_string())]);
821    if let Some(ref param_value) = p_query_new_node_name {
822        req_builder = req_builder.query(&[("NewNodeName", &param_value.to_string())]);
823    }
824    if let Some(ref param_value) = p_query_ignore_constraints {
825        req_builder = req_builder.query(&[("IgnoreConstraints", &param_value.to_string())]);
826    }
827    if let Some(ref param_value) = p_query_timeout {
828        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
829    }
830    if let Some(ref user_agent) = configuration.user_agent {
831        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
832    }
833
834    let req = req_builder.build()?;
835    let resp = configuration.client.execute(req).await?;
836
837    let status = resp.status();
838
839    if !status.is_client_error() && !status.is_server_error() {
840        Ok(())
841    } else {
842        let content = resp.text().await?;
843        let entity: Option<MoveSecondaryReplicaError> = serde_json::from_str(&content).ok();
844        Err(Error::ResponseError(ResponseContent {
845            status,
846            content,
847            entity,
848        }))
849    }
850}
851
852/// This operation should only be performed if it is known that the replicas that are down cannot be recovered. Incorrect use of this API can cause potential data loss.
853pub async fn recover_all_partitions(
854    configuration: &configuration::Configuration,
855    api_version: &str,
856    timeout: Option<i64>,
857) -> Result<(), Error<RecoverAllPartitionsError>> {
858    // add a prefix to parameters to efficiently prevent name collisions
859    let p_query_api_version = api_version;
860    let p_query_timeout = timeout;
861
862    let uri_str = format!("{}/$/RecoverAllPartitions", configuration.base_path);
863    let mut req_builder = configuration
864        .client
865        .request(reqwest::Method::POST, &uri_str);
866
867    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
868    if let Some(ref param_value) = p_query_timeout {
869        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
870    }
871    if let Some(ref user_agent) = configuration.user_agent {
872        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
873    }
874
875    let req = req_builder.build()?;
876    let resp = configuration.client.execute(req).await?;
877
878    let status = resp.status();
879
880    if !status.is_client_error() && !status.is_server_error() {
881        Ok(())
882    } else {
883        let content = resp.text().await?;
884        let entity: Option<RecoverAllPartitionsError> = serde_json::from_str(&content).ok();
885        Err(Error::ResponseError(ResponseContent {
886            status,
887            content,
888            entity,
889        }))
890    }
891}
892
893/// This operation should only be performed if it is known that the replicas that are down cannot be recovered. Incorrect use of this API can cause potential data loss.
894pub async fn recover_partition(
895    configuration: &configuration::Configuration,
896    partition_id: &str,
897    api_version: &str,
898    timeout: Option<i64>,
899) -> Result<(), Error<RecoverPartitionError>> {
900    // add a prefix to parameters to efficiently prevent name collisions
901    let p_path_partition_id = partition_id;
902    let p_query_api_version = api_version;
903    let p_query_timeout = timeout;
904
905    let uri_str = format!(
906        "{}/Partitions/{partitionId}/$/Recover",
907        configuration.base_path,
908        partitionId = crate::apis::urlencode(p_path_partition_id)
909    );
910    let mut req_builder = configuration
911        .client
912        .request(reqwest::Method::POST, &uri_str);
913
914    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
915    if let Some(ref param_value) = p_query_timeout {
916        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
917    }
918    if let Some(ref user_agent) = configuration.user_agent {
919        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
920    }
921
922    let req = req_builder.build()?;
923    let resp = configuration.client.execute(req).await?;
924
925    let status = resp.status();
926
927    if !status.is_client_error() && !status.is_server_error() {
928        Ok(())
929    } else {
930        let content = resp.text().await?;
931        let entity: Option<RecoverPartitionError> = serde_json::from_str(&content).ok();
932        Err(Error::ResponseError(ResponseContent {
933            status,
934            content,
935            entity,
936        }))
937    }
938}
939
940/// Indicates to the Service Fabric cluster that it should attempt to recover the specified service that is currently stuck in quorum loss. This operation should only be performed if it is known that the replicas that are down cannot be recovered. Incorrect use of this API can cause potential data loss.
941pub async fn recover_service_partitions(
942    configuration: &configuration::Configuration,
943    service_id: &str,
944    api_version: &str,
945    timeout: Option<i64>,
946) -> Result<(), Error<RecoverServicePartitionsError>> {
947    // add a prefix to parameters to efficiently prevent name collisions
948    let p_path_service_id = service_id;
949    let p_query_api_version = api_version;
950    let p_query_timeout = timeout;
951
952    let uri_str = format!(
953        "{}/Services/$/{serviceId}/$/GetPartitions/$/Recover",
954        configuration.base_path,
955        serviceId = crate::apis::urlencode(p_path_service_id)
956    );
957    let mut req_builder = configuration
958        .client
959        .request(reqwest::Method::POST, &uri_str);
960
961    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
962    if let Some(ref param_value) = p_query_timeout {
963        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
964    }
965    if let Some(ref user_agent) = configuration.user_agent {
966        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
967    }
968
969    let req = req_builder.build()?;
970    let resp = configuration.client.execute(req).await?;
971
972    let status = resp.status();
973
974    if !status.is_client_error() && !status.is_server_error() {
975        Ok(())
976    } else {
977        let content = resp.text().await?;
978        let entity: Option<RecoverServicePartitionsError> = serde_json::from_str(&content).ok();
979        Err(Error::ResponseError(ResponseContent {
980            status,
981            content,
982            entity,
983        }))
984    }
985}
986
987/// Indicates to the Service Fabric cluster that it should attempt to recover the system services that are currently stuck in quorum loss. This operation should only be performed if it is known that the replicas that are down cannot be recovered. Incorrect use of this API can cause potential data loss.
988pub async fn recover_system_partitions(
989    configuration: &configuration::Configuration,
990    api_version: &str,
991    timeout: Option<i64>,
992) -> Result<(), Error<RecoverSystemPartitionsError>> {
993    // add a prefix to parameters to efficiently prevent name collisions
994    let p_query_api_version = api_version;
995    let p_query_timeout = timeout;
996
997    let uri_str = format!("{}/$/RecoverSystemPartitions", configuration.base_path);
998    let mut req_builder = configuration
999        .client
1000        .request(reqwest::Method::POST, &uri_str);
1001
1002    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1003    if let Some(ref param_value) = p_query_timeout {
1004        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1005    }
1006    if let Some(ref user_agent) = configuration.user_agent {
1007        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1008    }
1009
1010    let req = req_builder.build()?;
1011    let resp = configuration.client.execute(req).await?;
1012
1013    let status = resp.status();
1014
1015    if !status.is_client_error() && !status.is_server_error() {
1016        Ok(())
1017    } else {
1018        let content = resp.text().await?;
1019        let entity: Option<RecoverSystemPartitionsError> = serde_json::from_str(&content).ok();
1020        Err(Error::ResponseError(ResponseContent {
1021            status,
1022            content,
1023            entity,
1024        }))
1025    }
1026}
1027
1028/// Reports health state of the specified Service Fabric partition. The report must contain the information about the source of the health report and property on which it is reported. The report is sent to a Service Fabric gateway Partition, which forwards to the health store. The report may be accepted by the gateway, but rejected by the health store after extra validation. For example, the health store may reject the report because of an invalid parameter, like a stale sequence number. To see whether the report was applied in the health store, run GetPartitionHealth and check that the report appears in the HealthEvents section.
1029pub async fn report_partition_health(
1030    configuration: &configuration::Configuration,
1031    api_version: &str,
1032    partition_id: &str,
1033    health_information: models::HealthInformation,
1034    immediate: Option<bool>,
1035    timeout: Option<i64>,
1036) -> Result<(), Error<ReportPartitionHealthError>> {
1037    // add a prefix to parameters to efficiently prevent name collisions
1038    let p_query_api_version = api_version;
1039    let p_path_partition_id = partition_id;
1040    let p_body_health_information = health_information;
1041    let p_query_immediate = immediate;
1042    let p_query_timeout = timeout;
1043
1044    let uri_str = format!(
1045        "{}/Partitions/{partitionId}/$/ReportHealth",
1046        configuration.base_path,
1047        partitionId = crate::apis::urlencode(p_path_partition_id)
1048    );
1049    let mut req_builder = configuration
1050        .client
1051        .request(reqwest::Method::POST, &uri_str);
1052
1053    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1054    if let Some(ref param_value) = p_query_immediate {
1055        req_builder = req_builder.query(&[("Immediate", &param_value.to_string())]);
1056    }
1057    if let Some(ref param_value) = p_query_timeout {
1058        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1059    }
1060    if let Some(ref user_agent) = configuration.user_agent {
1061        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1062    }
1063    req_builder = req_builder.json(&p_body_health_information);
1064
1065    let req = req_builder.build()?;
1066    let resp = configuration.client.execute(req).await?;
1067
1068    let status = resp.status();
1069
1070    if !status.is_client_error() && !status.is_server_error() {
1071        Ok(())
1072    } else {
1073        let content = resp.text().await?;
1074        let entity: Option<ReportPartitionHealthError> = serde_json::from_str(&content).ok();
1075        Err(Error::ResponseError(ResponseContent {
1076            status,
1077            content,
1078            entity,
1079        }))
1080    }
1081}
1082
1083/// Resets the current load of a Service Fabric partition to the default load for the service.
1084pub async fn reset_partition_load(
1085    configuration: &configuration::Configuration,
1086    partition_id: &str,
1087    api_version: &str,
1088    timeout: Option<i64>,
1089) -> Result<(), Error<ResetPartitionLoadError>> {
1090    // add a prefix to parameters to efficiently prevent name collisions
1091    let p_path_partition_id = partition_id;
1092    let p_query_api_version = api_version;
1093    let p_query_timeout = timeout;
1094
1095    let uri_str = format!(
1096        "{}/Partitions/{partitionId}/$/ResetLoad",
1097        configuration.base_path,
1098        partitionId = crate::apis::urlencode(p_path_partition_id)
1099    );
1100    let mut req_builder = configuration
1101        .client
1102        .request(reqwest::Method::POST, &uri_str);
1103
1104    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1105    if let Some(ref param_value) = p_query_timeout {
1106        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1107    }
1108    if let Some(ref user_agent) = configuration.user_agent {
1109        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1110    }
1111
1112    let req = req_builder.build()?;
1113    let resp = configuration.client.execute(req).await?;
1114
1115    let status = resp.status();
1116
1117    if !status.is_client_error() && !status.is_server_error() {
1118        Ok(())
1119    } else {
1120        let content = resp.text().await?;
1121        let entity: Option<ResetPartitionLoadError> = serde_json::from_str(&content).ok();
1122        Err(Error::ResponseError(ResponseContent {
1123            status,
1124            content,
1125            entity,
1126        }))
1127    }
1128}
1129
1130/// Updates the load value and predicted load value for all the partitions provided for specified metrics.
1131pub async fn update_partition_load(
1132    configuration: &configuration::Configuration,
1133    api_version: &str,
1134    partition_metric_load_description_list: Vec<models::PartitionMetricLoadDescription>,
1135    continuation_token: Option<&str>,
1136    max_results: Option<i64>,
1137    timeout: Option<i64>,
1138) -> Result<models::PagedUpdatePartitionLoadResultList, Error<UpdatePartitionLoadError>> {
1139    // add a prefix to parameters to efficiently prevent name collisions
1140    let p_query_api_version = api_version;
1141    let p_body_partition_metric_load_description_list = partition_metric_load_description_list;
1142    let p_query_continuation_token = continuation_token;
1143    let p_query_max_results = max_results;
1144    let p_query_timeout = timeout;
1145
1146    let uri_str = format!("{}/$/UpdatePartitionLoad", configuration.base_path);
1147    let mut req_builder = configuration
1148        .client
1149        .request(reqwest::Method::POST, &uri_str);
1150
1151    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1152    if let Some(ref param_value) = p_query_continuation_token {
1153        req_builder = req_builder.query(&[("ContinuationToken", &param_value.to_string())]);
1154    }
1155    if let Some(ref param_value) = p_query_max_results {
1156        req_builder = req_builder.query(&[("MaxResults", &param_value.to_string())]);
1157    }
1158    if let Some(ref param_value) = p_query_timeout {
1159        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1160    }
1161    if let Some(ref user_agent) = configuration.user_agent {
1162        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1163    }
1164    req_builder = req_builder.json(&p_body_partition_metric_load_description_list);
1165
1166    let req = req_builder.build()?;
1167    let resp = configuration.client.execute(req).await?;
1168
1169    let status = resp.status();
1170    let content_type = resp
1171        .headers()
1172        .get("content-type")
1173        .and_then(|v| v.to_str().ok())
1174        .unwrap_or("application/octet-stream");
1175    let content_type = super::ContentType::from(content_type);
1176
1177    if !status.is_client_error() && !status.is_server_error() {
1178        let content = resp.text().await?;
1179        match content_type {
1180            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1181            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedUpdatePartitionLoadResultList`"))),
1182            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PagedUpdatePartitionLoadResultList`")))),
1183        }
1184    } else {
1185        let content = resp.text().await?;
1186        let entity: Option<UpdatePartitionLoadError> = serde_json::from_str(&content).ok();
1187        Err(Error::ResponseError(ResponseContent {
1188            status,
1189            content,
1190            entity,
1191        }))
1192    }
1193}