Skip to main content

openapi_service_fabric/apis/
cluster_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_aad_metadata`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum GetAadMetadataError {
20    DefaultResponse(models::FabricError),
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`get_cluster_configuration`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum GetClusterConfigurationError {
28    DefaultResponse(models::FabricError),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_cluster_configuration_upgrade_status`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetClusterConfigurationUpgradeStatusError {
36    DefaultResponse(models::FabricError),
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`get_cluster_health`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum GetClusterHealthError {
44    DefaultResponse(models::FabricError),
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`get_cluster_health_chunk`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum GetClusterHealthChunkError {
52    DefaultResponse(models::FabricError),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`get_cluster_health_chunk_using_policy_and_advanced_filters`]
57#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum GetClusterHealthChunkUsingPolicyAndAdvancedFiltersError {
60    DefaultResponse(models::FabricError),
61    UnknownValue(serde_json::Value),
62}
63
64/// struct for typed errors of method [`get_cluster_health_using_policy`]
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum GetClusterHealthUsingPolicyError {
68    DefaultResponse(models::FabricError),
69    UnknownValue(serde_json::Value),
70}
71
72/// struct for typed errors of method [`get_cluster_load`]
73#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum GetClusterLoadError {
76    DefaultResponse(models::FabricError),
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`get_cluster_manifest`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum GetClusterManifestError {
84    DefaultResponse(models::FabricError),
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_cluster_upgrade_progress`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetClusterUpgradeProgressError {
92    DefaultResponse(models::FabricError),
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`get_cluster_version`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum GetClusterVersionError {
100    DefaultResponse(models::FabricError),
101    UnknownValue(serde_json::Value),
102}
103
104/// struct for typed errors of method [`get_provisioned_fabric_code_version_info_list`]
105#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum GetProvisionedFabricCodeVersionInfoListError {
108    DefaultResponse(models::FabricError),
109    UnknownValue(serde_json::Value),
110}
111
112/// struct for typed errors of method [`get_provisioned_fabric_config_version_info_list`]
113#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum GetProvisionedFabricConfigVersionInfoListError {
116    DefaultResponse(models::FabricError),
117    UnknownValue(serde_json::Value),
118}
119
120/// struct for typed errors of method [`get_upgrade_orchestration_service_state`]
121#[derive(Debug, Clone, Serialize, Deserialize)]
122#[serde(untagged)]
123pub enum GetUpgradeOrchestrationServiceStateError {
124    DefaultResponse(models::FabricError),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`provision_cluster`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum ProvisionClusterError {
132    DefaultResponse(models::FabricError),
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`report_cluster_health`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum ReportClusterHealthError {
140    DefaultResponse(models::FabricError),
141    UnknownValue(serde_json::Value),
142}
143
144/// struct for typed errors of method [`resume_cluster_upgrade`]
145#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum ResumeClusterUpgradeError {
148    DefaultResponse(models::FabricError),
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`rollback_cluster_upgrade`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum RollbackClusterUpgradeError {
156    DefaultResponse(models::FabricError),
157    UnknownValue(serde_json::Value),
158}
159
160/// struct for typed errors of method [`set_upgrade_orchestration_service_state`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum SetUpgradeOrchestrationServiceStateError {
164    DefaultResponse(models::FabricError),
165    UnknownValue(serde_json::Value),
166}
167
168/// struct for typed errors of method [`start_cluster_configuration_upgrade`]
169#[derive(Debug, Clone, Serialize, Deserialize)]
170#[serde(untagged)]
171pub enum StartClusterConfigurationUpgradeError {
172    DefaultResponse(models::FabricError),
173    UnknownValue(serde_json::Value),
174}
175
176/// struct for typed errors of method [`start_cluster_upgrade`]
177#[derive(Debug, Clone, Serialize, Deserialize)]
178#[serde(untagged)]
179pub enum StartClusterUpgradeError {
180    DefaultResponse(models::FabricError),
181    UnknownValue(serde_json::Value),
182}
183
184/// struct for typed errors of method [`toggle_verbose_service_placement_health_reporting`]
185#[derive(Debug, Clone, Serialize, Deserialize)]
186#[serde(untagged)]
187pub enum ToggleVerboseServicePlacementHealthReportingError {
188    DefaultResponse(models::FabricError),
189    UnknownValue(serde_json::Value),
190}
191
192/// struct for typed errors of method [`unprovision_cluster`]
193#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum UnprovisionClusterError {
196    DefaultResponse(models::FabricError),
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`update_cluster_upgrade`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum UpdateClusterUpgradeError {
204    DefaultResponse(models::FabricError),
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`validate_cluster_upgrade`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum ValidateClusterUpgradeError {
212    DefaultResponse(models::FabricError),
213    UnknownValue(serde_json::Value),
214}
215
216/// Gets the Azure Active Directory metadata used for secured connection to cluster. This API is not supposed to be called separately. It provides information needed to set up an Azure Active Directory secured connection with a Service Fabric cluster.
217pub async fn get_aad_metadata(
218    configuration: &configuration::Configuration,
219    api_version: &str,
220    timeout: Option<i64>,
221) -> Result<models::AadMetadataObject, Error<GetAadMetadataError>> {
222    // add a prefix to parameters to efficiently prevent name collisions
223    let p_query_api_version = api_version;
224    let p_query_timeout = timeout;
225
226    let uri_str = format!("{}/$/GetAadMetadata", configuration.base_path);
227    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
228
229    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
230    if let Some(ref param_value) = p_query_timeout {
231        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
232    }
233    if let Some(ref user_agent) = configuration.user_agent {
234        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
235    }
236
237    let req = req_builder.build()?;
238    let resp = configuration.client.execute(req).await?;
239
240    let status = resp.status();
241    let content_type = resp
242        .headers()
243        .get("content-type")
244        .and_then(|v| v.to_str().ok())
245        .unwrap_or("application/octet-stream");
246    let content_type = super::ContentType::from(content_type);
247
248    if !status.is_client_error() && !status.is_server_error() {
249        let content = resp.text().await?;
250        match content_type {
251            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
252            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AadMetadataObject`"))),
253            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::AadMetadataObject`")))),
254        }
255    } else {
256        let content = resp.text().await?;
257        let entity: Option<GetAadMetadataError> = serde_json::from_str(&content).ok();
258        Err(Error::ResponseError(ResponseContent {
259            status,
260            content,
261            entity,
262        }))
263    }
264}
265
266/// The cluster configuration contains properties of the cluster that include different node types on the cluster, security configurations, fault, and upgrade domain topologies, etc.
267pub async fn get_cluster_configuration(
268    configuration: &configuration::Configuration,
269    api_version: &str,
270    configuration_api_version: &str,
271    timeout: Option<i64>,
272) -> Result<models::ClusterConfiguration, Error<GetClusterConfigurationError>> {
273    // add a prefix to parameters to efficiently prevent name collisions
274    let p_query_api_version = api_version;
275    let p_query_configuration_api_version = configuration_api_version;
276    let p_query_timeout = timeout;
277
278    let uri_str = format!("{}/$/GetClusterConfiguration", configuration.base_path);
279    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
280
281    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
282    req_builder = req_builder.query(&[(
283        "ConfigurationApiVersion",
284        &p_query_configuration_api_version.to_string(),
285    )]);
286    if let Some(ref param_value) = p_query_timeout {
287        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
288    }
289    if let Some(ref user_agent) = configuration.user_agent {
290        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
291    }
292
293    let req = req_builder.build()?;
294    let resp = configuration.client.execute(req).await?;
295
296    let status = resp.status();
297    let content_type = resp
298        .headers()
299        .get("content-type")
300        .and_then(|v| v.to_str().ok())
301        .unwrap_or("application/octet-stream");
302    let content_type = super::ContentType::from(content_type);
303
304    if !status.is_client_error() && !status.is_server_error() {
305        let content = resp.text().await?;
306        match content_type {
307            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
308            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfiguration`"))),
309            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::ClusterConfiguration`")))),
310        }
311    } else {
312        let content = resp.text().await?;
313        let entity: Option<GetClusterConfigurationError> = serde_json::from_str(&content).ok();
314        Err(Error::ResponseError(ResponseContent {
315            status,
316            content,
317            entity,
318        }))
319    }
320}
321
322/// Get the cluster configuration upgrade status details of a Service Fabric standalone cluster.
323pub async fn get_cluster_configuration_upgrade_status(
324    configuration: &configuration::Configuration,
325    api_version: &str,
326    timeout: Option<i64>,
327) -> Result<
328    models::ClusterConfigurationUpgradeStatusInfo,
329    Error<GetClusterConfigurationUpgradeStatusError>,
330> {
331    // add a prefix to parameters to efficiently prevent name collisions
332    let p_query_api_version = api_version;
333    let p_query_timeout = timeout;
334
335    let uri_str = format!(
336        "{}/$/GetClusterConfigurationUpgradeStatus",
337        configuration.base_path
338    );
339    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
340
341    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
342    if let Some(ref param_value) = p_query_timeout {
343        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
344    }
345    if let Some(ref user_agent) = configuration.user_agent {
346        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
347    }
348
349    let req = req_builder.build()?;
350    let resp = configuration.client.execute(req).await?;
351
352    let status = resp.status();
353    let content_type = resp
354        .headers()
355        .get("content-type")
356        .and_then(|v| v.to_str().ok())
357        .unwrap_or("application/octet-stream");
358    let content_type = super::ContentType::from(content_type);
359
360    if !status.is_client_error() && !status.is_server_error() {
361        let content = resp.text().await?;
362        match content_type {
363            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
364            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterConfigurationUpgradeStatusInfo`"))),
365            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::ClusterConfigurationUpgradeStatusInfo`")))),
366        }
367    } else {
368        let content = resp.text().await?;
369        let entity: Option<GetClusterConfigurationUpgradeStatusError> =
370            serde_json::from_str(&content).ok();
371        Err(Error::ResponseError(ResponseContent {
372            status,
373            content,
374            entity,
375        }))
376    }
377}
378
379/// Use EventsHealthStateFilter to filter the collection of health events reported on the cluster based on the health state. Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to filter the collection of nodes and applications returned based on their aggregated health state.
380pub async fn get_cluster_health(
381    configuration: &configuration::Configuration,
382    api_version: &str,
383    nodes_health_state_filter: Option<i32>,
384    applications_health_state_filter: Option<i32>,
385    events_health_state_filter: Option<i32>,
386    exclude_health_statistics: Option<bool>,
387    include_system_application_health_statistics: Option<bool>,
388    timeout: Option<i64>,
389) -> Result<models::ClusterHealth, Error<GetClusterHealthError>> {
390    // add a prefix to parameters to efficiently prevent name collisions
391    let p_query_api_version = api_version;
392    let p_query_nodes_health_state_filter = nodes_health_state_filter;
393    let p_query_applications_health_state_filter = applications_health_state_filter;
394    let p_query_events_health_state_filter = events_health_state_filter;
395    let p_query_exclude_health_statistics = exclude_health_statistics;
396    let p_query_include_system_application_health_statistics =
397        include_system_application_health_statistics;
398    let p_query_timeout = timeout;
399
400    let uri_str = format!("{}/$/GetClusterHealth", configuration.base_path);
401    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
402
403    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
404    if let Some(ref param_value) = p_query_nodes_health_state_filter {
405        req_builder = req_builder.query(&[("NodesHealthStateFilter", &param_value.to_string())]);
406    }
407    if let Some(ref param_value) = p_query_applications_health_state_filter {
408        req_builder =
409            req_builder.query(&[("ApplicationsHealthStateFilter", &param_value.to_string())]);
410    }
411    if let Some(ref param_value) = p_query_events_health_state_filter {
412        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
413    }
414    if let Some(ref param_value) = p_query_exclude_health_statistics {
415        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
416    }
417    if let Some(ref param_value) = p_query_include_system_application_health_statistics {
418        req_builder = req_builder.query(&[(
419            "IncludeSystemApplicationHealthStatistics",
420            &param_value.to_string(),
421        )]);
422    }
423    if let Some(ref param_value) = p_query_timeout {
424        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
425    }
426    if let Some(ref user_agent) = configuration.user_agent {
427        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
428    }
429
430    let req = req_builder.build()?;
431    let resp = configuration.client.execute(req).await?;
432
433    let status = resp.status();
434    let content_type = resp
435        .headers()
436        .get("content-type")
437        .and_then(|v| v.to_str().ok())
438        .unwrap_or("application/octet-stream");
439    let content_type = super::ContentType::from(content_type);
440
441    if !status.is_client_error() && !status.is_server_error() {
442        let content = resp.text().await?;
443        match content_type {
444            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
445            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterHealth`"))),
446            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::ClusterHealth`")))),
447        }
448    } else {
449        let content = resp.text().await?;
450        let entity: Option<GetClusterHealthError> = serde_json::from_str(&content).ok();
451        Err(Error::ResponseError(ResponseContent {
452            status,
453            content,
454            entity,
455        }))
456    }
457}
458
459/// Gets the health of a Service Fabric cluster using health chunks. Includes the aggregated health state of the cluster, but none of the cluster entities. To expand the cluster health and get the health state of all or some of the entities, use the POST URI and specify the cluster health chunk query description.
460pub async fn get_cluster_health_chunk(
461    configuration: &configuration::Configuration,
462    api_version: &str,
463    timeout: Option<i64>,
464) -> Result<models::ClusterHealthChunk, Error<GetClusterHealthChunkError>> {
465    // add a prefix to parameters to efficiently prevent name collisions
466    let p_query_api_version = api_version;
467    let p_query_timeout = timeout;
468
469    let uri_str = format!("{}/$/GetClusterHealthChunk", configuration.base_path);
470    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
471
472    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
473    if let Some(ref param_value) = p_query_timeout {
474        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
475    }
476    if let Some(ref user_agent) = configuration.user_agent {
477        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
478    }
479
480    let req = req_builder.build()?;
481    let resp = configuration.client.execute(req).await?;
482
483    let status = resp.status();
484    let content_type = resp
485        .headers()
486        .get("content-type")
487        .and_then(|v| v.to_str().ok())
488        .unwrap_or("application/octet-stream");
489    let content_type = super::ContentType::from(content_type);
490
491    if !status.is_client_error() && !status.is_server_error() {
492        let content = resp.text().await?;
493        match content_type {
494            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
495            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterHealthChunk`"))),
496            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::ClusterHealthChunk`")))),
497        }
498    } else {
499        let content = resp.text().await?;
500        let entity: Option<GetClusterHealthChunkError> = serde_json::from_str(&content).ok();
501        Err(Error::ResponseError(ResponseContent {
502            status,
503            content,
504            entity,
505        }))
506    }
507}
508
509/// Gets the health of a Service Fabric cluster using health chunks. The health evaluation is done based on the input cluster health chunk query description. The query description allows users to specify health policies for evaluating the cluster and its children. Users can specify very flexible filters to select which cluster entities to return. The selection can be done based on the entities health state and based on the hierarchy. The query can return multi-level children of the entities based on the specified filters. For example, it can return one application with a specified name, and for this application, return only services that are in Error or Warning, and all partitions and replicas for one of these services.
510pub async fn get_cluster_health_chunk_using_policy_and_advanced_filters(
511    configuration: &configuration::Configuration,
512    api_version: &str,
513    timeout: Option<i64>,
514    cluster_health_chunk_query_description: Option<models::ClusterHealthChunkQueryDescription>,
515) -> Result<
516    models::ClusterHealthChunk,
517    Error<GetClusterHealthChunkUsingPolicyAndAdvancedFiltersError>,
518> {
519    // add a prefix to parameters to efficiently prevent name collisions
520    let p_query_api_version = api_version;
521    let p_query_timeout = timeout;
522    let p_body_cluster_health_chunk_query_description = cluster_health_chunk_query_description;
523
524    let uri_str = format!("{}/$/GetClusterHealthChunk", configuration.base_path);
525    let mut req_builder = configuration
526        .client
527        .request(reqwest::Method::POST, &uri_str);
528
529    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
530    if let Some(ref param_value) = p_query_timeout {
531        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
532    }
533    if let Some(ref user_agent) = configuration.user_agent {
534        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
535    }
536    req_builder = req_builder.json(&p_body_cluster_health_chunk_query_description);
537
538    let req = req_builder.build()?;
539    let resp = configuration.client.execute(req).await?;
540
541    let status = resp.status();
542    let content_type = resp
543        .headers()
544        .get("content-type")
545        .and_then(|v| v.to_str().ok())
546        .unwrap_or("application/octet-stream");
547    let content_type = super::ContentType::from(content_type);
548
549    if !status.is_client_error() && !status.is_server_error() {
550        let content = resp.text().await?;
551        match content_type {
552            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
553            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterHealthChunk`"))),
554            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::ClusterHealthChunk`")))),
555        }
556    } else {
557        let content = resp.text().await?;
558        let entity: Option<GetClusterHealthChunkUsingPolicyAndAdvancedFiltersError> =
559            serde_json::from_str(&content).ok();
560        Err(Error::ResponseError(ResponseContent {
561            status,
562            content,
563            entity,
564        }))
565    }
566}
567
568/// Use EventsHealthStateFilter to filter the collection of health events reported on the cluster based on the health state. Similarly, use NodesHealthStateFilter and ApplicationsHealthStateFilter to filter the collection of nodes and applications returned based on their aggregated health state. Use ClusterHealthPolicies to override the health policies used to evaluate the health.
569pub async fn get_cluster_health_using_policy(
570    configuration: &configuration::Configuration,
571    api_version: &str,
572    nodes_health_state_filter: Option<i32>,
573    applications_health_state_filter: Option<i32>,
574    events_health_state_filter: Option<i32>,
575    exclude_health_statistics: Option<bool>,
576    include_system_application_health_statistics: Option<bool>,
577    timeout: Option<i64>,
578    cluster_health_policies: Option<models::ClusterHealthPolicies>,
579) -> Result<models::ClusterHealth, Error<GetClusterHealthUsingPolicyError>> {
580    // add a prefix to parameters to efficiently prevent name collisions
581    let p_query_api_version = api_version;
582    let p_query_nodes_health_state_filter = nodes_health_state_filter;
583    let p_query_applications_health_state_filter = applications_health_state_filter;
584    let p_query_events_health_state_filter = events_health_state_filter;
585    let p_query_exclude_health_statistics = exclude_health_statistics;
586    let p_query_include_system_application_health_statistics =
587        include_system_application_health_statistics;
588    let p_query_timeout = timeout;
589    let p_body_cluster_health_policies = cluster_health_policies;
590
591    let uri_str = format!("{}/$/GetClusterHealth", configuration.base_path);
592    let mut req_builder = configuration
593        .client
594        .request(reqwest::Method::POST, &uri_str);
595
596    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
597    if let Some(ref param_value) = p_query_nodes_health_state_filter {
598        req_builder = req_builder.query(&[("NodesHealthStateFilter", &param_value.to_string())]);
599    }
600    if let Some(ref param_value) = p_query_applications_health_state_filter {
601        req_builder =
602            req_builder.query(&[("ApplicationsHealthStateFilter", &param_value.to_string())]);
603    }
604    if let Some(ref param_value) = p_query_events_health_state_filter {
605        req_builder = req_builder.query(&[("EventsHealthStateFilter", &param_value.to_string())]);
606    }
607    if let Some(ref param_value) = p_query_exclude_health_statistics {
608        req_builder = req_builder.query(&[("ExcludeHealthStatistics", &param_value.to_string())]);
609    }
610    if let Some(ref param_value) = p_query_include_system_application_health_statistics {
611        req_builder = req_builder.query(&[(
612            "IncludeSystemApplicationHealthStatistics",
613            &param_value.to_string(),
614        )]);
615    }
616    if let Some(ref param_value) = p_query_timeout {
617        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
618    }
619    if let Some(ref user_agent) = configuration.user_agent {
620        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
621    }
622    req_builder = req_builder.json(&p_body_cluster_health_policies);
623
624    let req = req_builder.build()?;
625    let resp = configuration.client.execute(req).await?;
626
627    let status = resp.status();
628    let content_type = resp
629        .headers()
630        .get("content-type")
631        .and_then(|v| v.to_str().ok())
632        .unwrap_or("application/octet-stream");
633    let content_type = super::ContentType::from(content_type);
634
635    if !status.is_client_error() && !status.is_server_error() {
636        let content = resp.text().await?;
637        match content_type {
638            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
639            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterHealth`"))),
640            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::ClusterHealth`")))),
641        }
642    } else {
643        let content = resp.text().await?;
644        let entity: Option<GetClusterHealthUsingPolicyError> = serde_json::from_str(&content).ok();
645        Err(Error::ResponseError(ResponseContent {
646            status,
647            content,
648            entity,
649        }))
650    }
651}
652
653/// Retrieves the load information of a Service Fabric cluster for all the metrics that have load or capacity defined.
654pub async fn get_cluster_load(
655    configuration: &configuration::Configuration,
656    api_version: &str,
657    timeout: Option<i64>,
658) -> Result<models::ClusterLoadInfo, Error<GetClusterLoadError>> {
659    // add a prefix to parameters to efficiently prevent name collisions
660    let p_query_api_version = api_version;
661    let p_query_timeout = timeout;
662
663    let uri_str = format!("{}/$/GetLoadInformation", configuration.base_path);
664    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
665
666    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
667    if let Some(ref param_value) = p_query_timeout {
668        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
669    }
670    if let Some(ref user_agent) = configuration.user_agent {
671        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
672    }
673
674    let req = req_builder.build()?;
675    let resp = configuration.client.execute(req).await?;
676
677    let status = resp.status();
678    let content_type = resp
679        .headers()
680        .get("content-type")
681        .and_then(|v| v.to_str().ok())
682        .unwrap_or("application/octet-stream");
683    let content_type = super::ContentType::from(content_type);
684
685    if !status.is_client_error() && !status.is_server_error() {
686        let content = resp.text().await?;
687        match content_type {
688            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
689            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterLoadInfo`"))),
690            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::ClusterLoadInfo`")))),
691        }
692    } else {
693        let content = resp.text().await?;
694        let entity: Option<GetClusterLoadError> = serde_json::from_str(&content).ok();
695        Err(Error::ResponseError(ResponseContent {
696            status,
697            content,
698            entity,
699        }))
700    }
701}
702
703/// Get the Service Fabric cluster manifest. The cluster manifest contains properties of the cluster that include different node types on the cluster, security configurations, fault, and upgrade domain topologies, etc.  These properties are specified as part of the ClusterConfig.JSON file while deploying a stand-alone cluster. However, most of the information in the cluster manifest is generated internally by service fabric during cluster deployment in other deployment scenarios (e.g. when using Azure portal).  The contents of the cluster manifest are for informational purposes only and users are not expected to take a dependency on the format of the file contents or its interpretation.
704pub async fn get_cluster_manifest(
705    configuration: &configuration::Configuration,
706    api_version: &str,
707    timeout: Option<i64>,
708) -> Result<models::ClusterManifest, Error<GetClusterManifestError>> {
709    // add a prefix to parameters to efficiently prevent name collisions
710    let p_query_api_version = api_version;
711    let p_query_timeout = timeout;
712
713    let uri_str = format!("{}/$/GetClusterManifest", configuration.base_path);
714    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
715
716    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
717    if let Some(ref param_value) = p_query_timeout {
718        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
719    }
720    if let Some(ref user_agent) = configuration.user_agent {
721        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
722    }
723
724    let req = req_builder.build()?;
725    let resp = configuration.client.execute(req).await?;
726
727    let status = resp.status();
728    let content_type = resp
729        .headers()
730        .get("content-type")
731        .and_then(|v| v.to_str().ok())
732        .unwrap_or("application/octet-stream");
733    let content_type = super::ContentType::from(content_type);
734
735    if !status.is_client_error() && !status.is_server_error() {
736        let content = resp.text().await?;
737        match content_type {
738            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
739            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterManifest`"))),
740            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::ClusterManifest`")))),
741        }
742    } else {
743        let content = resp.text().await?;
744        let entity: Option<GetClusterManifestError> = serde_json::from_str(&content).ok();
745        Err(Error::ResponseError(ResponseContent {
746            status,
747            content,
748            entity,
749        }))
750    }
751}
752
753/// Gets the current progress of the ongoing cluster upgrade. If no upgrade is currently in progress, get the last state of the previous cluster upgrade.
754pub async fn get_cluster_upgrade_progress(
755    configuration: &configuration::Configuration,
756    api_version: &str,
757    timeout: Option<i64>,
758) -> Result<models::ClusterUpgradeProgressObject, Error<GetClusterUpgradeProgressError>> {
759    // add a prefix to parameters to efficiently prevent name collisions
760    let p_query_api_version = api_version;
761    let p_query_timeout = timeout;
762
763    let uri_str = format!("{}/$/GetUpgradeProgress", configuration.base_path);
764    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
765
766    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
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    let content_type = resp
779        .headers()
780        .get("content-type")
781        .and_then(|v| v.to_str().ok())
782        .unwrap_or("application/octet-stream");
783    let content_type = super::ContentType::from(content_type);
784
785    if !status.is_client_error() && !status.is_server_error() {
786        let content = resp.text().await?;
787        match content_type {
788            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
789            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterUpgradeProgressObject`"))),
790            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::ClusterUpgradeProgressObject`")))),
791        }
792    } else {
793        let content = resp.text().await?;
794        let entity: Option<GetClusterUpgradeProgressError> = serde_json::from_str(&content).ok();
795        Err(Error::ResponseError(ResponseContent {
796            status,
797            content,
798            entity,
799        }))
800    }
801}
802
803/// If a cluster upgrade is happening, then this API will return the lowest (older) version of the current and target cluster runtime versions.
804pub async fn get_cluster_version(
805    configuration: &configuration::Configuration,
806    api_version: &str,
807    timeout: Option<i64>,
808) -> Result<models::ClusterVersion, Error<GetClusterVersionError>> {
809    // add a prefix to parameters to efficiently prevent name collisions
810    let p_query_api_version = api_version;
811    let p_query_timeout = timeout;
812
813    let uri_str = format!("{}/$/GetClusterVersion", configuration.base_path);
814    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
815
816    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
817    if let Some(ref param_value) = p_query_timeout {
818        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
819    }
820    if let Some(ref user_agent) = configuration.user_agent {
821        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
822    }
823
824    let req = req_builder.build()?;
825    let resp = configuration.client.execute(req).await?;
826
827    let status = resp.status();
828    let content_type = resp
829        .headers()
830        .get("content-type")
831        .and_then(|v| v.to_str().ok())
832        .unwrap_or("application/octet-stream");
833    let content_type = super::ContentType::from(content_type);
834
835    if !status.is_client_error() && !status.is_server_error() {
836        let content = resp.text().await?;
837        match content_type {
838            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
839            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ClusterVersion`"))),
840            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::ClusterVersion`")))),
841        }
842    } else {
843        let content = resp.text().await?;
844        let entity: Option<GetClusterVersionError> = serde_json::from_str(&content).ok();
845        Err(Error::ResponseError(ResponseContent {
846            status,
847            content,
848            entity,
849        }))
850    }
851}
852
853/// Gets a list of information about fabric code versions that are provisioned in the cluster. The parameter CodeVersion can be used to optionally filter the output to only that particular version.
854pub async fn get_provisioned_fabric_code_version_info_list(
855    configuration: &configuration::Configuration,
856    api_version: &str,
857    code_version: Option<&str>,
858    timeout: Option<i64>,
859) -> Result<Vec<models::FabricCodeVersionInfo>, Error<GetProvisionedFabricCodeVersionInfoListError>>
860{
861    // add a prefix to parameters to efficiently prevent name collisions
862    let p_query_api_version = api_version;
863    let p_query_code_version = code_version;
864    let p_query_timeout = timeout;
865
866    let uri_str = format!("{}/$/GetProvisionedCodeVersions", configuration.base_path);
867    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
868
869    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
870    if let Some(ref param_value) = p_query_code_version {
871        req_builder = req_builder.query(&[("CodeVersion", &param_value.to_string())]);
872    }
873    if let Some(ref param_value) = p_query_timeout {
874        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
875    }
876    if let Some(ref user_agent) = configuration.user_agent {
877        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
878    }
879
880    let req = req_builder.build()?;
881    let resp = configuration.client.execute(req).await?;
882
883    let status = resp.status();
884    let content_type = resp
885        .headers()
886        .get("content-type")
887        .and_then(|v| v.to_str().ok())
888        .unwrap_or("application/octet-stream");
889    let content_type = super::ContentType::from(content_type);
890
891    if !status.is_client_error() && !status.is_server_error() {
892        let content = resp.text().await?;
893        match content_type {
894            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
895            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::FabricCodeVersionInfo&gt;`"))),
896            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&lt;models::FabricCodeVersionInfo&gt;`")))),
897        }
898    } else {
899        let content = resp.text().await?;
900        let entity: Option<GetProvisionedFabricCodeVersionInfoListError> =
901            serde_json::from_str(&content).ok();
902        Err(Error::ResponseError(ResponseContent {
903            status,
904            content,
905            entity,
906        }))
907    }
908}
909
910/// Gets a list of information about fabric config versions that are provisioned in the cluster. The parameter ConfigVersion can be used to optionally filter the output to only that particular version.
911pub async fn get_provisioned_fabric_config_version_info_list(
912    configuration: &configuration::Configuration,
913    api_version: &str,
914    config_version: Option<&str>,
915    timeout: Option<i64>,
916) -> Result<
917    Vec<models::FabricConfigVersionInfo>,
918    Error<GetProvisionedFabricConfigVersionInfoListError>,
919> {
920    // add a prefix to parameters to efficiently prevent name collisions
921    let p_query_api_version = api_version;
922    let p_query_config_version = config_version;
923    let p_query_timeout = timeout;
924
925    let uri_str = format!("{}/$/GetProvisionedConfigVersions", configuration.base_path);
926    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
927
928    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
929    if let Some(ref param_value) = p_query_config_version {
930        req_builder = req_builder.query(&[("ConfigVersion", &param_value.to_string())]);
931    }
932    if let Some(ref param_value) = p_query_timeout {
933        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
934    }
935    if let Some(ref user_agent) = configuration.user_agent {
936        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
937    }
938
939    let req = req_builder.build()?;
940    let resp = configuration.client.execute(req).await?;
941
942    let status = resp.status();
943    let content_type = resp
944        .headers()
945        .get("content-type")
946        .and_then(|v| v.to_str().ok())
947        .unwrap_or("application/octet-stream");
948    let content_type = super::ContentType::from(content_type);
949
950    if !status.is_client_error() && !status.is_server_error() {
951        let content = resp.text().await?;
952        match content_type {
953            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
954            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::FabricConfigVersionInfo&gt;`"))),
955            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&lt;models::FabricConfigVersionInfo&gt;`")))),
956        }
957    } else {
958        let content = resp.text().await?;
959        let entity: Option<GetProvisionedFabricConfigVersionInfoListError> =
960            serde_json::from_str(&content).ok();
961        Err(Error::ResponseError(ResponseContent {
962            status,
963            content,
964            entity,
965        }))
966    }
967}
968
969/// Get the service state of Service Fabric Upgrade Orchestration Service. This API is internally used for support purposes.
970pub async fn get_upgrade_orchestration_service_state(
971    configuration: &configuration::Configuration,
972    api_version: &str,
973    timeout: Option<i64>,
974) -> Result<models::UpgradeOrchestrationServiceState, Error<GetUpgradeOrchestrationServiceStateError>>
975{
976    // add a prefix to parameters to efficiently prevent name collisions
977    let p_query_api_version = api_version;
978    let p_query_timeout = timeout;
979
980    let uri_str = format!(
981        "{}/$/GetUpgradeOrchestrationServiceState",
982        configuration.base_path
983    );
984    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
985
986    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
987    if let Some(ref param_value) = p_query_timeout {
988        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
989    }
990    if let Some(ref user_agent) = configuration.user_agent {
991        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
992    }
993
994    let req = req_builder.build()?;
995    let resp = configuration.client.execute(req).await?;
996
997    let status = resp.status();
998    let content_type = resp
999        .headers()
1000        .get("content-type")
1001        .and_then(|v| v.to_str().ok())
1002        .unwrap_or("application/octet-stream");
1003    let content_type = super::ContentType::from(content_type);
1004
1005    if !status.is_client_error() && !status.is_server_error() {
1006        let content = resp.text().await?;
1007        match content_type {
1008            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1009            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpgradeOrchestrationServiceState`"))),
1010            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::UpgradeOrchestrationServiceState`")))),
1011        }
1012    } else {
1013        let content = resp.text().await?;
1014        let entity: Option<GetUpgradeOrchestrationServiceStateError> =
1015            serde_json::from_str(&content).ok();
1016        Err(Error::ResponseError(ResponseContent {
1017            status,
1018            content,
1019            entity,
1020        }))
1021    }
1022}
1023
1024/// Validate and provision the code or configuration packages of a Service Fabric cluster.
1025pub async fn provision_cluster(
1026    configuration: &configuration::Configuration,
1027    api_version: &str,
1028    provision_fabric_description: models::ProvisionFabricDescription,
1029    timeout: Option<i64>,
1030) -> Result<(), Error<ProvisionClusterError>> {
1031    // add a prefix to parameters to efficiently prevent name collisions
1032    let p_query_api_version = api_version;
1033    let p_body_provision_fabric_description = provision_fabric_description;
1034    let p_query_timeout = timeout;
1035
1036    let uri_str = format!("{}/$/Provision", configuration.base_path);
1037    let mut req_builder = configuration
1038        .client
1039        .request(reqwest::Method::POST, &uri_str);
1040
1041    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1042    if let Some(ref param_value) = p_query_timeout {
1043        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1044    }
1045    if let Some(ref user_agent) = configuration.user_agent {
1046        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1047    }
1048    req_builder = req_builder.json(&p_body_provision_fabric_description);
1049
1050    let req = req_builder.build()?;
1051    let resp = configuration.client.execute(req).await?;
1052
1053    let status = resp.status();
1054
1055    if !status.is_client_error() && !status.is_server_error() {
1056        Ok(())
1057    } else {
1058        let content = resp.text().await?;
1059        let entity: Option<ProvisionClusterError> = serde_json::from_str(&content).ok();
1060        Err(Error::ResponseError(ResponseContent {
1061            status,
1062            content,
1063            entity,
1064        }))
1065    }
1066}
1067
1068/// Sends a health report on a Service Fabric cluster. 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 node, 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 GetClusterHealth and check that the report appears in the HealthEvents section.
1069pub async fn report_cluster_health(
1070    configuration: &configuration::Configuration,
1071    api_version: &str,
1072    health_information: models::HealthInformation,
1073    immediate: Option<bool>,
1074    timeout: Option<i64>,
1075) -> Result<(), Error<ReportClusterHealthError>> {
1076    // add a prefix to parameters to efficiently prevent name collisions
1077    let p_query_api_version = api_version;
1078    let p_body_health_information = health_information;
1079    let p_query_immediate = immediate;
1080    let p_query_timeout = timeout;
1081
1082    let uri_str = format!("{}/$/ReportClusterHealth", configuration.base_path);
1083    let mut req_builder = configuration
1084        .client
1085        .request(reqwest::Method::POST, &uri_str);
1086
1087    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1088    if let Some(ref param_value) = p_query_immediate {
1089        req_builder = req_builder.query(&[("Immediate", &param_value.to_string())]);
1090    }
1091    if let Some(ref param_value) = p_query_timeout {
1092        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1093    }
1094    if let Some(ref user_agent) = configuration.user_agent {
1095        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1096    }
1097    req_builder = req_builder.json(&p_body_health_information);
1098
1099    let req = req_builder.build()?;
1100    let resp = configuration.client.execute(req).await?;
1101
1102    let status = resp.status();
1103
1104    if !status.is_client_error() && !status.is_server_error() {
1105        Ok(())
1106    } else {
1107        let content = resp.text().await?;
1108        let entity: Option<ReportClusterHealthError> = serde_json::from_str(&content).ok();
1109        Err(Error::ResponseError(ResponseContent {
1110            status,
1111            content,
1112            entity,
1113        }))
1114    }
1115}
1116
1117/// Make the cluster code or configuration upgrade move on to the next upgrade domain if appropriate.
1118pub async fn resume_cluster_upgrade(
1119    configuration: &configuration::Configuration,
1120    api_version: &str,
1121    resume_cluster_upgrade_description: models::ResumeClusterUpgradeDescription,
1122    timeout: Option<i64>,
1123) -> Result<(), Error<ResumeClusterUpgradeError>> {
1124    // add a prefix to parameters to efficiently prevent name collisions
1125    let p_query_api_version = api_version;
1126    let p_body_resume_cluster_upgrade_description = resume_cluster_upgrade_description;
1127    let p_query_timeout = timeout;
1128
1129    let uri_str = format!("{}/$/MoveToNextUpgradeDomain", configuration.base_path);
1130    let mut req_builder = configuration
1131        .client
1132        .request(reqwest::Method::POST, &uri_str);
1133
1134    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1135    if let Some(ref param_value) = p_query_timeout {
1136        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1137    }
1138    if let Some(ref user_agent) = configuration.user_agent {
1139        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1140    }
1141    req_builder = req_builder.json(&p_body_resume_cluster_upgrade_description);
1142
1143    let req = req_builder.build()?;
1144    let resp = configuration.client.execute(req).await?;
1145
1146    let status = resp.status();
1147
1148    if !status.is_client_error() && !status.is_server_error() {
1149        Ok(())
1150    } else {
1151        let content = resp.text().await?;
1152        let entity: Option<ResumeClusterUpgradeError> = serde_json::from_str(&content).ok();
1153        Err(Error::ResponseError(ResponseContent {
1154            status,
1155            content,
1156            entity,
1157        }))
1158    }
1159}
1160
1161/// Roll back the code or configuration upgrade of a Service Fabric cluster.
1162pub async fn rollback_cluster_upgrade(
1163    configuration: &configuration::Configuration,
1164    api_version: &str,
1165    timeout: Option<i64>,
1166) -> Result<(), Error<RollbackClusterUpgradeError>> {
1167    // add a prefix to parameters to efficiently prevent name collisions
1168    let p_query_api_version = api_version;
1169    let p_query_timeout = timeout;
1170
1171    let uri_str = format!("{}/$/RollbackUpgrade", configuration.base_path);
1172    let mut req_builder = configuration
1173        .client
1174        .request(reqwest::Method::POST, &uri_str);
1175
1176    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1177    if let Some(ref param_value) = p_query_timeout {
1178        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1179    }
1180    if let Some(ref user_agent) = configuration.user_agent {
1181        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1182    }
1183
1184    let req = req_builder.build()?;
1185    let resp = configuration.client.execute(req).await?;
1186
1187    let status = resp.status();
1188
1189    if !status.is_client_error() && !status.is_server_error() {
1190        Ok(())
1191    } else {
1192        let content = resp.text().await?;
1193        let entity: Option<RollbackClusterUpgradeError> = serde_json::from_str(&content).ok();
1194        Err(Error::ResponseError(ResponseContent {
1195            status,
1196            content,
1197            entity,
1198        }))
1199    }
1200}
1201
1202/// Update the service state of Service Fabric Upgrade Orchestration Service. This API is internally used for support purposes.
1203pub async fn set_upgrade_orchestration_service_state(
1204    configuration: &configuration::Configuration,
1205    api_version: &str,
1206    upgrade_orchestration_service_state: models::UpgradeOrchestrationServiceState,
1207    timeout: Option<i64>,
1208) -> Result<
1209    models::UpgradeOrchestrationServiceStateSummary,
1210    Error<SetUpgradeOrchestrationServiceStateError>,
1211> {
1212    // add a prefix to parameters to efficiently prevent name collisions
1213    let p_query_api_version = api_version;
1214    let p_body_upgrade_orchestration_service_state = upgrade_orchestration_service_state;
1215    let p_query_timeout = timeout;
1216
1217    let uri_str = format!(
1218        "{}/$/SetUpgradeOrchestrationServiceState",
1219        configuration.base_path
1220    );
1221    let mut req_builder = configuration
1222        .client
1223        .request(reqwest::Method::POST, &uri_str);
1224
1225    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1226    if let Some(ref param_value) = p_query_timeout {
1227        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1228    }
1229    if let Some(ref user_agent) = configuration.user_agent {
1230        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1231    }
1232    req_builder = req_builder.json(&p_body_upgrade_orchestration_service_state);
1233
1234    let req = req_builder.build()?;
1235    let resp = configuration.client.execute(req).await?;
1236
1237    let status = resp.status();
1238    let content_type = resp
1239        .headers()
1240        .get("content-type")
1241        .and_then(|v| v.to_str().ok())
1242        .unwrap_or("application/octet-stream");
1243    let content_type = super::ContentType::from(content_type);
1244
1245    if !status.is_client_error() && !status.is_server_error() {
1246        let content = resp.text().await?;
1247        match content_type {
1248            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1249            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UpgradeOrchestrationServiceStateSummary`"))),
1250            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::UpgradeOrchestrationServiceStateSummary`")))),
1251        }
1252    } else {
1253        let content = resp.text().await?;
1254        let entity: Option<SetUpgradeOrchestrationServiceStateError> =
1255            serde_json::from_str(&content).ok();
1256        Err(Error::ResponseError(ResponseContent {
1257            status,
1258            content,
1259            entity,
1260        }))
1261    }
1262}
1263
1264/// Validate the supplied configuration upgrade parameters and start upgrading the cluster configuration if the parameters are valid.
1265pub async fn start_cluster_configuration_upgrade(
1266    configuration: &configuration::Configuration,
1267    api_version: &str,
1268    cluster_configuration_upgrade_description: models::ClusterConfigurationUpgradeDescription,
1269    timeout: Option<i64>,
1270) -> Result<(), Error<StartClusterConfigurationUpgradeError>> {
1271    // add a prefix to parameters to efficiently prevent name collisions
1272    let p_query_api_version = api_version;
1273    let p_body_cluster_configuration_upgrade_description =
1274        cluster_configuration_upgrade_description;
1275    let p_query_timeout = timeout;
1276
1277    let uri_str = format!(
1278        "{}/$/StartClusterConfigurationUpgrade",
1279        configuration.base_path
1280    );
1281    let mut req_builder = configuration
1282        .client
1283        .request(reqwest::Method::POST, &uri_str);
1284
1285    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1286    if let Some(ref param_value) = p_query_timeout {
1287        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1288    }
1289    if let Some(ref user_agent) = configuration.user_agent {
1290        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1291    }
1292    req_builder = req_builder.json(&p_body_cluster_configuration_upgrade_description);
1293
1294    let req = req_builder.build()?;
1295    let resp = configuration.client.execute(req).await?;
1296
1297    let status = resp.status();
1298
1299    if !status.is_client_error() && !status.is_server_error() {
1300        Ok(())
1301    } else {
1302        let content = resp.text().await?;
1303        let entity: Option<StartClusterConfigurationUpgradeError> =
1304            serde_json::from_str(&content).ok();
1305        Err(Error::ResponseError(ResponseContent {
1306            status,
1307            content,
1308            entity,
1309        }))
1310    }
1311}
1312
1313/// Validate the supplied upgrade parameters and start upgrading the code or configuration version of a Service Fabric cluster if the parameters are valid.
1314pub async fn start_cluster_upgrade(
1315    configuration: &configuration::Configuration,
1316    api_version: &str,
1317    start_cluster_upgrade_description: models::StartClusterUpgradeDescription,
1318    timeout: Option<i64>,
1319) -> Result<(), Error<StartClusterUpgradeError>> {
1320    // add a prefix to parameters to efficiently prevent name collisions
1321    let p_query_api_version = api_version;
1322    let p_body_start_cluster_upgrade_description = start_cluster_upgrade_description;
1323    let p_query_timeout = timeout;
1324
1325    let uri_str = format!("{}/$/Upgrade", configuration.base_path);
1326    let mut req_builder = configuration
1327        .client
1328        .request(reqwest::Method::POST, &uri_str);
1329
1330    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1331    if let Some(ref param_value) = p_query_timeout {
1332        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1333    }
1334    if let Some(ref user_agent) = configuration.user_agent {
1335        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1336    }
1337    req_builder = req_builder.json(&p_body_start_cluster_upgrade_description);
1338
1339    let req = req_builder.build()?;
1340    let resp = configuration.client.execute(req).await?;
1341
1342    let status = resp.status();
1343
1344    if !status.is_client_error() && !status.is_server_error() {
1345        Ok(())
1346    } else {
1347        let content = resp.text().await?;
1348        let entity: Option<StartClusterUpgradeError> = serde_json::from_str(&content).ok();
1349        Err(Error::ResponseError(ResponseContent {
1350            status,
1351            content,
1352            entity,
1353        }))
1354    }
1355}
1356
1357/// If verbosity is set to true, then detailed health reports will be generated when replicas cannot be placed or dropped. If verbosity is set to false, then no health reports will be generated when replicas cannot be placed or dropped.
1358pub async fn toggle_verbose_service_placement_health_reporting(
1359    configuration: &configuration::Configuration,
1360    api_version: &str,
1361    enabled: bool,
1362    timeout: Option<i64>,
1363) -> Result<(), Error<ToggleVerboseServicePlacementHealthReportingError>> {
1364    // add a prefix to parameters to efficiently prevent name collisions
1365    let p_query_api_version = api_version;
1366    let p_query_enabled = enabled;
1367    let p_query_timeout = timeout;
1368
1369    let uri_str = format!(
1370        "{}/$/ToggleVerboseServicePlacementHealthReporting",
1371        configuration.base_path
1372    );
1373    let mut req_builder = configuration
1374        .client
1375        .request(reqwest::Method::POST, &uri_str);
1376
1377    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1378    req_builder = req_builder.query(&[("Enabled", &p_query_enabled.to_string())]);
1379    if let Some(ref param_value) = p_query_timeout {
1380        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1381    }
1382    if let Some(ref user_agent) = configuration.user_agent {
1383        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1384    }
1385
1386    let req = req_builder.build()?;
1387    let resp = configuration.client.execute(req).await?;
1388
1389    let status = resp.status();
1390
1391    if !status.is_client_error() && !status.is_server_error() {
1392        Ok(())
1393    } else {
1394        let content = resp.text().await?;
1395        let entity: Option<ToggleVerboseServicePlacementHealthReportingError> =
1396            serde_json::from_str(&content).ok();
1397        Err(Error::ResponseError(ResponseContent {
1398            status,
1399            content,
1400            entity,
1401        }))
1402    }
1403}
1404
1405/// It is supported to unprovision code and configuration separately.
1406pub async fn unprovision_cluster(
1407    configuration: &configuration::Configuration,
1408    api_version: &str,
1409    unprovision_fabric_description: models::UnprovisionFabricDescription,
1410    timeout: Option<i64>,
1411) -> Result<(), Error<UnprovisionClusterError>> {
1412    // add a prefix to parameters to efficiently prevent name collisions
1413    let p_query_api_version = api_version;
1414    let p_body_unprovision_fabric_description = unprovision_fabric_description;
1415    let p_query_timeout = timeout;
1416
1417    let uri_str = format!("{}/$/Unprovision", configuration.base_path);
1418    let mut req_builder = configuration
1419        .client
1420        .request(reqwest::Method::POST, &uri_str);
1421
1422    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1423    if let Some(ref param_value) = p_query_timeout {
1424        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1425    }
1426    if let Some(ref user_agent) = configuration.user_agent {
1427        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1428    }
1429    req_builder = req_builder.json(&p_body_unprovision_fabric_description);
1430
1431    let req = req_builder.build()?;
1432    let resp = configuration.client.execute(req).await?;
1433
1434    let status = resp.status();
1435
1436    if !status.is_client_error() && !status.is_server_error() {
1437        Ok(())
1438    } else {
1439        let content = resp.text().await?;
1440        let entity: Option<UnprovisionClusterError> = serde_json::from_str(&content).ok();
1441        Err(Error::ResponseError(ResponseContent {
1442            status,
1443            content,
1444            entity,
1445        }))
1446    }
1447}
1448
1449/// Update the upgrade parameters used during a Service Fabric cluster upgrade.
1450pub async fn update_cluster_upgrade(
1451    configuration: &configuration::Configuration,
1452    api_version: &str,
1453    update_cluster_upgrade_description: models::UpdateClusterUpgradeDescription,
1454    timeout: Option<i64>,
1455) -> Result<(), Error<UpdateClusterUpgradeError>> {
1456    // add a prefix to parameters to efficiently prevent name collisions
1457    let p_query_api_version = api_version;
1458    let p_body_update_cluster_upgrade_description = update_cluster_upgrade_description;
1459    let p_query_timeout = timeout;
1460
1461    let uri_str = format!("{}/$/UpdateUpgrade", configuration.base_path);
1462    let mut req_builder = configuration
1463        .client
1464        .request(reqwest::Method::POST, &uri_str);
1465
1466    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1467    if let Some(ref param_value) = p_query_timeout {
1468        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1469    }
1470    if let Some(ref user_agent) = configuration.user_agent {
1471        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1472    }
1473    req_builder = req_builder.json(&p_body_update_cluster_upgrade_description);
1474
1475    let req = req_builder.build()?;
1476    let resp = configuration.client.execute(req).await?;
1477
1478    let status = resp.status();
1479
1480    if !status.is_client_error() && !status.is_server_error() {
1481        Ok(())
1482    } else {
1483        let content = resp.text().await?;
1484        let entity: Option<UpdateClusterUpgradeError> = serde_json::from_str(&content).ok();
1485        Err(Error::ResponseError(ResponseContent {
1486            status,
1487            content,
1488            entity,
1489        }))
1490    }
1491}
1492
1493/// Validate the supplied upgrade parameters and assess the expected impact of a code or configuration version upgrade of a Service Fabric cluster. The upgrade will not be initiated.
1494pub async fn validate_cluster_upgrade(
1495    configuration: &configuration::Configuration,
1496    api_version: &str,
1497    start_cluster_upgrade_description: models::StartClusterUpgradeDescription,
1498    timeout: Option<i64>,
1499) -> Result<models::ValidateClusterUpgradeResult, Error<ValidateClusterUpgradeError>> {
1500    // add a prefix to parameters to efficiently prevent name collisions
1501    let p_query_api_version = api_version;
1502    let p_body_start_cluster_upgrade_description = start_cluster_upgrade_description;
1503    let p_query_timeout = timeout;
1504
1505    let uri_str = format!("{}/$/ValidateUpgrade", configuration.base_path);
1506    let mut req_builder = configuration
1507        .client
1508        .request(reqwest::Method::POST, &uri_str);
1509
1510    req_builder = req_builder.query(&[("api-version", &p_query_api_version.to_string())]);
1511    if let Some(ref param_value) = p_query_timeout {
1512        req_builder = req_builder.query(&[("timeout", &param_value.to_string())]);
1513    }
1514    if let Some(ref user_agent) = configuration.user_agent {
1515        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1516    }
1517    req_builder = req_builder.json(&p_body_start_cluster_upgrade_description);
1518
1519    let req = req_builder.build()?;
1520    let resp = configuration.client.execute(req).await?;
1521
1522    let status = resp.status();
1523    let content_type = resp
1524        .headers()
1525        .get("content-type")
1526        .and_then(|v| v.to_str().ok())
1527        .unwrap_or("application/octet-stream");
1528    let content_type = super::ContentType::from(content_type);
1529
1530    if !status.is_client_error() && !status.is_server_error() {
1531        let content = resp.text().await?;
1532        match content_type {
1533            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1534            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ValidateClusterUpgradeResult`"))),
1535            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::ValidateClusterUpgradeResult`")))),
1536        }
1537    } else {
1538        let content = resp.text().await?;
1539        let entity: Option<ValidateClusterUpgradeError> = serde_json::from_str(&content).ok();
1540        Err(Error::ResponseError(ResponseContent {
1541            status,
1542            content,
1543            entity,
1544        }))
1545    }
1546}