/*
* CrowdStrike API Specification
*
* 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.
*
* The version of the OpenAPI document: rolling
*
* Generated by: https://openapi-generator.tech
*/
use super::{ContentType, Error, configuration};
use crate::{apis::ResponseContent, models};
use reqwest;
use serde::de::Error as _;
/// struct for typed errors of method [`ext_aggregate_cluster_assessments`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateClusterAssessmentsError {
Status400(models::DomainAggregateClusterAssessmentsResponse),
Status401(models::DomainAggregateClusterAssessmentsResponse),
Status403(models::DomainAggregateClusterAssessmentsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateClusterAssessmentsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_failed_containers_by_rules_path`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateFailedContainersByRulesPathError {
Status400(models::DomainAggregateFailedAssetsByRulesResponse),
Status401(models::DomainAggregateFailedAssetsByRulesResponse),
Status403(models::DomainAggregateFailedAssetsByRulesResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateFailedAssetsByRulesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_failed_containers_count_by_severity`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateFailedContainersCountBySeverityError {
Status400(models::DomainAggregateFailedAssetCountBySeverityResponse),
Status401(models::DomainAggregateFailedAssetCountBySeverityResponse),
Status403(models::DomainAggregateFailedAssetCountBySeverityResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateFailedAssetCountBySeverityResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_failed_images_by_rules_path`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateFailedImagesByRulesPathError {
Status400(models::DomainAggregateFailedAssetsByRulesResponse),
Status401(models::DomainAggregateFailedAssetsByRulesResponse),
Status403(models::DomainAggregateFailedAssetsByRulesResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateFailedAssetsByRulesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_failed_images_count_by_severity`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateFailedImagesCountBySeverityError {
Status400(models::DomainAggregateFailedAssetCountBySeverityResponse),
Status401(models::DomainAggregateFailedAssetCountBySeverityResponse),
Status403(models::DomainAggregateFailedAssetCountBySeverityResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateFailedAssetCountBySeverityResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_failed_rules_by_clusters`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateFailedRulesByClustersError {
Status400(models::DomainAggregateFailedRulesByClustersResponse),
Status401(models::DomainAggregateFailedRulesByClustersResponse),
Status403(models::DomainAggregateFailedRulesByClustersResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateFailedRulesByClustersResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_failed_rules_by_images`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateFailedRulesByImagesError {
Status400(models::DomainAggregateFailedRulesByImagesResponse),
Status401(models::DomainAggregateFailedRulesByImagesResponse),
Status403(models::DomainAggregateFailedRulesByImagesResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateFailedRulesByImagesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_failed_rules_count_by_severity`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateFailedRulesCountBySeverityError {
Status400(models::DomainAggregateFailedRulesCountBySeverityResponse),
Status401(models::DomainAggregateFailedRulesCountBySeverityResponse),
Status403(models::DomainAggregateFailedRulesCountBySeverityResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateFailedRulesCountBySeverityResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_image_assessments`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateImageAssessmentsError {
Status400(models::DomainAggregateImageAssessmentsResponse),
Status401(models::DomainAggregateImageAssessmentsResponse),
Status403(models::DomainAggregateImageAssessmentsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateImageAssessmentsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_rules_assessments`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateRulesAssessmentsError {
Status400(models::DomainAggregateRulesAssessmentsResponse),
Status401(models::DomainAggregateRulesAssessmentsResponse),
Status403(models::DomainAggregateRulesAssessmentsResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateRulesAssessmentsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`ext_aggregate_rules_by_status`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExtAggregateRulesByStatusError {
Status400(models::DomainAggregateRulesByStatusResponse),
Status401(models::DomainAggregateRulesByStatusResponse),
Status403(models::DomainAggregateRulesByStatusResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::DomainAggregateRulesByStatusResponse),
UnknownValue(serde_json::Value),
}
pub async fn ext_aggregate_cluster_assessments(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateClusterAssessmentsResponse,
Error<ExtAggregateClusterAssessmentsError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/compliance-by-clusters/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateClusterAssessmentsResponse`",
)));
}
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::DomainAggregateClusterAssessmentsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateClusterAssessmentsError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_failed_containers_by_rules_path(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateFailedAssetsByRulesResponse,
Error<ExtAggregateFailedContainersByRulesPathError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/failed-containers-by-rules/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateFailedAssetsByRulesResponse`",
)));
}
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::DomainAggregateFailedAssetsByRulesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateFailedContainersByRulesPathError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_failed_containers_count_by_severity(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateFailedAssetCountBySeverityResponse,
Error<ExtAggregateFailedContainersCountBySeverityError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/failed-containers-count-by-severity/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateFailedAssetCountBySeverityResponse`",
)));
}
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::DomainAggregateFailedAssetCountBySeverityResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateFailedContainersCountBySeverityError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_failed_images_by_rules_path(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateFailedAssetsByRulesResponse,
Error<ExtAggregateFailedImagesByRulesPathError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/failed-images-by-rules/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateFailedAssetsByRulesResponse`",
)));
}
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::DomainAggregateFailedAssetsByRulesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateFailedImagesByRulesPathError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_failed_images_count_by_severity(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateFailedAssetCountBySeverityResponse,
Error<ExtAggregateFailedImagesCountBySeverityError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/failed-images-count-by-severity/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateFailedAssetCountBySeverityResponse`",
)));
}
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::DomainAggregateFailedAssetCountBySeverityResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateFailedImagesCountBySeverityError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_failed_rules_by_clusters(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateFailedRulesByClustersResponse,
Error<ExtAggregateFailedRulesByClustersError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/failed-rules-by-clusters/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateFailedRulesByClustersResponse`",
)));
}
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::DomainAggregateFailedRulesByClustersResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateFailedRulesByClustersError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_failed_rules_by_images(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateFailedRulesByImagesResponse,
Error<ExtAggregateFailedRulesByImagesError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/failed-rules-by-images/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateFailedRulesByImagesResponse`",
)));
}
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::DomainAggregateFailedRulesByImagesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateFailedRulesByImagesError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_failed_rules_count_by_severity(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<
models::DomainAggregateFailedRulesCountBySeverityResponse,
Error<ExtAggregateFailedRulesCountBySeverityError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/failed-rules-count-by-severity/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateFailedRulesCountBySeverityResponse`",
)));
}
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::DomainAggregateFailedRulesCountBySeverityResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateFailedRulesCountBySeverityError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_image_assessments(
configuration: &configuration::Configuration,
filter: Option<&str>,
after: Option<&str>,
limit: Option<&str>,
) -> Result<models::DomainAggregateImageAssessmentsResponse, Error<ExtAggregateImageAssessmentsError>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_after = after;
let p_query_limit = limit;
let uri_str = format!(
"{}/container-compliance/aggregates/compliance-by-images/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_after {
req_builder = req_builder.query(&[("after", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_limit {
req_builder = req_builder.query(&[("limit", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateImageAssessmentsResponse`",
)));
}
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::DomainAggregateImageAssessmentsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateImageAssessmentsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_rules_assessments(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<models::DomainAggregateRulesAssessmentsResponse, Error<ExtAggregateRulesAssessmentsError>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/compliance-by-rules/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateRulesAssessmentsResponse`",
)));
}
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::DomainAggregateRulesAssessmentsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateRulesAssessmentsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn ext_aggregate_rules_by_status(
configuration: &configuration::Configuration,
filter: Option<&str>,
) -> Result<models::DomainAggregateRulesByStatusResponse, Error<ExtAggregateRulesByStatusError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let uri_str = format!(
"{}/container-compliance/aggregates/rules-by-status/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_filter {
req_builder = req_builder.query(&[("filter", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to `models::DomainAggregateRulesByStatusResponse`",
)));
}
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::DomainAggregateRulesByStatusResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ExtAggregateRulesByStatusError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}