From 3f81a726793680ec54a30aa8ac626a79582320b8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 15 May 2024 11:58:12 +0000 Subject: [PATCH] Regenerate client from commit 6a5a250e of spec repo --- .apigentools-info | 8 ++-- .generator/schemas/v2/openapi.yaml | 5 +++ ...d_security_agent_rule_create_attributes.go | 45 ++++++++++++++++--- .../csm-threats/CreateCSMThreatsAgentRule.go | 5 ++- ...eats_Agent_rule_returns_OK_response.freeze | 2 +- ...hreats_Agent_rule_returns_OK_response.yaml | 11 ++--- .../scenarios/features/v2/csm_threats.feature | 2 +- 7 files changed, 61 insertions(+), 17 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index fce2b913108..8b7001fce48 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -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" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0d5ca4f6e94..666928a7cf0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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 diff --git a/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go b/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go index f72687d4b57..3fd2950b8cc 100644 --- a/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go +++ b/api/datadogV2/model_cloud_workload_security_agent_rule_create_attributes.go @@ -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 @@ -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 { @@ -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 { @@ -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) @@ -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 { diff --git a/examples/v2/csm-threats/CreateCSMThreatsAgentRule.go b/examples/v2/csm-threats/CreateCSMThreatsAgentRule.go index 8efb12ef04b..921d6e9af2b 100644 --- a/examples/v2/csm-threats/CreateCSMThreatsAgentRule.go +++ b/examples/v2/csm-threats/CreateCSMThreatsAgentRule.go @@ -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, }, diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.freeze index bff050d55d1..3fcaf7532d9 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.freeze @@ -1 +1 @@ -2024-04-23T17:57:44.371Z \ No newline at end of file +2024-05-15T10:52:45.387Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.yaml index 7fada680809..062943792ed 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_CSM_Threats/Scenario_Create_a_CSM_Threats_Agent_rule_returns_OK_response.yaml @@ -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: @@ -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: @@ -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 diff --git a/tests/scenarios/features/v2/csm_threats.feature b/tests/scenarios/features/v2/csm_threats.feature index 9de7fc15e0a..739dee5a604 100644 --- a/tests/scenarios/features/v2/csm_threats.feature +++ b/tests/scenarios/features/v2/csm_threats.feature @@ -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