From aebf6e3f44426e965bc430f76b5ebe1ec11e83db Mon Sep 17 00:00:00 2001 From: Simon Lukasik Date: Fri, 2 Dec 2022 16:30:13 +0000 Subject: [PATCH] Re-generate the codebase using the latest swagger --- src/apis/installation_tokens_settings_api.rs | 62 +++++ src/apis/mod.rs | 1 + src/apis/mssp_api.rs | 237 ++++++++++++++++++ .../api_customer_settings_patch_request_v1.rs | 28 +++ src/models/mod.rs | 4 + src/models/msaspec_ids_request.rs | 21 ++ 6 files changed, 353 insertions(+) create mode 100644 src/apis/installation_tokens_settings_api.rs create mode 100644 src/models/api_customer_settings_patch_request_v1.rs create mode 100644 src/models/msaspec_ids_request.rs diff --git a/src/apis/installation_tokens_settings_api.rs b/src/apis/installation_tokens_settings_api.rs new file mode 100644 index 00000000..9da26567 --- /dev/null +++ b/src/apis/installation_tokens_settings_api.rs @@ -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> { + 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 = 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)) + } +} diff --git a/src/apis/mod.rs b/src/apis/mod.rs index a4b7f796..d880b1b8 100644 --- a/src/apis/mod.rs +++ b/src/apis/mod.rs @@ -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; diff --git a/src/apis/mssp_api.rs b/src/apis/mssp_api.rs index 3d52fcc1..ecdb1d06 100644 --- a/src/apis/mssp_api.rs +++ b/src/apis/mssp_api.rs @@ -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)] @@ -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)] @@ -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)] @@ -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)] @@ -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)] @@ -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> { + 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 = 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) -> Result> { let local_var_configuration = configuration; @@ -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) -> Result> { + 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::>()), + _ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::>().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 = 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) -> Result> { let local_var_configuration = configuration; @@ -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) -> Result> { + 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::>()), + _ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::>().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 = 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) -> Result> { let local_var_configuration = configuration; @@ -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) -> Result> { + 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::>()), + _ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::>().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 = 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) -> Result> { let local_var_configuration = configuration; @@ -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) -> Result> { + 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::>()), + _ => local_var_req_builder.query(&[("ids", &ids.into_iter().map(|p| p.to_string()).collect::>().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 = 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, limit: Option) -> Result> { let local_var_configuration = configuration; diff --git a/src/models/api_customer_settings_patch_request_v1.rs b/src/models/api_customer_settings_patch_request_v1.rs new file mode 100644 index 00000000..043b3c1b --- /dev/null +++ b/src/models/api_customer_settings_patch_request_v1.rs @@ -0,0 +1,28 @@ +/* + * 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 + */ + +/// ApiCustomerSettingsPatchRequestV1 : To require tokens for all installations in your CID, set `tokens_required` to `true`. To disable token requirement, set `tokens_required` to `false`To modify the maximum number of active tokens a customer may have, provide a positive interger value on `max_active_tokens` field + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct ApiCustomerSettingsPatchRequestV1 { + /// Set to a positive interger value to set limit of active tokens a customer may have at a time. + #[serde(rename = "max_active_tokens", skip_serializing_if = "Option::is_none")] + pub max_active_tokens: Option, + /// Set to true to enable installation tokens for the customer. + #[serde(rename = "tokens_required", skip_serializing_if = "Option::is_none")] + pub tokens_required: Option, +} + +impl ApiCustomerSettingsPatchRequestV1 { + /// To require tokens for all installations in your CID, set `tokens_required` to `true`. To disable token requirement, set `tokens_required` to `false`To modify the maximum number of active tokens a customer may have, provide a positive interger value on `max_active_tokens` field + pub fn new() -> ApiCustomerSettingsPatchRequestV1 { + ApiCustomerSettingsPatchRequestV1 { max_active_tokens: None, tokens_required: None } + } +} diff --git a/src/models/mod.rs b/src/models/mod.rs index 10593f31..3943951b 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -14,6 +14,8 @@ pub mod api_case_creation_request; pub use self::api_case_creation_request::ApiCaseCreationRequest; pub mod api_case_update_request; pub use self::api_case_update_request::ApiCaseUpdateRequest; +pub mod api_customer_settings_patch_request_v1; +pub use self::api_customer_settings_patch_request_v1::ApiCustomerSettingsPatchRequestV1; pub mod api_customer_settings_resource_v1; pub use self::api_customer_settings_resource_v1::ApiCustomerSettingsResourceV1; pub mod api_customer_settings_response_v1; @@ -1116,6 +1118,8 @@ pub mod msa_resources; pub use self::msa_resources::MsaResources; pub mod msaspec_action_parameter; pub use self::msaspec_action_parameter::MsaspecActionParameter; +pub mod msaspec_ids_request; +pub use self::msaspec_ids_request::MsaspecIdsRequest; pub mod msaspec_query_response; pub use self::msaspec_query_response::MsaspecQueryResponse; pub mod msaspec_response_fields; diff --git a/src/models/msaspec_ids_request.rs b/src/models/msaspec_ids_request.rs new file mode 100644 index 00000000..f31fcb23 --- /dev/null +++ b/src/models/msaspec_ids_request.rs @@ -0,0 +1,21 @@ +/* + * 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 + */ + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct MsaspecIdsRequest { + #[serde(rename = "ids")] + pub ids: Vec, +} + +impl MsaspecIdsRequest { + pub fn new(ids: Vec) -> MsaspecIdsRequest { + MsaspecIdsRequest { ids } + } +}