Skip to content

Commit

Permalink
Merge pull request #80 from isimluk/swagger-update
Browse files Browse the repository at this point in the history
Re-generate the codebase using the latest swagger
  • Loading branch information
isimluk committed Dec 2, 2022
2 parents 833c0e4 + aebf6e3 commit 65693db
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/apis/installation_tokens_settings_api.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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 more information about API endpoints that don't yet support OAuth2, 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 reqwest;

use super::{configuration, Error};
use crate::apis::ResponseContent;

/// struct for typed errors of method [`customer_settings_update`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CustomerSettingsUpdateError {
Status400(crate::models::MsaReplyMetaOnly),
Status403(crate::models::MsaReplyMetaOnly),
Status404(crate::models::MsaQueryResponse),
Status429(crate::models::MsaReplyMetaOnly),
Status500(crate::models::MsaReplyMetaOnly),
DefaultResponse(crate::models::MsaQueryResponse),
UnknownValue(serde_json::Value),
}

pub async fn customer_settings_update(configuration: &configuration::Configuration, body: crate::models::ApiCustomerSettingsPatchRequestV1) -> Result<crate::models::MsaQueryResponse, Error<CustomerSettingsUpdateError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/installation-tokens/entities/customer-settings/v1", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&body);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CustomerSettingsUpdateError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
1 change: 1 addition & 0 deletions src/apis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub mod hosts_api;
pub mod identity_protection_api;
pub mod incidents_api;
pub mod installation_tokens_api;
pub mod installation_tokens_settings_api;
pub mod intel_api;
pub mod ioa_exclusions_api;
pub mod ioc_api;
Expand Down
237 changes: 237 additions & 0 deletions src/apis/mssp_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ pub enum GetChildrenError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_children_v2`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetChildrenV2Error {
Status400(crate::models::MsaspecResponseFields),
Status403(crate::models::MsaspecResponseFields),
Status429(crate::models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_cid_group_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand All @@ -145,6 +155,16 @@ pub enum GetCidGroupByIdError {
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(crate::models::MsaErrorsOnly),
Status403(crate::models::MsaErrorsOnly),
Status429(crate::models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_cid_group_members_by`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand All @@ -156,6 +176,16 @@ pub enum GetCidGroupMembersByError {
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(crate::models::MsaErrorsOnly),
Status403(crate::models::MsaErrorsOnly),
Status429(crate::models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_roles_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand All @@ -178,6 +208,16 @@ pub enum GetUserGroupMembersByIdError {
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(crate::models::MsaErrorsOnly),
Status403(crate::models::MsaErrorsOnly),
Status429(crate::models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_user_groups_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand All @@ -189,6 +229,16 @@ pub enum GetUserGroupsByIdError {
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(crate::models::MsaErrorsOnly),
Status403(crate::models::MsaErrorsOnly),
Status429(crate::models::MsaReplyMetaOnly),
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`query_children`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -667,6 +717,41 @@ pub async fn get_children(configuration: &configuration::Configuration, ids: Vec
}
}

pub async fn get_children_v2(configuration: &configuration::Configuration, body: crate::models::MsaspecIdsRequest) -> Result<crate::models::DomainChildrenResponseV1, Error<GetChildrenV2Error>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/mssp/entities/children/GET/v2", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&body);

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetChildrenV2Error> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn get_cid_group_by_id(configuration: &configuration::Configuration, cid_group_ids: Vec<String>) -> Result<crate::models::DomainCidGroupsResponseV1, Error<GetCidGroupByIdError>> {
let local_var_configuration = configuration;

Expand Down Expand Up @@ -705,6 +790,44 @@ pub async fn get_cid_group_by_id(configuration: &configuration::Configuration, c
}
}

pub async fn get_cid_group_by_id_v2(configuration: &configuration::Configuration, ids: Vec<String>) -> Result<crate::models::DomainCidGroupsResponseV1, Error<GetCidGroupByIdV2Error>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/mssp/entities/cid-groups/v2", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&ids.into_iter().map(|p| ("ids".to_owned(), p)).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetCidGroupByIdV2Error> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn get_cid_group_members_by(configuration: &configuration::Configuration, cid_group_ids: Vec<String>) -> Result<crate::models::DomainCidGroupMembersResponseV1, Error<GetCidGroupMembersByError>> {
let local_var_configuration = configuration;

Expand Down Expand Up @@ -743,6 +866,44 @@ pub async fn get_cid_group_members_by(configuration: &configuration::Configurati
}
}

pub async fn get_cid_group_members_by_v2(configuration: &configuration::Configuration, ids: Vec<String>) -> Result<crate::models::DomainCidGroupMembersResponseV1, Error<GetCidGroupMembersByV2Error>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/mssp/entities/cid-group-members/v2", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&ids.into_iter().map(|p| ("ids".to_owned(), p)).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetCidGroupMembersByV2Error> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn get_roles_by_id(configuration: &configuration::Configuration, ids: Vec<String>) -> Result<crate::models::DomainMsspRoleResponseV1, Error<GetRolesByIdError>> {
let local_var_configuration = configuration;

Expand Down Expand Up @@ -819,6 +980,44 @@ pub async fn get_user_group_members_by_id(configuration: &configuration::Configu
}
}

pub async fn get_user_group_members_by_idv2(configuration: &configuration::Configuration, ids: Vec<String>) -> Result<crate::models::DomainUserGroupMembersResponseV1, Error<GetUserGroupMembersByIdv2Error>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/mssp/entities/user-group-members/v2", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&ids.into_iter().map(|p| ("ids".to_owned(), p)).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetUserGroupMembersByIdv2Error> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn get_user_groups_by_id(configuration: &configuration::Configuration, user_group_ids: Vec<String>) -> Result<crate::models::DomainUserGroupsResponseV1, Error<GetUserGroupsByIdError>> {
let local_var_configuration = configuration;

Expand Down Expand Up @@ -857,6 +1056,44 @@ pub async fn get_user_groups_by_id(configuration: &configuration::Configuration,
}
}

pub async fn get_user_groups_by_idv2(configuration: &configuration::Configuration, ids: Vec<String>) -> Result<crate::models::DomainUserGroupsResponseV1, Error<GetUserGroupsByIdv2Error>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/mssp/entities/user-groups/v2", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&ids.into_iter().map(|p| ("ids".to_owned(), p)).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetUserGroupsByIdv2Error> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn query_children(configuration: &configuration::Configuration, sort: Option<&str>, offset: Option<i32>, limit: Option<i32>) -> Result<crate::models::MsaQueryResponse, Error<QueryChildrenError>> {
let local_var_configuration = configuration;

Expand Down

0 comments on commit 65693db

Please sign in to comment.