Skip to content
Open
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
14 changes: 9 additions & 5 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13778,8 +13778,7 @@ components:
description: Attributes of the Jira issue to create.
properties:
assignee_id:
description: Unique identifier of the Datadog user assigned to the Jira
issue.
description: Unique identifier of the user assigned to the Jira issue.
example: f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0
type: string
description:
Expand All @@ -13800,9 +13799,8 @@ components:
type: object
priority:
$ref: '#/components/schemas/CasePriority'
description: Datadog case priority mapped to the Jira issue priority. If
not provided, the priority will be automatically set to "NOT_DEFINED".
To configure the mapping, see [Bidirectional ticket syncing with Jira](https://docs.datadoghq.com/security/ticketing_integrations/#bidirectional-ticket-syncing-with-jira).
description: Priority of the Jira issue. If not provided, the priority will
be automatically set to "NOT_DEFINED".
example: P4
title:
description: Title of the Jira issue. If not provided, the title will be
Expand Down Expand Up @@ -87821,6 +87819,9 @@ paths:
permissions:
- security_monitoring_findings_write
- appsec_vm_write
x-unstable: '**Note**: This endpoint is in beta and is subject to change.

Please check the documentation regularly for updates.'
post:
description: 'Create Jira issues for security findings.

Expand Down Expand Up @@ -87864,6 +87865,9 @@ paths:
permissions:
- security_monitoring_findings_write
- appsec_vm_write
x-unstable: '**Note**: This endpoint is in beta and is subject to change.

Please check the documentation regularly for updates.'
/api/v2/security/findings/search:
post:
description: 'Get a list of security findings that match a search query. [See
Expand Down
61 changes: 26 additions & 35 deletions examples/v2_security-monitoring_CreateJiraIssues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAP
use datadog_api_client::datadogV2::model::CaseManagementProject;
use datadog_api_client::datadogV2::model::CaseManagementProjectData;
use datadog_api_client::datadogV2::model::CaseManagementProjectDataType;
use datadog_api_client::datadogV2::model::CasePriority;
use datadog_api_client::datadogV2::model::CreateJiraIssueRequestArray;
use datadog_api_client::datadogV2::model::CreateJiraIssueRequestData;
use datadog_api_client::datadogV2::model::CreateJiraIssueRequestDataAttributes;
Expand All @@ -12,44 +13,34 @@ use datadog_api_client::datadogV2::model::FindingData;
use datadog_api_client::datadogV2::model::FindingDataType;
use datadog_api_client::datadogV2::model::Findings;
use datadog_api_client::datadogV2::model::JiraIssuesDataType;
use serde_json::Value;
use std::collections::BTreeMap;

#[tokio::main]
async fn main() {
let body = CreateJiraIssueRequestArray::new(vec![
CreateJiraIssueRequestData::new(JiraIssuesDataType::JIRA_ISSUES)
.attributes(
CreateJiraIssueRequestDataAttributes::new()
.description("A description".to_string())
.title("A title".to_string()),
)
.relationships(CreateJiraIssueRequestDataRelationships::new(
Findings::new().data(vec![FindingData::new(
"eWswLWJsdC1hZm5-aS0wMjRlYTgwMzVkZTU1MGIwYQ==".to_string(),
FindingDataType::FINDINGS,
)]),
CaseManagementProject::new(CaseManagementProjectData::new(
"959a6f71-bac8-4027-b1d3-2264f569296f".to_string(),
CaseManagementProjectDataType::PROJECTS,
)),
)),
CreateJiraIssueRequestData::new(JiraIssuesDataType::JIRA_ISSUES)
.attributes(
CreateJiraIssueRequestDataAttributes::new()
.description("A description".to_string())
.title("A title".to_string()),
)
.relationships(CreateJiraIssueRequestDataRelationships::new(
Findings::new().data(vec![FindingData::new(
"a3ZoLXNjbS14eXV-aS0wNWY5MGYwMGE4NDg2ODdlOA==".to_string(),
FindingDataType::FINDINGS,
)]),
CaseManagementProject::new(CaseManagementProjectData::new(
"959a6f71-bac8-4027-b1d3-2264f569296f".to_string(),
CaseManagementProjectDataType::PROJECTS,
)),
)),
]);
let configuration = datadog::Configuration::new();
let body = CreateJiraIssueRequestArray::new(vec![CreateJiraIssueRequestData::new(
JiraIssuesDataType::JIRA_ISSUES,
)
.attributes(
CreateJiraIssueRequestDataAttributes::new()
.assignee_id("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0".to_string())
.description("A description of the Jira issue.".to_string())
.fields(BTreeMap::from([("key1".to_string(), Value::from("value"))]))
.priority(CasePriority::NOT_DEFINED)
.title("A title for the Jira issue.".to_string()),
)
.relationships(CreateJiraIssueRequestDataRelationships::new(
Findings::new().data(vec![FindingData::new(
"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==".to_string(),
FindingDataType::FINDINGS,
)]),
CaseManagementProject::new(CaseManagementProjectData::new(
"aeadc05e-98a8-11ec-ac2c-da7ad0900001".to_string(),
CaseManagementProjectDataType::PROJECTS,
)),
))]);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.CreateJiraIssues", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.create_jira_issues(body).await;
if let Ok(value) = resp {
Expand Down
56 changes: 0 additions & 56 deletions examples/v2_security-monitoring_CreateJiraIssues_379590688.rs

This file was deleted.

50 changes: 0 additions & 50 deletions examples/v2_security-monitoring_CreateJiraIssues_829823123.rs

This file was deleted.

2 changes: 2 additions & 0 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ 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.attach_jira_issue".to_owned(), false),
("v2.cancel_threat_hunting_job".to_owned(), false),
("v2.convert_job_result_to_signal".to_owned(), false),
("v2.create_jira_issues".to_owned(), false),
("v2.delete_threat_hunting_job".to_owned(), false),
("v2.get_finding".to_owned(), false),
("v2.get_rule_version_history".to_owned(), false),
Expand Down
16 changes: 16 additions & 0 deletions src/datadogV2/api/api_security_monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2068,6 +2068,14 @@ impl SecurityMonitoringAPI {
> {
let local_configuration = &self.config;
let operation_id = "v2.attach_jira_issue";
if local_configuration.is_unstable_operation_enabled(operation_id) {
warn!("Using unstable operation {operation_id}");
} else {
let local_error = datadog::UnstableOperationDisabledError {
msg: "Operation 'v2.attach_jira_issue' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

let local_client = &self.client;

Expand Down Expand Up @@ -3214,6 +3222,14 @@ impl SecurityMonitoringAPI {
> {
let local_configuration = &self.config;
let operation_id = "v2.create_jira_issues";
if local_configuration.is_unstable_operation_enabled(operation_id) {
warn!("Using unstable operation {operation_id}");
} else {
let local_error = datadog::UnstableOperationDisabledError {
msg: "Operation 'v2.create_jira_issues' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

let local_client = &self.client;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::fmt::{self, Formatter};
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct CreateJiraIssueRequestDataAttributes {
/// Unique identifier of the Datadog user assigned to the Jira issue.
/// Unique identifier of the user assigned to the Jira issue.
#[serde(rename = "assignee_id")]
pub assignee_id: Option<String>,
/// Description of the Jira issue. If not provided, the description will be automatically generated.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading