Skip to content

Commit ce11823

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add field attribute to the Workload Protection hash action (#3487)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 935ce0c commit ce11823

56 files changed

Lines changed: 2735 additions & 4319 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: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10258,6 +10258,10 @@ components:
1025810258
description: Whether the policy is pinned
1025910259
example: false
1026010260
type: boolean
10261+
policyType:
10262+
description: The type of the policy
10263+
example: policy
10264+
type: string
1026110265
policyVersion:
1026210266
description: The version of the policy
1026310267
example: '1'
@@ -10436,11 +10440,11 @@ components:
1043610440
CloudWorkloadSecurityAgentPolicyVersion:
1043710441
description: The versions of the policy
1043810442
properties:
10439-
Date:
10443+
date:
1044010444
description: The date and time the version was created
1044110445
nullable: true
1044210446
type: string
10443-
Name:
10447+
name:
1044410448
description: The version of the policy
1044510449
example: 1.47.0-rc2
1044610450
type: string
@@ -10467,8 +10471,11 @@ components:
1046710471
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSet'
1046810472
type: object
1046910473
CloudWorkloadSecurityAgentRuleActionHash:
10470-
additionalProperties: {}
10471-
description: An empty object indicating the hash action
10474+
description: Hash file specified by the field attribute
10475+
properties:
10476+
field:
10477+
description: The field of the hash action
10478+
type: string
1047210479
type: object
1047310480
CloudWorkloadSecurityAgentRuleActionMetadata:
1047410481
description: The metadata action applied on the scope matching the rule
@@ -10516,9 +10523,14 @@ components:
1051610523
format: int64
1051710524
type: integer
1051810525
value:
10519-
description: The value of the set action
10520-
type: string
10526+
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSetValue'
1052110527
type: object
10528+
CloudWorkloadSecurityAgentRuleActionSetValue:
10529+
description: The value of the set action
10530+
oneOf:
10531+
- type: string
10532+
- type: integer
10533+
- type: boolean
1052210534
CloudWorkloadSecurityAgentRuleActions:
1052310535
description: The array of actions the rule can perform if triggered
1052410536
items:

api/datadogV2/model_cloud_workload_security_agent_policy_attributes.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ type CloudWorkloadSecurityAgentPolicyAttributes struct {
3030
Name *string `json:"name,omitempty"`
3131
// Whether the policy is pinned
3232
Pinned *bool `json:"pinned,omitempty"`
33+
// The type of the policy
34+
PolicyType *string `json:"policyType,omitempty"`
3335
// The version of the policy
3436
PolicyVersion *string `json:"policyVersion,omitempty"`
3537
// The priority of the policy
@@ -346,6 +348,34 @@ func (o *CloudWorkloadSecurityAgentPolicyAttributes) SetPinned(v bool) {
346348
o.Pinned = &v
347349
}
348350

351+
// GetPolicyType returns the PolicyType field value if set, zero value otherwise.
352+
func (o *CloudWorkloadSecurityAgentPolicyAttributes) GetPolicyType() string {
353+
if o == nil || o.PolicyType == nil {
354+
var ret string
355+
return ret
356+
}
357+
return *o.PolicyType
358+
}
359+
360+
// GetPolicyTypeOk returns a tuple with the PolicyType field value if set, nil otherwise
361+
// and a boolean to check if the value has been set.
362+
func (o *CloudWorkloadSecurityAgentPolicyAttributes) GetPolicyTypeOk() (*string, bool) {
363+
if o == nil || o.PolicyType == nil {
364+
return nil, false
365+
}
366+
return o.PolicyType, true
367+
}
368+
369+
// HasPolicyType returns a boolean if a field has been set.
370+
func (o *CloudWorkloadSecurityAgentPolicyAttributes) HasPolicyType() bool {
371+
return o != nil && o.PolicyType != nil
372+
}
373+
374+
// SetPolicyType gets a reference to the given string and assigns it to the PolicyType field.
375+
func (o *CloudWorkloadSecurityAgentPolicyAttributes) SetPolicyType(v string) {
376+
o.PolicyType = &v
377+
}
378+
349379
// GetPolicyVersion returns the PolicyVersion field value if set, zero value otherwise.
350380
func (o *CloudWorkloadSecurityAgentPolicyAttributes) GetPolicyVersion() string {
351381
if o == nil || o.PolicyVersion == nil {
@@ -578,6 +608,9 @@ func (o CloudWorkloadSecurityAgentPolicyAttributes) MarshalJSON() ([]byte, error
578608
if o.Pinned != nil {
579609
toSerialize["pinned"] = o.Pinned
580610
}
611+
if o.PolicyType != nil {
612+
toSerialize["policyType"] = o.PolicyType
613+
}
581614
if o.PolicyVersion != nil {
582615
toSerialize["policyVersion"] = o.PolicyVersion
583616
}
@@ -619,6 +652,7 @@ func (o *CloudWorkloadSecurityAgentPolicyAttributes) UnmarshalJSON(bytes []byte)
619652
MonitoringRulesCount *int32 `json:"monitoringRulesCount,omitempty"`
620653
Name *string `json:"name,omitempty"`
621654
Pinned *bool `json:"pinned,omitempty"`
655+
PolicyType *string `json:"policyType,omitempty"`
622656
PolicyVersion *string `json:"policyVersion,omitempty"`
623657
Priority *int64 `json:"priority,omitempty"`
624658
RuleCount *int32 `json:"ruleCount,omitempty"`
@@ -632,7 +666,7 @@ func (o *CloudWorkloadSecurityAgentPolicyAttributes) UnmarshalJSON(bytes []byte)
632666
}
633667
additionalProperties := make(map[string]interface{})
634668
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
635-
datadog.DeleteKeys(additionalProperties, &[]string{"blockingRulesCount", "datadogManaged", "description", "disabledRulesCount", "enabled", "hostTags", "hostTagsLists", "monitoringRulesCount", "name", "pinned", "policyVersion", "priority", "ruleCount", "updateDate", "updatedAt", "updater", "versions"})
669+
datadog.DeleteKeys(additionalProperties, &[]string{"blockingRulesCount", "datadogManaged", "description", "disabledRulesCount", "enabled", "hostTags", "hostTagsLists", "monitoringRulesCount", "name", "pinned", "policyType", "policyVersion", "priority", "ruleCount", "updateDate", "updatedAt", "updater", "versions"})
636670
} else {
637671
return err
638672
}
@@ -648,6 +682,7 @@ func (o *CloudWorkloadSecurityAgentPolicyAttributes) UnmarshalJSON(bytes []byte)
648682
o.MonitoringRulesCount = all.MonitoringRulesCount
649683
o.Name = all.Name
650684
o.Pinned = all.Pinned
685+
o.PolicyType = all.PolicyType
651686
o.PolicyVersion = all.PolicyVersion
652687
o.Priority = all.Priority
653688
o.RuleCount = all.RuleCount

api/datadogV2/model_cloud_workload_security_agent_policy_version.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
// CloudWorkloadSecurityAgentPolicyVersion The versions of the policy
1212
type CloudWorkloadSecurityAgentPolicyVersion struct {
1313
// The date and time the version was created
14-
Date datadog.NullableString `json:"Date,omitempty"`
14+
Date datadog.NullableString `json:"date,omitempty"`
1515
// The version of the policy
16-
Name *string `json:"Name,omitempty"`
16+
Name *string `json:"name,omitempty"`
1717
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1818
UnparsedObject map[string]interface{} `json:"-"`
1919
AdditionalProperties map[string]interface{} `json:"-"`
@@ -110,10 +110,10 @@ func (o CloudWorkloadSecurityAgentPolicyVersion) MarshalJSON() ([]byte, error) {
110110
return datadog.Marshal(o.UnparsedObject)
111111
}
112112
if o.Date.IsSet() {
113-
toSerialize["Date"] = o.Date.Get()
113+
toSerialize["date"] = o.Date.Get()
114114
}
115115
if o.Name != nil {
116-
toSerialize["Name"] = o.Name
116+
toSerialize["name"] = o.Name
117117
}
118118

119119
for key, value := range o.AdditionalProperties {
@@ -125,15 +125,15 @@ func (o CloudWorkloadSecurityAgentPolicyVersion) MarshalJSON() ([]byte, error) {
125125
// UnmarshalJSON deserializes the given payload.
126126
func (o *CloudWorkloadSecurityAgentPolicyVersion) UnmarshalJSON(bytes []byte) (err error) {
127127
all := struct {
128-
Date datadog.NullableString `json:"Date,omitempty"`
129-
Name *string `json:"Name,omitempty"`
128+
Date datadog.NullableString `json:"date,omitempty"`
129+
Name *string `json:"name,omitempty"`
130130
}{}
131131
if err = datadog.Unmarshal(bytes, &all); err != nil {
132132
return datadog.Unmarshal(bytes, &o.UnparsedObject)
133133
}
134134
additionalProperties := make(map[string]interface{})
135135
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
136-
datadog.DeleteKeys(additionalProperties, &[]string{"Date", "Name"})
136+
datadog.DeleteKeys(additionalProperties, &[]string{"date", "name"})
137137
} else {
138138
return err
139139
}

api/datadogV2/model_cloud_workload_security_agent_rule_action.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
type CloudWorkloadSecurityAgentRuleAction struct {
1313
// SECL expression used to target the container to apply the action on
1414
Filter *string `json:"filter,omitempty"`
15-
// An empty object indicating the hash action
16-
Hash map[string]interface{} `json:"hash,omitempty"`
15+
// Hash file specified by the field attribute
16+
Hash *CloudWorkloadSecurityAgentRuleActionHash `json:"hash,omitempty"`
1717
// Kill system call applied on the container matching the rule
1818
Kill *CloudWorkloadSecurityAgentRuleKill `json:"kill,omitempty"`
1919
// The metadata action applied on the scope matching the rule
@@ -71,31 +71,31 @@ func (o *CloudWorkloadSecurityAgentRuleAction) SetFilter(v string) {
7171
}
7272

7373
// GetHash returns the Hash field value if set, zero value otherwise.
74-
func (o *CloudWorkloadSecurityAgentRuleAction) GetHash() map[string]interface{} {
74+
func (o *CloudWorkloadSecurityAgentRuleAction) GetHash() CloudWorkloadSecurityAgentRuleActionHash {
7575
if o == nil || o.Hash == nil {
76-
var ret map[string]interface{}
76+
var ret CloudWorkloadSecurityAgentRuleActionHash
7777
return ret
7878
}
79-
return o.Hash
79+
return *o.Hash
8080
}
8181

8282
// GetHashOk returns a tuple with the Hash field value if set, nil otherwise
8383
// and a boolean to check if the value has been set.
84-
func (o *CloudWorkloadSecurityAgentRuleAction) GetHashOk() (*map[string]interface{}, bool) {
84+
func (o *CloudWorkloadSecurityAgentRuleAction) GetHashOk() (*CloudWorkloadSecurityAgentRuleActionHash, bool) {
8585
if o == nil || o.Hash == nil {
8686
return nil, false
8787
}
88-
return &o.Hash, true
88+
return o.Hash, true
8989
}
9090

9191
// HasHash returns a boolean if a field has been set.
9292
func (o *CloudWorkloadSecurityAgentRuleAction) HasHash() bool {
9393
return o != nil && o.Hash != nil
9494
}
9595

96-
// SetHash gets a reference to the given map[string]interface{} and assigns it to the Hash field.
97-
func (o *CloudWorkloadSecurityAgentRuleAction) SetHash(v map[string]interface{}) {
98-
o.Hash = v
96+
// SetHash gets a reference to the given CloudWorkloadSecurityAgentRuleActionHash and assigns it to the Hash field.
97+
func (o *CloudWorkloadSecurityAgentRuleAction) SetHash(v CloudWorkloadSecurityAgentRuleActionHash) {
98+
o.Hash = &v
9999
}
100100

101101
// GetKill returns the Kill field value if set, zero value otherwise.
@@ -214,7 +214,7 @@ func (o CloudWorkloadSecurityAgentRuleAction) MarshalJSON() ([]byte, error) {
214214
func (o *CloudWorkloadSecurityAgentRuleAction) UnmarshalJSON(bytes []byte) (err error) {
215215
all := struct {
216216
Filter *string `json:"filter,omitempty"`
217-
Hash map[string]interface{} `json:"hash,omitempty"`
217+
Hash *CloudWorkloadSecurityAgentRuleActionHash `json:"hash,omitempty"`
218218
Kill *CloudWorkloadSecurityAgentRuleKill `json:"kill,omitempty"`
219219
Metadata *CloudWorkloadSecurityAgentRuleActionMetadata `json:"metadata,omitempty"`
220220
Set *CloudWorkloadSecurityAgentRuleActionSet `json:"set,omitempty"`
@@ -231,6 +231,9 @@ func (o *CloudWorkloadSecurityAgentRuleAction) UnmarshalJSON(bytes []byte) (err
231231

232232
hasInvalidField := false
233233
o.Filter = all.Filter
234+
if all.Hash != nil && all.Hash.UnparsedObject != nil && o.UnparsedObject == nil {
235+
hasInvalidField = true
236+
}
234237
o.Hash = all.Hash
235238
if all.Kill != nil && all.Kill.UnparsedObject != nil && o.UnparsedObject == nil {
236239
hasInvalidField = true
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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+
// CloudWorkloadSecurityAgentRuleActionHash Hash file specified by the field attribute
12+
type CloudWorkloadSecurityAgentRuleActionHash struct {
13+
// The field of the hash action
14+
Field *string `json:"field,omitempty"`
15+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
16+
UnparsedObject map[string]interface{} `json:"-"`
17+
AdditionalProperties map[string]interface{} `json:"-"`
18+
}
19+
20+
// NewCloudWorkloadSecurityAgentRuleActionHash instantiates a new CloudWorkloadSecurityAgentRuleActionHash object.
21+
// This constructor will assign default values to properties that have it defined,
22+
// and makes sure properties required by API are set, but the set of arguments
23+
// will change when the set of required properties is changed.
24+
func NewCloudWorkloadSecurityAgentRuleActionHash() *CloudWorkloadSecurityAgentRuleActionHash {
25+
this := CloudWorkloadSecurityAgentRuleActionHash{}
26+
return &this
27+
}
28+
29+
// NewCloudWorkloadSecurityAgentRuleActionHashWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleActionHash object.
30+
// This constructor will only assign default values to properties that have it defined,
31+
// but it doesn't guarantee that properties required by API are set.
32+
func NewCloudWorkloadSecurityAgentRuleActionHashWithDefaults() *CloudWorkloadSecurityAgentRuleActionHash {
33+
this := CloudWorkloadSecurityAgentRuleActionHash{}
34+
return &this
35+
}
36+
37+
// GetField returns the Field field value if set, zero value otherwise.
38+
func (o *CloudWorkloadSecurityAgentRuleActionHash) GetField() string {
39+
if o == nil || o.Field == nil {
40+
var ret string
41+
return ret
42+
}
43+
return *o.Field
44+
}
45+
46+
// GetFieldOk returns a tuple with the Field field value if set, nil otherwise
47+
// and a boolean to check if the value has been set.
48+
func (o *CloudWorkloadSecurityAgentRuleActionHash) GetFieldOk() (*string, bool) {
49+
if o == nil || o.Field == nil {
50+
return nil, false
51+
}
52+
return o.Field, true
53+
}
54+
55+
// HasField returns a boolean if a field has been set.
56+
func (o *CloudWorkloadSecurityAgentRuleActionHash) HasField() bool {
57+
return o != nil && o.Field != nil
58+
}
59+
60+
// SetField gets a reference to the given string and assigns it to the Field field.
61+
func (o *CloudWorkloadSecurityAgentRuleActionHash) SetField(v string) {
62+
o.Field = &v
63+
}
64+
65+
// MarshalJSON serializes the struct using spec logic.
66+
func (o CloudWorkloadSecurityAgentRuleActionHash) MarshalJSON() ([]byte, error) {
67+
toSerialize := map[string]interface{}{}
68+
if o.UnparsedObject != nil {
69+
return datadog.Marshal(o.UnparsedObject)
70+
}
71+
if o.Field != nil {
72+
toSerialize["field"] = o.Field
73+
}
74+
75+
for key, value := range o.AdditionalProperties {
76+
toSerialize[key] = value
77+
}
78+
return datadog.Marshal(toSerialize)
79+
}
80+
81+
// UnmarshalJSON deserializes the given payload.
82+
func (o *CloudWorkloadSecurityAgentRuleActionHash) UnmarshalJSON(bytes []byte) (err error) {
83+
all := struct {
84+
Field *string `json:"field,omitempty"`
85+
}{}
86+
if err = datadog.Unmarshal(bytes, &all); err != nil {
87+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
88+
}
89+
additionalProperties := make(map[string]interface{})
90+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
91+
datadog.DeleteKeys(additionalProperties, &[]string{"field"})
92+
} else {
93+
return err
94+
}
95+
o.Field = all.Field
96+
97+
if len(additionalProperties) > 0 {
98+
o.AdditionalProperties = additionalProperties
99+
}
100+
101+
return nil
102+
}

0 commit comments

Comments
 (0)