Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
399 changes: 200 additions & 199 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions examples/v2_security-monitoring_CancelThreatHuntingJob.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Cancel a threat hunting job returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.CancelThreatHuntingJob", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.cancel_threat_hunting_job("job_id".to_string()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAP

#[tokio::main]
async fn main() {
// there is a valid "historical_job" in the system
let historical_job_data_id = std::env::var("HISTORICAL_JOB_DATA_ID").unwrap();
// there is a valid "threat_hunting_job" in the system
let threat_hunting_job_data_id = std::env::var("THREAT_HUNTING_JOB_DATA_ID").unwrap();
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.CancelHistoricalJob", true);
configuration.set_unstable_operation_enabled("v2.RunHistoricalJob", true);
configuration.set_unstable_operation_enabled("v2.CancelThreatHuntingJob", true);
configuration.set_unstable_operation_enabled("v2.RunThreatHuntingJob", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api
.cancel_historical_job(historical_job_data_id.clone())
.cancel_threat_hunting_job(threat_hunting_job_data_id.clone())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAP
#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.DeleteHistoricalJob", true);
configuration.set_unstable_operation_enabled("v2.DeleteThreatHuntingJob", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.delete_historical_job("job_id".to_string()).await;
let resp = api.delete_threat_hunting_job("job_id".to_string()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAP

#[tokio::main]
async fn main() {
// there is a valid "historical_job" in the system
let historical_job_data_id = std::env::var("HISTORICAL_JOB_DATA_ID").unwrap();
// there is a valid "threat_hunting_job" in the system
let threat_hunting_job_data_id = std::env::var("THREAT_HUNTING_JOB_DATA_ID").unwrap();
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.GetHistoricalJob", true);
configuration.set_unstable_operation_enabled("v2.RunHistoricalJob", true);
configuration.set_unstable_operation_enabled("v2.GetThreatHuntingJob", true);
configuration.set_unstable_operation_enabled("v2.RunThreatHuntingJob", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.get_historical_job(historical_job_data_id.clone()).await;
let resp = api
.get_threat_hunting_job(threat_hunting_job_data_id.clone())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
Expand Down
19 changes: 19 additions & 0 deletions examples/v2_security-monitoring_ListThreatHuntingJobs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// List threat hunting jobs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::ListThreatHuntingJobsOptionalParams;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.ListThreatHuntingJobs", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api
.list_threat_hunting_jobs(ListThreatHuntingJobsOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// List historical jobs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::ListHistoricalJobsOptionalParams;
use datadog_api_client::datadogV2::api_security_monitoring::ListThreatHuntingJobsOptionalParams;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;

#[tokio::main]
async fn main() {
// there is a valid "historical_job" in the system
// there is a valid "threat_hunting_job" in the system
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.ListHistoricalJobs", true);
configuration.set_unstable_operation_enabled("v2.RunHistoricalJob", true);
configuration.set_unstable_operation_enabled("v2.ListThreatHuntingJobs", true);
configuration.set_unstable_operation_enabled("v2.RunThreatHuntingJob", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api
.list_historical_jobs(
ListHistoricalJobsOptionalParams::default().filter_query("id:string".to_string()),
.list_threat_hunting_jobs(
ListThreatHuntingJobsOptionalParams::default().filter_query("id:string".to_string()),
)
.await;
if let Ok(value) = resp {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// Run a historical job returns "Status created" response
// Run a threat hunting job returns "Status created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
use datadog_api_client::datadogV2::model::HistoricalJobOptions;
use datadog_api_client::datadogV2::model::HistoricalJobQuery;
use datadog_api_client::datadogV2::model::JobDefinition;
use datadog_api_client::datadogV2::model::RunHistoricalJobRequest;
use datadog_api_client::datadogV2::model::RunHistoricalJobRequestAttributes;
use datadog_api_client::datadogV2::model::RunHistoricalJobRequestData;
use datadog_api_client::datadogV2::model::RunHistoricalJobRequestDataType;
use datadog_api_client::datadogV2::model::RunThreatHuntingJobRequest;
use datadog_api_client::datadogV2::model::RunThreatHuntingJobRequestAttributes;
use datadog_api_client::datadogV2::model::RunThreatHuntingJobRequestData;
use datadog_api_client::datadogV2::model::RunThreatHuntingJobRequestDataType;
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleCaseCreate;
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleEvaluationWindow;
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleKeepAlive;
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleMaxSignalDuration;
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleQueryAggregation;
use datadog_api_client::datadogV2::model::SecurityMonitoringRuleSeverity;
use datadog_api_client::datadogV2::model::ThreatHuntingJobOptions;
use datadog_api_client::datadogV2::model::ThreatHuntingJobQuery;

#[tokio::main]
async fn main() {
let body = RunHistoricalJobRequest::new().data(
RunHistoricalJobRequestData::new()
let body = RunThreatHuntingJobRequest::new().data(
RunThreatHuntingJobRequestData::new()
.attributes(
RunHistoricalJobRequestAttributes::new().job_definition(
RunThreatHuntingJobRequestAttributes::new().job_definition(
JobDefinition::new(
vec![SecurityMonitoringRuleCaseCreate::new(
SecurityMonitoringRuleSeverity::INFO,
Expand All @@ -32,15 +32,15 @@ async fn main() {
"main".to_string(),
"A large number of failed login attempts.".to_string(),
"Excessive number of failed attempts.".to_string(),
vec![HistoricalJobQuery::new()
vec![ThreatHuntingJobQuery::new()
.aggregation(SecurityMonitoringRuleQueryAggregation::COUNT)
.distinct_fields(vec![])
.group_by_fields(vec![])
.query("source:non_existing_src_weekend".to_string())],
1730387532611,
)
.options(
HistoricalJobOptions::new()
ThreatHuntingJobOptions::new()
.evaluation_window(
SecurityMonitoringRuleEvaluationWindow::FIFTEEN_MINUTES,
)
Expand All @@ -51,12 +51,12 @@ async fn main() {
.type_("log_detection".to_string()),
),
)
.type_(RunHistoricalJobRequestDataType::HISTORICALDETECTIONSJOBCREATE),
.type_(RunThreatHuntingJobRequestDataType::HISTORICALDETECTIONSJOBCREATE),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.RunHistoricalJob", true);
configuration.set_unstable_operation_enabled("v2.RunThreatHuntingJob", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.run_historical_job(body).await;
let resp = api.run_threat_hunting_job(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,27 +131,27 @@ impl Default for Configuration {
("v2.get_open_api".to_owned(), false),
("v2.list_apis".to_owned(), false),
("v2.update_open_api".to_owned(), false),
("v2.cancel_historical_job".to_owned(), false),
("v2.cancel_threat_hunting_job".to_owned(), false),
("v2.convert_job_result_to_signal".to_owned(), false),
("v2.delete_historical_job".to_owned(), false),
("v2.delete_threat_hunting_job".to_owned(), false),
("v2.get_finding".to_owned(), false),
("v2.get_historical_job".to_owned(), false),
("v2.get_rule_version_history".to_owned(), false),
("v2.get_sbom".to_owned(), false),
("v2.get_security_monitoring_histsignal".to_owned(), false),
(
"v2.get_security_monitoring_histsignals_by_job_id".to_owned(),
false,
),
("v2.get_threat_hunting_job".to_owned(), false),
("v2.list_assets_sbo_ms".to_owned(), false),
("v2.list_findings".to_owned(), false),
("v2.list_historical_jobs".to_owned(), false),
("v2.list_scanned_assets_metadata".to_owned(), false),
("v2.list_security_monitoring_histsignals".to_owned(), false),
("v2.list_threat_hunting_jobs".to_owned(), false),
("v2.list_vulnerabilities".to_owned(), false),
("v2.list_vulnerable_assets".to_owned(), false),
("v2.mute_findings".to_owned(), false),
("v2.run_historical_job".to_owned(), false),
("v2.run_threat_hunting_job".to_owned(), false),
(
"v2.search_security_monitoring_histsignals".to_owned(),
false,
Expand Down
Loading