rusty_falcon/apis/
sensor_update_policies_api.rs

1/*
2 * CrowdStrike API Specification
3 *
4 * Use this API specification as a reference for the API endpoints you can use to interact with your Falcon environment. These endpoints support authentication via OAuth2 and interact with detections and network containment. For detailed usage guides and examples, see our [documentation inside the Falcon console](https://falcon.crowdstrike.com/support/documentation).     To use the APIs described below, combine the base URL with the path shown for each API endpoint. For commercial cloud customers, your base URL is `https://api.crowdstrike.com`.    Each API endpoint requires authorization via an OAuth2 token. Your first API request should retrieve an OAuth2 token using the `oauth2/token` endpoint, such as `https://api.crowdstrike.com/oauth2/token`. For subsequent requests, include the OAuth2 token in an HTTP authorization header. Tokens expire after 30 minutes, after which you should make a new token request to continue making API requests.
5 *
6 * The version of the OpenAPI document: rolling
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 _;
15
16/// struct for typed errors of method [`create_sensor_update_policies`]
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum CreateSensorUpdatePoliciesError {
20    Status400(models::SensorUpdateRespV1),
21    Status403(models::MsaErrorsOnly),
22    Status404(models::SensorUpdateRespV1),
23    Status429(models::MsaReplyMetaOnly),
24    Status500(models::SensorUpdateRespV1),
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`create_sensor_update_policies_v2`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum CreateSensorUpdatePoliciesV2Error {
32    Status400(models::SensorUpdateRespV2),
33    Status403(models::MsaErrorsOnly),
34    Status404(models::SensorUpdateRespV2),
35    Status429(models::MsaReplyMetaOnly),
36    Status500(models::SensorUpdateRespV2),
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`delete_sensor_update_policies`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum DeleteSensorUpdatePoliciesError {
44    Status403(models::MsaErrorsOnly),
45    Status404(models::MsaQueryResponse),
46    Status429(models::MsaReplyMetaOnly),
47    Status500(models::MsaQueryResponse),
48    UnknownValue(serde_json::Value),
49}
50
51/// struct for typed errors of method [`get_sensor_update_policies`]
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum GetSensorUpdatePoliciesError {
55    Status403(models::MsaErrorsOnly),
56    Status404(models::SensorUpdateRespV1),
57    Status429(models::MsaReplyMetaOnly),
58    Status500(models::SensorUpdateRespV1),
59    UnknownValue(serde_json::Value),
60}
61
62/// struct for typed errors of method [`get_sensor_update_policies_v2`]
63#[derive(Debug, Clone, Serialize, Deserialize)]
64#[serde(untagged)]
65pub enum GetSensorUpdatePoliciesV2Error {
66    Status403(models::MsaErrorsOnly),
67    Status404(models::SensorUpdateRespV2),
68    Status429(models::MsaReplyMetaOnly),
69    Status500(models::SensorUpdateRespV2),
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`perform_sensor_update_policies_action`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum PerformSensorUpdatePoliciesActionError {
77    Status400(models::SensorUpdateRespV1),
78    Status403(models::MsaErrorsOnly),
79    Status404(models::SensorUpdateRespV1),
80    Status429(models::MsaReplyMetaOnly),
81    Status500(models::SensorUpdateRespV1),
82    UnknownValue(serde_json::Value),
83}
84
85/// struct for typed errors of method [`query_combined_sensor_update_builds`]
86#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum QueryCombinedSensorUpdateBuildsError {
89    Status400(models::SensorUpdateBuildsRespV1),
90    Status403(models::MsaErrorsOnly),
91    Status429(models::MsaReplyMetaOnly),
92    Status500(models::SensorUpdateBuildsRespV1),
93    DefaultResponse(String),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`query_combined_sensor_update_kernels`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum QueryCombinedSensorUpdateKernelsError {
101    Status400(models::SensorUpdateKernelsRespV1),
102    Status403(models::MsaErrorsOnly),
103    Status429(models::MsaReplyMetaOnly),
104    Status500(models::SensorUpdateKernelsRespV1),
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`query_combined_sensor_update_policies`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum QueryCombinedSensorUpdatePoliciesError {
112    Status400(models::SensorUpdateRespV1),
113    Status403(models::MsaErrorsOnly),
114    Status429(models::MsaReplyMetaOnly),
115    Status500(models::SensorUpdateRespV1),
116    UnknownValue(serde_json::Value),
117}
118
119/// struct for typed errors of method [`query_combined_sensor_update_policies_v2`]
120#[derive(Debug, Clone, Serialize, Deserialize)]
121#[serde(untagged)]
122pub enum QueryCombinedSensorUpdatePoliciesV2Error {
123    Status400(models::SensorUpdateRespV2),
124    Status403(models::MsaErrorsOnly),
125    Status429(models::MsaReplyMetaOnly),
126    Status500(models::SensorUpdateRespV2),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`query_combined_sensor_update_policy_members`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum QueryCombinedSensorUpdatePolicyMembersError {
134    Status400(models::BasePolicyMembersRespV1),
135    Status403(models::MsaErrorsOnly),
136    Status404(models::BasePolicyMembersRespV1),
137    Status429(models::MsaReplyMetaOnly),
138    Status500(models::BasePolicyMembersRespV1),
139    UnknownValue(serde_json::Value),
140}
141
142/// struct for typed errors of method [`query_sensor_update_kernels_distinct`]
143#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum QuerySensorUpdateKernelsDistinctError {
146    Status400(models::MsaQueryResponse),
147    Status403(models::MsaErrorsOnly),
148    Status429(models::MsaReplyMetaOnly),
149    Status500(models::MsaQueryResponse),
150    UnknownValue(serde_json::Value),
151}
152
153/// struct for typed errors of method [`query_sensor_update_policies`]
154#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum QuerySensorUpdatePoliciesError {
157    Status400(models::MsaQueryResponse),
158    Status403(models::MsaErrorsOnly),
159    Status429(models::MsaReplyMetaOnly),
160    Status500(models::MsaQueryResponse),
161    UnknownValue(serde_json::Value),
162}
163
164/// struct for typed errors of method [`query_sensor_update_policy_members`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum QuerySensorUpdatePolicyMembersError {
168    Status400(models::MsaQueryResponse),
169    Status403(models::MsaErrorsOnly),
170    Status404(models::MsaQueryResponse),
171    Status429(models::MsaReplyMetaOnly),
172    Status500(models::MsaQueryResponse),
173    UnknownValue(serde_json::Value),
174}
175
176/// struct for typed errors of method [`reveal_uninstall_token`]
177#[derive(Debug, Clone, Serialize, Deserialize)]
178#[serde(untagged)]
179pub enum RevealUninstallTokenError {
180    Status400(models::UninstallTokenRespV1),
181    Status403(models::MsaErrorsOnly),
182    Status429(models::MsaReplyMetaOnly),
183    Status500(models::UninstallTokenRespV1),
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`set_sensor_update_policies_precedence`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum SetSensorUpdatePoliciesPrecedenceError {
191    Status400(models::MsaQueryResponse),
192    Status403(models::MsaErrorsOnly),
193    Status429(models::MsaReplyMetaOnly),
194    Status500(models::MsaQueryResponse),
195    UnknownValue(serde_json::Value),
196}
197
198/// struct for typed errors of method [`update_sensor_update_policies`]
199#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum UpdateSensorUpdatePoliciesError {
202    Status400(models::SensorUpdateRespV1),
203    Status403(models::MsaErrorsOnly),
204    Status404(models::SensorUpdateRespV1),
205    Status429(models::MsaReplyMetaOnly),
206    Status500(models::SensorUpdateRespV1),
207    UnknownValue(serde_json::Value),
208}
209
210/// struct for typed errors of method [`update_sensor_update_policies_v2`]
211#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum UpdateSensorUpdatePoliciesV2Error {
214    Status400(models::SensorUpdateRespV2),
215    Status403(models::MsaErrorsOnly),
216    Status404(models::SensorUpdateRespV2),
217    Status429(models::MsaReplyMetaOnly),
218    Status500(models::SensorUpdateRespV2),
219    UnknownValue(serde_json::Value),
220}
221
222pub async fn create_sensor_update_policies(
223    configuration: &configuration::Configuration,
224    body: models::SensorUpdateCreatePoliciesReqV1,
225) -> Result<models::SensorUpdateRespV1, Error<CreateSensorUpdatePoliciesError>> {
226    // add a prefix to parameters to efficiently prevent name collisions
227    let p_body_body = body;
228
229    let uri_str = format!(
230        "{}/policy/entities/sensor-update/v1",
231        configuration.base_path
232    );
233    let mut req_builder = configuration
234        .client
235        .request(reqwest::Method::POST, &uri_str);
236
237    if let Some(ref user_agent) = configuration.user_agent {
238        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
239    }
240    if let Some(ref token) = configuration.oauth_access_token {
241        req_builder = req_builder.bearer_auth(token.to_owned());
242    };
243    req_builder = req_builder.json(&p_body_body);
244
245    let req = req_builder.build()?;
246    let resp = configuration.client.execute(req).await?;
247
248    let status = resp.status();
249    let content_type = resp
250        .headers()
251        .get("content-type")
252        .and_then(|v| v.to_str().ok())
253        .unwrap_or("application/octet-stream");
254    let content_type = super::ContentType::from(content_type);
255
256    if !status.is_client_error() && !status.is_server_error() {
257        let content = resp.text().await?;
258        match content_type {
259            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
260            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV1`"))),
261            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::SensorUpdateRespV1`")))),
262        }
263    } else {
264        let content = resp.text().await?;
265        let entity: Option<CreateSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
266        Err(Error::ResponseError(ResponseContent {
267            status,
268            content,
269            entity,
270        }))
271    }
272}
273
274pub async fn create_sensor_update_policies_v2(
275    configuration: &configuration::Configuration,
276    body: models::SensorUpdateCreatePoliciesReqV2,
277) -> Result<models::SensorUpdateRespV2, Error<CreateSensorUpdatePoliciesV2Error>> {
278    // add a prefix to parameters to efficiently prevent name collisions
279    let p_body_body = body;
280
281    let uri_str = format!(
282        "{}/policy/entities/sensor-update/v2",
283        configuration.base_path
284    );
285    let mut req_builder = configuration
286        .client
287        .request(reqwest::Method::POST, &uri_str);
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    if let Some(ref token) = configuration.oauth_access_token {
293        req_builder = req_builder.bearer_auth(token.to_owned());
294    };
295    req_builder = req_builder.json(&p_body_body);
296
297    let req = req_builder.build()?;
298    let resp = configuration.client.execute(req).await?;
299
300    let status = resp.status();
301    let content_type = resp
302        .headers()
303        .get("content-type")
304        .and_then(|v| v.to_str().ok())
305        .unwrap_or("application/octet-stream");
306    let content_type = super::ContentType::from(content_type);
307
308    if !status.is_client_error() && !status.is_server_error() {
309        let content = resp.text().await?;
310        match content_type {
311            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
312            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV2`"))),
313            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::SensorUpdateRespV2`")))),
314        }
315    } else {
316        let content = resp.text().await?;
317        let entity: Option<CreateSensorUpdatePoliciesV2Error> = serde_json::from_str(&content).ok();
318        Err(Error::ResponseError(ResponseContent {
319            status,
320            content,
321            entity,
322        }))
323    }
324}
325
326pub async fn delete_sensor_update_policies(
327    configuration: &configuration::Configuration,
328    ids: Vec<String>,
329) -> Result<models::MsaQueryResponse, Error<DeleteSensorUpdatePoliciesError>> {
330    // add a prefix to parameters to efficiently prevent name collisions
331    let p_query_ids = ids;
332
333    let uri_str = format!(
334        "{}/policy/entities/sensor-update/v1",
335        configuration.base_path
336    );
337    let mut req_builder = configuration
338        .client
339        .request(reqwest::Method::DELETE, &uri_str);
340
341    req_builder = match "multi" {
342        "multi" => req_builder.query(
343            &p_query_ids
344                .into_iter()
345                .map(|p| ("ids".to_owned(), p.to_string()))
346                .collect::<Vec<(std::string::String, std::string::String)>>(),
347        ),
348        _ => req_builder.query(&[(
349            "ids",
350            &p_query_ids
351                .into_iter()
352                .map(|p| p.to_string())
353                .collect::<Vec<String>>()
354                .join(",")
355                .to_string(),
356        )]),
357    };
358    if let Some(ref user_agent) = configuration.user_agent {
359        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
360    }
361    if let Some(ref token) = configuration.oauth_access_token {
362        req_builder = req_builder.bearer_auth(token.to_owned());
363    };
364
365    let req = req_builder.build()?;
366    let resp = configuration.client.execute(req).await?;
367
368    let status = resp.status();
369    let content_type = resp
370        .headers()
371        .get("content-type")
372        .and_then(|v| v.to_str().ok())
373        .unwrap_or("application/octet-stream");
374    let content_type = super::ContentType::from(content_type);
375
376    if !status.is_client_error() && !status.is_server_error() {
377        let content = resp.text().await?;
378        match content_type {
379            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
380            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaQueryResponse`"))),
381            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::MsaQueryResponse`")))),
382        }
383    } else {
384        let content = resp.text().await?;
385        let entity: Option<DeleteSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
386        Err(Error::ResponseError(ResponseContent {
387            status,
388            content,
389            entity,
390        }))
391    }
392}
393
394pub async fn get_sensor_update_policies(
395    configuration: &configuration::Configuration,
396    ids: Vec<String>,
397) -> Result<models::SensorUpdateRespV1, Error<GetSensorUpdatePoliciesError>> {
398    // add a prefix to parameters to efficiently prevent name collisions
399    let p_query_ids = ids;
400
401    let uri_str = format!(
402        "{}/policy/entities/sensor-update/v1",
403        configuration.base_path
404    );
405    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
406
407    req_builder = match "multi" {
408        "multi" => req_builder.query(
409            &p_query_ids
410                .into_iter()
411                .map(|p| ("ids".to_owned(), p.to_string()))
412                .collect::<Vec<(std::string::String, std::string::String)>>(),
413        ),
414        _ => req_builder.query(&[(
415            "ids",
416            &p_query_ids
417                .into_iter()
418                .map(|p| p.to_string())
419                .collect::<Vec<String>>()
420                .join(",")
421                .to_string(),
422        )]),
423    };
424    if let Some(ref user_agent) = configuration.user_agent {
425        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
426    }
427    if let Some(ref token) = configuration.oauth_access_token {
428        req_builder = req_builder.bearer_auth(token.to_owned());
429    };
430
431    let req = req_builder.build()?;
432    let resp = configuration.client.execute(req).await?;
433
434    let status = resp.status();
435    let content_type = resp
436        .headers()
437        .get("content-type")
438        .and_then(|v| v.to_str().ok())
439        .unwrap_or("application/octet-stream");
440    let content_type = super::ContentType::from(content_type);
441
442    if !status.is_client_error() && !status.is_server_error() {
443        let content = resp.text().await?;
444        match content_type {
445            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
446            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV1`"))),
447            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::SensorUpdateRespV1`")))),
448        }
449    } else {
450        let content = resp.text().await?;
451        let entity: Option<GetSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
452        Err(Error::ResponseError(ResponseContent {
453            status,
454            content,
455            entity,
456        }))
457    }
458}
459
460pub async fn get_sensor_update_policies_v2(
461    configuration: &configuration::Configuration,
462    ids: Vec<String>,
463) -> Result<models::SensorUpdateRespV2, Error<GetSensorUpdatePoliciesV2Error>> {
464    // add a prefix to parameters to efficiently prevent name collisions
465    let p_query_ids = ids;
466
467    let uri_str = format!(
468        "{}/policy/entities/sensor-update/v2",
469        configuration.base_path
470    );
471    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
472
473    req_builder = match "multi" {
474        "multi" => req_builder.query(
475            &p_query_ids
476                .into_iter()
477                .map(|p| ("ids".to_owned(), p.to_string()))
478                .collect::<Vec<(std::string::String, std::string::String)>>(),
479        ),
480        _ => req_builder.query(&[(
481            "ids",
482            &p_query_ids
483                .into_iter()
484                .map(|p| p.to_string())
485                .collect::<Vec<String>>()
486                .join(",")
487                .to_string(),
488        )]),
489    };
490    if let Some(ref user_agent) = configuration.user_agent {
491        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
492    }
493    if let Some(ref token) = configuration.oauth_access_token {
494        req_builder = req_builder.bearer_auth(token.to_owned());
495    };
496
497    let req = req_builder.build()?;
498    let resp = configuration.client.execute(req).await?;
499
500    let status = resp.status();
501    let content_type = resp
502        .headers()
503        .get("content-type")
504        .and_then(|v| v.to_str().ok())
505        .unwrap_or("application/octet-stream");
506    let content_type = super::ContentType::from(content_type);
507
508    if !status.is_client_error() && !status.is_server_error() {
509        let content = resp.text().await?;
510        match content_type {
511            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
512            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV2`"))),
513            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::SensorUpdateRespV2`")))),
514        }
515    } else {
516        let content = resp.text().await?;
517        let entity: Option<GetSensorUpdatePoliciesV2Error> = serde_json::from_str(&content).ok();
518        Err(Error::ResponseError(ResponseContent {
519            status,
520            content,
521            entity,
522        }))
523    }
524}
525
526pub async fn perform_sensor_update_policies_action(
527    configuration: &configuration::Configuration,
528    action_name: &str,
529    body: models::MsaEntityActionRequestV2,
530) -> Result<models::SensorUpdateRespV1, Error<PerformSensorUpdatePoliciesActionError>> {
531    // add a prefix to parameters to efficiently prevent name collisions
532    let p_query_action_name = action_name;
533    let p_body_body = body;
534
535    let uri_str = format!(
536        "{}/policy/entities/sensor-update-actions/v1",
537        configuration.base_path
538    );
539    let mut req_builder = configuration
540        .client
541        .request(reqwest::Method::POST, &uri_str);
542
543    req_builder = req_builder.query(&[("action_name", &p_query_action_name.to_string())]);
544    if let Some(ref user_agent) = configuration.user_agent {
545        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
546    }
547    if let Some(ref token) = configuration.oauth_access_token {
548        req_builder = req_builder.bearer_auth(token.to_owned());
549    };
550    req_builder = req_builder.json(&p_body_body);
551
552    let req = req_builder.build()?;
553    let resp = configuration.client.execute(req).await?;
554
555    let status = resp.status();
556    let content_type = resp
557        .headers()
558        .get("content-type")
559        .and_then(|v| v.to_str().ok())
560        .unwrap_or("application/octet-stream");
561    let content_type = super::ContentType::from(content_type);
562
563    if !status.is_client_error() && !status.is_server_error() {
564        let content = resp.text().await?;
565        match content_type {
566            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
567            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV1`"))),
568            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::SensorUpdateRespV1`")))),
569        }
570    } else {
571        let content = resp.text().await?;
572        let entity: Option<PerformSensorUpdatePoliciesActionError> =
573            serde_json::from_str(&content).ok();
574        Err(Error::ResponseError(ResponseContent {
575            status,
576            content,
577            entity,
578        }))
579    }
580}
581
582pub async fn query_combined_sensor_update_builds(
583    configuration: &configuration::Configuration,
584    platform: Option<&str>,
585    stage: Option<Vec<String>>,
586) -> Result<models::SensorUpdateBuildsRespV1, Error<QueryCombinedSensorUpdateBuildsError>> {
587    // add a prefix to parameters to efficiently prevent name collisions
588    let p_query_platform = platform;
589    let p_query_stage = stage;
590
591    let uri_str = format!(
592        "{}/policy/combined/sensor-update-builds/v1",
593        configuration.base_path
594    );
595    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
596
597    if let Some(ref param_value) = p_query_platform {
598        req_builder = req_builder.query(&[("platform", &param_value.to_string())]);
599    }
600    if let Some(ref param_value) = p_query_stage {
601        req_builder = match "multi" {
602            "multi" => req_builder.query(
603                &param_value
604                    .into_iter()
605                    .map(|p| ("stage".to_owned(), p.to_string()))
606                    .collect::<Vec<(std::string::String, std::string::String)>>(),
607            ),
608            _ => req_builder.query(&[(
609                "stage",
610                &param_value
611                    .into_iter()
612                    .map(|p| p.to_string())
613                    .collect::<Vec<String>>()
614                    .join(",")
615                    .to_string(),
616            )]),
617        };
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    if let Some(ref token) = configuration.oauth_access_token {
623        req_builder = req_builder.bearer_auth(token.to_owned());
624    };
625
626    let req = req_builder.build()?;
627    let resp = configuration.client.execute(req).await?;
628
629    let status = resp.status();
630    let content_type = resp
631        .headers()
632        .get("content-type")
633        .and_then(|v| v.to_str().ok())
634        .unwrap_or("application/octet-stream");
635    let content_type = super::ContentType::from(content_type);
636
637    if !status.is_client_error() && !status.is_server_error() {
638        let content = resp.text().await?;
639        match content_type {
640            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
641            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateBuildsRespV1`"))),
642            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::SensorUpdateBuildsRespV1`")))),
643        }
644    } else {
645        let content = resp.text().await?;
646        let entity: Option<QueryCombinedSensorUpdateBuildsError> =
647            serde_json::from_str(&content).ok();
648        Err(Error::ResponseError(ResponseContent {
649            status,
650            content,
651            entity,
652        }))
653    }
654}
655
656pub async fn query_combined_sensor_update_kernels(
657    configuration: &configuration::Configuration,
658    filter: Option<&str>,
659    offset: Option<i32>,
660    limit: Option<i32>,
661) -> Result<models::SensorUpdateKernelsRespV1, Error<QueryCombinedSensorUpdateKernelsError>> {
662    // add a prefix to parameters to efficiently prevent name collisions
663    let p_query_filter = filter;
664    let p_query_offset = offset;
665    let p_query_limit = limit;
666
667    let uri_str = format!(
668        "{}/policy/combined/sensor-update-kernels/v1",
669        configuration.base_path
670    );
671    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
672
673    if let Some(ref param_value) = p_query_filter {
674        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
675    }
676    if let Some(ref param_value) = p_query_offset {
677        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
678    }
679    if let Some(ref param_value) = p_query_limit {
680        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
681    }
682    if let Some(ref user_agent) = configuration.user_agent {
683        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
684    }
685    if let Some(ref token) = configuration.oauth_access_token {
686        req_builder = req_builder.bearer_auth(token.to_owned());
687    };
688
689    let req = req_builder.build()?;
690    let resp = configuration.client.execute(req).await?;
691
692    let status = resp.status();
693    let content_type = resp
694        .headers()
695        .get("content-type")
696        .and_then(|v| v.to_str().ok())
697        .unwrap_or("application/octet-stream");
698    let content_type = super::ContentType::from(content_type);
699
700    if !status.is_client_error() && !status.is_server_error() {
701        let content = resp.text().await?;
702        match content_type {
703            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
704            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateKernelsRespV1`"))),
705            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::SensorUpdateKernelsRespV1`")))),
706        }
707    } else {
708        let content = resp.text().await?;
709        let entity: Option<QueryCombinedSensorUpdateKernelsError> =
710            serde_json::from_str(&content).ok();
711        Err(Error::ResponseError(ResponseContent {
712            status,
713            content,
714            entity,
715        }))
716    }
717}
718
719pub async fn query_combined_sensor_update_policies(
720    configuration: &configuration::Configuration,
721    filter: Option<&str>,
722    offset: Option<i32>,
723    limit: Option<i32>,
724    sort: Option<&str>,
725) -> Result<models::SensorUpdateRespV1, Error<QueryCombinedSensorUpdatePoliciesError>> {
726    // add a prefix to parameters to efficiently prevent name collisions
727    let p_query_filter = filter;
728    let p_query_offset = offset;
729    let p_query_limit = limit;
730    let p_query_sort = sort;
731
732    let uri_str = format!(
733        "{}/policy/combined/sensor-update/v1",
734        configuration.base_path
735    );
736    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
737
738    if let Some(ref param_value) = p_query_filter {
739        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
740    }
741    if let Some(ref param_value) = p_query_offset {
742        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
743    }
744    if let Some(ref param_value) = p_query_limit {
745        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
746    }
747    if let Some(ref param_value) = p_query_sort {
748        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
749    }
750    if let Some(ref user_agent) = configuration.user_agent {
751        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
752    }
753    if let Some(ref token) = configuration.oauth_access_token {
754        req_builder = req_builder.bearer_auth(token.to_owned());
755    };
756
757    let req = req_builder.build()?;
758    let resp = configuration.client.execute(req).await?;
759
760    let status = resp.status();
761    let content_type = resp
762        .headers()
763        .get("content-type")
764        .and_then(|v| v.to_str().ok())
765        .unwrap_or("application/octet-stream");
766    let content_type = super::ContentType::from(content_type);
767
768    if !status.is_client_error() && !status.is_server_error() {
769        let content = resp.text().await?;
770        match content_type {
771            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
772            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV1`"))),
773            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::SensorUpdateRespV1`")))),
774        }
775    } else {
776        let content = resp.text().await?;
777        let entity: Option<QueryCombinedSensorUpdatePoliciesError> =
778            serde_json::from_str(&content).ok();
779        Err(Error::ResponseError(ResponseContent {
780            status,
781            content,
782            entity,
783        }))
784    }
785}
786
787pub async fn query_combined_sensor_update_policies_v2(
788    configuration: &configuration::Configuration,
789    filter: Option<&str>,
790    offset: Option<i32>,
791    limit: Option<i32>,
792    sort: Option<&str>,
793) -> Result<models::SensorUpdateRespV2, Error<QueryCombinedSensorUpdatePoliciesV2Error>> {
794    // add a prefix to parameters to efficiently prevent name collisions
795    let p_query_filter = filter;
796    let p_query_offset = offset;
797    let p_query_limit = limit;
798    let p_query_sort = sort;
799
800    let uri_str = format!(
801        "{}/policy/combined/sensor-update/v2",
802        configuration.base_path
803    );
804    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
805
806    if let Some(ref param_value) = p_query_filter {
807        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
808    }
809    if let Some(ref param_value) = p_query_offset {
810        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
811    }
812    if let Some(ref param_value) = p_query_limit {
813        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
814    }
815    if let Some(ref param_value) = p_query_sort {
816        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
817    }
818    if let Some(ref user_agent) = configuration.user_agent {
819        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
820    }
821    if let Some(ref token) = configuration.oauth_access_token {
822        req_builder = req_builder.bearer_auth(token.to_owned());
823    };
824
825    let req = req_builder.build()?;
826    let resp = configuration.client.execute(req).await?;
827
828    let status = resp.status();
829    let content_type = resp
830        .headers()
831        .get("content-type")
832        .and_then(|v| v.to_str().ok())
833        .unwrap_or("application/octet-stream");
834    let content_type = super::ContentType::from(content_type);
835
836    if !status.is_client_error() && !status.is_server_error() {
837        let content = resp.text().await?;
838        match content_type {
839            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
840            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV2`"))),
841            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::SensorUpdateRespV2`")))),
842        }
843    } else {
844        let content = resp.text().await?;
845        let entity: Option<QueryCombinedSensorUpdatePoliciesV2Error> =
846            serde_json::from_str(&content).ok();
847        Err(Error::ResponseError(ResponseContent {
848            status,
849            content,
850            entity,
851        }))
852    }
853}
854
855pub async fn query_combined_sensor_update_policy_members(
856    configuration: &configuration::Configuration,
857    id: Option<&str>,
858    filter: Option<&str>,
859    offset: Option<i32>,
860    limit: Option<i32>,
861    sort: Option<&str>,
862) -> Result<models::BasePolicyMembersRespV1, Error<QueryCombinedSensorUpdatePolicyMembersError>> {
863    // add a prefix to parameters to efficiently prevent name collisions
864    let p_query_id = id;
865    let p_query_filter = filter;
866    let p_query_offset = offset;
867    let p_query_limit = limit;
868    let p_query_sort = sort;
869
870    let uri_str = format!(
871        "{}/policy/combined/sensor-update-members/v1",
872        configuration.base_path
873    );
874    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
875
876    if let Some(ref param_value) = p_query_id {
877        req_builder = req_builder.query(&[("id", &param_value.to_string())]);
878    }
879    if let Some(ref param_value) = p_query_filter {
880        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
881    }
882    if let Some(ref param_value) = p_query_offset {
883        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
884    }
885    if let Some(ref param_value) = p_query_limit {
886        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
887    }
888    if let Some(ref param_value) = p_query_sort {
889        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
890    }
891    if let Some(ref user_agent) = configuration.user_agent {
892        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
893    }
894    if let Some(ref token) = configuration.oauth_access_token {
895        req_builder = req_builder.bearer_auth(token.to_owned());
896    };
897
898    let req = req_builder.build()?;
899    let resp = configuration.client.execute(req).await?;
900
901    let status = resp.status();
902    let content_type = resp
903        .headers()
904        .get("content-type")
905        .and_then(|v| v.to_str().ok())
906        .unwrap_or("application/octet-stream");
907    let content_type = super::ContentType::from(content_type);
908
909    if !status.is_client_error() && !status.is_server_error() {
910        let content = resp.text().await?;
911        match content_type {
912            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
913            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BasePolicyMembersRespV1`"))),
914            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::BasePolicyMembersRespV1`")))),
915        }
916    } else {
917        let content = resp.text().await?;
918        let entity: Option<QueryCombinedSensorUpdatePolicyMembersError> =
919            serde_json::from_str(&content).ok();
920        Err(Error::ResponseError(ResponseContent {
921            status,
922            content,
923            entity,
924        }))
925    }
926}
927
928pub async fn query_sensor_update_kernels_distinct(
929    configuration: &configuration::Configuration,
930    distinct_field: &str,
931    filter: Option<&str>,
932    offset: Option<i32>,
933    limit: Option<i32>,
934) -> Result<models::MsaQueryResponse, Error<QuerySensorUpdateKernelsDistinctError>> {
935    // add a prefix to parameters to efficiently prevent name collisions
936    let p_path_distinct_field = distinct_field;
937    let p_query_filter = filter;
938    let p_query_offset = offset;
939    let p_query_limit = limit;
940
941    let uri_str = format!(
942        "{}/policy/queries/sensor-update-kernels/{distinct_field}/v1",
943        configuration.base_path,
944        distinct_field = crate::apis::urlencode(p_path_distinct_field)
945    );
946    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
947
948    if let Some(ref param_value) = p_query_filter {
949        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
950    }
951    if let Some(ref param_value) = p_query_offset {
952        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
953    }
954    if let Some(ref param_value) = p_query_limit {
955        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
956    }
957    if let Some(ref user_agent) = configuration.user_agent {
958        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
959    }
960    if let Some(ref token) = configuration.oauth_access_token {
961        req_builder = req_builder.bearer_auth(token.to_owned());
962    };
963
964    let req = req_builder.build()?;
965    let resp = configuration.client.execute(req).await?;
966
967    let status = resp.status();
968    let content_type = resp
969        .headers()
970        .get("content-type")
971        .and_then(|v| v.to_str().ok())
972        .unwrap_or("application/octet-stream");
973    let content_type = super::ContentType::from(content_type);
974
975    if !status.is_client_error() && !status.is_server_error() {
976        let content = resp.text().await?;
977        match content_type {
978            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
979            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaQueryResponse`"))),
980            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::MsaQueryResponse`")))),
981        }
982    } else {
983        let content = resp.text().await?;
984        let entity: Option<QuerySensorUpdateKernelsDistinctError> =
985            serde_json::from_str(&content).ok();
986        Err(Error::ResponseError(ResponseContent {
987            status,
988            content,
989            entity,
990        }))
991    }
992}
993
994pub async fn query_sensor_update_policies(
995    configuration: &configuration::Configuration,
996    filter: Option<&str>,
997    offset: Option<i32>,
998    limit: Option<i32>,
999    sort: Option<&str>,
1000) -> Result<models::MsaQueryResponse, Error<QuerySensorUpdatePoliciesError>> {
1001    // add a prefix to parameters to efficiently prevent name collisions
1002    let p_query_filter = filter;
1003    let p_query_offset = offset;
1004    let p_query_limit = limit;
1005    let p_query_sort = sort;
1006
1007    let uri_str = format!(
1008        "{}/policy/queries/sensor-update/v1",
1009        configuration.base_path
1010    );
1011    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1012
1013    if let Some(ref param_value) = p_query_filter {
1014        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
1015    }
1016    if let Some(ref param_value) = p_query_offset {
1017        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
1018    }
1019    if let Some(ref param_value) = p_query_limit {
1020        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1021    }
1022    if let Some(ref param_value) = p_query_sort {
1023        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
1024    }
1025    if let Some(ref user_agent) = configuration.user_agent {
1026        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1027    }
1028    if let Some(ref token) = configuration.oauth_access_token {
1029        req_builder = req_builder.bearer_auth(token.to_owned());
1030    };
1031
1032    let req = req_builder.build()?;
1033    let resp = configuration.client.execute(req).await?;
1034
1035    let status = resp.status();
1036    let content_type = resp
1037        .headers()
1038        .get("content-type")
1039        .and_then(|v| v.to_str().ok())
1040        .unwrap_or("application/octet-stream");
1041    let content_type = super::ContentType::from(content_type);
1042
1043    if !status.is_client_error() && !status.is_server_error() {
1044        let content = resp.text().await?;
1045        match content_type {
1046            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1047            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaQueryResponse`"))),
1048            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::MsaQueryResponse`")))),
1049        }
1050    } else {
1051        let content = resp.text().await?;
1052        let entity: Option<QuerySensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
1053        Err(Error::ResponseError(ResponseContent {
1054            status,
1055            content,
1056            entity,
1057        }))
1058    }
1059}
1060
1061pub async fn query_sensor_update_policy_members(
1062    configuration: &configuration::Configuration,
1063    id: Option<&str>,
1064    filter: Option<&str>,
1065    offset: Option<i32>,
1066    limit: Option<i32>,
1067    sort: Option<&str>,
1068) -> Result<models::MsaQueryResponse, Error<QuerySensorUpdatePolicyMembersError>> {
1069    // add a prefix to parameters to efficiently prevent name collisions
1070    let p_query_id = id;
1071    let p_query_filter = filter;
1072    let p_query_offset = offset;
1073    let p_query_limit = limit;
1074    let p_query_sort = sort;
1075
1076    let uri_str = format!(
1077        "{}/policy/queries/sensor-update-members/v1",
1078        configuration.base_path
1079    );
1080    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1081
1082    if let Some(ref param_value) = p_query_id {
1083        req_builder = req_builder.query(&[("id", &param_value.to_string())]);
1084    }
1085    if let Some(ref param_value) = p_query_filter {
1086        req_builder = req_builder.query(&[("filter", &param_value.to_string())]);
1087    }
1088    if let Some(ref param_value) = p_query_offset {
1089        req_builder = req_builder.query(&[("offset", &param_value.to_string())]);
1090    }
1091    if let Some(ref param_value) = p_query_limit {
1092        req_builder = req_builder.query(&[("limit", &param_value.to_string())]);
1093    }
1094    if let Some(ref param_value) = p_query_sort {
1095        req_builder = req_builder.query(&[("sort", &param_value.to_string())]);
1096    }
1097    if let Some(ref user_agent) = configuration.user_agent {
1098        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1099    }
1100    if let Some(ref token) = configuration.oauth_access_token {
1101        req_builder = req_builder.bearer_auth(token.to_owned());
1102    };
1103
1104    let req = req_builder.build()?;
1105    let resp = configuration.client.execute(req).await?;
1106
1107    let status = resp.status();
1108    let content_type = resp
1109        .headers()
1110        .get("content-type")
1111        .and_then(|v| v.to_str().ok())
1112        .unwrap_or("application/octet-stream");
1113    let content_type = super::ContentType::from(content_type);
1114
1115    if !status.is_client_error() && !status.is_server_error() {
1116        let content = resp.text().await?;
1117        match content_type {
1118            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1119            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaQueryResponse`"))),
1120            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::MsaQueryResponse`")))),
1121        }
1122    } else {
1123        let content = resp.text().await?;
1124        let entity: Option<QuerySensorUpdatePolicyMembersError> =
1125            serde_json::from_str(&content).ok();
1126        Err(Error::ResponseError(ResponseContent {
1127            status,
1128            content,
1129            entity,
1130        }))
1131    }
1132}
1133
1134pub async fn reveal_uninstall_token(
1135    configuration: &configuration::Configuration,
1136    body: models::UninstallTokenRevealUninstallTokenReqV1,
1137) -> Result<models::UninstallTokenRespV1, Error<RevealUninstallTokenError>> {
1138    // add a prefix to parameters to efficiently prevent name collisions
1139    let p_body_body = body;
1140
1141    let uri_str = format!(
1142        "{}/policy/combined/reveal-uninstall-token/v1",
1143        configuration.base_path
1144    );
1145    let mut req_builder = configuration
1146        .client
1147        .request(reqwest::Method::POST, &uri_str);
1148
1149    if let Some(ref user_agent) = configuration.user_agent {
1150        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1151    }
1152    if let Some(ref token) = configuration.oauth_access_token {
1153        req_builder = req_builder.bearer_auth(token.to_owned());
1154    };
1155    req_builder = req_builder.json(&p_body_body);
1156
1157    let req = req_builder.build()?;
1158    let resp = configuration.client.execute(req).await?;
1159
1160    let status = resp.status();
1161    let content_type = resp
1162        .headers()
1163        .get("content-type")
1164        .and_then(|v| v.to_str().ok())
1165        .unwrap_or("application/octet-stream");
1166    let content_type = super::ContentType::from(content_type);
1167
1168    if !status.is_client_error() && !status.is_server_error() {
1169        let content = resp.text().await?;
1170        match content_type {
1171            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1172            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UninstallTokenRespV1`"))),
1173            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::UninstallTokenRespV1`")))),
1174        }
1175    } else {
1176        let content = resp.text().await?;
1177        let entity: Option<RevealUninstallTokenError> = serde_json::from_str(&content).ok();
1178        Err(Error::ResponseError(ResponseContent {
1179            status,
1180            content,
1181            entity,
1182        }))
1183    }
1184}
1185
1186pub async fn set_sensor_update_policies_precedence(
1187    configuration: &configuration::Configuration,
1188    body: models::BaseSetPolicyPrecedenceReqV1,
1189) -> Result<models::MsaQueryResponse, Error<SetSensorUpdatePoliciesPrecedenceError>> {
1190    // add a prefix to parameters to efficiently prevent name collisions
1191    let p_body_body = body;
1192
1193    let uri_str = format!(
1194        "{}/policy/entities/sensor-update-precedence/v1",
1195        configuration.base_path
1196    );
1197    let mut req_builder = configuration
1198        .client
1199        .request(reqwest::Method::POST, &uri_str);
1200
1201    if let Some(ref user_agent) = configuration.user_agent {
1202        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1203    }
1204    if let Some(ref token) = configuration.oauth_access_token {
1205        req_builder = req_builder.bearer_auth(token.to_owned());
1206    };
1207    req_builder = req_builder.json(&p_body_body);
1208
1209    let req = req_builder.build()?;
1210    let resp = configuration.client.execute(req).await?;
1211
1212    let status = resp.status();
1213    let content_type = resp
1214        .headers()
1215        .get("content-type")
1216        .and_then(|v| v.to_str().ok())
1217        .unwrap_or("application/octet-stream");
1218    let content_type = super::ContentType::from(content_type);
1219
1220    if !status.is_client_error() && !status.is_server_error() {
1221        let content = resp.text().await?;
1222        match content_type {
1223            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1224            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaQueryResponse`"))),
1225            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::MsaQueryResponse`")))),
1226        }
1227    } else {
1228        let content = resp.text().await?;
1229        let entity: Option<SetSensorUpdatePoliciesPrecedenceError> =
1230            serde_json::from_str(&content).ok();
1231        Err(Error::ResponseError(ResponseContent {
1232            status,
1233            content,
1234            entity,
1235        }))
1236    }
1237}
1238
1239pub async fn update_sensor_update_policies(
1240    configuration: &configuration::Configuration,
1241    body: models::SensorUpdateUpdatePoliciesReqV1,
1242) -> Result<models::SensorUpdateRespV1, Error<UpdateSensorUpdatePoliciesError>> {
1243    // add a prefix to parameters to efficiently prevent name collisions
1244    let p_body_body = body;
1245
1246    let uri_str = format!(
1247        "{}/policy/entities/sensor-update/v1",
1248        configuration.base_path
1249    );
1250    let mut req_builder = configuration
1251        .client
1252        .request(reqwest::Method::PATCH, &uri_str);
1253
1254    if let Some(ref user_agent) = configuration.user_agent {
1255        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1256    }
1257    if let Some(ref token) = configuration.oauth_access_token {
1258        req_builder = req_builder.bearer_auth(token.to_owned());
1259    };
1260    req_builder = req_builder.json(&p_body_body);
1261
1262    let req = req_builder.build()?;
1263    let resp = configuration.client.execute(req).await?;
1264
1265    let status = resp.status();
1266    let content_type = resp
1267        .headers()
1268        .get("content-type")
1269        .and_then(|v| v.to_str().ok())
1270        .unwrap_or("application/octet-stream");
1271    let content_type = super::ContentType::from(content_type);
1272
1273    if !status.is_client_error() && !status.is_server_error() {
1274        let content = resp.text().await?;
1275        match content_type {
1276            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1277            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV1`"))),
1278            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::SensorUpdateRespV1`")))),
1279        }
1280    } else {
1281        let content = resp.text().await?;
1282        let entity: Option<UpdateSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
1283        Err(Error::ResponseError(ResponseContent {
1284            status,
1285            content,
1286            entity,
1287        }))
1288    }
1289}
1290
1291pub async fn update_sensor_update_policies_v2(
1292    configuration: &configuration::Configuration,
1293    body: models::SensorUpdateUpdatePoliciesReqV2,
1294) -> Result<models::SensorUpdateRespV2, Error<UpdateSensorUpdatePoliciesV2Error>> {
1295    // add a prefix to parameters to efficiently prevent name collisions
1296    let p_body_body = body;
1297
1298    let uri_str = format!(
1299        "{}/policy/entities/sensor-update/v2",
1300        configuration.base_path
1301    );
1302    let mut req_builder = configuration
1303        .client
1304        .request(reqwest::Method::PATCH, &uri_str);
1305
1306    if let Some(ref user_agent) = configuration.user_agent {
1307        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1308    }
1309    if let Some(ref token) = configuration.oauth_access_token {
1310        req_builder = req_builder.bearer_auth(token.to_owned());
1311    };
1312    req_builder = req_builder.json(&p_body_body);
1313
1314    let req = req_builder.build()?;
1315    let resp = configuration.client.execute(req).await?;
1316
1317    let status = resp.status();
1318    let content_type = resp
1319        .headers()
1320        .get("content-type")
1321        .and_then(|v| v.to_str().ok())
1322        .unwrap_or("application/octet-stream");
1323    let content_type = super::ContentType::from(content_type);
1324
1325    if !status.is_client_error() && !status.is_server_error() {
1326        let content = resp.text().await?;
1327        match content_type {
1328            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1329            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SensorUpdateRespV2`"))),
1330            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::SensorUpdateRespV2`")))),
1331        }
1332    } else {
1333        let content = resp.text().await?;
1334        let entity: Option<UpdateSensorUpdatePoliciesV2Error> = serde_json::from_str(&content).ok();
1335        Err(Error::ResponseError(ResponseContent {
1336            status,
1337            content,
1338            entity,
1339        }))
1340    }
1341}