Skip to content

Commit 7d316b4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add Critical Assets specs to security_monitoring feature (#3581)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 6111c76 commit 7d316b4

46 files changed

Lines changed: 3795 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.generator/schemas/v2/openapi.yaml

Lines changed: 418 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/api_security_monitoring.go

Lines changed: 490 additions & 0 deletions
Large diffs are not rendered by default.

api/datadogV2/doc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,14 @@
547547
// - [SecurityMonitoringApi.CreateCustomFramework]
548548
// - [SecurityMonitoringApi.CreateJiraIssues]
549549
// - [SecurityMonitoringApi.CreateSecurityFilter]
550+
// - [SecurityMonitoringApi.CreateSecurityMonitoringCriticalAsset]
550551
// - [SecurityMonitoringApi.CreateSecurityMonitoringRule]
551552
// - [SecurityMonitoringApi.CreateSecurityMonitoringSuppression]
552553
// - [SecurityMonitoringApi.CreateSignalNotificationRule]
553554
// - [SecurityMonitoringApi.CreateVulnerabilityNotificationRule]
554555
// - [SecurityMonitoringApi.DeleteCustomFramework]
555556
// - [SecurityMonitoringApi.DeleteSecurityFilter]
557+
// - [SecurityMonitoringApi.DeleteSecurityMonitoringCriticalAsset]
556558
// - [SecurityMonitoringApi.DeleteSecurityMonitoringRule]
557559
// - [SecurityMonitoringApi.DeleteSecurityMonitoringSuppression]
558560
// - [SecurityMonitoringApi.DeleteSignalNotificationRule]
@@ -562,13 +564,15 @@
562564
// - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee]
563565
// - [SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents]
564566
// - [SecurityMonitoringApi.EditSecurityMonitoringSignalState]
567+
// - [SecurityMonitoringApi.GetCriticalAssetsAffectingRule]
565568
// - [SecurityMonitoringApi.GetCustomFramework]
566569
// - [SecurityMonitoringApi.GetFinding]
567570
// - [SecurityMonitoringApi.GetResourceEvaluationFilters]
568571
// - [SecurityMonitoringApi.GetRuleVersionHistory]
569572
// - [SecurityMonitoringApi.GetSBOM]
570573
// - [SecurityMonitoringApi.GetSecretsRules]
571574
// - [SecurityMonitoringApi.GetSecurityFilter]
575+
// - [SecurityMonitoringApi.GetSecurityMonitoringCriticalAsset]
572576
// - [SecurityMonitoringApi.GetSecurityMonitoringHistsignal]
573577
// - [SecurityMonitoringApi.GetSecurityMonitoringHistsignalsByJobId]
574578
// - [SecurityMonitoringApi.GetSecurityMonitoringRule]
@@ -588,6 +592,7 @@
588592
// - [SecurityMonitoringApi.ListScannedAssetsMetadata]
589593
// - [SecurityMonitoringApi.ListSecurityFilters]
590594
// - [SecurityMonitoringApi.ListSecurityFindings]
595+
// - [SecurityMonitoringApi.ListSecurityMonitoringCriticalAssets]
591596
// - [SecurityMonitoringApi.ListSecurityMonitoringHistsignals]
592597
// - [SecurityMonitoringApi.ListSecurityMonitoringRules]
593598
// - [SecurityMonitoringApi.ListSecurityMonitoringSignals]
@@ -607,6 +612,7 @@
607612
// - [SecurityMonitoringApi.UpdateCustomFramework]
608613
// - [SecurityMonitoringApi.UpdateResourceEvaluationFilters]
609614
// - [SecurityMonitoringApi.UpdateSecurityFilter]
615+
// - [SecurityMonitoringApi.UpdateSecurityMonitoringCriticalAsset]
610616
// - [SecurityMonitoringApi.UpdateSecurityMonitoringRule]
611617
// - [SecurityMonitoringApi.UpdateSecurityMonitoringSuppression]
612618
// - [SecurityMonitoringApi.ValidateSecurityMonitoringRule]
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
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+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// SecurityMonitoringCriticalAsset The critical asset's properties.
12+
type SecurityMonitoringCriticalAsset struct {
13+
// The attributes of the critical asset.
14+
Attributes *SecurityMonitoringCriticalAssetAttributes `json:"attributes,omitempty"`
15+
// The ID of the critical asset.
16+
Id *string `json:"id,omitempty"`
17+
// The type of the resource. The value should always be `critical_assets`.
18+
Type *SecurityMonitoringCriticalAssetType `json:"type,omitempty"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewSecurityMonitoringCriticalAsset instantiates a new SecurityMonitoringCriticalAsset object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewSecurityMonitoringCriticalAsset() *SecurityMonitoringCriticalAsset {
29+
this := SecurityMonitoringCriticalAsset{}
30+
var typeVar SecurityMonitoringCriticalAssetType = SECURITYMONITORINGCRITICALASSETTYPE_CRITICAL_ASSETS
31+
this.Type = &typeVar
32+
return &this
33+
}
34+
35+
// NewSecurityMonitoringCriticalAssetWithDefaults instantiates a new SecurityMonitoringCriticalAsset object.
36+
// This constructor will only assign default values to properties that have it defined,
37+
// but it doesn't guarantee that properties required by API are set.
38+
func NewSecurityMonitoringCriticalAssetWithDefaults() *SecurityMonitoringCriticalAsset {
39+
this := SecurityMonitoringCriticalAsset{}
40+
var typeVar SecurityMonitoringCriticalAssetType = SECURITYMONITORINGCRITICALASSETTYPE_CRITICAL_ASSETS
41+
this.Type = &typeVar
42+
return &this
43+
}
44+
45+
// GetAttributes returns the Attributes field value if set, zero value otherwise.
46+
func (o *SecurityMonitoringCriticalAsset) GetAttributes() SecurityMonitoringCriticalAssetAttributes {
47+
if o == nil || o.Attributes == nil {
48+
var ret SecurityMonitoringCriticalAssetAttributes
49+
return ret
50+
}
51+
return *o.Attributes
52+
}
53+
54+
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
55+
// and a boolean to check if the value has been set.
56+
func (o *SecurityMonitoringCriticalAsset) GetAttributesOk() (*SecurityMonitoringCriticalAssetAttributes, bool) {
57+
if o == nil || o.Attributes == nil {
58+
return nil, false
59+
}
60+
return o.Attributes, true
61+
}
62+
63+
// HasAttributes returns a boolean if a field has been set.
64+
func (o *SecurityMonitoringCriticalAsset) HasAttributes() bool {
65+
return o != nil && o.Attributes != nil
66+
}
67+
68+
// SetAttributes gets a reference to the given SecurityMonitoringCriticalAssetAttributes and assigns it to the Attributes field.
69+
func (o *SecurityMonitoringCriticalAsset) SetAttributes(v SecurityMonitoringCriticalAssetAttributes) {
70+
o.Attributes = &v
71+
}
72+
73+
// GetId returns the Id field value if set, zero value otherwise.
74+
func (o *SecurityMonitoringCriticalAsset) GetId() string {
75+
if o == nil || o.Id == nil {
76+
var ret string
77+
return ret
78+
}
79+
return *o.Id
80+
}
81+
82+
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
83+
// and a boolean to check if the value has been set.
84+
func (o *SecurityMonitoringCriticalAsset) GetIdOk() (*string, bool) {
85+
if o == nil || o.Id == nil {
86+
return nil, false
87+
}
88+
return o.Id, true
89+
}
90+
91+
// HasId returns a boolean if a field has been set.
92+
func (o *SecurityMonitoringCriticalAsset) HasId() bool {
93+
return o != nil && o.Id != nil
94+
}
95+
96+
// SetId gets a reference to the given string and assigns it to the Id field.
97+
func (o *SecurityMonitoringCriticalAsset) SetId(v string) {
98+
o.Id = &v
99+
}
100+
101+
// GetType returns the Type field value if set, zero value otherwise.
102+
func (o *SecurityMonitoringCriticalAsset) GetType() SecurityMonitoringCriticalAssetType {
103+
if o == nil || o.Type == nil {
104+
var ret SecurityMonitoringCriticalAssetType
105+
return ret
106+
}
107+
return *o.Type
108+
}
109+
110+
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
111+
// and a boolean to check if the value has been set.
112+
func (o *SecurityMonitoringCriticalAsset) GetTypeOk() (*SecurityMonitoringCriticalAssetType, bool) {
113+
if o == nil || o.Type == nil {
114+
return nil, false
115+
}
116+
return o.Type, true
117+
}
118+
119+
// HasType returns a boolean if a field has been set.
120+
func (o *SecurityMonitoringCriticalAsset) HasType() bool {
121+
return o != nil && o.Type != nil
122+
}
123+
124+
// SetType gets a reference to the given SecurityMonitoringCriticalAssetType and assigns it to the Type field.
125+
func (o *SecurityMonitoringCriticalAsset) SetType(v SecurityMonitoringCriticalAssetType) {
126+
o.Type = &v
127+
}
128+
129+
// MarshalJSON serializes the struct using spec logic.
130+
func (o SecurityMonitoringCriticalAsset) MarshalJSON() ([]byte, error) {
131+
toSerialize := map[string]interface{}{}
132+
if o.UnparsedObject != nil {
133+
return datadog.Marshal(o.UnparsedObject)
134+
}
135+
if o.Attributes != nil {
136+
toSerialize["attributes"] = o.Attributes
137+
}
138+
if o.Id != nil {
139+
toSerialize["id"] = o.Id
140+
}
141+
if o.Type != nil {
142+
toSerialize["type"] = o.Type
143+
}
144+
145+
for key, value := range o.AdditionalProperties {
146+
toSerialize[key] = value
147+
}
148+
return datadog.Marshal(toSerialize)
149+
}
150+
151+
// UnmarshalJSON deserializes the given payload.
152+
func (o *SecurityMonitoringCriticalAsset) UnmarshalJSON(bytes []byte) (err error) {
153+
all := struct {
154+
Attributes *SecurityMonitoringCriticalAssetAttributes `json:"attributes,omitempty"`
155+
Id *string `json:"id,omitempty"`
156+
Type *SecurityMonitoringCriticalAssetType `json:"type,omitempty"`
157+
}{}
158+
if err = datadog.Unmarshal(bytes, &all); err != nil {
159+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
160+
}
161+
additionalProperties := make(map[string]interface{})
162+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
163+
datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"})
164+
} else {
165+
return err
166+
}
167+
168+
hasInvalidField := false
169+
if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
170+
hasInvalidField = true
171+
}
172+
o.Attributes = all.Attributes
173+
o.Id = all.Id
174+
if all.Type != nil && !all.Type.IsValid() {
175+
hasInvalidField = true
176+
} else {
177+
o.Type = all.Type
178+
}
179+
180+
if len(additionalProperties) > 0 {
181+
o.AdditionalProperties = additionalProperties
182+
}
183+
184+
if hasInvalidField {
185+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
186+
}
187+
188+
return nil
189+
}

0 commit comments

Comments
 (0)