1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum GetDeployedServiceReplicaDetailInfoError {
20 DefaultResponse(models::FabricError),
21 UnknownValue(serde_json::Value),
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum GetDeployedServiceReplicaDetailInfoByPartitionIdError {
28 DefaultResponse(models::FabricError),
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetDeployedServiceReplicaInfoListError {
36 DefaultResponse(models::FabricError),
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum GetReplicaHealthError {
44 DefaultResponse(models::FabricError),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum GetReplicaHealthUsingPolicyError {
52 DefaultResponse(models::FabricError),
53 UnknownValue(serde_json::Value),
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum GetReplicaInfoError {
60 DefaultResponse(models::FabricError),
61 UnknownValue(serde_json::Value),
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum GetReplicaInfoListError {
68 DefaultResponse(models::FabricError),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum RemoveReplicaError {
76 DefaultResponse(models::FabricError),
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum ReportReplicaHealthError {
84 DefaultResponse(models::FabricError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum RestartReplicaError {
92 DefaultResponse(models::FabricError),
93 UnknownValue(serde_json::Value),
94}
95
96pub async fn get_deployed_service_replica_detail_info(
98 configuration: &configuration::Configuration,
99 api_version: &str,
100 node_name: &str,
101 partition_id: &str,
102 replica_id: &str,
103 timeout: Option<i64>,
104) -> Result<models::DeployedServiceReplicaDetailInfo, Error<GetDeployedServiceReplicaDetailInfoError>>
105{
106 let p_query_api_version = api_version;
108 let p_path_node_name = node_name;
109 let p_path_partition_id = partition_id;
110 let p_path_replica_id = replica_id;
111 let p_query_timeout = timeout;
112
113 let uri_str = format!(
114 "{}/Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas/{replicaId}/$/GetDetail",
115 configuration.base_path,
116 nodeName = crate::apis::urlencode(p_path_node_name),
117 partitionId = crate::apis::urlencode(p_path_partition_id),
118 replicaId = crate::apis::urlencode(p_path_replica_id)
119 );
120 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
121
122 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
123 if let Some(ref param_value) = p_query_timeout {
124 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
125 }
126 if let Some(ref user_agent) = configuration.user_agent {
127 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
128 }
129
130 let req = req_builder.build()?;
131 let resp = configuration.client.execute(req).await?;
132
133 let status = resp.status();
134 let content_type = resp
135 .headers()
136 .get("content-type")
137 .and_then(|v| v.to_str().ok())
138 .unwrap_or("application/octet-stream");
139 let content_type = super::ContentType::from(content_type);
140
141 if !status.is_client_error() && !status.is_server_error() {
142 let content = resp.text().await?;
143 match content_type {
144 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
145 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployedServiceReplicaDetailInfo`"))),
146 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::DeployedServiceReplicaDetailInfo`")))),
147 }
148 } else {
149 let content = resp.text().await?;
150 let entity: Option<GetDeployedServiceReplicaDetailInfoError> =
151 serde_json::from_str(&content).ok();
152 Err(Error::ResponseError(ResponseContent {
153 status,
154 content,
155 entity,
156 }))
157 }
158}
159
160pub async fn get_deployed_service_replica_detail_info_by_partition_id(
162 configuration: &configuration::Configuration,
163 api_version: &str,
164 node_name: &str,
165 partition_id: &str,
166 timeout: Option<i64>,
167) -> Result<
168 models::DeployedServiceReplicaDetailInfo,
169 Error<GetDeployedServiceReplicaDetailInfoByPartitionIdError>,
170> {
171 let p_query_api_version = api_version;
173 let p_path_node_name = node_name;
174 let p_path_partition_id = partition_id;
175 let p_query_timeout = timeout;
176
177 let uri_str = format!(
178 "{}/Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas",
179 configuration.base_path,
180 nodeName = crate::apis::urlencode(p_path_node_name),
181 partitionId = crate::apis::urlencode(p_path_partition_id)
182 );
183 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
184
185 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
186 if let Some(ref param_value) = p_query_timeout {
187 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
188 }
189 if let Some(ref user_agent) = configuration.user_agent {
190 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
191 }
192
193 let req = req_builder.build()?;
194 let resp = configuration.client.execute(req).await?;
195
196 let status = resp.status();
197 let content_type = resp
198 .headers()
199 .get("content-type")
200 .and_then(|v| v.to_str().ok())
201 .unwrap_or("application/octet-stream");
202 let content_type = super::ContentType::from(content_type);
203
204 if !status.is_client_error() && !status.is_server_error() {
205 let content = resp.text().await?;
206 match content_type {
207 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
208 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployedServiceReplicaDetailInfo`"))),
209 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::DeployedServiceReplicaDetailInfo`")))),
210 }
211 } else {
212 let content = resp.text().await?;
213 let entity: Option<GetDeployedServiceReplicaDetailInfoByPartitionIdError> =
214 serde_json::from_str(&content).ok();
215 Err(Error::ResponseError(ResponseContent {
216 status,
217 content,
218 entity,
219 }))
220 }
221}
222
223pub async fn get_deployed_service_replica_info_list(
225 configuration: &configuration::Configuration,
226 api_version: &str,
227 node_name: &str,
228 application_id: &str,
229 partition_id: Option<&str>,
230 service_manifest_name: Option<&str>,
231 timeout: Option<i64>,
232) -> Result<Vec<models::DeployedServiceReplicaInfo>, Error<GetDeployedServiceReplicaInfoListError>>
233{
234 let p_query_api_version = api_version;
236 let p_path_node_name = node_name;
237 let p_path_application_id = application_id;
238 let p_query_partition_id = partition_id;
239 let p_query_service_manifest_name = service_manifest_name;
240 let p_query_timeout = timeout;
241
242 let uri_str = format!(
243 "{}/Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetReplicas",
244 configuration.base_path,
245 nodeName = crate::apis::urlencode(p_path_node_name),
246 applicationId = crate::apis::urlencode(p_path_application_id)
247 );
248 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
249
250 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
251 if let Some(ref param_value) = p_query_partition_id {
252 req_builder = req_builder.query(&[("PartitionId", ¶m_value.to_string())]);
253 }
254 if let Some(ref param_value) = p_query_service_manifest_name {
255 req_builder = req_builder.query(&[("ServiceManifestName", ¶m_value.to_string())]);
256 }
257 if let Some(ref param_value) = p_query_timeout {
258 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
259 }
260 if let Some(ref user_agent) = configuration.user_agent {
261 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
262 }
263
264 let req = req_builder.build()?;
265 let resp = configuration.client.execute(req).await?;
266
267 let status = resp.status();
268 let content_type = resp
269 .headers()
270 .get("content-type")
271 .and_then(|v| v.to_str().ok())
272 .unwrap_or("application/octet-stream");
273 let content_type = super::ContentType::from(content_type);
274
275 if !status.is_client_error() && !status.is_server_error() {
276 let content = resp.text().await?;
277 match content_type {
278 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
279 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::DeployedServiceReplicaInfo>`"))),
280 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::DeployedServiceReplicaInfo>`")))),
281 }
282 } else {
283 let content = resp.text().await?;
284 let entity: Option<GetDeployedServiceReplicaInfoListError> =
285 serde_json::from_str(&content).ok();
286 Err(Error::ResponseError(ResponseContent {
287 status,
288 content,
289 entity,
290 }))
291 }
292}
293
294pub async fn get_replica_health(
296 configuration: &configuration::Configuration,
297 api_version: &str,
298 partition_id: &str,
299 replica_id: &str,
300 events_health_state_filter: Option<i32>,
301 timeout: Option<i64>,
302) -> Result<models::ReplicaHealth, Error<GetReplicaHealthError>> {
303 let p_query_api_version = api_version;
305 let p_path_partition_id = partition_id;
306 let p_path_replica_id = replica_id;
307 let p_query_events_health_state_filter = events_health_state_filter;
308 let p_query_timeout = timeout;
309
310 let uri_str = format!(
311 "{}/Partitions/{partitionId}/$/GetReplicas/{replicaId}/$/GetHealth",
312 configuration.base_path,
313 partitionId = crate::apis::urlencode(p_path_partition_id),
314 replicaId = crate::apis::urlencode(p_path_replica_id)
315 );
316 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
317
318 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
319 if let Some(ref param_value) = p_query_events_health_state_filter {
320 req_builder = req_builder.query(&[("EventsHealthStateFilter", ¶m_value.to_string())]);
321 }
322 if let Some(ref param_value) = p_query_timeout {
323 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
324 }
325 if let Some(ref user_agent) = configuration.user_agent {
326 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
327 }
328
329 let req = req_builder.build()?;
330 let resp = configuration.client.execute(req).await?;
331
332 let status = resp.status();
333 let content_type = resp
334 .headers()
335 .get("content-type")
336 .and_then(|v| v.to_str().ok())
337 .unwrap_or("application/octet-stream");
338 let content_type = super::ContentType::from(content_type);
339
340 if !status.is_client_error() && !status.is_server_error() {
341 let content = resp.text().await?;
342 match content_type {
343 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
344 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplicaHealth`"))),
345 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::ReplicaHealth`")))),
346 }
347 } else {
348 let content = resp.text().await?;
349 let entity: Option<GetReplicaHealthError> = serde_json::from_str(&content).ok();
350 Err(Error::ResponseError(ResponseContent {
351 status,
352 content,
353 entity,
354 }))
355 }
356}
357
358pub async fn get_replica_health_using_policy(
360 configuration: &configuration::Configuration,
361 api_version: &str,
362 partition_id: &str,
363 replica_id: &str,
364 events_health_state_filter: Option<i32>,
365 timeout: Option<i64>,
366 application_health_policy: Option<models::ApplicationHealthPolicy>,
367) -> Result<models::ReplicaHealth, Error<GetReplicaHealthUsingPolicyError>> {
368 let p_query_api_version = api_version;
370 let p_path_partition_id = partition_id;
371 let p_path_replica_id = replica_id;
372 let p_query_events_health_state_filter = events_health_state_filter;
373 let p_query_timeout = timeout;
374 let p_body_application_health_policy = application_health_policy;
375
376 let uri_str = format!(
377 "{}/Partitions/{partitionId}/$/GetReplicas/{replicaId}/$/GetHealth",
378 configuration.base_path,
379 partitionId = crate::apis::urlencode(p_path_partition_id),
380 replicaId = crate::apis::urlencode(p_path_replica_id)
381 );
382 let mut req_builder = configuration
383 .client
384 .request(reqwest::Method::POST, &uri_str);
385
386 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
387 if let Some(ref param_value) = p_query_events_health_state_filter {
388 req_builder = req_builder.query(&[("EventsHealthStateFilter", ¶m_value.to_string())]);
389 }
390 if let Some(ref param_value) = p_query_timeout {
391 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
392 }
393 if let Some(ref user_agent) = configuration.user_agent {
394 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
395 }
396 req_builder = req_builder.json(&p_body_application_health_policy);
397
398 let req = req_builder.build()?;
399 let resp = configuration.client.execute(req).await?;
400
401 let status = resp.status();
402 let content_type = resp
403 .headers()
404 .get("content-type")
405 .and_then(|v| v.to_str().ok())
406 .unwrap_or("application/octet-stream");
407 let content_type = super::ContentType::from(content_type);
408
409 if !status.is_client_error() && !status.is_server_error() {
410 let content = resp.text().await?;
411 match content_type {
412 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
413 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplicaHealth`"))),
414 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::ReplicaHealth`")))),
415 }
416 } else {
417 let content = resp.text().await?;
418 let entity: Option<GetReplicaHealthUsingPolicyError> = serde_json::from_str(&content).ok();
419 Err(Error::ResponseError(ResponseContent {
420 status,
421 content,
422 entity,
423 }))
424 }
425}
426
427pub async fn get_replica_info(
429 configuration: &configuration::Configuration,
430 api_version: &str,
431 partition_id: &str,
432 replica_id: &str,
433 timeout: Option<i64>,
434) -> Result<models::ReplicaInfo, Error<GetReplicaInfoError>> {
435 let p_query_api_version = api_version;
437 let p_path_partition_id = partition_id;
438 let p_path_replica_id = replica_id;
439 let p_query_timeout = timeout;
440
441 let uri_str = format!(
442 "{}/Partitions/{partitionId}/$/GetReplicas/{replicaId}",
443 configuration.base_path,
444 partitionId = crate::apis::urlencode(p_path_partition_id),
445 replicaId = crate::apis::urlencode(p_path_replica_id)
446 );
447 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
448
449 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
450 if let Some(ref param_value) = p_query_timeout {
451 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
452 }
453 if let Some(ref user_agent) = configuration.user_agent {
454 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
455 }
456
457 let req = req_builder.build()?;
458 let resp = configuration.client.execute(req).await?;
459
460 let status = resp.status();
461 let content_type = resp
462 .headers()
463 .get("content-type")
464 .and_then(|v| v.to_str().ok())
465 .unwrap_or("application/octet-stream");
466 let content_type = super::ContentType::from(content_type);
467
468 if !status.is_client_error() && !status.is_server_error() {
469 let content = resp.text().await?;
470 match content_type {
471 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
472 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplicaInfo`"))),
473 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::ReplicaInfo`")))),
474 }
475 } else {
476 let content = resp.text().await?;
477 let entity: Option<GetReplicaInfoError> = serde_json::from_str(&content).ok();
478 Err(Error::ResponseError(ResponseContent {
479 status,
480 content,
481 entity,
482 }))
483 }
484}
485
486pub async fn get_replica_info_list(
488 configuration: &configuration::Configuration,
489 api_version: &str,
490 partition_id: &str,
491 continuation_token: Option<&str>,
492 timeout: Option<i64>,
493) -> Result<models::PagedReplicaInfoList, Error<GetReplicaInfoListError>> {
494 let p_query_api_version = api_version;
496 let p_path_partition_id = partition_id;
497 let p_query_continuation_token = continuation_token;
498 let p_query_timeout = timeout;
499
500 let uri_str = format!(
501 "{}/Partitions/{partitionId}/$/GetReplicas",
502 configuration.base_path,
503 partitionId = crate::apis::urlencode(p_path_partition_id)
504 );
505 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
506
507 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
508 if let Some(ref param_value) = p_query_continuation_token {
509 req_builder = req_builder.query(&[("ContinuationToken", ¶m_value.to_string())]);
510 }
511 if let Some(ref param_value) = p_query_timeout {
512 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
513 }
514 if let Some(ref user_agent) = configuration.user_agent {
515 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
516 }
517
518 let req = req_builder.build()?;
519 let resp = configuration.client.execute(req).await?;
520
521 let status = resp.status();
522 let content_type = resp
523 .headers()
524 .get("content-type")
525 .and_then(|v| v.to_str().ok())
526 .unwrap_or("application/octet-stream");
527 let content_type = super::ContentType::from(content_type);
528
529 if !status.is_client_error() && !status.is_server_error() {
530 let content = resp.text().await?;
531 match content_type {
532 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
533 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedReplicaInfoList`"))),
534 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::PagedReplicaInfoList`")))),
535 }
536 } else {
537 let content = resp.text().await?;
538 let entity: Option<GetReplicaInfoListError> = serde_json::from_str(&content).ok();
539 Err(Error::ResponseError(ResponseContent {
540 status,
541 content,
542 entity,
543 }))
544 }
545}
546
547pub async fn remove_replica(
549 configuration: &configuration::Configuration,
550 api_version: &str,
551 node_name: &str,
552 partition_id: &str,
553 replica_id: &str,
554 force_remove: Option<bool>,
555 timeout: Option<i64>,
556) -> Result<(), Error<RemoveReplicaError>> {
557 let p_query_api_version = api_version;
559 let p_path_node_name = node_name;
560 let p_path_partition_id = partition_id;
561 let p_path_replica_id = replica_id;
562 let p_query_force_remove = force_remove;
563 let p_query_timeout = timeout;
564
565 let uri_str = format!(
566 "{}/Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas/{replicaId}/$/Delete",
567 configuration.base_path,
568 nodeName = crate::apis::urlencode(p_path_node_name),
569 partitionId = crate::apis::urlencode(p_path_partition_id),
570 replicaId = crate::apis::urlencode(p_path_replica_id)
571 );
572 let mut req_builder = configuration
573 .client
574 .request(reqwest::Method::POST, &uri_str);
575
576 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
577 if let Some(ref param_value) = p_query_force_remove {
578 req_builder = req_builder.query(&[("ForceRemove", ¶m_value.to_string())]);
579 }
580 if let Some(ref param_value) = p_query_timeout {
581 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
582 }
583 if let Some(ref user_agent) = configuration.user_agent {
584 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
585 }
586
587 let req = req_builder.build()?;
588 let resp = configuration.client.execute(req).await?;
589
590 let status = resp.status();
591
592 if !status.is_client_error() && !status.is_server_error() {
593 Ok(())
594 } else {
595 let content = resp.text().await?;
596 let entity: Option<RemoveReplicaError> = serde_json::from_str(&content).ok();
597 Err(Error::ResponseError(ResponseContent {
598 status,
599 content,
600 entity,
601 }))
602 }
603}
604
605pub async fn report_replica_health(
607 configuration: &configuration::Configuration,
608 api_version: &str,
609 partition_id: &str,
610 replica_id: &str,
611 service_kind: &str,
612 health_information: models::HealthInformation,
613 immediate: Option<bool>,
614 timeout: Option<i64>,
615) -> Result<(), Error<ReportReplicaHealthError>> {
616 let p_query_api_version = api_version;
618 let p_path_partition_id = partition_id;
619 let p_path_replica_id = replica_id;
620 let p_query_service_kind = service_kind;
621 let p_body_health_information = health_information;
622 let p_query_immediate = immediate;
623 let p_query_timeout = timeout;
624
625 let uri_str = format!(
626 "{}/Partitions/{partitionId}/$/GetReplicas/{replicaId}/$/ReportHealth",
627 configuration.base_path,
628 partitionId = crate::apis::urlencode(p_path_partition_id),
629 replicaId = crate::apis::urlencode(p_path_replica_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 req_builder = req_builder.query(&[("ServiceKind", &p_query_service_kind.to_string())]);
637 if let Some(ref param_value) = p_query_immediate {
638 req_builder = req_builder.query(&[("Immediate", ¶m_value.to_string())]);
639 }
640 if let Some(ref param_value) = p_query_timeout {
641 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
642 }
643 if let Some(ref user_agent) = configuration.user_agent {
644 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
645 }
646 req_builder = req_builder.json(&p_body_health_information);
647
648 let req = req_builder.build()?;
649 let resp = configuration.client.execute(req).await?;
650
651 let status = resp.status();
652
653 if !status.is_client_error() && !status.is_server_error() {
654 Ok(())
655 } else {
656 let content = resp.text().await?;
657 let entity: Option<ReportReplicaHealthError> = serde_json::from_str(&content).ok();
658 Err(Error::ResponseError(ResponseContent {
659 status,
660 content,
661 entity,
662 }))
663 }
664}
665
666pub async fn restart_replica(
668 configuration: &configuration::Configuration,
669 api_version: &str,
670 node_name: &str,
671 partition_id: &str,
672 replica_id: &str,
673 timeout: Option<i64>,
674) -> Result<(), Error<RestartReplicaError>> {
675 let p_query_api_version = api_version;
677 let p_path_node_name = node_name;
678 let p_path_partition_id = partition_id;
679 let p_path_replica_id = replica_id;
680 let p_query_timeout = timeout;
681
682 let uri_str = format!(
683 "{}/Nodes/{nodeName}/$/GetPartitions/{partitionId}/$/GetReplicas/{replicaId}/$/Restart",
684 configuration.base_path,
685 nodeName = crate::apis::urlencode(p_path_node_name),
686 partitionId = crate::apis::urlencode(p_path_partition_id),
687 replicaId = crate::apis::urlencode(p_path_replica_id)
688 );
689 let mut req_builder = configuration
690 .client
691 .request(reqwest::Method::POST, &uri_str);
692
693 req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
694 if let Some(ref param_value) = p_query_timeout {
695 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
696 }
697 if let Some(ref user_agent) = configuration.user_agent {
698 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
699 }
700
701 let req = req_builder.build()?;
702 let resp = configuration.client.execute(req).await?;
703
704 let status = resp.status();
705
706 if !status.is_client_error() && !status.is_server_error() {
707 Ok(())
708 } else {
709 let content = resp.text().await?;
710 let entity: Option<RestartReplicaError> = serde_json::from_str(&content).ok();
711 Err(Error::ResponseError(ResponseContent {
712 status,
713 content,
714 entity,
715 }))
716 }
717}