/*
* 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 crate::models;
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ItautomationTaskExecution {
#[serde(rename = "composite_query", skip_serializing_if = "Option::is_none")]
pub composite_query: Option<Box<models::ItautomationCompositeQuery>>,
/// Whether to discover new hosts for the scheduled task. Example: true
#[serde(rename = "discover_new_hosts", skip_serializing_if = "Option::is_none")]
pub discover_new_hosts: Option<bool>,
/// Whether to discover offline hosts for the scheduled task. Example: true
#[serde(
rename = "discover_offline_hosts",
skip_serializing_if = "Option::is_none"
)]
pub discover_offline_hosts: Option<bool>,
/// Whether to distribute the scheduled task. Example: true
#[serde(rename = "distribute", skip_serializing_if = "Option::is_none")]
pub distribute: Option<bool>,
/// Key-value pairs of argument values to pass when executing the task. Example: {'api_key': 'abc123', 'region': 'us-east-1'}
#[serde(rename = "execution_args", skip_serializing_if = "Option::is_none")]
pub execution_args: Option<std::collections::HashMap<String, String>>,
/// Duration for which the task stays active. Once expired, new and offline hosts won't be targeted. Example: 1m
#[serde(
rename = "expiration_interval",
skip_serializing_if = "Option::is_none"
)]
pub expiration_interval: Option<String>,
#[serde(rename = "guardrails", skip_serializing_if = "Option::is_none")]
pub guardrails: Option<Box<models::FalconforitapiGuardrails>>,
/// Unique identifier for the task execution. Example: f64b95555ef54ea682619ce880d267cc
#[serde(rename = "id")]
pub id: String,
/// OSQuery to execute. Example: select * from users
#[serde(rename = "os_query", skip_serializing_if = "Option::is_none")]
pub os_query: Option<String>,
/// List of supported platforms. Example: ['Windows', 'Linux', 'Mac']
#[serde(rename = "platforms", skip_serializing_if = "Option::is_none")]
pub platforms: Option<Vec<String>>,
#[serde(rename = "queries", skip_serializing_if = "Option::is_none")]
pub queries: Option<Box<models::ItautomationScripts>>,
#[serde(rename = "remediations", skip_serializing_if = "Option::is_none")]
pub remediations: Option<Box<models::ItautomationScripts>>,
/// Username/api client name of who initiated the execution. Example: john.smith@crowdstrike.com
#[serde(rename = "run_by")]
pub run_by: String,
/// Type of execution. Example: OnDemand
#[serde(rename = "run_type")]
pub run_type: String,
#[serde(rename = "status_by_stage", skip_serializing_if = "Option::is_none")]
pub status_by_stage: Option<Box<models::ItautomationTaskStageExecutionStatus>>,
/// Target filter in FQL format. Example: platform_name: 'Windows'
#[serde(rename = "target")]
pub target: String,
/// ID of the task execution. Example: b533b64eed8a49a8aad84a0b82983939
#[serde(rename = "task_id", skip_serializing_if = "Option::is_none")]
pub task_id: Option<String>,
/// Name of the task execution. Example: OSQuery Check
#[serde(rename = "task_name", skip_serializing_if = "Option::is_none")]
pub task_name: Option<String>,
/// Parameters for the task
#[serde(rename = "task_parameters", skip_serializing_if = "Option::is_none")]
pub task_parameters: Option<Vec<models::ItautomationTaskParameter>>,
/// Type of task execution.
#[serde(rename = "task_type")]
pub task_type: TaskType,
/// Conditions that trigger remediation scripts
#[serde(rename = "trigger_condition", skip_serializing_if = "Option::is_none")]
pub trigger_condition: Option<Vec<models::FalconforitapiConditionGroup>>,
/// Conditions that verify action tasks
#[serde(
rename = "verification_condition",
skip_serializing_if = "Option::is_none"
)]
pub verification_condition: Option<Vec<models::FalconforitapiConditionGroup>>,
}
impl ItautomationTaskExecution {
pub fn new(
id: String,
run_by: String,
run_type: String,
target: String,
task_type: TaskType,
) -> ItautomationTaskExecution {
ItautomationTaskExecution {
composite_query: None,
discover_new_hosts: None,
discover_offline_hosts: None,
distribute: None,
execution_args: None,
expiration_interval: None,
guardrails: None,
id,
os_query: None,
platforms: None,
queries: None,
remediations: None,
run_by,
run_type,
status_by_stage: None,
target,
task_id: None,
task_name: None,
task_parameters: None,
task_type,
trigger_condition: None,
verification_condition: None,
}
}
}
/// Type of task execution.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TaskType {
#[serde(rename = "query")]
Query,
#[serde(rename = "remediation")]
Remediation,
}
impl Default for TaskType {
fn default() -> TaskType {
Self::Query
}
}