/*
* 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 [`connect_d4_cgcp_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ConnectD4CgcpAccountError {
Status400(models::RegistrationGcpAccountResponseExtV2),
Status403(models::MsaReplyMetaOnly),
Status409(models::RegistrationGcpAccountResponseExtV2),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationGcpAccountResponseExtV2),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_d4_c_aws_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateD4CAwsAccountError {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_d4_cgcp_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateD4CgcpAccountError {
Status400(models::RegistrationGcpAccountResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationGcpAccountResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_discover_cloud_azure_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateDiscoverCloudAzureAccountError {
Status400(models::RegistrationAzureAccountResponseV1),
Status403(models::MsaReplyMetaOnly),
Status409(models::RegistrationAzureAccountResponseV1),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationAzureAccountResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_d4_c_aws_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteD4CAwsAccountError {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_d4_cgcp_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteD4CgcpAccountError {
Status400(models::MsaBaseEntitiesResponse),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaBaseEntitiesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_d4_c_aws_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetD4CAwsAccountError {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_d4_c_aws_console_setup_urls`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetD4CAwsConsoleSetupUrlsError {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_d4_caws_account_scripts_attachment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetD4CawsAccountScriptsAttachmentError {
Status400(models::MsaspecResponseFields),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaspecResponseFields),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_d4_ccgp_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetD4CcgpAccountError {
Status400(models::RegistrationGcpAccountResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationGcpAccountResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_d4_cgcp_service_accounts_ext`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetD4CgcpServiceAccountsExtError {
Status400(models::RegistrationGcpServiceAccountResponseExtV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationGcpServiceAccountResponseExtV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_d4_cgcp_user_scripts`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetD4CgcpUserScriptsError {
Status400(models::RegistrationGcpProvisionGetUserScriptResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationGcpProvisionGetUserScriptResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_d4_cgcp_user_scripts_attachment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetD4CgcpUserScriptsAttachmentError {
Status400(models::RegistrationGcpProvisionGetUserScriptResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationGcpProvisionGetUserScriptResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_discover_cloud_azure_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetDiscoverCloudAzureAccountError {
Status400(models::RegistrationAzureAccountResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationAzureAccountResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_discover_cloud_azure_tenant_ids`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetDiscoverCloudAzureTenantIdsError {
Status400(models::RegistrationAzureTenantIdsResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationAzureTenantIdsResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_discover_cloud_azure_user_scripts`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetDiscoverCloudAzureUserScriptsError {
Status400(models::RegistrationAzureProvisionGetUserScriptResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationAzureProvisionGetUserScriptResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_discover_cloud_azure_user_scripts_attachment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetDiscoverCloudAzureUserScriptsAttachmentError {
Status400(models::RegistrationAzureProvisionGetUserScriptResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationAzureProvisionGetUserScriptResponseV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_horizon_d4_c_scripts`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetHorizonD4CScriptsError {
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_d4_cgcp_service_accounts_ext`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateD4CgcpServiceAccountsExtError {
Status400(models::RegistrationGcpServiceAccountResponseExtV1),
Status403(models::MsaspecResponseFields),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationGcpServiceAccountResponseExtV1),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_discover_cloud_azure_account_client_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateDiscoverCloudAzureAccountClientIdError {
Status400(models::RegistrationAzureTenantConfigurationResponseV1),
Status403(models::MsaReplyMetaOnly),
Status429(models::MsaReplyMetaOnly),
Status500(models::RegistrationAzureTenantConfigurationResponseV1),
UnknownValue(serde_json::Value),
}
pub async fn connect_d4_cgcp_account(
configuration: &configuration::Configuration,
body: models::RegistrationGcpAccountExtRequestV2,
) -> Result<models::RegistrationGcpAccountResponseExtV2, Error<ConnectD4CgcpAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/account/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::RegistrationGcpAccountResponseExtV2`",
)));
}
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::RegistrationGcpAccountResponseExtV2`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<ConnectD4CgcpAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_d4_c_aws_account(
configuration: &configuration::Configuration,
body: models::RegistrationAwsAccountCreateRequestD4CExtV2,
) -> Result<models::RegistrationAwsAccountResponseV2, Error<CreateD4CAwsAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/cloud-connect-aws/entities/account/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::RegistrationAwsAccountResponseV2`",
)));
}
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::RegistrationAwsAccountResponseV2`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateD4CAwsAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_d4_cgcp_account(
configuration: &configuration::Configuration,
body: models::RegistrationGcpAccountCreateRequestExtV1,
) -> Result<models::RegistrationGcpAccountResponseV1, Error<CreateD4CgcpAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/account/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::RegistrationGcpAccountResponseV1`",
)));
}
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::RegistrationGcpAccountResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateD4CgcpAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn create_discover_cloud_azure_account(
configuration: &configuration::Configuration,
body: models::RegistrationAzureAccountCreateRequestExternalV1,
) -> Result<models::RegistrationAzureAccountResponseV1, Error<CreateDiscoverCloudAzureAccountError>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/cloud-connect-azure/entities/account/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::RegistrationAzureAccountResponseV1`",
)));
}
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::RegistrationAzureAccountResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<CreateDiscoverCloudAzureAccountError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_d4_c_aws_account(
configuration: &configuration::Configuration,
ids: Option<Vec<String>>,
organization_ids: Option<Vec<String>>,
) -> Result<models::MsaspecResponseFields, Error<DeleteD4CAwsAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let p_query_organization_ids = organization_ids;
let uri_str = format!(
"{}/cloud-connect-aws/entities/account/v2",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref param_value) = p_query_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_organization_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("organization-ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"organization-ids",
¶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::MsaspecResponseFields`",
)));
}
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::MsaspecResponseFields`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteD4CAwsAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn delete_d4_cgcp_account(
configuration: &configuration::Configuration,
ids: Option<Vec<String>>,
) -> Result<models::MsaBaseEntitiesResponse, Error<DeleteD4CgcpAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/account/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref param_value) = p_query_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
¶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::MsaBaseEntitiesResponse`",
)));
}
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::MsaBaseEntitiesResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<DeleteD4CgcpAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_d4_c_aws_account(
configuration: &configuration::Configuration,
scan_type: Option<&str>,
ids: Option<Vec<String>>,
organization_ids: Option<Vec<String>>,
status: Option<&str>,
limit: Option<i32>,
offset: Option<i32>,
migrated: Option<&str>,
) -> Result<models::RegistrationAwsAccountResponseV2, Error<GetD4CAwsAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_scan_type = scan_type;
let p_query_ids = ids;
let p_query_organization_ids = organization_ids;
let p_query_status = status;
let p_query_limit = limit;
let p_query_offset = offset;
let p_query_migrated = migrated;
let uri_str = format!(
"{}/cloud-connect-aws/entities/account/v2",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_scan_type {
req_builder = req_builder.query(&[("scan-type", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_organization_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("organization-ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"organization-ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_status {
req_builder = req_builder.query(&[("status", ¶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_offset {
req_builder = req_builder.query(&[("offset", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_migrated {
req_builder = req_builder.query(&[("migrated", ¶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::RegistrationAwsAccountResponseV2`",
)));
}
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::RegistrationAwsAccountResponseV2`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetD4CAwsAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_d4_c_aws_console_setup_urls(
configuration: &configuration::Configuration,
region: Option<&str>,
) -> Result<models::RegistrationAwsConsoleUrlResponseV2, Error<GetD4CAwsConsoleSetupUrlsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_region = region;
let uri_str = format!(
"{}/cloud-connect-aws/entities/console-setup-urls/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_region {
req_builder = req_builder.query(&[("region", ¶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::RegistrationAwsConsoleUrlResponseV2`",
)));
}
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::RegistrationAwsConsoleUrlResponseV2`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetD4CAwsConsoleSetupUrlsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_d4_caws_account_scripts_attachment(
configuration: &configuration::Configuration,
ids: Option<Vec<String>>,
template: Option<&str>,
accounts: Option<Vec<String>>,
behavior_assessment_enabled: Option<&str>,
sensor_management_enabled: Option<&str>,
dspm_enabled: Option<&str>,
dspm_regions: Option<Vec<String>>,
dspm_role: Option<&str>,
use_existing_cloudtrail: Option<&str>,
organization_id: Option<&str>,
organizational_unit_ids: Option<Vec<String>>,
aws_profile: Option<&str>,
aws_region: Option<&str>,
iam_role_arn: Option<&str>,
falcon_client_id: Option<&str>,
idp_enabled: Option<&str>,
tags: Option<&str>,
) -> Result<
models::RegistrationAwsProvisionGetAccountScriptResponseV2,
Error<GetD4CawsAccountScriptsAttachmentError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let p_query_template = template;
let p_query_accounts = accounts;
let p_query_behavior_assessment_enabled = behavior_assessment_enabled;
let p_query_sensor_management_enabled = sensor_management_enabled;
let p_query_dspm_enabled = dspm_enabled;
let p_query_dspm_regions = dspm_regions;
let p_query_dspm_role = dspm_role;
let p_query_use_existing_cloudtrail = use_existing_cloudtrail;
let p_query_organization_id = organization_id;
let p_query_organizational_unit_ids = organizational_unit_ids;
let p_query_aws_profile = aws_profile;
let p_query_aws_region = aws_region;
let p_query_iam_role_arn = iam_role_arn;
let p_query_falcon_client_id = falcon_client_id;
let p_query_idp_enabled = idp_enabled;
let p_query_tags = tags;
let uri_str = format!(
"{}/cloud-connect-aws/entities/user-scripts-download/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_template {
req_builder = req_builder.query(&[("template", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_accounts {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("accounts".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"accounts",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_behavior_assessment_enabled {
req_builder =
req_builder.query(&[("behavior_assessment_enabled", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_sensor_management_enabled {
req_builder = req_builder.query(&[("sensor_management_enabled", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_dspm_enabled {
req_builder = req_builder.query(&[("dspm_enabled", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_dspm_regions {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("dspm_regions".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"dspm_regions",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_dspm_role {
req_builder = req_builder.query(&[("dspm_role", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_use_existing_cloudtrail {
req_builder = req_builder.query(&[("use_existing_cloudtrail", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_organization_id {
req_builder = req_builder.query(&[("organization_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_organizational_unit_ids {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("organizational_unit_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"organizational_unit_ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_aws_profile {
req_builder = req_builder.query(&[("aws_profile", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_aws_region {
req_builder = req_builder.query(&[("aws_region", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_iam_role_arn {
req_builder = req_builder.query(&[("iam_role_arn", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_falcon_client_id {
req_builder = req_builder.query(&[("falcon_client_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_idp_enabled {
req_builder = req_builder.query(&[("idp_enabled", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_tags {
req_builder = req_builder.query(&[("tags", ¶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::RegistrationAwsProvisionGetAccountScriptResponseV2`",
)));
}
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::RegistrationAwsProvisionGetAccountScriptResponseV2`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetD4CawsAccountScriptsAttachmentError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_d4_ccgp_account(
configuration: &configuration::Configuration,
parent_type: Option<&str>,
ids: Option<Vec<String>>,
scan_type: Option<&str>,
status: Option<&str>,
limit: Option<i32>,
offset: Option<i32>,
sort: Option<&str>,
) -> Result<models::RegistrationGcpAccountResponseV1, Error<GetD4CcgpAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_parent_type = parent_type;
let p_query_ids = ids;
let p_query_scan_type = scan_type;
let p_query_status = status;
let p_query_limit = limit;
let p_query_offset = offset;
let p_query_sort = sort;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/account/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_parent_type {
req_builder = req_builder.query(&[("parent_type", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_scan_type {
req_builder = req_builder.query(&[("scan-type", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_status {
req_builder = req_builder.query(&[("status", ¶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_offset {
req_builder = req_builder.query(&[("offset", ¶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::RegistrationGcpAccountResponseV1`",
)));
}
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::RegistrationGcpAccountResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetD4CcgpAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_d4_cgcp_service_accounts_ext(
configuration: &configuration::Configuration,
id: Option<&str>,
) -> Result<
models::RegistrationGcpServiceAccountResponseExtV1,
Error<GetD4CgcpServiceAccountsExtError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_id = id;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/service-accounts/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 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::RegistrationGcpServiceAccountResponseExtV1`",
)));
}
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::RegistrationGcpServiceAccountResponseExtV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetD4CgcpServiceAccountsExtError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_d4_cgcp_user_scripts(
configuration: &configuration::Configuration,
parent_type: Option<&str>,
) -> Result<models::RegistrationGcpProvisionGetUserScriptResponseV1, Error<GetD4CgcpUserScriptsError>>
{
// add a prefix to parameters to efficiently prevent name collisions
let p_query_parent_type = parent_type;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/user-scripts/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_parent_type {
req_builder = req_builder.query(&[("parent_type", ¶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::RegistrationGcpProvisionGetUserScriptResponseV1`",
)));
}
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::RegistrationGcpProvisionGetUserScriptResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetD4CgcpUserScriptsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_d4_cgcp_user_scripts_attachment(
configuration: &configuration::Configuration,
parent_type: Option<&str>,
ids: Option<Vec<String>>,
status: Option<&str>,
) -> Result<
models::RegistrationGcpProvisionGetUserScriptResponseV1,
Error<GetD4CgcpUserScriptsAttachmentError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_parent_type = parent_type;
let p_query_ids = ids;
let p_query_status = status;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/user-scripts-download/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_parent_type {
req_builder = req_builder.query(&[("parent_type", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_status {
req_builder = req_builder.query(&[("status", ¶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::RegistrationGcpProvisionGetUserScriptResponseV1`",
)));
}
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::RegistrationGcpProvisionGetUserScriptResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetD4CgcpUserScriptsAttachmentError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_discover_cloud_azure_account(
configuration: &configuration::Configuration,
ids: Option<Vec<String>>,
tenant_ids: Option<Vec<String>>,
scan_type: Option<&str>,
status: Option<&str>,
limit: Option<i32>,
offset: Option<i32>,
) -> Result<models::RegistrationAzureAccountResponseV1, Error<GetDiscoverCloudAzureAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_ids = ids;
let p_query_tenant_ids = tenant_ids;
let p_query_scan_type = scan_type;
let p_query_status = status;
let p_query_limit = limit;
let p_query_offset = offset;
let uri_str = format!(
"{}/cloud-connect-azure/entities/account/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_tenant_ids {
req_builder = match "multi" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("tenant_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"tenant_ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_scan_type {
req_builder = req_builder.query(&[("scan-type", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_status {
req_builder = req_builder.query(&[("status", ¶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_offset {
req_builder = req_builder.query(&[("offset", ¶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::RegistrationAzureAccountResponseV1`",
)));
}
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::RegistrationAzureAccountResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetDiscoverCloudAzureAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_discover_cloud_azure_tenant_ids(
configuration: &configuration::Configuration,
) -> Result<models::RegistrationAzureTenantIdsResponseV1, Error<GetDiscoverCloudAzureTenantIdsError>>
{
let uri_str = format!(
"{}/cloud-connect-azure/entities/tenant-id/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &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());
};
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::RegistrationAzureTenantIdsResponseV1`",
)));
}
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::RegistrationAzureTenantIdsResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetDiscoverCloudAzureTenantIdsError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_discover_cloud_azure_user_scripts(
configuration: &configuration::Configuration,
) -> Result<
models::RegistrationAzureProvisionGetUserScriptResponseV1,
Error<GetDiscoverCloudAzureUserScriptsError>,
> {
let uri_str = format!(
"{}/cloud-connect-azure/entities/user-scripts/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &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());
};
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::RegistrationAzureProvisionGetUserScriptResponseV1`",
)));
}
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::RegistrationAzureProvisionGetUserScriptResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetDiscoverCloudAzureUserScriptsError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_discover_cloud_azure_user_scripts_attachment(
configuration: &configuration::Configuration,
tenant_id: Vec<String>,
subscription_ids: Option<Vec<String>>,
template: Option<&str>,
azure_management_group: Option<bool>,
) -> Result<
models::RegistrationAzureProvisionGetUserScriptResponseV1,
Error<GetDiscoverCloudAzureUserScriptsAttachmentError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_tenant_id = tenant_id;
let p_query_subscription_ids = subscription_ids;
let p_query_template = template;
let p_query_azure_management_group = azure_management_group;
let uri_str = format!(
"{}/cloud-connect-azure/entities/user-scripts-download/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = match "csv" {
"multi" => req_builder.query(
&p_query_tenant_id
.into_iter()
.map(|p| ("tenant-id".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"tenant-id",
&p_query_tenant_id
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
if let Some(ref param_value) = p_query_subscription_ids {
req_builder = match "csv" {
"multi" => req_builder.query(
¶m_value
.into_iter()
.map(|p| ("subscription_ids".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"subscription_ids",
¶m_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_template {
req_builder = req_builder.query(&[("template", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_azure_management_group {
req_builder = req_builder.query(&[("azure_management_group", ¶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::RegistrationAzureProvisionGetUserScriptResponseV1`",
)));
}
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::RegistrationAzureProvisionGetUserScriptResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetDiscoverCloudAzureUserScriptsAttachmentError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_horizon_d4_c_scripts(
configuration: &configuration::Configuration,
single_account: Option<&str>,
organization_id: Option<&str>,
delete: Option<&str>,
account_type: Option<&str>,
) -> Result<models::RegistrationStaticScriptsResponse, Error<GetHorizonD4CScriptsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_single_account = single_account;
let p_query_organization_id = organization_id;
let p_query_delete = delete;
let p_query_account_type = account_type;
let uri_str = format!(
"{}/settings-discover/entities/gen/scripts/v1",
configuration.base_path
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_single_account {
req_builder = req_builder.query(&[("single_account", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_organization_id {
req_builder = req_builder.query(&[("organization-id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_delete {
req_builder = req_builder.query(&[("delete", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_account_type {
req_builder = req_builder.query(&[("account_type", ¶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::RegistrationStaticScriptsResponse`",
)));
}
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::RegistrationStaticScriptsResponse`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<GetHorizonD4CScriptsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn update_d4_cgcp_service_accounts_ext(
configuration: &configuration::Configuration,
body: models::RegistrationGcpServiceAccountPatchRequestV1,
) -> Result<
models::RegistrationGcpServiceAccountResponseExtV1,
Error<UpdateD4CgcpServiceAccountsExtError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!(
"{}/cloud-connect-gcp/entities/service-accounts/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::RegistrationGcpServiceAccountResponseExtV1`",
)));
}
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::RegistrationGcpServiceAccountResponseExtV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateD4CgcpServiceAccountsExtError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn update_discover_cloud_azure_account_client_id(
configuration: &configuration::Configuration,
id: &str,
object_id: Option<&str>,
tenant_id: Option<&str>,
) -> Result<
models::RegistrationAzureTenantConfigurationResponseV1,
Error<UpdateDiscoverCloudAzureAccountClientIdError>,
> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_id = id;
let p_query_object_id = object_id;
let p_query_tenant_id = tenant_id;
let uri_str = format!(
"{}/cloud-connect-azure/entities/client-id/v1",
configuration.base_path
);
let mut req_builder = configuration
.client
.request(reqwest::Method::PATCH, &uri_str);
req_builder = req_builder.query(&[("id", &p_query_id.to_string())]);
if let Some(ref param_value) = p_query_object_id {
req_builder = req_builder.query(&[("object_id", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_tenant_id {
req_builder = req_builder.query(&[("tenant-id", ¶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::RegistrationAzureTenantConfigurationResponseV1`",
)));
}
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::RegistrationAzureTenantConfigurationResponseV1`"
))));
}
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateDiscoverCloudAzureAccountClientIdError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}