Skip to content

Commit b58a632

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI specs for static-analysis-api missing endpoints (#1651)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 228024d commit b58a632

109 files changed

Lines changed: 18159 additions & 1010 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.generator/schemas/v2/openapi.yaml

Lines changed: 2777 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Get AST for source code returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4+
use datadog_api_client::datadogV2::model::GetAstRequest;
5+
use datadog_api_client::datadogV2::model::GetAstRequestData;
6+
use datadog_api_client::datadogV2::model::GetAstRequestDataAttributes;
7+
use datadog_api_client::datadogV2::model::GetAstRequestDataType;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
let body = GetAstRequest::new(GetAstRequestData::new(
12+
GetAstRequestDataAttributes::new(
13+
"aW1wb3J0IHN5cw==".to_string(),
14+
"utf-8".to_string(),
15+
"python".to_string(),
16+
),
17+
GetAstRequestDataType::GET_AST_REQUEST,
18+
));
19+
let mut configuration = datadog::Configuration::new();
20+
configuration.set_unstable_operation_enabled("v2.CreateStaticAnalysisAst", true);
21+
let api = SecurityMonitoringAPI::with_config(configuration);
22+
let resp = api.create_static_analysis_ast(body).await;
23+
if let Ok(value) = resp {
24+
println!("{:#?}", value);
25+
} else {
26+
println!("{:#?}", resp.unwrap_err());
27+
}
28+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Analyze code returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4+
use datadog_api_client::datadogV2::model::AnalysisRequest;
5+
use datadog_api_client::datadogV2::model::AnalysisRequestData;
6+
use datadog_api_client::datadogV2::model::AnalysisRequestDataAttributes;
7+
use datadog_api_client::datadogV2::model::AnalysisRequestDataType;
8+
use datadog_api_client::datadogV2::model::AnalysisRequestRule;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
let body = AnalysisRequest::new(AnalysisRequestData::new(
13+
AnalysisRequestDataAttributes::new(
14+
"aW1wb3J0IHN5cw==".to_string(),
15+
"utf-8".to_string(),
16+
"test.py".to_string(),
17+
"python".to_string(),
18+
vec![AnalysisRequestRule::new(
19+
"BEST_PRACTICES".to_string(),
20+
"abc123def456".to_string(),
21+
"ZnVuY3Rpb24gdmlzaXQobm9kZSkge30=".to_string(),
22+
"python-best-practices/no-exit".to_string(),
23+
"python".to_string(),
24+
"WARNING".to_string(),
25+
"KGNhbGwgbmFtZTogKGF0dHJpYnV0ZSkpQHZhbA==".to_string(),
26+
"TREE_SITTER_QUERY".to_string(),
27+
)
28+
.entity_checked(None)
29+
.regex(None)],
30+
),
31+
AnalysisRequestDataType::ANALYSIS_REQUEST,
32+
));
33+
let mut configuration = datadog::Configuration::new();
34+
configuration.set_unstable_operation_enabled("v2.CreateStaticAnalysisServerAnalysis", true);
35+
let api = SecurityMonitoringAPI::with_config(configuration);
36+
let resp = api.create_static_analysis_server_analysis(body).await;
37+
if let Ok(value) = resp {
38+
println!("{:#?}", value);
39+
} else {
40+
println!("{:#?}", resp.unwrap_err());
41+
}
42+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Get default rulesets for a language returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.GetStaticAnalysisDefaultRulesets", true);
9+
let api = SecurityMonitoringAPI::with_config(configuration);
10+
let resp = api
11+
.get_static_analysis_default_rulesets("python".to_string())
12+
.await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Get node types for a language returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.GetStaticAnalysisNodeTypes", true);
9+
let api = SecurityMonitoringAPI::with_config(configuration);
10+
let resp = api
11+
.get_static_analysis_node_types("python".to_string())
12+
.await;
13+
if let Ok(value) = resp {
14+
println!("{:#?}", value);
15+
} else {
16+
println!("{:#?}", resp.unwrap_err());
17+
}
18+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Get a SAST ruleset returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::GetStaticAnalysisRulesetOptionalParams;
4+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
let mut configuration = datadog::Configuration::new();
9+
configuration.set_unstable_operation_enabled("v2.GetStaticAnalysisRuleset", true);
10+
let api = SecurityMonitoringAPI::with_config(configuration);
11+
let resp = api
12+
.get_static_analysis_ruleset(
13+
"python-best-practices".to_string(),
14+
GetStaticAnalysisRulesetOptionalParams::default(),
15+
)
16+
.await;
17+
if let Ok(value) = resp {
18+
println!("{:#?}", value);
19+
} else {
20+
println!("{:#?}", resp.unwrap_err());
21+
}
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Get tree-sitter WASM file returns "BLOB with the content of the WASM file"
2+
// response
3+
use datadog_api_client::datadog;
4+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
let mut configuration = datadog::Configuration::new();
9+
configuration.set_unstable_operation_enabled("v2.GetStaticAnalysisTreeSitterWasm", true);
10+
let api = SecurityMonitoringAPI::with_config(configuration);
11+
let resp = api
12+
.get_static_analysis_tree_sitter_wasm("tree-sitter-python.wasm".to_string())
13+
.await;
14+
if let Ok(value) = resp {
15+
println!("{:#?}", value);
16+
} else {
17+
println!("{:#?}", resp.unwrap_err());
18+
}
19+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// List codegen rulesets returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
let mut configuration = datadog::Configuration::new();
8+
configuration.set_unstable_operation_enabled("v2.ListStaticAnalysisCodegenRulesets", true);
9+
let api = SecurityMonitoringAPI::with_config(configuration);
10+
let resp = api.list_static_analysis_codegen_rulesets().await;
11+
if let Ok(value) = resp {
12+
println!("{:#?}", value);
13+
} else {
14+
println!("{:#?}", resp.unwrap_err());
15+
}
16+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Create an AI custom rule returns "Successfully created" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_static_analysis::StaticAnalysisAPI;
4+
use datadog_api_client::datadogV2::model::AiCustomRuleDataType;
5+
use datadog_api_client::datadogV2::model::AiCustomRuleRequest;
6+
use datadog_api_client::datadogV2::model::AiCustomRuleRequestAttributes;
7+
use datadog_api_client::datadogV2::model::AiCustomRuleRequestData;
8+
9+
#[tokio::main]
10+
async fn main() {
11+
let body = AiCustomRuleRequest::new().data(
12+
AiCustomRuleRequestData::new()
13+
.attributes(AiCustomRuleRequestAttributes::new().name("my-ai-rule".to_string()))
14+
.id("my-ai-rule".to_string())
15+
.type_(AiCustomRuleDataType::AI_RULE),
16+
);
17+
let mut configuration = datadog::Configuration::new();
18+
configuration.set_unstable_operation_enabled("v2.CreateAiCustomRule", true);
19+
let api = StaticAnalysisAPI::with_config(configuration);
20+
let resp = api
21+
.create_ai_custom_rule("my-ai-ruleset".to_string(), body)
22+
.await;
23+
if let Ok(value) = resp {
24+
println!("{:#?}", value);
25+
} else {
26+
println!("{:#?}", resp.unwrap_err());
27+
}
28+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Create an AI custom rule revision returns "Successfully created" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_static_analysis::StaticAnalysisAPI;
4+
use datadog_api_client::datadogV2::model::AiCustomRuleRevisionDataType;
5+
use datadog_api_client::datadogV2::model::AiCustomRuleRevisionExecutionMode;
6+
use datadog_api_client::datadogV2::model::AiCustomRuleRevisionRequest;
7+
use datadog_api_client::datadogV2::model::AiCustomRuleRevisionRequestAttributes;
8+
use datadog_api_client::datadogV2::model::AiCustomRuleRevisionRequestData;
9+
use datadog_api_client::datadogV2::model::CustomRuleRevisionAttributesCategory;
10+
use datadog_api_client::datadogV2::model::CustomRuleRevisionAttributesSeverity;
11+
12+
#[tokio::main]
13+
async fn main() {
14+
let body = AiCustomRuleRevisionRequest::new().data(
15+
AiCustomRuleRevisionRequestData::new()
16+
.attributes(
17+
AiCustomRuleRevisionRequestAttributes::new(
18+
CustomRuleRevisionAttributesCategory::SECURITY,
19+
"Content".to_string(),
20+
"Ruleset description".to_string(),
21+
vec![],
22+
AiCustomRuleRevisionExecutionMode::AUTO,
23+
vec!["**/*.py".to_string()],
24+
false,
25+
false,
26+
CustomRuleRevisionAttributesSeverity::ERROR,
27+
"Ruleset short description".to_string(),
28+
)
29+
.cwe(Some("79".to_string()))
30+
.version_id(1),
31+
)
32+
.id("revision-abc-123".to_string())
33+
.type_(AiCustomRuleRevisionDataType::AI_RULE_REVISION),
34+
);
35+
let mut configuration = datadog::Configuration::new();
36+
configuration.set_unstable_operation_enabled("v2.CreateAiCustomRuleRevision", true);
37+
let api = StaticAnalysisAPI::with_config(configuration);
38+
let resp = api
39+
.create_ai_custom_rule_revision("my-ai-ruleset".to_string(), "my-ai-rule".to_string(), body)
40+
.await;
41+
if let Ok(value) = resp {
42+
println!("{:#?}", value);
43+
} else {
44+
println!("{:#?}", resp.unwrap_err());
45+
}
46+
}

0 commit comments

Comments
 (0)