Assign or unassign security findings
https://api.datadoghq.com/api/v2/security/findings/assigneehttps://api.us3.datadoghq.com/api/v2/security/findings/assigneehttps://api.us5.datadoghq.com/api/v2/security/findings/assigneehttps://api.datadoghq.eu/api/v2/security/findings/assigneehttps://api.ap1.datadoghq.com/api/v2/security/findings/assigneehttps://api.ap2.datadoghq.com/api/v2/security/findings/assigneehttps://api.uk1.datadoghq.com/api/v2/security/findings/assigneehttps://api.ddog-gov.com/api/v2/security/findings/assigneehttps://api.us2.ddog-gov.com/api/v2/security/findings/assignee概要
Assign or unassign security findings.
You can assign up to 100 security findings per request. Set assignee_id to the unique identifier of the Datadog user you want to assign the findings to. Omit assignee_id (or set it to null) to unassign the findings. Per-finding warnings and failures are returned in the response meta object.
リクエスト
Body Data (required)
data [required]Data of the assignee request.
attributesAttributes of the assignee request.
assignee_idUnique identifier of the Datadog user to assign the security findings to. If this field is not provided, the security findings are unassigned.
idUnique identifier of the assignee request.
relationships [required]Relationships of the assignee request.
findings [required]Security findings to assign or unassign.
dataArray of security finding data objects.
id [required]Unique identifier of the security finding.
type [required]Security findings resource type.
findingsfindingstype [required]Assignee resource type.
assigneeassignee{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}応答
Accepted
Response for the assign or unassign request.
data [required]Data of the assignee response.
attributes [required]Attributes of the assignee response.
assignee_idUnique identifier of the Datadog user assigned to the security findings. Omitted when the findings were unassigned.
id [required]Unique identifier of the assignee request.
type [required]Assignee resource type.
assigneeassigneemetaPer-finding warnings and failures produced while processing the bulk assignee request.
failuresFindings that could not be assigned or unassigned.
detail [required]Human-readable explanation of the outcome.
finding_id [required]Unique identifier of the security finding.
status [required]HTTP-like status code describing the outcome for this finding.
title [required]Short label describing the outcome for this finding.
warningsFindings for which the assignment succeeded but a non-critical error occurred during processing.
detail [required]Human-readable explanation of the outcome.
finding_id [required]Unique identifier of the security finding.
status [required]HTTP-like status code describing the outcome for this finding.
title [required]Short label describing the outcome for this finding.
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"type": "assignee"
},
"meta": {
"failures": [
{
"detail": "failed to update finding assignee",
"finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"status": 500,
"title": "Internal Server Error"
}
],
"warnings": [
{
"detail": "failed to update finding assignee",
"finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"status": 500,
"title": "Internal Server Error"
}
]
}
}Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Found
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}コード例
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X PATCH "https://api.${DD_SITE}/api/v2/security/findings/assignee" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
},
"id": "00000000-0000-0000-0000-000000000001",
"relationships": {
"findings": {
"data": [
{
"id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
"type": "findings"
}
]
}
},
"type": "assignee"
}
}
EOF// Assign or unassign security findings returns "Accepted" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := datadogV2.AssigneeRequest{
Data: datadogV2.AssigneeRequestData{
Attributes: &datadogV2.AssigneeRequestDataAttributes{
AssigneeId: datadog.PtrString("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"),
},
Id: datadog.PtrString("00000000-0000-0000-0000-000000000001"),
Relationships: datadogV2.AssigneeRequestDataRelationships{
Findings: datadogV2.Findings{
Data: []datadogV2.FindingData{
{
Id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
Type: datadogV2.FINDINGDATATYPE_FINDINGS,
},
},
},
},
Type: datadogV2.ASSIGNEEDATATYPE_ASSIGNEE,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.UpdateFindingsAssignee", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewSecurityMonitoringApi(apiClient)
resp, r, err := api.UpdateFindingsAssignee(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.UpdateFindingsAssignee`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.UpdateFindingsAssignee`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Assign or unassign security findings returns "Accepted" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.model.AssigneeDataType;
import com.datadog.api.client.v2.model.AssigneeRequest;
import com.datadog.api.client.v2.model.AssigneeRequestData;
import com.datadog.api.client.v2.model.AssigneeRequestDataAttributes;
import com.datadog.api.client.v2.model.AssigneeRequestDataRelationships;
import com.datadog.api.client.v2.model.AssigneeResponse;
import com.datadog.api.client.v2.model.FindingData;
import com.datadog.api.client.v2.model.FindingDataType;
import com.datadog.api.client.v2.model.Findings;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.updateFindingsAssignee", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);
AssigneeRequest body =
new AssigneeRequest()
.data(
new AssigneeRequestData()
.attributes(
new AssigneeRequestDataAttributes()
.assigneeId("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"))
.id("00000000-0000-0000-0000-000000000001")
.relationships(
new AssigneeRequestDataRelationships()
.findings(
new Findings()
.data(
Collections.singletonList(
new FindingData()
.id("ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==")
.type(FindingDataType.FINDINGS)))))
.type(AssigneeDataType.ASSIGNEE));
try {
AssigneeResponse result = apiInstance.updateFindingsAssignee(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SecurityMonitoringApi#updateFindingsAssignee");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Assign or unassign security findings returns "Accepted" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
from datadog_api_client.v2.model.assignee_data_type import AssigneeDataType
from datadog_api_client.v2.model.assignee_request import AssigneeRequest
from datadog_api_client.v2.model.assignee_request_data import AssigneeRequestData
from datadog_api_client.v2.model.assignee_request_data_attributes import AssigneeRequestDataAttributes
from datadog_api_client.v2.model.assignee_request_data_relationships import AssigneeRequestDataRelationships
from datadog_api_client.v2.model.finding_data import FindingData
from datadog_api_client.v2.model.finding_data_type import FindingDataType
from datadog_api_client.v2.model.findings import Findings
body = AssigneeRequest(
data=AssigneeRequestData(
attributes=AssigneeRequestDataAttributes(
assignee_id="f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
),
id="00000000-0000-0000-0000-000000000001",
relationships=AssigneeRequestDataRelationships(
findings=Findings(
data=[
FindingData(
id="ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
type=FindingDataType.FINDINGS,
),
],
),
),
type=AssigneeDataType.ASSIGNEE,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["update_findings_assignee"] = True
with ApiClient(configuration) as api_client:
api_instance = SecurityMonitoringApi(api_client)
response = api_instance.update_findings_assignee(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Assign or unassign security findings returns "Accepted" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.update_findings_assignee".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
body = DatadogAPIClient::V2::AssigneeRequest.new({
data: DatadogAPIClient::V2::AssigneeRequestData.new({
attributes: DatadogAPIClient::V2::AssigneeRequestDataAttributes.new({
assignee_id: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
}),
id: "00000000-0000-0000-0000-000000000001",
relationships: DatadogAPIClient::V2::AssigneeRequestDataRelationships.new({
findings: DatadogAPIClient::V2::Findings.new({
data: [
DatadogAPIClient::V2::FindingData.new({
id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
type: DatadogAPIClient::V2::FindingDataType::FINDINGS,
}),
],
}),
}),
type: DatadogAPIClient::V2::AssigneeDataType::ASSIGNEE,
}),
})
p api_instance.update_findings_assignee(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Assign or unassign security findings returns "Accepted" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
use datadog_api_client::datadogV2::model::AssigneeDataType;
use datadog_api_client::datadogV2::model::AssigneeRequest;
use datadog_api_client::datadogV2::model::AssigneeRequestData;
use datadog_api_client::datadogV2::model::AssigneeRequestDataAttributes;
use datadog_api_client::datadogV2::model::AssigneeRequestDataRelationships;
use datadog_api_client::datadogV2::model::FindingData;
use datadog_api_client::datadogV2::model::FindingDataType;
use datadog_api_client::datadogV2::model::Findings;
#[tokio::main]
async fn main() {
let body = AssigneeRequest::new(
AssigneeRequestData::new(
AssigneeRequestDataRelationships::new(Findings::new().data(vec![FindingData::new(
"ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==".to_string(),
FindingDataType::FINDINGS,
)])),
AssigneeDataType::ASSIGNEE,
)
.attributes(
AssigneeRequestDataAttributes::new()
.assignee_id("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0".to_string()),
)
.id("00000000-0000-0000-0000-000000000001".to_string()),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.update_findings_assignee", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api.update_findings_assignee(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Assign or unassign security findings returns "Accepted" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.updateFindingsAssignee"] = true;
const apiInstance = new v2.SecurityMonitoringApi(configuration);
const params: v2.SecurityMonitoringApiUpdateFindingsAssigneeRequest = {
body: {
data: {
attributes: {
assigneeId: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
},
id: "00000000-0000-0000-0000-000000000001",
relationships: {
findings: {
data: [
{
id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
type: "findings",
},
],
},
},
type: "assignee",
},
},
};
apiInstance
.updateFindingsAssignee(params)
.then((data: v2.AssigneeResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"