Skip to content

Commit eb0ec2f

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3253c453 of spec repo
1 parent c5927fc commit eb0ec2f

File tree

5 files changed

+168
-14
lines changed

5 files changed

+168
-14
lines changed

.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": "2024-10-07 20:44:53.487332",
8-
"spec_repo_commit": "5b4f9ebe"
7+
"regenerated": "2024-10-08 13:39:24.451389",
8+
"spec_repo_commit": "3253c453"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-07 20:44:53.506185",
13-
"spec_repo_commit": "5b4f9ebe"
12+
"regenerated": "2024-10-08 13:39:24.466026",
13+
"spec_repo_commit": "3253c453"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9230,6 +9230,8 @@ components:
92309230
$ref: '#/components/schemas/FindingStatus'
92319231
tags:
92329232
$ref: '#/components/schemas/FindingTags'
9233+
vulnerability_type:
9234+
$ref: '#/components/schemas/FindingVulnerabilityType'
92339235
type: object
92349236
FindingEvaluation:
92359237
description: The evaluation of the finding.
@@ -9363,6 +9365,20 @@ components:
93639365
type: string
93649366
x-enum-varnames:
93659367
- FINDING
9368+
FindingVulnerabilityType:
9369+
description: The vulnerability type of the finding.
9370+
enum:
9371+
- misconfiguration
9372+
- attack_path
9373+
- identity_risk
9374+
- api_security
9375+
example: misconfiguration
9376+
type: string
9377+
x-enum-varnames:
9378+
- MISCONFIGURATION
9379+
- ATTACK_PATH
9380+
- IDENTITY_RISK
9381+
- API_SECURITY
93669382
FormulaLimit:
93679383
description: 'Message for specifying limits to the number of values returned
93689384
by a query.
@@ -34377,6 +34393,16 @@ paths:
3437734393
required: false
3437834394
schema:
3437934395
$ref: '#/components/schemas/FindingStatus'
34396+
- description: Return findings that match the selected vulnerability types (repeatable).
34397+
example:
34398+
- misconfiguration
34399+
in: query
34400+
name: filter[vulnerability_type]
34401+
required: false
34402+
schema:
34403+
items:
34404+
$ref: '#/components/schemas/FindingVulnerabilityType'
34405+
type: array
3438034406
responses:
3438134407
'200':
3438234408
content:

api/datadogV2/api_security_monitoring.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
_log "log"
1111
_nethttp "net/http"
1212
_neturl "net/url"
13+
"reflect"
1314
"strings"
1415
"time"
1516

@@ -1199,6 +1200,7 @@ type ListFindingsOptionalParameters struct {
11991200
FilterDiscoveryTimestamp *string
12001201
FilterEvaluation *FindingEvaluation
12011202
FilterStatus *FindingStatus
1203+
FilterVulnerabilityType *[]FindingVulnerabilityType
12021204
}
12031205

12041206
// NewListFindingsOptionalParameters creates an empty struct for parameters.
@@ -1279,6 +1281,12 @@ func (r *ListFindingsOptionalParameters) WithFilterStatus(filterStatus FindingSt
12791281
return r
12801282
}
12811283

