Skip to content

Commit 29be77f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Added new optional field definition to include more detail in findings for '/api/v2/posture_management/findings' (#3096)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 925669b commit 29be77f

8 files changed

Lines changed: 236 additions & 12 deletions

File tree

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-06-05 08:11:20.052852",
8-
"spec_repo_commit": "0e7259ca"
7+
"regenerated": "2025-06-05 09:49:41.695191",
8+
"spec_repo_commit": "faa72400"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-05 08:11:20.068715",
13-
"spec_repo_commit": "0e7259ca"
12+
"regenerated": "2025-06-05 09:49:41.711238",
13+
"spec_repo_commit": "faa72400"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15279,10 +15279,16 @@ components:
1527915279
FindingAttributes:
1528015280
description: The JSON:API attributes of the finding.
1528115281
properties:
15282+
datadog_link:
15283+
$ref: '#/components/schemas/FindingDatadogLink'
15284+
description:
15285+
$ref: '#/components/schemas/FindingDescription'
1528215286
evaluation:
1528315287
$ref: '#/components/schemas/FindingEvaluation'
1528415288
evaluation_changed_at:
1528515289
$ref: '#/components/schemas/FindingEvaluationChangedAt'
15290+
external_id:
15291+
$ref: '#/components/schemas/FindingExternalId'
1528615292
mute:
1528715293
$ref: '#/components/schemas/FindingMute'
1528815294
resource:
@@ -15300,6 +15306,22 @@ components:
1530015306
vulnerability_type:
1530115307
$ref: '#/components/schemas/FindingVulnerabilityType'
1530215308
type: object
15309+
FindingDatadogLink:
15310+
description: The Datadog relative link for this finding.
15311+
example: /security/compliance?panels=cpfinding%7Cevent%7CruleId%3Adef-000-u5t%7CresourceId%3Ae8c9ab7c52ebd7bf2fdb4db641082d7d%7CtabId%3Aoverview
15312+
type: string
15313+
FindingDescription:
15314+
description: The description and remediation steps for this finding.
15315+
example: '## Remediation
15316+
15317+
15318+
1. In the console, go to **Storage Account**.
15319+
15320+
2. For each Storage Account, navigate to **Data Protection**.
15321+
15322+
3. Select **Set soft delete enabled** and enter the number of days to retain
15323+
soft deleted data.'
15324+
type: string
1530315325
FindingEvaluation:
1530415326
description: The evaluation of the finding.
1530515327
enum:
@@ -15317,6 +15339,10 @@ components:
1531715339
format: int64
1531815340
minimum: 1
1531915341
type: integer
15342+
FindingExternalId:
15343+
description: The cloud-based ID for the resource related to the finding.
15344+
example: arn:aws:s3:::my-example-bucket
15345+
type: string
1532015346
FindingID:
1532115347
description: The unique ID for this finding.
1532215348
example: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==
@@ -53082,13 +53108,19 @@ paths:
5308253108
the equal sign: `filter[evaluation_changed_at]=>=1678809373257`.\n\nQuery
5308353109
parameters must be only among the documented ones and with values of correct
5308453110
types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`)
53085-
are not allowed.\n\n### Response\n\nThe response includes an array of finding
53086-
objects, pagination metadata, and a count of items that match the query.\n\nEach
53087-
finding object contains the following:\n\n- The finding ID that can be used
53088-
in a `GetFinding` request to retrieve the full finding details.\n- Core attributes,
53089-
including status, evaluation, high-level resource details, muted state, and
53090-
rule details.\n- `evaluation_changed_at` and `resource_discovery_date` time
53091-
stamps.\n- An array of associated tags.\n"
53111+
are not allowed.\n\n### Additional extension fields\n\nAdditional extension
53112+
fields are available for some findings.\n\nThe data is available when you
53113+
include the query parameter `?detailed_findings=true` in the request.\n\nThe
53114+
following fields are available for findings:\n- `external_id`: The resource
53115+
external ID related to the finding.\n- `description`: The description and
53116+
remediation steps for the finding.\n- `datadog_link`: The Datadog relative
53117+
link for the finding.\n\n### Response\n\nThe response includes an array of
53118+
finding objects, pagination metadata, and a count of items that match the
53119+
query.\n\nEach finding object contains the following:\n\n- The finding ID
53120+
that can be used in a `GetFinding` request to retrieve the full finding details.\n-
53121+
Core attributes, including status, evaluation, high-level resource details,
53122+
muted state, and rule details.\n- `evaluation_changed_at` and `resource_discovery_date`
53123+
time stamps.\n- An array of associated tags.\n"
5309253124
operationId: ListFindings
5309353125
parameters:
5309453126
- description: Limit the number of findings returned. Must be <= 1000.
@@ -53191,6 +53223,14 @@ paths:
5319153223
items:
5319253224
$ref: '#/components/schemas/FindingVulnerabilityType'
5319353225
type: array
53226+
- description: Return additional fields for some findings.
53227+
example:
53228+
- true
53229+
in: query
53230+
name: detailed_findings
53231+
required: false
53232+
schema:
53233+
type: boolean
5319453234
responses:
5319553235
'200':
5319653236
content:

api/datadogV2/api_security_monitoring.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,6 +2615,7 @@ type ListFindingsOptionalParameters struct {
26152615
FilterEvaluation *FindingEvaluation
26162616
FilterStatus *FindingStatus
26172617
FilterVulnerabilityType *[]FindingVulnerabilityType
2618+
DetailedFindings *bool
26182619
}
26192620

26202621
// NewListFindingsOptionalParameters creates an empty struct for parameters.
@@ -2701,6 +2702,12 @@ func (r *ListFindingsOptionalParameters) WithFilterVulnerabilityType(filterVulne
27012702
return r
27022703
}
27032704

2705+
// WithDetailedFindings sets the corresponding parameter name and returns the struct.
2706+
func (r *ListFindingsOptionalParameters) WithDetailedFindings(detailedFindings bool) *ListFindingsOptionalParameters {
2707+
r.DetailedFindings = &detailedFindings
2708+
return r
2709+
}
2710+
27042711
// ListFindings List findings.
27052712
// Get a list of findings. These include both misconfigurations and identity risks.
27062713
//
@@ -2724,6 +2731,17 @@ func (r *ListFindingsOptionalParameters) WithFilterVulnerabilityType(filterVulne
27242731
//
27252732
// Query parameters must be only among the documented ones and with values of correct types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`) are not allowed.
27262733
//
2734+
// ### Additional extension fields
2735+
//
2736+
// Additional extension fields are available for some findings.
2737+
//
2738+
// The data is available when you include the query parameter `?detailed_findings=true` in the request.
2739+
//
2740+
// The following fields are available for findings:
2741+
// - `external_id`: The resource external ID related to the finding.
2742+
// - `description`: The description and remediation steps for the finding.
2743+
// - `datadog_link`: The Datadog relative link for the finding.
2744+
//
27272745
// ### Response
27282746
//
27292747
// The response includes an array of finding objects, pagination metadata, and a count of items that match the query.
@@ -2815,6 +2833,9 @@ func (a *SecurityMonitoringApi) ListFindings(ctx _context.Context, o ...ListFind
28152833
localVarQueryParams.Add("filter[vulnerability_type]", datadog.ParameterToString(t, "multi"))
28162834
}
28172835
}
2836+
if optionalParams.DetailedFindings != nil {
2837+
localVarQueryParams.Add("detailed_findings", datadog.ParameterToString(*optionalParams.DetailedFindings, ""))
2838+
}
28182839
localVarHeaderParams["Accept"] = "application/json"
28192840

