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
43 changes: 15 additions & 28 deletions examples/v2/security-monitoring/CreateJiraIssues.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.datadog.api.client.v2.model.CaseManagementProject;
import com.datadog.api.client.v2.model.CaseManagementProjectData;
import com.datadog.api.client.v2.model.CaseManagementProjectDataType;
import com.datadog.api.client.v2.model.CasePriority;
import com.datadog.api.client.v2.model.CreateJiraIssueRequestArray;
import com.datadog.api.client.v2.model.CreateJiraIssueRequestData;
import com.datadog.api.client.v2.model.CreateJiraIssueRequestDataAttributes;
Expand All @@ -15,23 +16,31 @@
import com.datadog.api.client.v2.model.FindingDataType;
import com.datadog.api.client.v2.model.Findings;
import com.datadog.api.client.v2.model.JiraIssuesDataType;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.createJiraIssues", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

CreateJiraIssueRequestArray body =
new CreateJiraIssueRequestArray()
.data(
Arrays.asList(
Collections.singletonList(
new CreateJiraIssueRequestData()
.attributes(
new CreateJiraIssueRequestDataAttributes()
.title("A title")
.description("A description"))
.assigneeId("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0")
.description("A description of the Jira issue.")
.fields(
Map.ofEntries(
Map.entry("key1", "value"),
Map.entry("key2", "['value']"),
Map.entry("key3", "{'key4': 'value'}")))
.priority(CasePriority.NOT_DEFINED)
.title("A title for the Jira issue."))
.relationships(
new CreateJiraIssueRequestDataRelationships()
.findings(
Expand All @@ -40,35 +49,13 @@ public static void main(String[] args) {
Collections.singletonList(
new FindingData()
.id(
"eWswLWJsdC1hZm5-aS0wMjRlYTgwMzVkZTU1MGIwYQ==")
"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==")
.type(FindingDataType.FINDINGS))))
.project(
new CaseManagementProject()
.data(
new CaseManagementProjectData()
.id("959a6f71-bac8-4027-b1d3-2264f569296f")
.type(CaseManagementProjectDataType.PROJECTS))))
.type(JiraIssuesDataType.JIRA_ISSUES),
new CreateJiraIssueRequestData()
.attributes(
new CreateJiraIssueRequestDataAttributes()
.title("A title")
.description("A description"))
.relationships(
new CreateJiraIssueRequestDataRelationships()
.findings(
new Findings()
.data(
Collections.singletonList(
new FindingData()
.id(
"a3ZoLXNjbS14eXV-aS0wNWY5MGYwMGE4NDg2ODdlOA==")
.type(FindingDataType.FINDINGS))))
.project(
new CaseManagementProject()
.data(
new CaseManagementProjectData()
.id("959a6f71-bac8-4027-b1d3-2264f569296f")
.id("aeadc05e-98a8-11ec-ac2c-da7ad0900001")
.type(CaseManagementProjectDataType.PROJECTS))))
.type(JiraIssuesDataType.JIRA_ISSUES)));

Expand Down
63 changes: 0 additions & 63 deletions examples/v2/security-monitoring/CreateJiraIssues_379590688.java

This file was deleted.

68 changes: 0 additions & 68 deletions examples/v2/security-monitoring/CreateJiraIssues_829823123.java

This file was deleted.