1284+
// WithFilterVulnerabilityType sets the corresponding parameter name and returns the struct.
1285+
func (r *ListFindingsOptionalParameters) WithFilterVulnerabilityType(filterVulnerabilityType []FindingVulnerabilityType) *ListFindingsOptionalParameters {
1286+
r.FilterVulnerabilityType = &filterVulnerabilityType
1287+
return r
1288+
}
1289+
12821290
// ListFindings List findings.
12831291
// Get a list of CSPM findings.
12841292
//
@@ -1378,6 +1386,17 @@ func (a *SecurityMonitoringApi) ListFindings(ctx _context.Context, o ...ListFind
13781386
if optionalParams.FilterStatus != nil {
13791387
localVarQueryParams.Add("filter[status]", datadog.ParameterToString(*optionalParams.FilterStatus, ""))
13801388
}
1389+
if optionalParams.FilterVulnerabilityType != nil {
1390+
t := *optionalParams.FilterVulnerabilityType
1391+
if reflect.TypeOf(t).Kind() == reflect.Slice {
1392+
s := reflect.ValueOf(t)
1393+
for i := 0; i < s.Len(); i++ {
1394+
localVarQueryParams.Add("filter[vulnerability_type]", datadog.ParameterToString(s.Index(i), "multi"))
1395+
}
1396+
} else {
1397+
localVarQueryParams.Add("filter[vulnerability_type]", datadog.ParameterToString(t, "multi"))
1398+
}
1399+
}
13811400
localVarHeaderParams["Accept"] = "application/json"
13821401

13831402
datadog.SetAuthKeys(

api/datadogV2/model_finding_attributes.go

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type FindingAttributes struct {
2828
Status *FindingStatus `json:"status,omitempty"`
2929
// The tags associated with this finding.
3030
Tags []string `json:"tags,omitempty"`
31+
// The vulnerability type of the finding.
32+
VulnerabilityType *FindingVulnerabilityType `json:"vulnerability_type,omitempty"`
3133
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
3234
UnparsedObject map[string]interface{} `json:"-"`
3335
AdditionalProperties map[string]interface{} `json:"-"`
@@ -302,6 +304,34 @@ func (o *FindingAttributes) SetTags(v []string) {
302304
o.Tags = v
303305
}
304306

307+
// GetVulnerabilityType returns the VulnerabilityType field value if set, zero value otherwise.
308+
func (o *FindingAttributes) GetVulnerabilityType() FindingVulnerabilityType {
309+
if o == nil || o.VulnerabilityType == nil {
310+
var ret FindingVulnerabilityType
311+
return ret
312+
}
313+
return *o.VulnerabilityType
314+
}
315+
316+
// GetVulnerabilityTypeOk returns a tuple with the VulnerabilityType field value if set, nil otherwise
317+
// and a boolean to check if the value has been set.
318+
func (o *FindingAttributes) GetVulnerabilityTypeOk() (*FindingVulnerabilityType, bool) {
319+
if o == nil || o.VulnerabilityType == nil {
320+
return nil, false
321+
}
322+
return o.VulnerabilityType, true
323+
}
324+
325+
// HasVulnerabilityType returns a boolean if a field has been set.
326+
func (o *FindingAttributes) HasVulnerabilityType() bool {
327+
return o != nil && o.VulnerabilityType != nil
328+
}
329+
330+
// SetVulnerabilityType gets a reference to the given FindingVulnerabilityType and assigns it to the VulnerabilityType field.
331+
func (o *FindingAttributes) SetVulnerabilityType(v FindingVulnerabilityType) {
332+
o.VulnerabilityType = &v
333+
}
334+
305335
// MarshalJSON serializes the struct using spec logic.
306336
func (o FindingAttributes) MarshalJSON() ([]byte, error) {
307337
toSerialize := map[string]interface{}{}
@@ -335,6 +365,9 @@ func (o FindingAttributes) MarshalJSON() ([]byte, error) {
335365
if o.Tags != nil {
336366
toSerialize["tags"] = o.Tags
337367
}
368+
if o.VulnerabilityType != nil {
369+
toSerialize["vulnerability_type"] = o.VulnerabilityType
370+
}
338371

339372
for key, value := range o.AdditionalProperties {
340373
toSerialize[key] = value
@@ -345,22 +378,23 @@ func (o FindingAttributes) MarshalJSON() ([]byte, error) {
345378
// UnmarshalJSON deserializes the given payload.
346379
func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) {
347380
all := struct {
348-
Evaluation *FindingEvaluation `json:"evaluation,omitempty"`
349-
EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"`
350-
Mute *FindingMute `json:"mute,omitempty"`
351-
Resource *string `json:"resource,omitempty"`
352-
ResourceDiscoveryDate *int64 `json:"resource_discovery_date,omitempty"`
353-
ResourceType *string `json:"resource_type,omitempty"`
354-
Rule *FindingRule `json:"rule,omitempty"`
355-
Status *FindingStatus `json:"status,omitempty"`
356-
Tags []string `json:"tags,omitempty"`
381+
Evaluation *FindingEvaluation `json:"evaluation,omitempty"`
382+
EvaluationChangedAt *int64 `json:"evaluation_changed_at,omitempty"`
383+
Mute *FindingMute `json:"mute,omitempty"`
384+
Resource *string `json:"resource,omitempty"`
385+
ResourceDiscoveryDate *int64 `json:"resource_discovery_date,omitempty"`
386+
ResourceType *string `json:"resource_type,omitempty"`
387+
Rule *FindingRule `json:"rule,omitempty"`
388+
Status *FindingStatus `json:"status,omitempty"`
389+
Tags []string `json:"tags,omitempty"`
390+
VulnerabilityType *FindingVulnerabilityType `json:"vulnerability_type,omitempty"`
357391
}{}
358392
if err = datadog.Unmarshal(bytes, &all); err != nil {
359393
return datadog.Unmarshal(bytes, &o.UnparsedObject)
360394
}
361395
additionalProperties := make(map[string]interface{})
362396
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
363-
datadog.DeleteKeys(additionalProperties, &[]string{"evaluation", "evaluation_changed_at", "mute", "resource", "resource_discovery_date", "resource_type", "rule", "status", "tags"})
397+
datadog.DeleteKeys(additionalProperties, &[]string{"evaluation", "evaluation_changed_at", "mute", "resource", "resource_discovery_date", "resource_type", "rule", "status", "tags", "vulnerability_type"})
364398
} else {
365399
return err
366400
}
@@ -389,6 +423,11 @@ func (o *FindingAttributes) UnmarshalJSON(bytes []byte) (err error) {
389423
o.Status = all.Status
390424
}
391425
o.Tags = all.Tags
426+
if all.VulnerabilityType != nil && !all.VulnerabilityType.IsValid() {
427+
hasInvalidField = true
428+
} else {
429+
o.VulnerabilityType = all.VulnerabilityType
430+
}
392431

393432
if len(additionalProperties) > 0 {
394433
o.AdditionalProperties = additionalProperties
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// FindingVulnerabilityType The vulnerability type of the finding.
14+
type FindingVulnerabilityType string
15+
16+
// List of FindingVulnerabilityType.
17+
const (
18+
FINDINGVULNERABILITYTYPE_MISCONFIGURATION FindingVulnerabilityType = "misconfiguration"
19+
FINDINGVULNERABILITYTYPE_ATTACK_PATH FindingVulnerabilityType = "attack_path"
20+
FINDINGVULNERABILITYTYPE_IDENTITY_RISK FindingVulnerabilityType = "identity_risk"
21+
FINDINGVULNERABILITYTYPE_API_SECURITY FindingVulnerabilityType = "api_security"
22+
)
23+
24+
var allowedFindingVulnerabilityTypeEnumValues = []FindingVulnerabilityType{
25+
FINDINGVULNERABILITYTYPE_MISCONFIGURATION,
26+
FINDINGVULNERABILITYTYPE_ATTACK_PATH,
27+
FINDINGVULNERABILITYTYPE_IDENTITY_RISK,
28+
FINDINGVULNERABILITYTYPE_API_SECURITY,
29+
}
30+
31+
// GetAllowedValues reeturns the list of possible values.
32+
func (v *FindingVulnerabilityType) GetAllowedValues() []FindingVulnerabilityType {
33+
return allowedFindingVulnerabilityTypeEnumValues
34+
}
35+
36+
// UnmarshalJSON deserializes the given payload.
37+
func (v *FindingVulnerabilityType) UnmarshalJSON(src []byte) error {
38+
var value string
39+
err := datadog.Unmarshal(src, &value)
40+
if err != nil {
41+
return err
42+
}
43+
*v = FindingVulnerabilityType(value)
44+
return nil
45+
}
46+
47+
// NewFindingVulnerabilityTypeFromValue returns a pointer to a valid FindingVulnerabilityType
48+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
49+
func NewFindingVulnerabilityTypeFromValue(v string) (*FindingVulnerabilityType, error) {
50+
ev := FindingVulnerabilityType(v)
51+
if ev.IsValid() {
52+
return &ev, nil
53+
}
54+
return nil, fmt.Errorf("invalid value '%v' for FindingVulnerabilityType: valid values are %v", v, allowedFindingVulnerabilityTypeEnumValues)
55+
}
56+
57+
// IsValid return true if the value is valid for the enum, false otherwise.
58+
func (v FindingVulnerabilityType) IsValid() bool {
59+
for _, existing := range allowedFindingVulnerabilityTypeEnumValues {
60+
if existing == v {
61+
return true
62+
}
63+
}
64+
return false
65+
}
66+
67+
// Ptr returns reference to FindingVulnerabilityType value.
68+
func (v FindingVulnerabilityType) Ptr() *FindingVulnerabilityType {
69+
return &v
70+
}

0 commit comments

Comments
 (0)