Skip to content

Commit

Permalink
Regenerate client from commit 6a5a250e of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed May 15, 2024
1 parent ea5c581 commit 3f81a72
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-05-14 16:40:03.937580",
"spec_repo_commit": "45952461"
"regenerated": "2024-05-15 11:56:32.637683",
"spec_repo_commit": "6a5a250e"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-05-14 16:40:03.955222",
"spec_repo_commit": "45952461"
"regenerated": "2024-05-15 11:56:32.655366",
"spec_repo_commit": "6a5a250e"
}
}
}
5 changes: 5 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4105,6 +4105,11 @@ components:
description: The SECL expression of the Agent rule.
example: exec.file.name == \"sh\"
type: string
filters:
description: The platforms the Agent rule is supported on.
items:
type: string
type: array
name:
description: The name of the Agent rule.
example: my_agent_rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type CloudWorkloadSecurityAgentRuleCreateAttributes struct {
Enabled *bool `json:"enabled,omitempty"`
// The SECL expression of the Agent rule.
Expression string `json:"expression"`
// The platforms the Agent rule is supported on.
Filters []string `json:"filters,omitempty"`
// The name of the Agent rule.
Name string `json:"name"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand Down Expand Up @@ -123,6 +125,34 @@ func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetExpression(v string)
o.Expression = v
}

// GetFilters returns the Filters field value if set, zero value otherwise.
func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetFilters() []string {
if o == nil || o.Filters == nil {
var ret []string
return ret
}
return o.Filters
}

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

// HasFilters returns a boolean if a field has been set.
func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) HasFilters() bool {
return o != nil && o.Filters != nil
}

// SetFilters gets a reference to the given []string and assigns it to the Filters field.
func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) SetFilters(v []string) {
o.Filters = v
}

// GetName returns the Name field value.
func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) GetName() string {
if o == nil {
Expand Down Expand Up @@ -159,6 +189,9 @@ func (o CloudWorkloadSecurityAgentRuleCreateAttributes) MarshalJSON() ([]byte, e
toSerialize["enabled"] = o.Enabled
}
toSerialize["expression"] = o.Expression
if o.Filters != nil {
toSerialize["filters"] = o.Filters
}
toSerialize["name"] = o.Name

for key, value := range o.AdditionalProperties {
Expand All @@ -170,10 +203,11 @@ func (o CloudWorkloadSecurityAgentRuleCreateAttributes) MarshalJSON() ([]byte, e
// UnmarshalJSON deserializes the given payload.
func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Description *string `json:"description,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Expression *string `json:"expression"`
Name *string `json:"name"`
Description *string `json:"description,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Expression *string `json:"expression"`
Filters []string `json:"filters,omitempty"`
Name *string `json:"name"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand All @@ -186,13 +220,14 @@ func (o *CloudWorkloadSecurityAgentRuleCreateAttributes) UnmarshalJSON(bytes []b
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"description", "enabled", "expression", "name"})
datadog.DeleteKeys(additionalProperties, &[]string{"description", "enabled", "expression", "filters", "name"})
} else {
return err
}
o.Description = all.Description
o.Enabled = all.Enabled
o.Expression = *all.Expression
o.Filters = all.Filters
o.Name = *all.Name

if len(additionalProperties) > 0 {
Expand Down
5 changes: 4 additions & 1 deletion examples/v2/csm-threats/CreateCSMThreatsAgentRule.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ func main() {
Description: datadog.PtrString("My Agent rule"),
Enabled: datadog.PtrBool(true),
Expression: `exec.file.name == "sh"`,
Name: "examplecsmthreat",
Filters: []string{
`os == "linux"`,
},
Name: "examplecsmthreat",
},
Type: datadogV2.CLOUDWORKLOADSECURITYAGENTRULETYPE_AGENT_RULE,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-04-23T17:57:44.371Z
2024-05-15T10:52:45.387Z
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: |
{"data":{"attributes":{"description":"My Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","name":"testcreateacsmthreatsagentrulereturnsokresponse1713895064"},"type":"agent_rule"}}
{"data":{"attributes":{"description":"My Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","filters":["os == \"linux\""],"name":"testcreateacsmthreatsagentrulereturnsokresponse1715770365"},"type":"agent_rule"}}
form: {}
headers:
Accept:
Expand All @@ -12,10 +12,11 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules
response:
body: '{"data":{"id":"922-a60-32v","type":"agent_rule","attributes":{"category":"Process
Activity","creationDate":1713895064438,"creator":{"name":"","handle":"frog@datadoghq.com"},"defaultRule":false,"description":"My
body: '{"data":{"id":"hcd-5u7-zd8","type":"agent_rule","attributes":{"category":"Process
Activity","creationDate":1715770365873,"creator":{"name":"CI Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"defaultRule":false,"description":"My
Agent rule","enabled":true,"expression":"exec.file.name == \"sh\"","filters":["os
== \"linux\""],"name":"testcreateacsmthreatsagentrulereturnsokresponse1713895064","updateDate":1713895064438,"updater":{"name":"","handle":"frog@datadoghq.com"}}}}'
== \"linux\""],"name":"testcreateacsmthreatsagentrulereturnsokresponse1715770365","updateDate":1715770365873,"updater":{"name":"CI
Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}'
code: 200
duration: 0ms
headers:
Expand All @@ -30,7 +31,7 @@ interactions:
- '*/*'
id: 1
method: DELETE
url: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/922-a60-32v
url: https://api.datadoghq.com/api/v2/remote_config/products/cws/agent_rules/hcd-5u7-zd8
response:
body: ''
code: 204
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/features/v2/csm_threats.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feature: CSM Threats
@team:DataDog/k9-cloud-security-platform @team:DataDog/k9-cws-backend
Scenario: Create a CSM Threats Agent rule returns "OK" response
Given new "CreateCSMThreatsAgentRule" request
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name == \"sh\"", "name": "{{ unique_lower_alnum }}"}, "type": "agent_rule"}}
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": ["os == \"linux\""], "name": "{{ unique_lower_alnum }}"}, "type": "agent_rule"}}
When the request is sent
Then the response status is 200 OK

Expand Down

0 comments on commit 3f81a72

Please sign in to comment.