Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8650,6 +8650,11 @@ components:
CloudWorkloadSecurityAgentRuleActionHash:
additionalProperties: {}
description: An empty object indicating the hash action
properties:
field:
description: Event field to use for the hash computation.
example: process.file
type: string
type: object
CloudWorkloadSecurityAgentRuleActionMetadata:
description: The metadata action applied on the scope matching the rule
Expand Down
23 changes: 13 additions & 10 deletions api/datadogV2/model_cloud_workload_security_agent_rule_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type CloudWorkloadSecurityAgentRuleAction struct {
// SECL expression used to target the container to apply the action on
Filter *string `json:"filter,omitempty"`
// An empty object indicating the hash action
Hash map[string]interface{} `json:"hash,omitempty"`
Hash *CloudWorkloadSecurityAgentRuleActionHash `json:"hash,omitempty"`
// Kill system call applied on the container matching the rule
Kill *CloudWorkloadSecurityAgentRuleKill `json:"kill,omitempty"`
// The metadata action applied on the scope matching the rule
Expand Down Expand Up @@ -71,31 +71,31 @@ func (o *CloudWorkloadSecurityAgentRuleAction) SetFilter(v string) {
}

// GetHash returns the Hash field value if set, zero value otherwise.
func (o *CloudWorkloadSecurityAgentRuleAction) GetHash() map[string]interface{} {
func (o *CloudWorkloadSecurityAgentRuleAction) GetHash() CloudWorkloadSecurityAgentRuleActionHash {
if o == nil || o.Hash == nil {
var ret map[string]interface{}
var ret CloudWorkloadSecurityAgentRuleActionHash
return ret
}
return o.Hash
return *o.Hash
}

// GetHashOk returns a tuple with the Hash field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CloudWorkloadSecurityAgentRuleAction) GetHashOk() (*map[string]interface{}, bool) {
func (o *CloudWorkloadSecurityAgentRuleAction) GetHashOk() (*CloudWorkloadSecurityAgentRuleActionHash, bool) {
if o == nil || o.Hash == nil {
return nil, false
}
return &o.Hash, true
return o.Hash, true
}

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

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

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

hasInvalidField := false
o.Filter = all.Filter
if all.Hash != nil && all.Hash.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Hash = all.Hash
if all.Kill != nil && all.Kill.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV2

import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// CloudWorkloadSecurityAgentRuleActionHash An empty object indicating the hash action
type CloudWorkloadSecurityAgentRuleActionHash struct {
// Event field to use for the hash computation.
Field *string `json:"field,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewCloudWorkloadSecurityAgentRuleActionHash instantiates a new CloudWorkloadSecurityAgentRuleActionHash object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewCloudWorkloadSecurityAgentRuleActionHash() *CloudWorkloadSecurityAgentRuleActionHash {
this := CloudWorkloadSecurityAgentRuleActionHash{}
return &this
}

// NewCloudWorkloadSecurityAgentRuleActionHashWithDefaults instantiates a new CloudWorkloadSecurityAgentRuleActionHash object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewCloudWorkloadSecurityAgentRuleActionHashWithDefaults() *CloudWorkloadSecurityAgentRuleActionHash {
this := CloudWorkloadSecurityAgentRuleActionHash{}
return &this
}

// GetField returns the Field field value if set, zero value otherwise.
func (o *CloudWorkloadSecurityAgentRuleActionHash) GetField() string {
if o == nil || o.Field == nil {
var ret string
return ret
}
return *o.Field
}

// GetFieldOk returns a tuple with the Field field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CloudWorkloadSecurityAgentRuleActionHash) GetFieldOk() (*string, bool) {
if o == nil || o.Field == nil {
return nil, false
}
return o.Field, true
}

// HasField returns a boolean if a field has been set.
func (o *CloudWorkloadSecurityAgentRuleActionHash) HasField() bool {
return o != nil && o.Field != nil
}

// SetField gets a reference to the given string and assigns it to the Field field.
func (o *CloudWorkloadSecurityAgentRuleActionHash) SetField(v string) {
o.Field = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o CloudWorkloadSecurityAgentRuleActionHash) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Field != nil {
toSerialize["field"] = o.Field
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *CloudWorkloadSecurityAgentRuleActionHash) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Field *string `json:"field,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"field"})
} else {
return err
}
o.Field = all.Field

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func main() {
},
},
{
Hash: map[string]interface{}{},
Hash: &datadogV2.CloudWorkloadSecurityAgentRuleActionHash{},
},
},
},
Expand Down
Loading