/*
* 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 [`add_cid_group_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddCidGroupMembersError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`add_role`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddRoleError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`add_user_group_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AddUserGroupMembersError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_cid_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateCidGroupsError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_user_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateUserGroupsError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_cid_group_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteCidGroupMembersError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_cid_group_members_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteCidGroupMembersV2Error {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_cid_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteCidGroupsError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_user_group_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteUserGroupMembersError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_user_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteUserGroupsError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`deleted_roles`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeletedRolesError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_children`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetChildrenError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_children_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetChildrenV2Error {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_cid_group_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCidGroupByIdError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_cid_group_by_id_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCidGroupByIdV2Error {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_cid_group_members_by`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCidGroupMembersByError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_cid_group_members_by_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCidGroupMembersByV2Error {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_roles_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetRolesByIdError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_user_group_members_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserGroupMembersByIdError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_user_group_members_by_idv2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserGroupMembersByIdv2Error {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_user_groups_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserGroupsByIdError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_user_groups_by_idv2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUserGroupsByIdv2Error {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_children`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryChildrenError {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_cid_group_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryCidGroupMembersError {
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_cid_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryCidGroupsError {
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_roles`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryRolesError {
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_user_group_members`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryUserGroupMembersError {
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`query_user_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum QueryUserGroupsError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_cid_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateCidGroupsError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_user_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateUserGroupsError {
Status400(models::MsaErrorsOnly),
Status403(models::MsaErrorsOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
pub async fn add_cid_group_members(
configuration: &configuration::Configuration,
body: models::DomainCidGroupMembersRequestV1,
) -> Result<models::DomainCidGroupMembersResponseV1, Error<AddCidGroupMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/mssp/entities/cid-group-members/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::DomainCidGroupMembersResponseV1`",
)));
}
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::DomainCidGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<AddCidGroupMembersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn add_role(
configuration: &configuration::Configuration,
body: models::DomainMsspRoleRequestV1,
) -> Result<models::DomainMsspRoleResponseV1, Error<AddRoleError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/mssp/entities/mssp-roles/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::DomainMsspRoleResponseV1`",
)));
}
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::DomainMsspRoleResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<AddRoleError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn add_user_group_members(
configuration: &configuration::Configuration,
body: models::DomainUserGroupMembersRequestV1,
) -> Result<models::DomainUserGroupMembersResponseV1, Error<AddUserGroupMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/mssp/entities/user-group-members/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::DomainUserGroupMembersResponseV1`",
)));
}
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::DomainUserGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<AddUserGroupMembersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_cid_groups(
configuration: &configuration::Configuration,
body: models::DomainCidGroupsRequestV1,
) -> Result<models::DomainCidGroupsResponseV1, Error<CreateCidGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/mssp/entities/cid-groups/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::DomainCidGroupsResponseV1`",
)));
}
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::DomainCidGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateCidGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_user_groups(
configuration: &configuration::Configuration,
body: models::DomainUserGroupsRequestV1,
) -> Result<models::DomainUserGroupsResponseV1, Error<CreateUserGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/mssp/entities/user-groups/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::DomainUserGroupsResponseV1`",
)));
}
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::DomainUserGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateUserGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_cid_group_members(
configuration: &configuration::Configuration,
body: models::DomainCidGroupMembersRequestV1,
) -> Result<models::DomainCidGroupMembersResponseV1, Error<DeleteCidGroupMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/mssp/entities/cid-group-members/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &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::DomainCidGroupMembersResponseV1`",
)));
}
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::DomainCidGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteCidGroupMembersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_cid_group_members_v2(
configuration: &configuration::Configuration,
body: models::DomainCidGroupMembersRequestV1,
) -> Result<models::DomainCidGroupMembersResponseV1, Error<DeleteCidGroupMembersV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/mssp/entities/cid-group-members/v2",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &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::DomainCidGroupMembersResponseV1`",
)));
}
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::DomainCidGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteCidGroupMembersV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_cid_groups(
configuration: &configuration::Configuration,
cid_group_ids: Vec<String>,
) -> Result<models::MsaEntitiesResponse, Error<DeleteCidGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_cid_group_ids = cid_group_ids;
let uri_str = format!("{}/mssp/entities/cid-groups/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_cid_group_ids
.into_iter()
.map(|p| ("cid_group_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"cid_group_ids",
&p_query_cid_group_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::MsaEntitiesResponse`",
)));
}
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::MsaEntitiesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteCidGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_user_group_members(
configuration: &configuration::Configuration,
body: models::DomainUserGroupMembersRequestV1,
) -> Result<models::DomainUserGroupMembersResponseV1, Error<DeleteUserGroupMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/mssp/entities/user-group-members/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &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::DomainUserGroupMembersResponseV1`",
)));
}
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::DomainUserGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteUserGroupMembersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_user_groups(
configuration: &configuration::Configuration,
user_group_ids: Vec<String>,
) -> Result<models::MsaEntitiesResponse, Error<DeleteUserGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_user_group_ids = user_group_ids;
let uri_str = format!("{}/mssp/entities/user-groups/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_user_group_ids
.into_iter()
.map(|p| ("user_group_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"user_group_ids",
&p_query_user_group_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::MsaEntitiesResponse`",
)));
}
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::MsaEntitiesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteUserGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn deleted_roles(
configuration: &configuration::Configuration,
body: models::DomainMsspRoleRequestV1,
) -> Result<models::DomainMsspRoleResponseV1, Error<DeletedRolesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/mssp/entities/mssp-roles/v1", configuration.base_path);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &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::DomainMsspRoleResponseV1`",
)));
}
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::DomainMsspRoleResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeletedRolesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_children(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::DomainChildrenResponseV1, Error<GetChildrenError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!("{}/mssp/entities/children/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::DomainChildrenResponseV1`",
)));
}
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::DomainChildrenResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetChildrenError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_children_v2(
configuration: &configuration::Configuration,
body: models::MsaspecIdsRequest,
) -> Result<models::DomainChildrenResponseV1, Error<GetChildrenV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/mssp/entities/children/GET/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::DomainChildrenResponseV1`",
)));
}
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::DomainChildrenResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetChildrenV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_cid_group_by_id(
configuration: &configuration::Configuration,
cid_group_ids: Vec<String>,
) -> Result<models::DomainCidGroupsResponseV1, Error<GetCidGroupByIdError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_cid_group_ids = cid_group_ids;
let uri_str = format!("{}/mssp/entities/cid-groups/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_cid_group_ids
.into_iter()
.map(|p| ("cid_group_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"cid_group_ids",
&p_query_cid_group_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::DomainCidGroupsResponseV1`",
)));
}
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::DomainCidGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetCidGroupByIdError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_cid_group_by_id_v2(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::DomainCidGroupsResponseV1, Error<GetCidGroupByIdV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!("{}/mssp/entities/cid-groups/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::DomainCidGroupsResponseV1`",
)));
}
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::DomainCidGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetCidGroupByIdV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_cid_group_members_by(
configuration: &configuration::Configuration,
cid_group_ids: Vec<String>,
) -> Result<models::DomainCidGroupMembersResponseV1, Error<GetCidGroupMembersByError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_cid_group_ids = cid_group_ids;
let uri_str = format!(
"{}/mssp/entities/cid-group-members/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_cid_group_ids
.into_iter()
.map(|p| ("cid_group_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"cid_group_ids",
&p_query_cid_group_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::DomainCidGroupMembersResponseV1`",
)));
}
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::DomainCidGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetCidGroupMembersByError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_cid_group_members_by_v2(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::DomainCidGroupMembersResponseV1, Error<GetCidGroupMembersByV2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/mssp/entities/cid-group-members/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::DomainCidGroupMembersResponseV1`",
)));
}
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::DomainCidGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetCidGroupMembersByV2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_roles_by_id(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::DomainMsspRoleResponseV1, Error<GetRolesByIdError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!("{}/mssp/entities/mssp-roles/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::DomainMsspRoleResponseV1`",
)));
}
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::DomainMsspRoleResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetRolesByIdError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_user_group_members_by_id(
configuration: &configuration::Configuration,
user_group_ids: Vec<String>,
) -> Result<models::DomainUserGroupMembersResponseV1, Error<GetUserGroupMembersByIdError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_user_group_ids = user_group_ids;
let uri_str = format!(
"{}/mssp/entities/user-group-members/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_user_group_ids
.into_iter()
.map(|p| ("user_group_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"user_group_ids",
&p_query_user_group_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::DomainUserGroupMembersResponseV1`",
)));
}
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::DomainUserGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserGroupMembersByIdError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_user_group_members_by_idv2(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::DomainUserGroupMembersResponseV1, Error<GetUserGroupMembersByIdv2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/mssp/entities/user-group-members/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::DomainUserGroupMembersResponseV1`",
)));
}
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::DomainUserGroupMembersResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserGroupMembersByIdv2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_user_groups_by_id(
configuration: &configuration::Configuration,
user_group_ids: Vec<String>,
) -> Result<models::DomainUserGroupsResponseV1, Error<GetUserGroupsByIdError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_user_group_ids = user_group_ids;
let uri_str = format!("{}/mssp/entities/user-groups/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_user_group_ids
.into_iter()
.map(|p| ("user_group_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"user_group_ids",
&p_query_user_group_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::DomainUserGroupsResponseV1`",
)));
}
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::DomainUserGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserGroupsByIdError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_user_groups_by_idv2(
configuration: &configuration::Configuration,
ids: Vec<String>,
) -> Result<models::DomainUserGroupsResponseV1, Error<GetUserGroupsByIdv2Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!("{}/mssp/entities/user-groups/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::DomainUserGroupsResponseV1`",
)));
}
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::DomainUserGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetUserGroupsByIdv2Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_children(
configuration: &configuration::Configuration,
filter: Option<&str>,
sort: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::MsaspecQueryResponse, Error<QueryChildrenError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_filter = filter;
let p_query_sort = sort;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!("{}/mssp/queries/children/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_sort {
req_builder = req_builder.query(&[("sort", ¶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::MsaspecQueryResponse`",
)));
}
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`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<QueryChildrenError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_cid_group_members(
configuration: &configuration::Configuration,
cid: &str,
sort: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::MsaQueryResponse, Error<QueryCidGroupMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_cid = cid;
let p_query_sort = sort;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!(
"{}/mssp/queries/cid-group-members/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("cid", &p_query_cid.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 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<QueryCidGroupMembersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_cid_groups(
configuration: &configuration::Configuration,
name: Option<&str>,
sort: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::MsaQueryResponse, Error<QueryCidGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_name = name;
let p_query_sort = sort;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!("{}/mssp/queries/cid-groups/v1", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_name {
req_builder = req_builder.query(&[("name", ¶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 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<QueryCidGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_roles(
configuration: &configuration::Configuration,
user_group_id: Option<&str>,
cid_group_id: Option<&str>,
role_id: Option<&str>,
sort: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::MsaQueryResponse, Error<QueryRolesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_user_group_id = user_group_id;
let p_query_cid_group_id = cid_group_id;
let p_query_role_id = role_id;
let p_query_sort = sort;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!("{}/mssp/queries/mssp-roles/v1", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_user_group_id {
req_builder = req_builder.query(&[("user_group_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_cid_group_id {
req_builder = req_builder.query(&[("cid_group_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_role_id {
req_builder = req_builder.query(&[("role_id", ¶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 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<QueryRolesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_user_group_members(
configuration: &configuration::Configuration,
user_uuid: &str,
sort: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::MsaQueryResponse, Error<QueryUserGroupMembersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_user_uuid = user_uuid;
let p_query_sort = sort;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!(
"{}/mssp/queries/user-group-members/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("user_uuid", &p_query_user_uuid.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 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<QueryUserGroupMembersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn query_user_groups(
configuration: &configuration::Configuration,
name: Option<&str>,
sort: Option<&str>,
offset: Option<i32>,
limit: Option<i32>,
) -> Result<models::MsaQueryResponse, Error<QueryUserGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_name = name;
let p_query_sort = sort;
let p_query_offset = offset;
let p_query_limit = limit;
let uri_str = format!("{}/mssp/queries/user-groups/v1", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_name {
req_builder = req_builder.query(&[("name", ¶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 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<QueryUserGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn update_cid_groups(
configuration: &configuration::Configuration,
body: models::DomainCidGroupsRequestV1,
) -> Result<models::DomainCidGroupsResponseV1, Error<UpdateCidGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/mssp/entities/cid-groups/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::DomainCidGroupsResponseV1`",
)));
}
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::DomainCidGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateCidGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn update_user_groups(
configuration: &configuration::Configuration,
body: models::DomainUserGroupsRequestV1,
) -> Result<models::DomainUserGroupsResponseV1, Error<UpdateUserGroupsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/mssp/entities/user-groups/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::DomainUserGroupsResponseV1`",
)));
}
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::DomainUserGroupsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateUserGroupsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}