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
20 changes: 14 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10205,11 +10205,11 @@ components:
CloudWorkloadSecurityAgentPolicyVersion:
description: The versions of the policy
properties:
Date:
date:
description: The date and time the version was created
nullable: true
type: string
Name:
name:
description: The version of the policy
example: 1.47.0-rc2
type: string
Expand All @@ -10236,8 +10236,11 @@ components:
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSet'
type: object
CloudWorkloadSecurityAgentRuleActionHash:
additionalProperties: {}
description: An empty object indicating the hash action
description: Hash file specified by the field attribute
properties:
field:
description: The field of the hash action
type: string
type: object
CloudWorkloadSecurityAgentRuleActionMetadata:
description: The metadata action applied on the scope matching the rule
Expand Down Expand Up @@ -10285,9 +10288,14 @@ components:
format: int64
type: integer
value:
description: The value of the set action
type: string
$ref: '#/components/schemas/CloudWorkloadSecurityAgentRuleActionSetValue'
type: object
CloudWorkloadSecurityAgentRuleActionSetValue:
description: The value of the set action
oneOf:
- type: string
- type: integer
- type: boolean
CloudWorkloadSecurityAgentRuleActions:
description: The array of actions the rule can perform if triggered
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
// CloudWorkloadSecurityAgentPolicyVersion The versions of the policy
type CloudWorkloadSecurityAgentPolicyVersion struct {
// The date and time the version was created
Date datadog.NullableString `json:"Date,omitempty"`
Date datadog.NullableString `json:"date,omitempty"`
// The version of the policy
Name *string `json:"Name,omitempty"`
Name *string `json:"name,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:"-"`
Expand Down Expand Up @@ -110,10 +110,10 @@ func (o CloudWorkloadSecurityAgentPolicyVersion) MarshalJSON() ([]byte, error) {
return datadog.Marshal(o.UnparsedObject)
}
if o.Date.IsSet() {
toSerialize["Date"] = o.Date.Get()
toSerialize["date"] = o.Date.Get()
}
if o.Name != nil {
toSerialize["Name"] = o.Name
toSerialize["name"] = o.Name
}

for key, value := range o.AdditionalProperties {
Expand All @@ -125,15 +125,15 @@ func (o CloudWorkloadSecurityAgentPolicyVersion) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *CloudWorkloadSecurityAgentPolicyVersion) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Date datadog.NullableString `json:"Date,omitempty"`
Name *string `json:"Name,omitempty"`
Date datadog.NullableString `json:"date,omitempty"`
Name *string `json:"name,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{"Date", "Name"})
datadog.DeleteKeys(additionalProperties, &[]string{"date", "name"})
} else {
return err
}
Expand Down
25 changes: 14 additions & 11 deletions api/datadogV2/model_cloud_workload_security_agent_rule_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
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 file specified by the field attribute
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 Hash file specified by the field attribute
type CloudWorkloadSecurityAgentRuleActionHash struct {
// The field of the hash action
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 @@ -29,7 +29,7 @@ type CloudWorkloadSecurityAgentRuleActionSet struct {
// The time to live of the set action.
Ttl *int64 `json:"ttl,omitempty"`
// The value of the set action
Value *string `json:"value,omitempty"`
Value *CloudWorkloadSecurityAgentRuleActionSetValue `json:"value,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:"-"`
Expand Down Expand Up @@ -305,17 +305,17 @@ func (o *CloudWorkloadSecurityAgentRuleActionSet) SetTtl(v int64) {
}

// GetValue returns the Value field value if set, zero value otherwise.
func (o *CloudWorkloadSecurityAgentRuleActionSet) GetValue() string {
func (o *CloudWorkloadSecurityAgentRuleActionSet) GetValue() CloudWorkloadSecurityAgentRuleActionSetValue {
if o == nil || o.Value == nil {
var ret string
var ret CloudWorkloadSecurityAgentRuleActionSetValue
return ret
}
return *o.Value
}

// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CloudWorkloadSecurityAgentRuleActionSet) GetValueOk() (*string, bool) {
func (o *CloudWorkloadSecurityAgentRuleActionSet) GetValueOk() (*CloudWorkloadSecurityAgentRuleActionSetValue, bool) {
if o == nil || o.Value == nil {
return nil, false
}
Expand All @@ -327,8 +327,8 @@ func (o *CloudWorkloadSecurityAgentRuleActionSet) HasValue() bool {
return o != nil && o.Value != nil
}

// SetValue gets a reference to the given string and assigns it to the Value field.
func (o *CloudWorkloadSecurityAgentRuleActionSet) SetValue(v string) {
// SetValue gets a reference to the given CloudWorkloadSecurityAgentRuleActionSetValue and assigns it to the Value field.
func (o *CloudWorkloadSecurityAgentRuleActionSet) SetValue(v CloudWorkloadSecurityAgentRuleActionSetValue) {
o.Value = &v
}

Expand Down Expand Up @@ -378,16 +378,16 @@ func (o CloudWorkloadSecurityAgentRuleActionSet) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *CloudWorkloadSecurityAgentRuleActionSet) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Append *bool `json:"append,omitempty"`
DefaultValue *string `json:"default_value,omitempty"`
Expression *string `json:"expression,omitempty"`
Field *string `json:"field,omitempty"`
Inherited *bool `json:"inherited,omitempty"`
Name *string `json:"name,omitempty"`
Scope *string `json:"scope,omitempty"`
Size *int64 `json:"size,omitempty"`
Ttl *int64 `json:"ttl,omitempty"`
Value *string `json:"value,omitempty"`
Append *bool `json:"append,omitempty"`
DefaultValue *string `json:"default_value,omitempty"`
Expression *string `json:"expression,omitempty"`
Field *string `json:"field,omitempty"`
Inherited *bool `json:"inherited,omitempty"`
Name *string `json:"name,omitempty"`
Scope *string `json:"scope,omitempty"`
Size *int64 `json:"size,omitempty"`
Ttl *int64 `json:"ttl,omitempty"`
Value *CloudWorkloadSecurityAgentRuleActionSetValue `json:"value,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand Down
Loading
Loading