2 changes: 2 additions & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,10 @@ public class ApiClient {
put("v2.getOpenAPI", false);
put("v2.listAPIs", false);
put("v2.updateOpenAPI", false);
put("v2.attachJiraIssue", false);
put("v2.cancelThreatHuntingJob", false);
put("v2.convertJobResultToSignal", false);
put("v2.createJiraIssues", false);
put("v2.deleteThreatHuntingJob", false);
put("v2.getFinding", false);
put("v2.getRuleVersionHistory", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ public CompletableFuture<FindingCaseResponse> attachJiraIssueAsync(AttachJiraIss
*/
public ApiResponse<FindingCaseResponse> attachJiraIssueWithHttpInfo(AttachJiraIssueRequest body)
throws ApiException {
// Check if unstable operation is enabled
String operationId = "attachJiraIssue";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
}
Object localVarPostBody = body;

// verify the required parameter 'body' is set
Expand Down Expand Up @@ -388,6 +395,16 @@ public ApiResponse<FindingCaseResponse> attachJiraIssueWithHttpInfo(AttachJiraIs
*/
public CompletableFuture<ApiResponse<FindingCaseResponse>> attachJiraIssueWithHttpInfoAsync(
AttachJiraIssueRequest body) {
// Check if unstable operation is enabled
String operationId = "attachJiraIssue";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<FindingCaseResponse>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
return result;
}
Object localVarPostBody = body;

// verify the required parameter 'body' is set
Expand Down Expand Up @@ -1496,6 +1513,13 @@ public CompletableFuture<FindingCaseResponseArray> createJiraIssuesAsync(
*/
public ApiResponse<FindingCaseResponseArray> createJiraIssuesWithHttpInfo(
CreateJiraIssueRequestArray body) throws ApiException {
// Check if unstable operation is enabled
String operationId = "createJiraIssues";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
}
Object localVarPostBody = body;

// verify the required parameter 'body' is set
Expand Down Expand Up @@ -1538,6 +1562,16 @@ public ApiResponse<FindingCaseResponseArray> createJiraIssuesWithHttpInfo(
*/
public CompletableFuture<ApiResponse<FindingCaseResponseArray>> createJiraIssuesWithHttpInfoAsync(
CreateJiraIssueRequestArray body) {
// Check if unstable operation is enabled
String operationId = "createJiraIssues";
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
CompletableFuture<ApiResponse<FindingCaseResponseArray>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
return result;
}
Object localVarPostBody = body;

// verify the required parameter 'body' is set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public CreateJiraIssueRequestDataAttributes assigneeId(String assigneeId) {
}

/**
* Unique identifier of the Datadog user assigned to the Jira issue.
* Unique identifier of the user assigned to the Jira issue.
*
* @return assigneeId
*/
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/com/datadog/api/Undo.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public static class Parameter {
public List<Parameter> parameters;

public Map<String, Object> getRequestParameters(
Object responseData, Object requestData, Method requestBuilder, ObjectMapper mapper, Map<String, Object> pathParameters) {
Object responseData,
Object requestData,
Method requestBuilder,
ObjectMapper mapper,
Map<String, Object> pathParameters) {
Map<String, Object> requestParams = new HashMap<String, Object>();
for (int i = 0; i < parameters.size(); i++) {
Undo.UndoMethod.Parameter p = parameters.get(i);
Expand Down
16 changes: 12 additions & 4 deletions src/test/java/com/datadog/api/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public void newRequest(String name) {
}
}
parametersArray = new ArrayList<>();
pathParameters = new HashMap<>(); // Clear path parameters for new request
pathParameters = new HashMap<>(); // Clear path parameters for new request
}

public void addRequestParameter(String parameterName, String value)
Expand Down Expand Up @@ -458,7 +458,9 @@ public void given(String apiVersion, Given step) throws Exception {

Undo undoSettings = UndoAction.UndoAction().getUndo(apiVersion, step.getOperationName());
if (undoSettings != null) {
undo.add(getRequestUndo(apiVersion, undoSettings, responseData, givenParametersArray.get(0), pathParameters));
undo.add(
getRequestUndo(
apiVersion, undoSettings, responseData, givenParametersArray.get(0), pathParameters));
}

if (step.source != null) {
Expand All @@ -471,7 +473,11 @@ public void given(String apiVersion, Given step) throws Exception {
}

public Callable<?> getRequestUndo(
String apiVersion, Undo undoSettings, Object responseData, Object requestData, Map<String, Object> pathParameters)
String apiVersion,
Undo undoSettings,
Object responseData,
Object requestData,
Map<String, Object> pathParameters)
throws Exception {
// find API service based on undo tag value
Class<?> undoAPIClass =
Expand Down Expand Up @@ -579,7 +585,9 @@ public void sendRequest() throws Exception {
} catch (Exception e) {
throw new Exception(e.getCause());
}
undo.add(getRequestUndo(apiVersion, undoSettings, responseData, parametersArray.get(0), pathParameters));
undo.add(
getRequestUndo(
apiVersion, undoSettings, responseData, parametersArray.get(0), pathParameters));
}
}

Expand Down

This file was deleted.

Loading
Loading