1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::de::Error as _;
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum AggregateQueryScanHostMetadataError {
20 Status403(models::MsaReplyMetaOnly),
21 Status404(models::MsaspecResponseFields),
22 Status429(models::MsaReplyMetaOnly),
23 Status500(models::MsaReplyMetaOnly),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum AggregateScansError {
31 Status403(models::MsaReplyMetaOnly),
32 Status404(models::MsaspecResponseFields),
33 Status429(models::MsaReplyMetaOnly),
34 Status500(models::MsaReplyMetaOnly),
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum AggregateScheduledScansError {
42 Status403(models::MsaReplyMetaOnly),
43 Status404(models::MsaspecResponseFields),
44 Status429(models::MsaReplyMetaOnly),
45 Status500(models::MsaReplyMetaOnly),
46 UnknownValue(serde_json::Value),
47}
48
49#[derive(Debug, Clone, Serialize, Deserialize)]
51#[serde(untagged)]
52pub enum CancelScansError {
53 Status403(models::MsaReplyMetaOnly),
54 Status404(models::MsaspecResponseFields),
55 Status429(models::MsaReplyMetaOnly),
56 Status500(models::MsaReplyMetaOnly),
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum CreateScanError {
64 Status403(models::MsaReplyMetaOnly),
65 Status429(models::MsaReplyMetaOnly),
66 Status500(models::MsaReplyMetaOnly),
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum DeleteScheduledScansError {
74 Status403(models::MsaReplyMetaOnly),
75 Status404(models::MsaspecResponseFields),
76 Status429(models::MsaReplyMetaOnly),
77 Status500(models::MsaReplyMetaOnly),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetMaliciousFilesByIdsError {
85 Status403(models::MsaReplyMetaOnly),
86 Status404(models::MsaspecResponseFields),
87 Status429(models::MsaReplyMetaOnly),
88 Status500(models::MsaReplyMetaOnly),
89 UnknownValue(serde_json::Value),
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum GetScanHostMetadataByIdsError {
96 Status403(models::MsaReplyMetaOnly),
97 Status404(models::MsaspecResponseFields),
98 Status429(models::MsaReplyMetaOnly),
99 Status500(models::MsaReplyMetaOnly),
100 UnknownValue(serde_json::Value),
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum GetScansByScanIdsError {
107 Status403(models::MsaReplyMetaOnly),
108 Status404(models::MsaspecResponseFields),
109 Status429(models::MsaReplyMetaOnly),
110 Status500(models::MsaReplyMetaOnly),
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum GetScansByScanIdsV2Error {
118 Status403(models::MsaReplyMetaOnly),
119 Status404(models::MsaspecResponseFields),
120 Status429(models::MsaReplyMetaOnly),
121 Status500(models::MsaReplyMetaOnly),
122 UnknownValue(serde_json::Value),
123}
124
125#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum GetScheduledScansByScanIdsError {
129 Status403(models::MsaReplyMetaOnly),
130 Status404(models::MsaspecResponseFields),
131 Status429(models::MsaReplyMetaOnly),
132 Status500(models::MsaReplyMetaOnly),
133 UnknownValue(serde_json::Value),
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum QueryMaliciousFilesError {
140 Status403(models::MsaReplyMetaOnly),
141 Status404(models::MsaspecResponseFields),
142 Status429(models::MsaReplyMetaOnly),
143 Status500(models::MsaReplyMetaOnly),
144 UnknownValue(serde_json::Value),
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum QueryScanHostMetadataError {
151 Status403(models::MsaReplyMetaOnly),
152 Status404(models::MsaspecResponseFields),
153 Status429(models::MsaReplyMetaOnly),
154 Status500(models::MsaReplyMetaOnly),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum QueryScansError {
162 Status403(models::MsaReplyMetaOnly),
163 Status404(models::MsaspecResponseFields),
164 Status429(models::MsaReplyMetaOnly),
165 Status500(models::MsaReplyMetaOnly),
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum QueryScheduledScansError {
173 Status403(models::MsaReplyMetaOnly),
174 Status404(models::MsaspecResponseFields),
175 Status429(models::MsaReplyMetaOnly),
176 Status500(models::MsaReplyMetaOnly),
177 UnknownValue(serde_json::Value),
178}
179
180#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum ScheduleScanError {
184 Status403(models::MsaReplyMetaOnly),
185 Status429(models::MsaReplyMetaOnly),
186 Status500(models::MsaReplyMetaOnly),
187 UnknownValue(serde_json::Value),
188}
189
190pub async fn aggregate_query_scan_host_metadata(
191 configuration: &configuration::Configuration,
192 body: Vec<models::MsaAggregateQueryRequest>,
193) -> Result<models::MsaAggregatesResponse, Error<AggregateQueryScanHostMetadataError>> {
194 let p_body_body = body;
196
197 let uri_str = format!("{}/ods/aggregates/scan-hosts/v1", configuration.base_path);
198 let mut req_builder = configuration
199 .client
200 .request(reqwest::Method::POST, &uri_str);
201
202 if let Some(ref user_agent) = configuration.user_agent {
203 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
204 }
205 if let Some(ref token) = configuration.oauth_access_token {
206 req_builder = req_builder.bearer_auth(token.to_owned());
207 };
208 req_builder = req_builder.json(&p_body_body);
209
210 let req = req_builder.build()?;
211 let resp = configuration.client.execute(req).await?;
212
213 let status = resp.status();
214 let content_type = resp
215 .headers()
216 .get("content-type")
217 .and_then(|v| v.to_str().ok())
218 .unwrap_or("application/octet-stream");
219 let content_type = super::ContentType::from(content_type);
220
221 if !status.is_client_error() && !status.is_server_error() {
222 let content = resp.text().await?;
223 match content_type {
224 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
225 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaAggregatesResponse`"))),
226 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::MsaAggregatesResponse`")))),
227 }
228 } else {
229 let content = resp.text().await?;
230 let entity: Option<AggregateQueryScanHostMetadataError> =
231 serde_json::from_str(&content).ok();
232 Err(Error::ResponseError(ResponseContent {
233 status,
234 content,
235 entity,
236 }))
237 }
238}
239
240pub async fn aggregate_scans(
241 configuration: &configuration::Configuration,
242 body: Vec<models::MsaAggregateQueryRequest>,
243) -> Result<models::MsaAggregatesResponse, Error<AggregateScansError>> {
244 let p_body_body = body;
246
247 let uri_str = format!("{}/ods/aggregates/scans/v1", configuration.base_path);
248 let mut req_builder = configuration
249 .client
250 .request(reqwest::Method::POST, &uri_str);
251
252 if let Some(ref user_agent) = configuration.user_agent {
253 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
254 }
255 if let Some(ref token) = configuration.oauth_access_token {
256 req_builder = req_builder.bearer_auth(token.to_owned());
257 };
258 req_builder = req_builder.json(&p_body_body);
259
260 let req = req_builder.build()?;
261 let resp = configuration.client.execute(req).await?;
262
263 let status = resp.status();
264 let content_type = resp
265 .headers()
266 .get("content-type")
267 .and_then(|v| v.to_str().ok())
268 .unwrap_or("application/octet-stream");
269 let content_type = super::ContentType::from(content_type);
270
271 if !status.is_client_error() && !status.is_server_error() {
272 let content = resp.text().await?;
273 match content_type {
274 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
275 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaAggregatesResponse`"))),
276 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::MsaAggregatesResponse`")))),
277 }
278 } else {
279 let content = resp.text().await?;
280 let entity: Option<AggregateScansError> = serde_json::from_str(&content).ok();
281 Err(Error::ResponseError(ResponseContent {
282 status,
283 content,
284 entity,
285 }))
286 }
287}
288
289pub async fn aggregate_scheduled_scans(
290 configuration: &configuration::Configuration,
291 body: Vec<models::MsaAggregateQueryRequest>,
292) -> Result<models::MsaAggregatesResponse, Error<AggregateScheduledScansError>> {
293 let p_body_body = body;
295
296 let uri_str = format!(
297 "{}/ods/aggregates/scheduled-scans/v1",
298 configuration.base_path
299 );
300 let mut req_builder = configuration
301 .client
302 .request(reqwest::Method::POST, &uri_str);
303
304 if let Some(ref user_agent) = configuration.user_agent {
305 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306 }
307 if let Some(ref token) = configuration.oauth_access_token {
308 req_builder = req_builder.bearer_auth(token.to_owned());
309 };
310 req_builder = req_builder.json(&p_body_body);
311
312 let req = req_builder.build()?;
313 let resp = configuration.client.execute(req).await?;
314
315 let status = resp.status();
316 let content_type = resp
317 .headers()
318 .get("content-type")
319 .and_then(|v| v.to_str().ok())
320 .unwrap_or("application/octet-stream");
321 let content_type = super::ContentType::from(content_type);
322
323 if !status.is_client_error() && !status.is_server_error() {
324 let content = resp.text().await?;
325 match content_type {
326 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
327 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaAggregatesResponse`"))),
328 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::MsaAggregatesResponse`")))),
329 }
330 } else {
331 let content = resp.text().await?;
332 let entity: Option<AggregateScheduledScansError> = serde_json::from_str(&content).ok();
333 Err(Error::ResponseError(ResponseContent {
334 status,
335 content,
336 entity,
337 }))
338 }
339}
340
341pub async fn cancel_scans(
342 configuration: &configuration::Configuration,
343 body: models::EntitiesOdsCancelScanRequest,
344) -> Result<models::MsaspecQueryResponse, Error<CancelScansError>> {
345 let p_body_body = body;
347
348 let uri_str = format!(
349 "{}/ods/entities/scan-control-actions/cancel/v1",
350 configuration.base_path
351 );
352 let mut req_builder = configuration
353 .client
354 .request(reqwest::Method::POST, &uri_str);
355
356 if let Some(ref user_agent) = configuration.user_agent {
357 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
358 }
359 if let Some(ref token) = configuration.oauth_access_token {
360 req_builder = req_builder.bearer_auth(token.to_owned());
361 };
362 req_builder = req_builder.json(&p_body_body);
363
364 let req = req_builder.build()?;
365 let resp = configuration.client.execute(req).await?;
366
367 let status = resp.status();
368 let content_type = resp
369 .headers()
370 .get("content-type")
371 .and_then(|v| v.to_str().ok())
372 .unwrap_or("application/octet-stream");
373 let content_type = super::ContentType::from(content_type);
374
375 if !status.is_client_error() && !status.is_server_error() {
376 let content = resp.text().await?;
377 match content_type {
378 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
379 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaspecQueryResponse`"))),
380 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::MsaspecQueryResponse`")))),
381 }
382 } else {
383 let content = resp.text().await?;
384 let entity: Option<CancelScansError> = serde_json::from_str(&content).ok();
385 Err(Error::ResponseError(ResponseContent {
386 status,
387 content,
388 entity,
389 }))
390 }
391}
392
393pub async fn create_scan(
394 configuration: &configuration::Configuration,
395 body: models::EntitiesOdsScanRequest,
396) -> Result<models::EntitiesOdsScanResponse, Error<CreateScanError>> {
397 let p_body_body = body;
399
400 let uri_str = format!("{}/ods/entities/scans/v1", configuration.base_path);
401 let mut req_builder = configuration
402 .client
403 .request(reqwest::Method::POST, &uri_str);
404
405 if let Some(ref user_agent) = configuration.user_agent {
406 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
407 }
408 if let Some(ref token) = configuration.oauth_access_token {
409 req_builder = req_builder.bearer_auth(token.to_owned());
410 };
411 req_builder = req_builder.json(&p_body_body);
412
413 let req = req_builder.build()?;
414 let resp = configuration.client.execute(req).await?;
415
416 let status = resp.status();
417 let content_type = resp
418 .headers()
419 .get("content-type")
420 .and_then(|v| v.to_str().ok())
421 .unwrap_or("application/octet-stream");
422 let content_type = super::ContentType::from(content_type);
423
424 if !status.is_client_error() && !status.is_server_error() {
425 let content = resp.text().await?;
426 match content_type {
427 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
428 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EntitiesOdsScanResponse`"))),
429 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::EntitiesOdsScanResponse`")))),
430 }
431 } else {
432 let content = resp.text().await?;
433 let entity: Option<CreateScanError> = serde_json::from_str(&content).ok();
434 Err(Error::ResponseError(ResponseContent {
435 status,
436 content,
437 entity,
438 }))
439 }
440}
441
442pub async fn delete_scheduled_scans(
443 configuration: &configuration::Configuration,
444 ids: Vec<String>,
445 filter: Option<&str>,
446) -> Result<models::MsaspecQueryResponse, Error<DeleteScheduledScansError>> {
447 let p_query_ids = ids;
449 let p_query_filter = filter;
450
451 let uri_str = format!(
452 "{}/ods/entities/scheduled-scans/v1",
453 configuration.base_path
454 );
455 let mut req_builder = configuration
456 .client
457 .request(reqwest::Method::DELETE, &uri_str);
458
459 req_builder = match "multi" {
460 "multi" => req_builder.query(
461 &p_query_ids
462 .into_iter()
463 .map(|p| ("ids".to_owned(), p.to_string()))
464 .collect::<Vec<(std::string::String, std::string::String)>>(),
465 ),
466 _ => req_builder.query(&[(
467 "ids",
468 &p_query_ids
469 .into_iter()
470 .map(|p| p.to_string())
471 .collect::<Vec<String>>()
472 .join(",")
473 .to_string(),
474 )]),
475 };
476 if let Some(ref param_value) = p_query_filter {
477 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
478 }
479 if let Some(ref user_agent) = configuration.user_agent {
480 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
481 }
482 if let Some(ref token) = configuration.oauth_access_token {
483 req_builder = req_builder.bearer_auth(token.to_owned());
484 };
485
486 let req = req_builder.build()?;
487 let resp = configuration.client.execute(req).await?;
488
489 let status = resp.status();
490 let content_type = resp
491 .headers()
492 .get("content-type")
493 .and_then(|v| v.to_str().ok())
494 .unwrap_or("application/octet-stream");
495 let content_type = super::ContentType::from(content_type);
496
497 if !status.is_client_error() && !status.is_server_error() {
498 let content = resp.text().await?;
499 match content_type {
500 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
501 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaspecQueryResponse`"))),
502 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::MsaspecQueryResponse`")))),
503 }
504 } else {
505 let content = resp.text().await?;
506 let entity: Option<DeleteScheduledScansError> = serde_json::from_str(&content).ok();
507 Err(Error::ResponseError(ResponseContent {
508 status,
509 content,
510 entity,
511 }))
512 }
513}
514
515pub async fn get_malicious_files_by_ids(
516 configuration: &configuration::Configuration,
517 ids: Vec<String>,
518) -> Result<models::EntitiesOdsScanMaliciousFileResponse, Error<GetMaliciousFilesByIdsError>> {
519 let p_query_ids = ids;
521
522 let uri_str = format!(
523 "{}/ods/entities/malicious-files/v1",
524 configuration.base_path
525 );
526 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
527
528 req_builder = match "multi" {
529 "multi" => req_builder.query(
530 &p_query_ids
531 .into_iter()
532 .map(|p| ("ids".to_owned(), p.to_string()))
533 .collect::<Vec<(std::string::String, std::string::String)>>(),
534 ),
535 _ => req_builder.query(&[(
536 "ids",
537 &p_query_ids
538 .into_iter()
539 .map(|p| p.to_string())
540 .collect::<Vec<String>>()
541 .join(",")
542 .to_string(),
543 )]),
544 };
545 if let Some(ref user_agent) = configuration.user_agent {
546 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
547 }
548 if let Some(ref token) = configuration.oauth_access_token {
549 req_builder = req_builder.bearer_auth(token.to_owned());
550 };
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::EntitiesOdsScanMaliciousFileResponse`"))),
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::EntitiesOdsScanMaliciousFileResponse`")))),
569 }
570 } else {
571 let content = resp.text().await?;
572 let entity: Option<GetMaliciousFilesByIdsError> = serde_json::from_str(&content).ok();
573 Err(Error::ResponseError(ResponseContent {
574 status,
575 content,
576 entity,
577 }))
578 }
579}
580
581pub async fn get_scan_host_metadata_by_ids(
582 configuration: &configuration::Configuration,
583 ids: Vec<String>,
584) -> Result<models::EntitiesOdsScanHostResponse, Error<GetScanHostMetadataByIdsError>> {
585 let p_query_ids = ids;
587
588 let uri_str = format!("{}/ods/entities/scan-hosts/v1", configuration.base_path);
589 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
590
591 req_builder = match "multi" {
592 "multi" => req_builder.query(
593 &p_query_ids
594 .into_iter()
595 .map(|p| ("ids".to_owned(), p.to_string()))
596 .collect::<Vec<(std::string::String, std::string::String)>>(),
597 ),
598 _ => req_builder.query(&[(
599 "ids",
600 &p_query_ids
601 .into_iter()
602 .map(|p| p.to_string())
603 .collect::<Vec<String>>()
604 .join(",")
605 .to_string(),
606 )]),
607 };
608 if let Some(ref user_agent) = configuration.user_agent {
609 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
610 }
611 if let Some(ref token) = configuration.oauth_access_token {
612 req_builder = req_builder.bearer_auth(token.to_owned());
613 };
614
615 let req = req_builder.build()?;
616 let resp = configuration.client.execute(req).await?;
617
618 let status = resp.status();
619 let content_type = resp
620 .headers()
621 .get("content-type")
622 .and_then(|v| v.to_str().ok())
623 .unwrap_or("application/octet-stream");
624 let content_type = super::ContentType::from(content_type);
625
626 if !status.is_client_error() && !status.is_server_error() {
627 let content = resp.text().await?;
628 match content_type {
629 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
630 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EntitiesOdsScanHostResponse`"))),
631 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::EntitiesOdsScanHostResponse`")))),
632 }
633 } else {
634 let content = resp.text().await?;
635 let entity: Option<GetScanHostMetadataByIdsError> = serde_json::from_str(&content).ok();
636 Err(Error::ResponseError(ResponseContent {
637 status,
638 content,
639 entity,
640 }))
641 }
642}
643
644pub async fn get_scans_by_scan_ids(
645 configuration: &configuration::Configuration,
646 ids: Vec<String>,
647) -> Result<models::EntitiesOdsScanResponse, Error<GetScansByScanIdsError>> {
648 let p_query_ids = ids;
650
651 let uri_str = format!("{}/ods/entities/scans/v1", configuration.base_path);
652 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
653
654 req_builder = match "multi" {
655 "multi" => req_builder.query(
656 &p_query_ids
657 .into_iter()
658 .map(|p| ("ids".to_owned(), p.to_string()))
659 .collect::<Vec<(std::string::String, std::string::String)>>(),
660 ),
661 _ => req_builder.query(&[(
662 "ids",
663 &p_query_ids
664 .into_iter()
665 .map(|p| p.to_string())
666 .collect::<Vec<String>>()
667 .join(",")
668 .to_string(),
669 )]),
670 };
671 if let Some(ref user_agent) = configuration.user_agent {
672 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
673 }
674 if let Some(ref token) = configuration.oauth_access_token {
675 req_builder = req_builder.bearer_auth(token.to_owned());
676 };
677
678 let req = req_builder.build()?;
679 let resp = configuration.client.execute(req).await?;
680
681 let status = resp.status();
682 let content_type = resp
683 .headers()
684 .get("content-type")
685 .and_then(|v| v.to_str().ok())
686 .unwrap_or("application/octet-stream");
687 let content_type = super::ContentType::from(content_type);
688
689 if !status.is_client_error() && !status.is_server_error() {
690 let content = resp.text().await?;
691 match content_type {
692 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
693 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EntitiesOdsScanResponse`"))),
694 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::EntitiesOdsScanResponse`")))),
695 }
696 } else {
697 let content = resp.text().await?;
698 let entity: Option<GetScansByScanIdsError> = serde_json::from_str(&content).ok();
699 Err(Error::ResponseError(ResponseContent {
700 status,
701 content,
702 entity,
703 }))
704 }
705}
706
707pub async fn get_scans_by_scan_ids_v2(
708 configuration: &configuration::Configuration,
709 ids: Vec<String>,
710) -> Result<models::EntitiesOdsScanResponseV2, Error<GetScansByScanIdsV2Error>> {
711 let p_query_ids = ids;
713
714 let uri_str = format!("{}/ods/entities/scans/v2", configuration.base_path);
715 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
716
717 req_builder = match "multi" {
718 "multi" => req_builder.query(
719 &p_query_ids
720 .into_iter()
721 .map(|p| ("ids".to_owned(), p.to_string()))
722 .collect::<Vec<(std::string::String, std::string::String)>>(),
723 ),
724 _ => req_builder.query(&[(
725 "ids",
726 &p_query_ids
727 .into_iter()
728 .map(|p| p.to_string())
729 .collect::<Vec<String>>()
730 .join(",")
731 .to_string(),
732 )]),
733 };
734 if let Some(ref user_agent) = configuration.user_agent {
735 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
736 }
737 if let Some(ref token) = configuration.oauth_access_token {
738 req_builder = req_builder.bearer_auth(token.to_owned());
739 };
740
741 let req = req_builder.build()?;
742 let resp = configuration.client.execute(req).await?;
743
744 let status = resp.status();
745 let content_type = resp
746 .headers()
747 .get("content-type")
748 .and_then(|v| v.to_str().ok())
749 .unwrap_or("application/octet-stream");
750 let content_type = super::ContentType::from(content_type);
751
752 if !status.is_client_error() && !status.is_server_error() {
753 let content = resp.text().await?;
754 match content_type {
755 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
756 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EntitiesOdsScanResponseV2`"))),
757 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::EntitiesOdsScanResponseV2`")))),
758 }
759 } else {
760 let content = resp.text().await?;
761 let entity: Option<GetScansByScanIdsV2Error> = serde_json::from_str(&content).ok();
762 Err(Error::ResponseError(ResponseContent {
763 status,
764 content,
765 entity,
766 }))
767 }
768}
769
770pub async fn get_scheduled_scans_by_scan_ids(
771 configuration: &configuration::Configuration,
772 ids: Vec<String>,
773) -> Result<models::EntitiesOdsScheduleScanResponse, Error<GetScheduledScansByScanIdsError>> {
774 let p_query_ids = ids;
776
777 let uri_str = format!(
778 "{}/ods/entities/scheduled-scans/v1",
779 configuration.base_path
780 );
781 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
782
783 req_builder = match "multi" {
784 "multi" => req_builder.query(
785 &p_query_ids
786 .into_iter()
787 .map(|p| ("ids".to_owned(), p.to_string()))
788 .collect::<Vec<(std::string::String, std::string::String)>>(),
789 ),
790 _ => req_builder.query(&[(
791 "ids",
792 &p_query_ids
793 .into_iter()
794 .map(|p| p.to_string())
795 .collect::<Vec<String>>()
796 .join(",")
797 .to_string(),
798 )]),
799 };
800 if let Some(ref user_agent) = configuration.user_agent {
801 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
802 }
803 if let Some(ref token) = configuration.oauth_access_token {
804 req_builder = req_builder.bearer_auth(token.to_owned());
805 };
806
807 let req = req_builder.build()?;
808 let resp = configuration.client.execute(req).await?;
809
810 let status = resp.status();
811 let content_type = resp
812 .headers()
813 .get("content-type")
814 .and_then(|v| v.to_str().ok())
815 .unwrap_or("application/octet-stream");
816 let content_type = super::ContentType::from(content_type);
817
818 if !status.is_client_error() && !status.is_server_error() {
819 let content = resp.text().await?;
820 match content_type {
821 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
822 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EntitiesOdsScheduleScanResponse`"))),
823 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::EntitiesOdsScheduleScanResponse`")))),
824 }
825 } else {
826 let content = resp.text().await?;
827 let entity: Option<GetScheduledScansByScanIdsError> = serde_json::from_str(&content).ok();
828 Err(Error::ResponseError(ResponseContent {
829 status,
830 content,
831 entity,
832 }))
833 }
834}
835
836pub async fn query_malicious_files(
837 configuration: &configuration::Configuration,
838 filter: Option<&str>,
839 offset: Option<i32>,
840 limit: Option<i32>,
841 sort: Option<&str>,
842) -> Result<models::MsaspecQueryResponse, Error<QueryMaliciousFilesError>> {
843 let p_query_filter = filter;
845 let p_query_offset = offset;
846 let p_query_limit = limit;
847 let p_query_sort = sort;
848
849 let uri_str = format!("{}/ods/queries/malicious-files/v1", configuration.base_path);
850 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
851
852 if let Some(ref param_value) = p_query_filter {
853 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
854 }
855 if let Some(ref param_value) = p_query_offset {
856 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
857 }
858 if let Some(ref param_value) = p_query_limit {
859 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
860 }
861 if let Some(ref param_value) = p_query_sort {
862 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
863 }
864 if let Some(ref user_agent) = configuration.user_agent {
865 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
866 }
867 if let Some(ref token) = configuration.oauth_access_token {
868 req_builder = req_builder.bearer_auth(token.to_owned());
869 };
870
871 let req = req_builder.build()?;
872 let resp = configuration.client.execute(req).await?;
873
874 let status = resp.status();
875 let content_type = resp
876 .headers()
877 .get("content-type")
878 .and_then(|v| v.to_str().ok())
879 .unwrap_or("application/octet-stream");
880 let content_type = super::ContentType::from(content_type);
881
882 if !status.is_client_error() && !status.is_server_error() {
883 let content = resp.text().await?;
884 match content_type {
885 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
886 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaspecQueryResponse`"))),
887 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::MsaspecQueryResponse`")))),
888 }
889 } else {
890 let content = resp.text().await?;
891 let entity: Option<QueryMaliciousFilesError> = serde_json::from_str(&content).ok();
892 Err(Error::ResponseError(ResponseContent {
893 status,
894 content,
895 entity,
896 }))
897 }
898}
899
900pub async fn query_scan_host_metadata(
901 configuration: &configuration::Configuration,
902 filter: Option<&str>,
903 offset: Option<i32>,
904 limit: Option<i32>,
905 sort: Option<&str>,
906) -> Result<models::MsaspecQueryResponse, Error<QueryScanHostMetadataError>> {
907 let p_query_filter = filter;
909 let p_query_offset = offset;
910 let p_query_limit = limit;
911 let p_query_sort = sort;
912
913 let uri_str = format!("{}/ods/queries/scan-hosts/v1", configuration.base_path);
914 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
915
916 if let Some(ref param_value) = p_query_filter {
917 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
918 }
919 if let Some(ref param_value) = p_query_offset {
920 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
921 }
922 if let Some(ref param_value) = p_query_limit {
923 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
924 }
925 if let Some(ref param_value) = p_query_sort {
926 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
927 }
928 if let Some(ref user_agent) = configuration.user_agent {
929 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
930 }
931 if let Some(ref token) = configuration.oauth_access_token {
932 req_builder = req_builder.bearer_auth(token.to_owned());
933 };
934
935 let req = req_builder.build()?;
936 let resp = configuration.client.execute(req).await?;
937
938 let status = resp.status();
939 let content_type = resp
940 .headers()
941 .get("content-type")
942 .and_then(|v| v.to_str().ok())
943 .unwrap_or("application/octet-stream");
944 let content_type = super::ContentType::from(content_type);
945
946 if !status.is_client_error() && !status.is_server_error() {
947 let content = resp.text().await?;
948 match content_type {
949 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
950 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaspecQueryResponse`"))),
951 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::MsaspecQueryResponse`")))),
952 }
953 } else {
954 let content = resp.text().await?;
955 let entity: Option<QueryScanHostMetadataError> = serde_json::from_str(&content).ok();
956 Err(Error::ResponseError(ResponseContent {
957 status,
958 content,
959 entity,
960 }))
961 }
962}
963
964pub async fn query_scans(
965 configuration: &configuration::Configuration,
966 filter: Option<&str>,
967 offset: Option<i32>,
968 limit: Option<i32>,
969 sort: Option<&str>,
970) -> Result<models::MsaspecQueryResponse, Error<QueryScansError>> {
971 let p_query_filter = filter;
973 let p_query_offset = offset;
974 let p_query_limit = limit;
975 let p_query_sort = sort;
976
977 let uri_str = format!("{}/ods/queries/scans/v1", configuration.base_path);
978 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
979
980 if let Some(ref param_value) = p_query_filter {
981 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
982 }
983 if let Some(ref param_value) = p_query_offset {
984 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
985 }
986 if let Some(ref param_value) = p_query_limit {
987 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
988 }
989 if let Some(ref param_value) = p_query_sort {
990 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
991 }
992 if let Some(ref user_agent) = configuration.user_agent {
993 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
994 }
995 if let Some(ref token) = configuration.oauth_access_token {
996 req_builder = req_builder.bearer_auth(token.to_owned());
997 };
998
999 let req = req_builder.build()?;
1000 let resp = configuration.client.execute(req).await?;
1001
1002 let status = resp.status();
1003 let content_type = resp
1004 .headers()
1005 .get("content-type")
1006 .and_then(|v| v.to_str().ok())
1007 .unwrap_or("application/octet-stream");
1008 let content_type = super::ContentType::from(content_type);
1009
1010 if !status.is_client_error() && !status.is_server_error() {
1011 let content = resp.text().await?;
1012 match content_type {
1013 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1014 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaspecQueryResponse`"))),
1015 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::MsaspecQueryResponse`")))),
1016 }
1017 } else {
1018 let content = resp.text().await?;
1019 let entity: Option<QueryScansError> = serde_json::from_str(&content).ok();
1020 Err(Error::ResponseError(ResponseContent {
1021 status,
1022 content,
1023 entity,
1024 }))
1025 }
1026}
1027
1028pub async fn query_scheduled_scans(
1029 configuration: &configuration::Configuration,
1030 filter: Option<&str>,
1031 offset: Option<i32>,
1032 limit: Option<i32>,
1033 sort: Option<&str>,
1034) -> Result<models::MsaspecQueryResponse, Error<QueryScheduledScansError>> {
1035 let p_query_filter = filter;
1037 let p_query_offset = offset;
1038 let p_query_limit = limit;
1039 let p_query_sort = sort;
1040
1041 let uri_str = format!("{}/ods/queries/scheduled-scans/v1", configuration.base_path);
1042 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1043
1044 if let Some(ref param_value) = p_query_filter {
1045 req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
1046 }
1047 if let Some(ref param_value) = p_query_offset {
1048 req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
1049 }
1050 if let Some(ref param_value) = p_query_limit {
1051 req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
1052 }
1053 if let Some(ref param_value) = p_query_sort {
1054 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
1055 }
1056 if let Some(ref user_agent) = configuration.user_agent {
1057 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1058 }
1059 if let Some(ref token) = configuration.oauth_access_token {
1060 req_builder = req_builder.bearer_auth(token.to_owned());
1061 };
1062
1063 let req = req_builder.build()?;
1064 let resp = configuration.client.execute(req).await?;
1065
1066 let status = resp.status();
1067 let content_type = resp
1068 .headers()
1069 .get("content-type")
1070 .and_then(|v| v.to_str().ok())
1071 .unwrap_or("application/octet-stream");
1072 let content_type = super::ContentType::from(content_type);
1073
1074 if !status.is_client_error() && !status.is_server_error() {
1075 let content = resp.text().await?;
1076 match content_type {
1077 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1078 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MsaspecQueryResponse`"))),
1079 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::MsaspecQueryResponse`")))),
1080 }
1081 } else {
1082 let content = resp.text().await?;
1083 let entity: Option<QueryScheduledScansError> = serde_json::from_str(&content).ok();
1084 Err(Error::ResponseError(ResponseContent {
1085 status,
1086 content,
1087 entity,
1088 }))
1089 }
1090}
1091
1092pub async fn schedule_scan(
1093 configuration: &configuration::Configuration,
1094 body: models::EntitiesOdsScheduleScanRequest,
1095) -> Result<models::EntitiesOdsScheduleScanResponse, Error<ScheduleScanError>> {
1096 let p_body_body = body;
1098
1099 let uri_str = format!(
1100 "{}/ods/entities/scheduled-scans/v1",
1101 configuration.base_path
1102 );
1103 let mut req_builder = configuration
1104 .client
1105 .request(reqwest::Method::POST, &uri_str);
1106
1107 if let Some(ref user_agent) = configuration.user_agent {
1108 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1109 }
1110 if let Some(ref token) = configuration.oauth_access_token {
1111 req_builder = req_builder.bearer_auth(token.to_owned());
1112 };
1113 req_builder = req_builder.json(&p_body_body);
1114
1115 let req = req_builder.build()?;
1116 let resp = configuration.client.execute(req).await?;
1117
1118 let status = resp.status();
1119 let content_type = resp
1120 .headers()
1121 .get("content-type")
1122 .and_then(|v| v.to_str().ok())
1123 .unwrap_or("application/octet-stream");
1124 let content_type = super::ContentType::from(content_type);
1125
1126 if !status.is_client_error() && !status.is_server_error() {
1127 let content = resp.text().await?;
1128 match content_type {
1129 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1130 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EntitiesOdsScheduleScanResponse`"))),
1131 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::EntitiesOdsScheduleScanResponse`")))),
1132 }
1133 } else {
1134 let content = resp.text().await?;
1135 let entity: Option<ScheduleScanError> = serde_json::from_str(&content).ok();
1136 Err(Error::ResponseError(ResponseContent {
1137 status,
1138 content,
1139 entity,
1140 }))
1141 }
1142}