/*
* 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 [`create_sensor_update_policies`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSensorUpdatePoliciesError {
Status400(models::SensorUpdateRespV1),
Status403(models::MsaErrorsOnly),
Status404(models::SensorUpdateRespV1),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_sensor_update_policies_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSensorUpdatePoliciesV2Error {
Status400(models::SensorUpdateRespV2),
Status403(models::MsaErrorsOnly),
Status404(models::SensorUpdateRespV2),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV2),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_sensor_update_policies`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteSensorUpdatePoliciesError {
Status403(models::MsaErrorsOnly),
Status404(models::MsaQueryResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaQueryResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_sensor_update_policies`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSensorUpdatePoliciesError {
Status403(models::MsaErrorsOnly),
Status404(models::SensorUpdateRespV1),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_sensor_update_policies_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSensorUpdatePoliciesV2Error {
Status403(models::MsaErrorsOnly),
Status404(models::SensorUpdateRespV2),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV2),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`perform_sensor_update_policies_action`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PerformSensorUpdatePoliciesActionError {
Status400(models::SensorUpdateRespV1),
Status403(models::MsaErrorsOnly),
Status404(models::SensorUpdateRespV1),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_combined_sensor_update_builds`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryCombinedSensorUpdateBuildsError {
Status400(models::SensorUpdateBuildsRespV1),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateBuildsRespV1),
DefaultResponse(String),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_combined_sensor_update_kernels`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryCombinedSensorUpdateKernelsError {
Status400(models::SensorUpdateKernelsRespV1),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateKernelsRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_combined_sensor_update_policies`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryCombinedSensorUpdatePoliciesError {
Status400(models::SensorUpdateRespV1),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_combined_sensor_update_policies_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryCombinedSensorUpdatePoliciesV2Error {
Status400(models::SensorUpdateRespV2),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV2),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_combined_sensor_update_policy_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryCombinedSensorUpdatePolicyMembersError {
Status400(models::BasePolicyMembersRespV1),
Status403(models::MsaErrorsOnly),
Status404(models::BasePolicyMembersRespV1),
Status429(models::MsaReplyMetaOnly),
Status500(models::BasePolicyMembersRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_sensor_update_kernels_distinct`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QuerySensorUpdateKernelsDistinctError {
Status400(models::MsaQueryResponse),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaQueryResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_sensor_update_policies`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QuerySensorUpdatePoliciesError {
Status400(models::MsaQueryResponse),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaQueryResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_sensor_update_policy_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QuerySensorUpdatePolicyMembersError {
Status400(models::MsaQueryResponse),
Status403(models::MsaErrorsOnly),
Status404(models::MsaQueryResponse),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaQueryResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`reveal_uninstall_token`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RevealUninstallTokenError {
Status400(models::UninstallTokenRespV1),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::UninstallTokenRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`set_sensor_update_policies_precedence`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetSensorUpdatePoliciesPrecedenceError {
Status400(models::MsaQueryResponse),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaQueryResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_sensor_update_policies`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateSensorUpdatePoliciesError {
Status400(models::SensorUpdateRespV1),
Status403(models::MsaErrorsOnly),
Status404(models::SensorUpdateRespV1),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_sensor_update_policies_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateSensorUpdatePoliciesV2Error {
Status400(models::SensorUpdateRespV2),
Status403(models::MsaErrorsOnly),
Status404(models::SensorUpdateRespV2),
Status429(models::MsaReplyMetaOnly),
Status500(models::SensorUpdateRespV2),
UnknownValue(serde_json::Value),
}
pub async fn create_sensor_update_policies(
configuration: &configuration::Configuration,
body: models::SensorUpdateCreatePoliciesReqV1,
) -> Result<models::SensorUpdateRespV1, Error<CreateSensorUpdatePoliciesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/policy/entities/sensor-update/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
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());
};
req_builder = req_builder.json(&p_body_body);
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::SensorUpdateRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_sensor_update_policies_v2(
configuration: &configuration::Configuration,
body: models::SensorUpdateCreatePoliciesReqV2,
) -> Result<models::SensorUpdateRespV2, Error<CreateSensorUpdatePoliciesV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/policy/entities/sensor-update/v2",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
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());
};
req_builder = req_builder.json(&p_body_body);
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::SensorUpdateRespV2`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateSensorUpdatePoliciesV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_sensor_update_policies(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::MsaQueryResponse, Error<DeleteSensorUpdatePoliciesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/policy/entities/sensor-update/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
req_builder = match "multi" {
"multi" => req_builder.query(
&p_query_ids
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
&p_query_ids
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.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::MsaQueryResponse`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_sensor_update_policies(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::SensorUpdateRespV1, Error<GetSensorUpdatePoliciesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/policy/entities/sensor-update/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = match "multi" {
"multi" => req_builder.query(
&p_query_ids
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
&p_query_ids
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.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::SensorUpdateRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_sensor_update_policies_v2(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::SensorUpdateRespV2, Error<GetSensorUpdatePoliciesV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/policy/entities/sensor-update/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = match "multi" {
"multi" => req_builder.query(
&p_query_ids
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
&p_query_ids
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.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::SensorUpdateRespV2`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetSensorUpdatePoliciesV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn perform_sensor_update_policies_action(
configuration: &configuration::Configuration,
action_name: &str,
body: models::MsaEntityActionRequestV2,
) -> Result<models::SensorUpdateRespV1, Error<PerformSensorUpdatePoliciesActionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_action_name = action_name;
let p_body_body = body;
let uri_str = format!(
"{}/policy/entities/sensor-update-actions/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
req_builder = req_builder.query(&[("action_name", &p_query_action_name.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());
};
req_builder = req_builder.json(&p_body_body);
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::SensorUpdateRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<PerformSensorUpdatePoliciesActionError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_combined_sensor_update_builds(
configuration: &configuration::Configuration,
platform: Option<&str>,
stage: Option<Vec<String>>,
) -> Result<models::SensorUpdateBuildsRespV1, Error<QueryCombinedSensorUpdateBuildsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_platform = platform;
let p_query_stage = stage;
let uri_str = format!(
"{}/policy/combined/sensor-update-builds/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_platform {
req_builder = req_builder.query(&[("platform", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_stage {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("stage".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"stage",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.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::SensorUpdateBuildsRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QueryCombinedSensorUpdateBuildsError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_combined_sensor_update_kernels(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::SensorUpdateKernelsRespV1, Error<QueryCombinedSensorUpdateKernelsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!(
"{}/policy/combined/sensor-update-kernels/v1",
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_offset {
req_builder = req_builder.query(&[("offset", ¶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::SensorUpdateKernelsRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QueryCombinedSensorUpdateKernelsError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_combined_sensor_update_policies(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::SensorUpdateRespV1, Error<QueryCombinedSensorUpdatePoliciesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/policy/combined/sensor-update/v1",
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_offset {
req_builder = req_builder.query(&[("offset", ¶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 param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶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::SensorUpdateRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QueryCombinedSensorUpdatePoliciesError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_combined_sensor_update_policies_v2(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::SensorUpdateRespV2, Error<QueryCombinedSensorUpdatePoliciesV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/policy/combined/sensor-update/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_offset {
req_builder = req_builder.query(&[("offset", ¶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 param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶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::SensorUpdateRespV2`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QueryCombinedSensorUpdatePoliciesV2Error> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_combined_sensor_update_policy_members(
configuration: &configuration::Configuration,
id: Option<&str>,
filter: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::BasePolicyMembersRespV1, Error<QueryCombinedSensorUpdatePolicyMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_id = id;
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/policy/combined/sensor-update-members/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_id {
req_builder = req_builder.query(&[("id", ¶m_value.to_string())]);
}
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_offset {
req_builder = req_builder.query(&[("offset", ¶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 param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶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::BasePolicyMembersRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QueryCombinedSensorUpdatePolicyMembersError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_sensor_update_kernels_distinct(
configuration: &configuration::Configuration,
distinct_field: &str,
filter: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::MsaQueryResponse, Error<QuerySensorUpdateKernelsDistinctError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_distinct_field = distinct_field;
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!(
"{}/policy/queries/sensor-update-kernels/{distinct_field}/v1",
configuration.base_path,
distinct_field = crate::apis::urlencode(p_path_distinct_field)
);
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_offset {
req_builder = req_builder.query(&[("offset", ¶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::MsaQueryResponse`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QuerySensorUpdateKernelsDistinctError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_sensor_update_policies(
configuration: &configuration::Configuration,
filter: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::MsaQueryResponse, Error<QuerySensorUpdatePoliciesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/policy/queries/sensor-update/v1",
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_offset {
req_builder = req_builder.query(&[("offset", ¶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 param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶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::MsaQueryResponse`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QuerySensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_sensor_update_policy_members(
configuration: &configuration::Configuration,
id: Option<&str>,
filter: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
sort: Option<&str>,
) -> Result<models::MsaQueryResponse, Error<QuerySensorUpdatePolicyMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_id = id;
let p_query_filter = filter;
let p_query_offset = offset;
let p_query_limit = limit;
let p_query_sort = sort;
let uri_str = format!(
"{}/policy/queries/sensor-update-members/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_id {
req_builder = req_builder.query(&[("id", ¶m_value.to_string())]);
}
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_offset {
req_builder = req_builder.query(&[("offset", ¶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 param_value) = p_query_sort {
req_builder = req_builder.query(&[("sort", ¶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::MsaQueryResponse`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QuerySensorUpdatePolicyMembersError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn reveal_uninstall_token(
configuration: &configuration::Configuration,
body: models::UninstallTokenRevealUninstallTokenReqV1,
) -> Result<models::UninstallTokenRespV1, Error<RevealUninstallTokenError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/policy/combined/reveal-uninstall-token/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
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());
};
req_builder = req_builder.json(&p_body_body);
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::UninstallTokenRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<RevealUninstallTokenError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn set_sensor_update_policies_precedence(
configuration: &configuration::Configuration,
body: models::BaseSetPolicyPrecedenceReqV1,
) -> Result<models::MsaQueryResponse, Error<SetSensorUpdatePoliciesPrecedenceError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/policy/entities/sensor-update-precedence/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
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());
};
req_builder = req_builder.json(&p_body_body);
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::MsaQueryResponse`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<SetSensorUpdatePoliciesPrecedenceError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn update_sensor_update_policies(
configuration: &configuration::Configuration,
body: models::SensorUpdateUpdatePoliciesReqV1,
) -> Result<models::SensorUpdateRespV1, Error<UpdateSensorUpdatePoliciesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/policy/entities/sensor-update/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::PATCH, &uri_str);
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());
};
req_builder = req_builder.json(&p_body_body);
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::SensorUpdateRespV1`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateSensorUpdatePoliciesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn update_sensor_update_policies_v2(
configuration: &configuration::Configuration,
body: models::SensorUpdateUpdatePoliciesReqV2,
) -> Result<models::SensorUpdateRespV2, Error<UpdateSensorUpdatePoliciesV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/policy/entities/sensor-update/v2",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::PATCH, &uri_str);
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());
};
req_builder = req_builder.json(&p_body_body);
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::SensorUpdateRespV2`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateSensorUpdatePoliciesV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}