Skip to main content

openapi_service_fabric/apis/
application_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 [`create_application`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum CreateApplicationError {
20    DefaultResponse(models::FabricError),
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`delete_application`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum DeleteApplicationError {
28    DefaultResponse(models::FabricError),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_application_health`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetApplicationHealthError {
36    DefaultResponse(models::FabricError),
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`get_application_health_using_policy`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum GetApplicationHealthUsingPolicyError {
44    DefaultResponse(models::FabricError),
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`get_application_info`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum GetApplicationInfoError {
52    DefaultResponse(models::FabricError),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`get_application_info_list`]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum GetApplicationInfoListError {
60    DefaultResponse(models::FabricError),
61    UnknownValue(serde_json::Value),
62}
63
64/// struct for typed errors of method [`get_application_load_info`]
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum GetApplicationLoadInfoError {
68    DefaultResponse(models::FabricError),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`get_application_upgrade`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum GetApplicationUpgradeError {
76    DefaultResponse(models::FabricError),
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`get_deployed_application_health`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum GetDeployedApplicationHealthError {
84    DefaultResponse(models::FabricError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_deployed_application_health_using_policy`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetDeployedApplicationHealthUsingPolicyError {
92    DefaultResponse(models::FabricError),
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`get_deployed_application_info`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum GetDeployedApplicationInfoError {
100    DefaultResponse(models::FabricError),
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`get_deployed_application_info_list`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum GetDeployedApplicationInfoListError {
108    DefaultResponse(models::FabricError),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`report_application_health`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum ReportApplicationHealthError {
116    DefaultResponse(models::FabricError),
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`report_deployed_application_health`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum ReportDeployedApplicationHealthError {
124    DefaultResponse(models::FabricError),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`resume_application_upgrade`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum ResumeApplicationUpgradeError {
132    DefaultResponse(models::FabricError),
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`rollback_application_upgrade`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum RollbackApplicationUpgradeError {
140    DefaultResponse(models::FabricError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`start_application_upgrade`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum StartApplicationUpgradeError {
148    DefaultResponse(models::FabricError),
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`update_application`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum UpdateApplicationError {
156    DefaultResponse(models::FabricError),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`update_application_upgrade`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum UpdateApplicationUpgradeError {
164    DefaultResponse(models::FabricError),
165    UnknownValue(serde_json::Value),
166}
167
168/// Creates a Service Fabric application using the specified description.
169pub async fn create_application(
170    configuration: &configuration::Configuration,
171    api_version: &str,
172    application_description: models::ApplicationDescription,
173    timeout: Option<i64>,
174) -> Result<(), Error<CreateApplicationError>> {
175    // add a prefix to parameters to efficiently prevent name collisions
176    let p_query_api_version = api_version;
177    let p_body_application_description = application_description;
178    let p_query_timeout = timeout;
179
180    let uri_str = format!("{}/Applications/$/Create", configuration.base_path);
181    let mut req_builder = configuration
182        .client
183        .request(reqwest::Method::POST, &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", &param_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    req_builder = req_builder.json(&p_body_application_description);
193
194    let req = req_builder.build()?;
195    let resp = configuration.client.execute(req).await?;
196
197    let status = resp.status();
198
199    if !status.is_client_error() && !status.is_server_error() {
200        Ok(())
201    } else {
202        let content = resp.text().await?;
203        let entity: Option<CreateApplicationError> = serde_json::from_str(&content).ok();
204        Err(Error::ResponseError(ResponseContent {
205            status,
206            content,
207            entity,
208        }))
209    }
210}
211
212/// An application must be created before it can be deleted. Deleting an application will delete all services that are part of that application. By default, Service Fabric will try to close service replicas in a graceful manner and then delete the service. However, if a service is having issues closing the replica gracefully, the delete operation may take a long time or get stuck. Use the optional ForceRemove flag to skip the graceful close sequence and forcefully delete the application and all of its services.
213pub async fn delete_application(
214    configuration: &configuration::Configuration,
215    api_version: &str,
216    application_id: &str,
217    force_remove: Option<bool>,
218    timeout: Option<i64>,
219) -> Result<(), Error<DeleteApplicationError>> {
220    // add a prefix to parameters to efficiently prevent name collisions
221    let p_query_api_version = api_version;
222    let p_path_application_id = application_id;
223    let p_query_force_remove = force_remove;
224    let p_query_timeout = timeout;
225
226    let uri_str = format!(
227        "{}/Applications/{applicationId}/$/Delete",
228        configuration.base_path,
229        applicationId = crate::apis::urlencode(p_path_application_id)
230    );
231    let mut req_builder = configuration
232        .client
233        .request(reqwest::Method::POST, &uri_str);
234
235    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
236    if let Some(ref param_value) = p_query_force_remove {
237        req_builder = req_builder.query(&[("ForceRemove", &param_value.to_string())]);
238    }
239    if let Some(ref param_value) = p_query_timeout {
240        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
241    }
242    if let Some(ref user_agent) = configuration.user_agent {
243        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
244    }
245
246    let req = req_builder.build()?;
247    let resp = configuration.client.execute(req).await?;
248
249    let status = resp.status();
250
251    if !status.is_client_error() && !status.is_server_error() {
252        Ok(())
253    } else {
254        let content = resp.text().await?;
255        let entity: Option<DeleteApplicationError> = serde_json::from_str(&content).ok();
256        Err(Error::ResponseError(ResponseContent {
257            status,
258            content,
259            entity,
260        }))
261    }
262}
263
264/// Returns the heath state of the service fabric application. The response reports either Ok, Error or Warning health state. If the entity is not found in the health store, it will return Error.
265pub async fn get_application_health(
266    configuration: &configuration::Configuration,
267    application_id: &str,
268    api_version: &str,
269    events_health_state_filter: Option<i32>,
270    deployed_applications_health_state_filter: Option<i32>,
271    services_health_state_filter: Option<i32>,
272    exclude_health_statistics: Option<bool>,
273    timeout: Option<i64>,
274) -> Result<models::ApplicationHealth, Error<GetApplicationHealthError>> {
275    // add a prefix to parameters to efficiently prevent name collisions
276    let p_path_application_id = application_id;
277    let p_query_api_version = api_version;
278    let p_query_events_health_state_filter = events_health_state_filter;
279    let p_query_deployed_applications_health_state_filter =
280        deployed_applications_health_state_filter;
281    let p_query_services_health_state_filter = services_health_state_filter;
282    let p_query_exclude_health_statistics = exclude_health_statistics;
283    let p_query_timeout = timeout;
284
285    let uri_str = format!(
286        "{}/Applications/{applicationId}/$/GetHealth",
287        configuration.base_path,
288        applicationId = crate::apis::urlencode(p_path_application_id)
289    );
290    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
291
292    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
293    if let Some(ref param_value) = p_query_events_health_state_filter {
294        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
295    }
296    if let Some(ref param_value) = p_query_deployed_applications_health_state_filter {
297        req_builder = req_builder.query(&[(
298            "DeployedApplicationsHealthStateFilter",
299            &param_value.to_string(),
300        )]);
301    }
302    if let Some(ref param_value) = p_query_services_health_state_filter {
303        req_builder = req_builder.query(&[("ServicesHealthStateFilter", &param_value.to_string())]);
304    }
305    if let Some(ref param_value) = p_query_exclude_health_statistics {
306        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
307    }
308    if let Some(ref param_value) = p_query_timeout {
309        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
310    }
311    if let Some(ref user_agent) = configuration.user_agent {
312        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
313    }
314
315    let req = req_builder.build()?;
316    let resp = configuration.client.execute(req).await?;
317
318    let status = resp.status();
319    let content_type = resp
320        .headers()
321        .get("content-type")
322        .and_then(|v| v.to_str().ok())
323        .unwrap_or("application/octet-stream");
324    let content_type = super::ContentType::from(content_type);
325
326    if !status.is_client_error() && !status.is_server_error() {
327        let content = resp.text().await?;
328        match content_type {
329            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
330            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationHealth`"))),
331            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::ApplicationHealth`")))),
332        }
333    } else {
334        let content = resp.text().await?;
335        let entity: Option<GetApplicationHealthError> = serde_json::from_str(&content).ok();
336        Err(Error::ResponseError(ResponseContent {
337            status,
338            content,
339            entity,
340        }))
341    }
342}
343
344/// Gets the health of a Service Fabric application. Use EventsHealthStateFilter to filter the collection of health events reported on the node based on the health state. Use ClusterHealthPolicies to override the health policies used to evaluate the health.
345pub async fn get_application_health_using_policy(
346    configuration: &configuration::Configuration,
347    application_id: &str,
348    api_version: &str,
349    events_health_state_filter: Option<i32>,
350    deployed_applications_health_state_filter: Option<i32>,
351    services_health_state_filter: Option<i32>,
352    exclude_health_statistics: Option<bool>,
353    timeout: Option<i64>,
354    application_health_policy: Option<models::ApplicationHealthPolicy>,
355) -> Result<models::ApplicationHealth, Error<GetApplicationHealthUsingPolicyError>> {
356    // add a prefix to parameters to efficiently prevent name collisions
357    let p_path_application_id = application_id;
358    let p_query_api_version = api_version;
359    let p_query_events_health_state_filter = events_health_state_filter;
360    let p_query_deployed_applications_health_state_filter =
361        deployed_applications_health_state_filter;
362    let p_query_services_health_state_filter = services_health_state_filter;
363    let p_query_exclude_health_statistics = exclude_health_statistics;
364    let p_query_timeout = timeout;
365    let p_body_application_health_policy = application_health_policy;
366
367    let uri_str = format!(
368        "{}/Applications/{applicationId}/$/GetHealth",
369        configuration.base_path,
370        applicationId = crate::apis::urlencode(p_path_application_id)
371    );
372    let mut req_builder = configuration
373        .client
374        .request(reqwest::Method::POST, &uri_str);
375
376    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
377    if let Some(ref param_value) = p_query_events_health_state_filter {
378        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
379    }
380    if let Some(ref param_value) = p_query_deployed_applications_health_state_filter {
381        req_builder = req_builder.query(&[(
382            "DeployedApplicationsHealthStateFilter",
383            &param_value.to_string(),
384        )]);
385    }
386    if let Some(ref param_value) = p_query_services_health_state_filter {
387        req_builder = req_builder.query(&[("ServicesHealthStateFilter", &param_value.to_string())]);
388    }
389    if let Some(ref param_value) = p_query_exclude_health_statistics {
390        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
391    }
392    if let Some(ref param_value) = p_query_timeout {
393        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
394    }
395    if let Some(ref user_agent) = configuration.user_agent {
396        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
397    }
398    req_builder = req_builder.json(&p_body_application_health_policy);
399
400    let req = req_builder.build()?;
401    let resp = configuration.client.execute(req).await?;
402
403    let status = resp.status();
404    let content_type = resp
405        .headers()
406        .get("content-type")
407        .and_then(|v| v.to_str().ok())
408        .unwrap_or("application/octet-stream");
409    let content_type = super::ContentType::from(content_type);
410
411    if !status.is_client_error() && !status.is_server_error() {
412        let content = resp.text().await?;
413        match content_type {
414            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
415            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationHealth`"))),
416            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::ApplicationHealth`")))),
417        }
418    } else {
419        let content = resp.text().await?;
420        let entity: Option<GetApplicationHealthUsingPolicyError> =
421            serde_json::from_str(&content).ok();
422        Err(Error::ResponseError(ResponseContent {
423            status,
424            content,
425            entity,
426        }))
427    }
428}
429
430/// Returns the information about the application that was created or in the process of being created in the Service Fabric cluster and whose name matches the one specified as the parameter. The response includes the name, type, status, parameters, and other details about the application.
431pub async fn get_application_info(
432    configuration: &configuration::Configuration,
433    api_version: &str,
434    application_id: &str,
435    exclude_application_parameters: Option<bool>,
436    timeout: Option<i64>,
437) -> Result<models::ApplicationInfo, Error<GetApplicationInfoError>> {
438    // add a prefix to parameters to efficiently prevent name collisions
439    let p_query_api_version = api_version;
440    let p_path_application_id = application_id;
441    let p_query_exclude_application_parameters = exclude_application_parameters;
442    let p_query_timeout = timeout;
443
444    let uri_str = format!(
445        "{}/Applications/{applicationId}",
446        configuration.base_path,
447        applicationId = crate::apis::urlencode(p_path_application_id)
448    );
449    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
450
451    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
452    if let Some(ref param_value) = p_query_exclude_application_parameters {
453        req_builder =
454            req_builder.query(&[("ExcludeApplicationParameters", &param_value.to_string())]);
455    }
456    if let Some(ref param_value) = p_query_timeout {
457        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
458    }
459    if let Some(ref user_agent) = configuration.user_agent {
460        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
461    }
462
463    let req = req_builder.build()?;
464    let resp = configuration.client.execute(req).await?;
465
466    let status = resp.status();
467    let content_type = resp
468        .headers()
469        .get("content-type")
470        .and_then(|v| v.to_str().ok())
471        .unwrap_or("application/octet-stream");
472    let content_type = super::ContentType::from(content_type);
473
474    if !status.is_client_error() && !status.is_server_error() {
475        let content = resp.text().await?;
476        match content_type {
477            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
478            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationInfo`"))),
479            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::ApplicationInfo`")))),
480        }
481    } else {
482        let content = resp.text().await?;
483        let entity: Option<GetApplicationInfoError> = serde_json::from_str(&content).ok();
484        Err(Error::ResponseError(ResponseContent {
485            status,
486            content,
487            entity,
488        }))
489    }
490}
491
492/// Gets the information about the applications that were created or in the process of being created in the Service Fabric cluster and match the specified filters. The response includes the name, type, status, parameters, and other details about the application. If the applications do not fit in a page, one page of results is returned as well as a continuation token, which can be used to get the next page. Filters ApplicationTypeName and ApplicationDefinitionKindFilter cannot be specified at the same time.
493pub async fn get_application_info_list(
494    configuration: &configuration::Configuration,
495    api_version: &str,
496    application_definition_kind_filter: Option<i32>,
497    application_type_name: Option<&str>,
498    exclude_application_parameters: Option<bool>,
499    continuation_token: Option<&str>,
500    max_results: Option<i64>,
501    timeout: Option<i64>,
502) -> Result<models::PagedApplicationInfoList, Error<GetApplicationInfoListError>> {
503    // add a prefix to parameters to efficiently prevent name collisions
504    let p_query_api_version = api_version;
505    let p_query_application_definition_kind_filter = application_definition_kind_filter;
506    let p_query_application_type_name = application_type_name;
507    let p_query_exclude_application_parameters = exclude_application_parameters;
508    let p_query_continuation_token = continuation_token;
509    let p_query_max_results = max_results;
510    let p_query_timeout = timeout;
511
512    let uri_str = format!("{}/Applications", configuration.base_path);
513    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
514
515    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
516    if let Some(ref param_value) = p_query_application_definition_kind_filter {
517        req_builder =
518            req_builder.query(&[("ApplicationDefinitionKindFilter", &param_value.to_string())]);
519    }
520    if let Some(ref param_value) = p_query_application_type_name {
521        req_builder = req_builder.query(&[("ApplicationTypeName", &param_value.to_string())]);
522    }
523    if let Some(ref param_value) = p_query_exclude_application_parameters {
524        req_builder =
525            req_builder.query(&[("ExcludeApplicationParameters", &param_value.to_string())]);
526    }
527    if let Some(ref param_value) = p_query_continuation_token {
528        req_builder = req_builder.query(&[("ContinuationToken", &param_value.to_string())]);
529    }
530    if let Some(ref param_value) = p_query_max_results {
531        req_builder = req_builder.query(&[("MaxResults", &param_value.to_string())]);
532    }
533    if let Some(ref param_value) = p_query_timeout {
534        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
535    }
536    if let Some(ref user_agent) = configuration.user_agent {
537        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
538    }
539
540    let req = req_builder.build()?;
541    let resp = configuration.client.execute(req).await?;
542
543    let status = resp.status();
544    let content_type = resp
545        .headers()
546        .get("content-type")
547        .and_then(|v| v.to_str().ok())
548        .unwrap_or("application/octet-stream");
549    let content_type = super::ContentType::from(content_type);
550
551    if !status.is_client_error() && !status.is_server_error() {
552        let content = resp.text().await?;
553        match content_type {
554            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
555            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedApplicationInfoList`"))),
556            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::PagedApplicationInfoList`")))),
557        }
558    } else {
559        let content = resp.text().await?;
560        let entity: Option<GetApplicationInfoListError> = serde_json::from_str(&content).ok();
561        Err(Error::ResponseError(ResponseContent {
562            status,
563            content,
564            entity,
565        }))
566    }
567}
568
569/// Returns the load information about the application that was created or in the process of being created in the Service Fabric cluster and whose name matches the one specified as the parameter. The response includes the name, minimum nodes, maximum nodes, the number of nodes the application is occupying currently, and application load metric information about the application.
570pub async fn get_application_load_info(
571    configuration: &configuration::Configuration,
572    api_version: &str,
573    application_id: &str,
574    timeout: Option<i64>,
575) -> Result<models::ApplicationLoadInfo, Error<GetApplicationLoadInfoError>> {
576    // add a prefix to parameters to efficiently prevent name collisions
577    let p_query_api_version = api_version;
578    let p_path_application_id = application_id;
579    let p_query_timeout = timeout;
580
581    let uri_str = format!(
582        "{}/Applications/{applicationId}/$/GetLoadInformation",
583        configuration.base_path,
584        applicationId = crate::apis::urlencode(p_path_application_id)
585    );
586    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
587
588    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
589    if let Some(ref param_value) = p_query_timeout {
590        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
591    }
592    if let Some(ref user_agent) = configuration.user_agent {
593        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
594    }
595
596    let req = req_builder.build()?;
597    let resp = configuration.client.execute(req).await?;
598
599    let status = resp.status();
600    let content_type = resp
601        .headers()
602        .get("content-type")
603        .and_then(|v| v.to_str().ok())
604        .unwrap_or("application/octet-stream");
605    let content_type = super::ContentType::from(content_type);
606
607    if !status.is_client_error() && !status.is_server_error() {
608        let content = resp.text().await?;
609        match content_type {
610            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
611            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationLoadInfo`"))),
612            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::ApplicationLoadInfo`")))),
613        }
614    } else {
615        let content = resp.text().await?;
616        let entity: Option<GetApplicationLoadInfoError> = serde_json::from_str(&content).ok();
617        Err(Error::ResponseError(ResponseContent {
618            status,
619            content,
620            entity,
621        }))
622    }
623}
624
625/// Returns information about the state of the latest application upgrade along with details to aid debugging application health issues.
626pub async fn get_application_upgrade(
627    configuration: &configuration::Configuration,
628    api_version: &str,
629    application_id: &str,
630    timeout: Option<i64>,
631) -> Result<models::ApplicationUpgradeProgressInfo, Error<GetApplicationUpgradeError>> {
632    // add a prefix to parameters to efficiently prevent name collisions
633    let p_query_api_version = api_version;
634    let p_path_application_id = application_id;
635    let p_query_timeout = timeout;
636
637    let uri_str = format!(
638        "{}/Applications/{applicationId}/$/GetUpgradeProgress",
639        configuration.base_path,
640        applicationId = crate::apis::urlencode(p_path_application_id)
641    );
642    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
643
644    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
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    let content_type = resp
657        .headers()
658        .get("content-type")
659        .and_then(|v| v.to_str().ok())
660        .unwrap_or("application/octet-stream");
661    let content_type = super::ContentType::from(content_type);
662
663    if !status.is_client_error() && !status.is_server_error() {
664        let content = resp.text().await?;
665        match content_type {
666            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
667            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ApplicationUpgradeProgressInfo`"))),
668            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::ApplicationUpgradeProgressInfo`")))),
669        }
670    } else {
671        let content = resp.text().await?;
672        let entity: Option<GetApplicationUpgradeError> = serde_json::from_str(&content).ok();
673        Err(Error::ResponseError(ResponseContent {
674            status,
675            content,
676            entity,
677        }))
678    }
679}
680
681/// Gets the information about health of an application deployed on a Service Fabric node. Use EventsHealthStateFilter to optionally filter for the collection of HealthEvent objects reported on the deployed application based on health state. Use DeployedServicePackagesHealthStateFilter to optionally filter for DeployedServicePackageHealth children based on health state.
682pub async fn get_deployed_application_health(
683    configuration: &configuration::Configuration,
684    api_version: &str,
685    node_name: &str,
686    application_id: &str,
687    events_health_state_filter: Option<i32>,
688    deployed_service_packages_health_state_filter: Option<i32>,
689    exclude_health_statistics: Option<bool>,
690    timeout: Option<i64>,
691) -> Result<models::DeployedApplicationHealth, Error<GetDeployedApplicationHealthError>> {
692    // add a prefix to parameters to efficiently prevent name collisions
693    let p_query_api_version = api_version;
694    let p_path_node_name = node_name;
695    let p_path_application_id = application_id;
696    let p_query_events_health_state_filter = events_health_state_filter;
697    let p_query_deployed_service_packages_health_state_filter =
698        deployed_service_packages_health_state_filter;
699    let p_query_exclude_health_statistics = exclude_health_statistics;
700    let p_query_timeout = timeout;
701
702    let uri_str = format!(
703        "{}/Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetHealth",
704        configuration.base_path,
705        nodeName = crate::apis::urlencode(p_path_node_name),
706        applicationId = crate::apis::urlencode(p_path_application_id)
707    );
708    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
709
710    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
711    if let Some(ref param_value) = p_query_events_health_state_filter {
712        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
713    }
714    if let Some(ref param_value) = p_query_deployed_service_packages_health_state_filter {
715        req_builder = req_builder.query(&[(
716            "DeployedServicePackagesHealthStateFilter",
717            &param_value.to_string(),
718        )]);
719    }
720    if let Some(ref param_value) = p_query_exclude_health_statistics {
721        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
722    }
723    if let Some(ref param_value) = p_query_timeout {
724        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
725    }
726    if let Some(ref user_agent) = configuration.user_agent {
727        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
728    }
729
730    let req = req_builder.build()?;
731    let resp = configuration.client.execute(req).await?;
732
733    let status = resp.status();
734    let content_type = resp
735        .headers()
736        .get("content-type")
737        .and_then(|v| v.to_str().ok())
738        .unwrap_or("application/octet-stream");
739    let content_type = super::ContentType::from(content_type);
740
741    if !status.is_client_error() && !status.is_server_error() {
742        let content = resp.text().await?;
743        match content_type {
744            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
745            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployedApplicationHealth`"))),
746            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::DeployedApplicationHealth`")))),
747        }
748    } else {
749        let content = resp.text().await?;
750        let entity: Option<GetDeployedApplicationHealthError> = serde_json::from_str(&content).ok();
751        Err(Error::ResponseError(ResponseContent {
752            status,
753            content,
754            entity,
755        }))
756    }
757}
758
759/// Gets the information about health of an application deployed on a Service Fabric node using the specified policy. Use EventsHealthStateFilter to optionally filter for the collection of HealthEvent objects reported on the deployed application based on health state. Use DeployedServicePackagesHealthStateFilter to optionally filter for DeployedServicePackageHealth children based on health state. Use ApplicationHealthPolicy to optionally override the health policies used to evaluate the health. This API only uses 'ConsiderWarningAsError' field of the ApplicationHealthPolicy. The rest of the fields are ignored while evaluating the health of the deployed application.
760pub async fn get_deployed_application_health_using_policy(
761    configuration: &configuration::Configuration,
762    api_version: &str,
763    node_name: &str,
764    application_id: &str,
765    events_health_state_filter: Option<i32>,
766    deployed_service_packages_health_state_filter: Option<i32>,
767    exclude_health_statistics: Option<bool>,
768    timeout: Option<i64>,
769    application_health_policy: Option<models::ApplicationHealthPolicy>,
770) -> Result<models::DeployedApplicationHealth, Error<GetDeployedApplicationHealthUsingPolicyError>>
771{
772    // add a prefix to parameters to efficiently prevent name collisions
773    let p_query_api_version = api_version;
774    let p_path_node_name = node_name;
775    let p_path_application_id = application_id;
776    let p_query_events_health_state_filter = events_health_state_filter;
777    let p_query_deployed_service_packages_health_state_filter =
778        deployed_service_packages_health_state_filter;
779    let p_query_exclude_health_statistics = exclude_health_statistics;
780    let p_query_timeout = timeout;
781    let p_body_application_health_policy = application_health_policy;
782
783    let uri_str = format!(
784        "{}/Nodes/{nodeName}/$/GetApplications/{applicationId}/$/GetHealth",
785        configuration.base_path,
786        nodeName = crate::apis::urlencode(p_path_node_name),
787        applicationId = crate::apis::urlencode(p_path_application_id)
788    );
789    let mut req_builder = configuration
790        .client
791        .request(reqwest::Method::POST, &uri_str);
792
793    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
794    if let Some(ref param_value) = p_query_events_health_state_filter {
795        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
796    }
797    if let Some(ref param_value) = p_query_deployed_service_packages_health_state_filter {
798        req_builder = req_builder.query(&[(
799            "DeployedServicePackagesHealthStateFilter",
800            &param_value.to_string(),
801        )]);
802    }
803    if let Some(ref param_value) = p_query_exclude_health_statistics {
804        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
805    }
806    if let Some(ref param_value) = p_query_timeout {
807        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
808    }
809    if let Some(ref user_agent) = configuration.user_agent {
810        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
811    }
812    req_builder = req_builder.json(&p_body_application_health_policy);
813
814    let req = req_builder.build()?;
815    let resp = configuration.client.execute(req).await?;
816
817    let status = resp.status();
818    let content_type = resp
819        .headers()
820        .get("content-type")
821        .and_then(|v| v.to_str().ok())
822        .unwrap_or("application/octet-stream");
823    let content_type = super::ContentType::from(content_type);
824
825    if !status.is_client_error() && !status.is_server_error() {
826        let content = resp.text().await?;
827        match content_type {
828            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
829            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployedApplicationHealth`"))),
830            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::DeployedApplicationHealth`")))),
831        }
832    } else {
833        let content = resp.text().await?;
834        let entity: Option<GetDeployedApplicationHealthUsingPolicyError> =
835            serde_json::from_str(&content).ok();
836        Err(Error::ResponseError(ResponseContent {
837            status,
838            content,
839            entity,
840        }))
841    }
842}
843
844/// This query returns system application information if the application ID provided is for system application. Results encompass deployed applications in active, activating, and downloading states. This query requires that the node name corresponds to a node on the cluster. The query fails if the provided node name does not point to any active Service Fabric nodes on the cluster.
845pub async fn get_deployed_application_info(
846    configuration: &configuration::Configuration,
847    api_version: &str,
848    node_name: &str,
849    application_id: &str,
850    timeout: Option<i64>,
851    include_health_state: Option<bool>,
852) -> Result<models::DeployedApplicationInfo, Error<GetDeployedApplicationInfoError>> {
853    // add a prefix to parameters to efficiently prevent name collisions
854    let p_query_api_version = api_version;
855    let p_path_node_name = node_name;
856    let p_path_application_id = application_id;
857    let p_query_timeout = timeout;
858    let p_query_include_health_state = include_health_state;
859
860    let uri_str = format!(
861        "{}/Nodes/{nodeName}/$/GetApplications/{applicationId}",
862        configuration.base_path,
863        nodeName = crate::apis::urlencode(p_path_node_name),
864        applicationId = crate::apis::urlencode(p_path_application_id)
865    );
866    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
867
868    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
869    if let Some(ref param_value) = p_query_timeout {
870        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
871    }
872    if let Some(ref param_value) = p_query_include_health_state {
873        req_builder = req_builder.query(&[("IncludeHealthState", &param_value.to_string())]);
874    }
875    if let Some(ref user_agent) = configuration.user_agent {
876        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
877    }
878
879    let req = req_builder.build()?;
880    let resp = configuration.client.execute(req).await?;
881
882    let status = resp.status();
883    let content_type = resp
884        .headers()
885        .get("content-type")
886        .and_then(|v| v.to_str().ok())
887        .unwrap_or("application/octet-stream");
888    let content_type = super::ContentType::from(content_type);
889
890    if !status.is_client_error() && !status.is_server_error() {
891        let content = resp.text().await?;
892        match content_type {
893            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
894            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployedApplicationInfo`"))),
895            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::DeployedApplicationInfo`")))),
896        }
897    } else {
898        let content = resp.text().await?;
899        let entity: Option<GetDeployedApplicationInfoError> = serde_json::from_str(&content).ok();
900        Err(Error::ResponseError(ResponseContent {
901            status,
902            content,
903            entity,
904        }))
905    }
906}
907
908/// Gets the list of applications deployed on a Service Fabric node. The results do not include information about deployed system applications unless explicitly queried for by ID. Results encompass deployed applications in active, activating, and downloading states. This query requires that the node name corresponds to a node on the cluster. The query fails if the provided node name does not point to any active Service Fabric nodes on the cluster.
909pub async fn get_deployed_application_info_list(
910    configuration: &configuration::Configuration,
911    api_version: &str,
912    node_name: &str,
913    timeout: Option<i64>,
914    include_health_state: Option<bool>,
915    continuation_token: Option<&str>,
916    max_results: Option<i64>,
917) -> Result<models::PagedDeployedApplicationInfoList, Error<GetDeployedApplicationInfoListError>> {
918    // add a prefix to parameters to efficiently prevent name collisions
919    let p_query_api_version = api_version;
920    let p_path_node_name = node_name;
921    let p_query_timeout = timeout;
922    let p_query_include_health_state = include_health_state;
923    let p_query_continuation_token = continuation_token;
924    let p_query_max_results = max_results;
925
926    let uri_str = format!(
927        "{}/Nodes/{nodeName}/$/GetApplications",
928        configuration.base_path,
929        nodeName = crate::apis::urlencode(p_path_node_name)
930    );
931    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
932
933    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
934    if let Some(ref param_value) = p_query_timeout {
935        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
936    }
937    if let Some(ref param_value) = p_query_include_health_state {
938        req_builder = req_builder.query(&[("IncludeHealthState", &param_value.to_string())]);
939    }
940    if let Some(ref param_value) = p_query_continuation_token {
941        req_builder = req_builder.query(&[("ContinuationToken", &param_value.to_string())]);
942    }
943    if let Some(ref param_value) = p_query_max_results {
944        req_builder = req_builder.query(&[("MaxResults", &param_value.to_string())]);
945    }
946    if let Some(ref user_agent) = configuration.user_agent {
947        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
948    }
949
950    let req = req_builder.build()?;
951    let resp = configuration.client.execute(req).await?;
952
953    let status = resp.status();
954    let content_type = resp
955        .headers()
956        .get("content-type")
957        .and_then(|v| v.to_str().ok())
958        .unwrap_or("application/octet-stream");
959    let content_type = super::ContentType::from(content_type);
960
961    if !status.is_client_error() && !status.is_server_error() {
962        let content = resp.text().await?;
963        match content_type {
964            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
965            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PagedDeployedApplicationInfoList`"))),
966            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::PagedDeployedApplicationInfoList`")))),
967        }
968    } else {
969        let content = resp.text().await?;
970        let entity: Option<GetDeployedApplicationInfoListError> =
971            serde_json::from_str(&content).ok();
972        Err(Error::ResponseError(ResponseContent {
973            status,
974            content,
975            entity,
976        }))
977    }
978}
979
980/// Reports health state of the specified Service Fabric application. 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 Application, 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, get application health and check that the report appears in the HealthEvents section.
981pub async fn report_application_health(
982    configuration: &configuration::Configuration,
983    api_version: &str,
984    application_id: &str,
985    health_information: models::HealthInformation,
986    immediate: Option<bool>,
987    timeout: Option<i64>,
988) -> Result<(), Error<ReportApplicationHealthError>> {
989    // add a prefix to parameters to efficiently prevent name collisions
990    let p_query_api_version = api_version;
991    let p_path_application_id = application_id;
992    let p_body_health_information = health_information;
993    let p_query_immediate = immediate;
994    let p_query_timeout = timeout;
995
996    let uri_str = format!(
997        "{}/Applications/{applicationId}/$/ReportHealth",
998        configuration.base_path,
999        applicationId = crate::apis::urlencode(p_path_application_id)
1000    );
1001    let mut req_builder = configuration
1002        .client
1003        .request(reqwest::Method::POST, &uri_str);
1004
1005    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1006    if let Some(ref param_value) = p_query_immediate {
1007        req_builder = req_builder.query(&[("Immediate", &param_value.to_string())]);
1008    }
1009    if let Some(ref param_value) = p_query_timeout {
1010        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1011    }
1012    if let Some(ref user_agent) = configuration.user_agent {
1013        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1014    }
1015    req_builder = req_builder.json(&p_body_health_information);
1016
1017    let req = req_builder.build()?;
1018    let resp = configuration.client.execute(req).await?;
1019
1020    let status = resp.status();
1021
1022    if !status.is_client_error() && !status.is_server_error() {
1023        Ok(())
1024    } else {
1025        let content = resp.text().await?;
1026        let entity: Option<ReportApplicationHealthError> = serde_json::from_str(&content).ok();
1027        Err(Error::ResponseError(ResponseContent {
1028            status,
1029            content,
1030            entity,
1031        }))
1032    }
1033}
1034
1035/// Reports health state of the application deployed on a Service Fabric node. 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 Service, 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, get deployed application health and check that the report appears in the HealthEvents section.
1036pub async fn report_deployed_application_health(
1037    configuration: &configuration::Configuration,
1038    api_version: &str,
1039    node_name: &str,
1040    application_id: &str,
1041    health_information: models::HealthInformation,
1042    immediate: Option<bool>,
1043    timeout: Option<i64>,
1044) -> Result<(), Error<ReportDeployedApplicationHealthError>> {
1045    // add a prefix to parameters to efficiently prevent name collisions
1046    let p_query_api_version = api_version;
1047    let p_path_node_name = node_name;
1048    let p_path_application_id = application_id;
1049    let p_body_health_information = health_information;
1050    let p_query_immediate = immediate;
1051    let p_query_timeout = timeout;
1052
1053    let uri_str = format!(
1054        "{}/Nodes/{nodeName}/$/GetApplications/{applicationId}/$/ReportHealth",
1055        configuration.base_path,
1056        nodeName = crate::apis::urlencode(p_path_node_name),
1057        applicationId = crate::apis::urlencode(p_path_application_id)
1058    );
1059    let mut req_builder = configuration
1060        .client
1061        .request(reqwest::Method::POST, &uri_str);
1062
1063    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1064    if let Some(ref param_value) = p_query_immediate {
1065        req_builder = req_builder.query(&[("Immediate", &param_value.to_string())]);
1066    }
1067    if let Some(ref param_value) = p_query_timeout {
1068        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1069    }
1070    if let Some(ref user_agent) = configuration.user_agent {
1071        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1072    }
1073    req_builder = req_builder.json(&p_body_health_information);
1074
1075    let req = req_builder.build()?;
1076    let resp = configuration.client.execute(req).await?;
1077
1078    let status = resp.status();
1079
1080    if !status.is_client_error() && !status.is_server_error() {
1081        Ok(())
1082    } else {
1083        let content = resp.text().await?;
1084        let entity: Option<ReportDeployedApplicationHealthError> =
1085            serde_json::from_str(&content).ok();
1086        Err(Error::ResponseError(ResponseContent {
1087            status,
1088            content,
1089            entity,
1090        }))
1091    }
1092}
1093
1094/// Resumes an unmonitored manual Service Fabric application upgrade. Service Fabric upgrades one upgrade domain at a time. For unmonitored manual upgrades, after Service Fabric finishes an upgrade domain, it waits for you to call this API before proceeding to the next upgrade domain.
1095pub async fn resume_application_upgrade(
1096    configuration: &configuration::Configuration,
1097    api_version: &str,
1098    application_id: &str,
1099    resume_application_upgrade_description: models::ResumeApplicationUpgradeDescription,
1100    timeout: Option<i64>,
1101) -> Result<(), Error<ResumeApplicationUpgradeError>> {
1102    // add a prefix to parameters to efficiently prevent name collisions
1103    let p_query_api_version = api_version;
1104    let p_path_application_id = application_id;
1105    let p_body_resume_application_upgrade_description = resume_application_upgrade_description;
1106    let p_query_timeout = timeout;
1107
1108    let uri_str = format!(
1109        "{}/Applications/{applicationId}/$/MoveToNextUpgradeDomain",
1110        configuration.base_path,
1111        applicationId = crate::apis::urlencode(p_path_application_id)
1112    );
1113    let mut req_builder = configuration
1114        .client
1115        .request(reqwest::Method::POST, &uri_str);
1116
1117    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1118    if let Some(ref param_value) = p_query_timeout {
1119        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1120    }
1121    if let Some(ref user_agent) = configuration.user_agent {
1122        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1123    }
1124    req_builder = req_builder.json(&p_body_resume_application_upgrade_description);
1125
1126    let req = req_builder.build()?;
1127    let resp = configuration.client.execute(req).await?;
1128
1129    let status = resp.status();
1130
1131    if !status.is_client_error() && !status.is_server_error() {
1132        Ok(())
1133    } else {
1134        let content = resp.text().await?;
1135        let entity: Option<ResumeApplicationUpgradeError> = serde_json::from_str(&content).ok();
1136        Err(Error::ResponseError(ResponseContent {
1137            status,
1138            content,
1139            entity,
1140        }))
1141    }
1142}
1143
1144/// Starts rolling back the current application upgrade to the previous version. This API can only be used to roll back the current in-progress upgrade that is rolling forward to new version. If the application is not currently being upgraded use StartApplicationUpgrade API to upgrade it to desired version, including rolling back to a previous version.
1145pub async fn rollback_application_upgrade(
1146    configuration: &configuration::Configuration,
1147    api_version: &str,
1148    application_id: &str,
1149    timeout: Option<i64>,
1150) -> Result<(), Error<RollbackApplicationUpgradeError>> {
1151    // add a prefix to parameters to efficiently prevent name collisions
1152    let p_query_api_version = api_version;
1153    let p_path_application_id = application_id;
1154    let p_query_timeout = timeout;
1155
1156    let uri_str = format!(
1157        "{}/Applications/{applicationId}/$/RollbackUpgrade",
1158        configuration.base_path,
1159        applicationId = crate::apis::urlencode(p_path_application_id)
1160    );
1161    let mut req_builder = configuration
1162        .client
1163        .request(reqwest::Method::POST, &uri_str);
1164
1165    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1166    if let Some(ref param_value) = p_query_timeout {
1167        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1168    }
1169    if let Some(ref user_agent) = configuration.user_agent {
1170        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1171    }
1172
1173    let req = req_builder.build()?;
1174    let resp = configuration.client.execute(req).await?;
1175
1176    let status = resp.status();
1177
1178    if !status.is_client_error() && !status.is_server_error() {
1179        Ok(())
1180    } else {
1181        let content = resp.text().await?;
1182        let entity: Option<RollbackApplicationUpgradeError> = serde_json::from_str(&content).ok();
1183        Err(Error::ResponseError(ResponseContent {
1184            status,
1185            content,
1186            entity,
1187        }))
1188    }
1189}
1190
1191/// Validates the supplied application upgrade parameters and starts upgrading the application if the parameters are valid. Note, [ApplicationParameter](https://docs.microsoft.com/dotnet/api/system.fabric.description.applicationdescription.applicationparameters)s are not preserved across an application upgrade. In order to preserve current application parameters, the user should get the parameters using [GetApplicationInfo](./GetApplicationInfo.md) operation first and pass them into the upgrade API call as shown in the example.
1192pub async fn start_application_upgrade(
1193    configuration: &configuration::Configuration,
1194    api_version: &str,
1195    application_id: &str,
1196    application_upgrade_description: models::ApplicationUpgradeDescription,
1197    timeout: Option<i64>,
1198) -> Result<(), Error<StartApplicationUpgradeError>> {
1199    // add a prefix to parameters to efficiently prevent name collisions
1200    let p_query_api_version = api_version;
1201    let p_path_application_id = application_id;
1202    let p_body_application_upgrade_description = application_upgrade_description;
1203    let p_query_timeout = timeout;
1204
1205    let uri_str = format!(
1206        "{}/Applications/{applicationId}/$/Upgrade",
1207        configuration.base_path,
1208        applicationId = crate::apis::urlencode(p_path_application_id)
1209    );
1210    let mut req_builder = configuration
1211        .client
1212        .request(reqwest::Method::POST, &uri_str);
1213
1214    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1215    if let Some(ref param_value) = p_query_timeout {
1216        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1217    }
1218    if let Some(ref user_agent) = configuration.user_agent {
1219        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1220    }
1221    req_builder = req_builder.json(&p_body_application_upgrade_description);
1222
1223    let req = req_builder.build()?;
1224    let resp = configuration.client.execute(req).await?;
1225
1226    let status = resp.status();
1227
1228    if !status.is_client_error() && !status.is_server_error() {
1229        Ok(())
1230    } else {
1231        let content = resp.text().await?;
1232        let entity: Option<StartApplicationUpgradeError> = serde_json::from_str(&content).ok();
1233        Err(Error::ResponseError(ResponseContent {
1234            status,
1235            content,
1236            entity,
1237        }))
1238    }
1239}
1240
1241/// Updates a Service Fabric application instance. The set of properties that can be updated are a subset of the properties that were specified at the time of creating the application.
1242pub async fn update_application(
1243    configuration: &configuration::Configuration,
1244    api_version: &str,
1245    application_id: &str,
1246    application_update_description: models::ApplicationUpdateDescription,
1247    timeout: Option<i64>,
1248) -> Result<(), Error<UpdateApplicationError>> {
1249    // add a prefix to parameters to efficiently prevent name collisions
1250    let p_query_api_version = api_version;
1251    let p_path_application_id = application_id;
1252    let p_body_application_update_description = application_update_description;
1253    let p_query_timeout = timeout;
1254
1255    let uri_str = format!(
1256        "{}/Applications/{applicationId}/$/Update",
1257        configuration.base_path,
1258        applicationId = crate::apis::urlencode(p_path_application_id)
1259    );
1260    let mut req_builder = configuration
1261        .client
1262        .request(reqwest::Method::POST, &uri_str);
1263
1264    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1265    if let Some(ref param_value) = p_query_timeout {
1266        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1267    }
1268    if let Some(ref user_agent) = configuration.user_agent {
1269        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1270    }
1271    req_builder = req_builder.json(&p_body_application_update_description);
1272
1273    let req = req_builder.build()?;
1274    let resp = configuration.client.execute(req).await?;
1275
1276    let status = resp.status();
1277
1278    if !status.is_client_error() && !status.is_server_error() {
1279        Ok(())
1280    } else {
1281        let content = resp.text().await?;
1282        let entity: Option<UpdateApplicationError> = serde_json::from_str(&content).ok();
1283        Err(Error::ResponseError(ResponseContent {
1284            status,
1285            content,
1286            entity,
1287        }))
1288    }
1289}
1290
1291/// Updates the parameters of an ongoing application upgrade from the ones specified at the time of starting the application upgrade. This may be required to mitigate stuck application upgrades due to incorrect parameters or issues in the application to make progress.
1292pub async fn update_application_upgrade(
1293    configuration: &configuration::Configuration,
1294    api_version: &str,
1295    application_id: &str,
1296    application_upgrade_update_description: models::ApplicationUpgradeUpdateDescription,
1297    timeout: Option<i64>,
1298) -> Result<(), Error<UpdateApplicationUpgradeError>> {
1299    // add a prefix to parameters to efficiently prevent name collisions
1300    let p_query_api_version = api_version;
1301    let p_path_application_id = application_id;
1302    let p_body_application_upgrade_update_description = application_upgrade_update_description;
1303    let p_query_timeout = timeout;
1304
1305    let uri_str = format!(
1306        "{}/Applications/{applicationId}/$/UpdateUpgrade",
1307        configuration.base_path,
1308        applicationId = crate::apis::urlencode(p_path_application_id)
1309    );
1310    let mut req_builder = configuration
1311        .client
1312        .request(reqwest::Method::POST, &uri_str);
1313
1314    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1315    if let Some(ref param_value) = p_query_timeout {
1316        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1317    }
1318    if let Some(ref user_agent) = configuration.user_agent {
1319        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1320    }
1321    req_builder = req_builder.json(&p_body_application_upgrade_update_description);
1322
1323    let req = req_builder.build()?;
1324    let resp = configuration.client.execute(req).await?;
1325
1326    let status = resp.status();
1327
1328    if !status.is_client_error() && !status.is_server_error() {
1329        Ok(())
1330    } else {
1331        let content = resp.text().await?;
1332        let entity: Option<UpdateApplicationUpgradeError> = serde_json::from_str(&content).ok();
1333        Err(Error::ResponseError(ResponseContent {
1334            status,
1335            content,
1336            entity,
1337        }))
1338    }
1339}