28202841
datadog.SetAuthKeys(

api/datadogV2/model_finding_attributes.go

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ import (
1010

1111
// FindingAttributes The JSON:API attributes of the finding.
1212
type FindingAttributes struct {
13+
// The Datadog relative link for this finding.
14+
DatadogLink *string `json:"datadog_link,omitempty"`
15+
// The description and remediation steps for this finding.
16+
Description *string `json:"description,omitempty"`
1317
// The evaluation of the finding.
1418
Evaluation *FindingEvaluation `json:"evaluation,omitempty"`
1519
// The date on which the evaluation for this finding changed (Unix ms).
1620
EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"`
21+
// The cloud-based ID for the resource related to the finding.
22+
ExternalId *string `json:"external_id,omitempty"`
1723
// Information about the mute status of this finding.
1824
Mute *FindingMute `json:"mute,omitempty"`
1925
// The resource name of this finding.
@@ -52,6 +58,62 @@ func NewFindingAttributesWithDefaults() *FindingAttributes {
5258
return &this
5359
}
5460

61+
// GetDatadogLink returns the DatadogLink field value if set, zero value otherwise.
62+
func (o *FindingAttributes) GetDatadogLink() string {
63+
if o == nil || o.DatadogLink == nil {
64+
var ret string
65+
return ret
66+
}
67+
return *o.DatadogLink
68+
}
69+
70+
// GetDatadogLinkOk returns a tuple with the DatadogLink field value if set, nil otherwise
71+
// and a boolean to check if the value has been set.
72+
func (o *FindingAttributes) GetDatadogLinkOk() (*string, bool) {
73+
if o == nil || o.DatadogLink == nil {
74+
return nil, false
75+
}
76+
return o.DatadogLink, true
77+
}
78+
79+
// HasDatadogLink returns a boolean if a field has been set.
80+
func (o *FindingAttributes) HasDatadogLink() bool {
81+
return o != nil && o.DatadogLink != nil
82+
}
83+
84+
// SetDatadogLink gets a reference to the given string and assigns it to the DatadogLink field.
85+
func (o *FindingAttributes) SetDatadogLink(v string) {
86+
o.DatadogLink = &v
87+
}
88+
89+
// GetDescription returns the Description field value if set, zero value otherwise.
90+
func (o *FindingAttributes) GetDescription() string {
91+
if o == nil || o.Description == nil {
92+
var ret string
93+
return ret
94+
}
95+
return *o.Description
96+
}
97+
98+
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
99+
// and a boolean to check if the value has been set.
100+
func (o *FindingAttributes) GetDescriptionOk() (*string, bool) {
101+
if o == nil || o.Description == nil {
102+
return nil, false
103+
}
104+
return o.Description, true
105+
}
106+
107+
// HasDescription returns a boolean if a field has been set.
108+
func (o *FindingAttributes) HasDescription() bool {
109+
return o != nil && o.Description != nil
110+
}
111+
112+
// SetDescription gets a reference to the given string and assigns it to the Description field.
113+
func (o *FindingAttributes) SetDescription(v string) {
114+
o.Description = &v
115+
}
116+
55117
// GetEvaluation returns the Evaluation field value if set, zero value otherwise.
56118
func (o *FindingAttributes) GetEvaluation() FindingEvaluation {
57119
if o == nil || o.Evaluation == nil {
@@ -108,6 +170,34 @@ func (o *FindingAttributes) SetEvaluationChangedAt(v int64) {
108170
o.EvaluationChangedAt = &v
109171
}
110172

173+
// GetExternalId returns the ExternalId field value if set, zero value otherwise.
174+
func (o *FindingAttributes) GetExternalId() string {
175+
if o == nil || o.ExternalId == nil {
176+
var ret string
177+
return ret
178+
}
179+
return *o.ExternalId
180+
}
181+
182+
// GetExternalIdOk returns a tuple with the ExternalId field value if set, nil otherwise
183+
// and a boolean to check if the value has been set.
184+
func (o *FindingAttributes) GetExternalIdOk() (*string, bool) {
185+
if o == nil || o.ExternalId == nil {
186+
return nil, false
187+
}
188+
return o.ExternalId, true
189+
}
190+
191+
// HasExternalId returns a boolean if a field has been set.
192+
func (o *FindingAttributes) HasExternalId() bool {
193+
return o != nil && o.ExternalId != nil
194+
}
195+
196+
// SetExternalId gets a reference to the given string and assigns it to the ExternalId field.
197+
func (o *FindingAttributes) SetExternalId(v string) {
198+
o.ExternalId = &v
199+
}
200+
111201
// GetMute returns the Mute field value if set, zero value otherwise.
112202
func (o *FindingAttributes) GetMute() FindingMute {
113203
if o == nil || o.Mute == nil {
@@ -338,12 +428,21 @@ func (o FindingAttributes) MarshalJSON() ([]byte, error) {
338428
if o.UnparsedObject != nil {
339429
return datadog.Marshal(o.UnparsedObject)
340430
}
431+
if o.DatadogLink != nil {
432+
toSerialize["datadog_link"] = o.DatadogLink
433+
}
434+
if o.Description != nil {
435+
toSerialize["description"] = o.Description
436+
}
341437
if o.Evaluation != nil {
342438
toSerialize["evaluation"] = o.Evaluation
343439
}
344440
if o.EvaluationChangedAt != nil {
345441
toSerialize["evaluation_changed_at"] = o.EvaluationChangedAt
346442
}
443+
if o.ExternalId != nil {
444+
toSerialize["external_id"] = o.ExternalId
445+
}
347446
if o.Mute != nil {
348447
toSerialize["mute"] = o.Mute
349448
}
@@ -378,8 +477,11 @@ func (o FindingAttributes) MarshalJSON() ([]byte, error) {
378477
// UnmarshalJSON deserializes the given payload.
379478
func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) {
380479
all := struct {
480+
DatadogLink *string `json:"datadog_link,omitempty"`
481+
Description *string `json:"description,omitempty"`
381482
Evaluation *FindingEvaluation `json:"evaluation,omitempty"`
382483
EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"`
484+
ExternalId *string `json:"external_id,omitempty"`
383485
Mute *FindingMute `json:"mute,omitempty"`
384486
Resource *string `json:"resource,omitempty"`
385487
ResourceDiscoveryDate *int64 `json:"resource_discovery_date,omitempty"`
@@ -394,18 +496,21 @@ func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) {
394496
}
395497
additionalProperties := make(map[string]interface{})
396498
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
397-
datadog.DeleteKeys(additionalProperties, &[]string{"evaluation", "evaluation_changed_at", "mute", "resource", "resource_discovery_date", "resource_type", "rule", "status", "tags", "vulnerability_type"})
499+
datadog.DeleteKeys(additionalProperties, &[]string{"datadog_link", "description", "evaluation", "evaluation_changed_at", "external_id", "mute", "resource", "resource_discovery_date", "resource_type", "rule", "status", "tags", "vulnerability_type"})
398500
} else {
399501
return err
400502
}
401503

402504
hasInvalidField := false
505+
o.DatadogLink = all.DatadogLink
506+
o.Description = all.Description
403507
if all.Evaluation != nil && !all.Evaluation.IsValid() {
404508
hasInvalidField = true
405509
} else {
406510
o.Evaluation = all.Evaluation
407511
}
408512
o.EvaluationChangedAt = all.EvaluationChangedAt
513+
o.ExternalId = all.ExternalId
409514
if all.Mute != nil && all.Mute.UnparsedObject != nil && o.UnparsedObject == nil {
410515
hasInvalidField = true
411516
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// List findings returns "OK" response with details
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
13+
)
14+
15+
func main() {
16+
ctx := datadog.NewDefaultContext(context.Background())
17+
configuration := datadog.NewConfiguration()
18+
configuration.SetUnstableOperationEnabled("v2.ListFindings", true)
19+
apiClient := datadog.NewAPIClient(configuration)
20+
api := datadogV2.NewSecurityMonitoringApi(apiClient)
21+
resp, r, err := api.ListFindings(ctx, *datadogV2.NewListFindingsOptionalParameters().WithDetailedFindings(true))
22+
23+
if err != nil {
24+
fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.ListFindings`: %v\n", err)
25+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
26+
}
27+
28+
responseContent, _ := json.MarshalIndent(resp, "", " ")
29+
fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.ListFindings`:\n%s\n", responseContent)
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-05-20T12:11:24.321Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
interactions:
2+
- request:
3+
body: ''
4+
form: {}
5+
headers:
6+
Accept:
7+
- application/json
8+
id: 0
9+
method: GET
10+
url: https://api.datadoghq.com/api/v2/posture_management/findings?detailed_findings=true
11+
response:
12+
body: '{"data":[],"meta":{"page":{"total_filtered_count":0},"snapshot_timestamp":1747743085077}}'
13+
code: 200
14+
duration: 0ms
15+
headers:
16+
Content-Type:
17+
- application/vnd.api+json
18+
status: 200 OK
19+
version: 2

0 commit comments

Comments
 (0)