Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,29 @@
body = DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleCreateRequest.new({
data: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleCreateData.new({
attributes: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleCreateAttributes.new({
actions: [
DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleAction.new({
coredump: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionCoreDump.new({}),
disabled: false,
_hash: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionHash.new({}),
kill: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleKill.new({}),
log: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionLog.new({}),
metadata: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionMetadata.new({}),
network_filter: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionNetworkFilter.new({}),
set: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionSet.new({}),
}),
],
blocking: [],
description: "My Agent rule",
disabled: [],
enabled: true,
expression: 'exec.file.name == "sh"',
filters: [],
name: "examplecsmthreat",
monitoring: [],
name: "my_agent_rule",
policy_id: "a8c8e364-6556-434d-b798-a4c23de29c0b",
product_tags: [],
silent: false,
}),
type: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CSMThreatsAPI.new

# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = ENV["AGENT_RULE_DATA_ID"]
api_instance.delete_cloud_workload_security_agent_rule(AGENT_RULE_DATA_ID)
api_instance.delete_cloud_workload_security_agent_rule("agent_rule_id")
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CSMThreatsAPI.new

# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = ENV["AGENT_RULE_DATA_ID"]
p api_instance.get_cloud_workload_security_agent_rule(AGENT_RULE_DATA_ID)
p api_instance.get_cloud_workload_security_agent_rule("agent_rule_id")
28 changes: 22 additions & 6 deletions examples/v2/csm-threats/UpdateCloudWorkloadSecurityAgentRule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,33 @@
end
api_instance = DatadogAPIClient::V2::CSMThreatsAPI.new

# there is a valid "agent_rule" in the system
AGENT_RULE_DATA_ID = ENV["AGENT_RULE_DATA_ID"]

body = DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleUpdateRequest.new({
data: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleUpdateData.new({
attributes: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleUpdateAttributes.new({
description: "Updated Agent rule",
actions: [
DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleAction.new({
coredump: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionCoreDump.new({}),
disabled: false,
_hash: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionHash.new({}),
kill: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleKill.new({}),
log: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionLog.new({}),
metadata: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionMetadata.new({}),
network_filter: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionNetworkFilter.new({}),
set: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionSet.new({}),
}),
],
blocking: [],
description: "My Agent rule",
disabled: [],
enabled: true,
expression: 'exec.file.name == "sh"',
monitoring: [],
policy_id: "a8c8e364-6556-434d-b798-a4c23de29c0b",
product_tags: [],
silent: false,
}),
id: AGENT_RULE_DATA_ID,
id: "3dd-0uc-h1s",
type: DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleType::AGENT_RULE,
}),
})
p api_instance.update_cloud_workload_security_agent_rule(AGENT_RULE_DATA_ID, body)
p api_instance.update_cloud_workload_security_agent_rule("agent_rule_id", body)
72 changes: 32 additions & 40 deletions features/v2/csm_threats.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,24 @@ Feature: CSM Threats
And a valid "appKeyAuth" key in the system
And an instance of "CSMThreats" API

@replay-only @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Create a Workload Protection agent rule (US1-FED) returns "Bad Request" response
Given there is a valid "policy_rc" in the system
And new "CreateCloudWorkloadSecurityAgentRule" request
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name", "filters": [], "name": "my_agent_rule"}, "type": "agent_rule"}}
Given new "CreateCloudWorkloadSecurityAgentRule" request
And body with value {"data": {"attributes": {"actions": [{"coredump": {}, "disabled": false, "hash": {}, "kill": {}, "log": {}, "metadata": {}, "network_filter": {}, "set": {}}], "blocking": [], "description": "My Agent rule", "disabled": [], "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": [], "monitoring": [], "name": "my_agent_rule", "policy_id": "a8c8e364-6556-434d-b798-a4c23de29c0b", "product_tags": [], "silent": false}, "type": "agent_rule"}}
When the request is sent
Then the response status is 400 Bad Request

@skip @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Create a Workload Protection agent rule (US1-FED) returns "Conflict" response
Given there is a valid "policy_rc" in the system
And new "CreateCloudWorkloadSecurityAgentRule" request
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": [], "name": "my_agent_rule"}, "type": "agent_rule"}}
Given new "CreateCloudWorkloadSecurityAgentRule" request
And body with value {"data": {"attributes": {"actions": [{"coredump": {}, "disabled": false, "hash": {}, "kill": {}, "log": {}, "metadata": {}, "network_filter": {}, "set": {}}], "blocking": [], "description": "My Agent rule", "disabled": [], "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": [], "monitoring": [], "name": "my_agent_rule", "policy_id": "a8c8e364-6556-434d-b798-a4c23de29c0b", "product_tags": [], "silent": false}, "type": "agent_rule"}}
When the request is sent
Then the response status is 409 Conflict

@replay-only @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Create a Workload Protection agent rule (US1-FED) returns "OK" response
Given there is a valid "policy_rc" in the system
And new "CreateCloudWorkloadSecurityAgentRule" request
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": [], "name": "{{ unique_lower_alnum }}"}, "type": "agent_rule"}}
Given new "CreateCloudWorkloadSecurityAgentRule" request
And body with value {"data": {"attributes": {"actions": [{"coredump": {}, "disabled": false, "hash": {}, "kill": {}, "log": {}, "metadata": {}, "network_filter": {}, "set": {}}], "blocking": [], "description": "My Agent rule", "disabled": [], "enabled": true, "expression": "exec.file.name == \"sh\"", "filters": [], "monitoring": [], "name": "my_agent_rule", "policy_id": "a8c8e364-6556-434d-b798-a4c23de29c0b", "product_tags": [], "silent": false}, "type": "agent_rule"}}
When the request is sent
Then the response status is 200 OK

Expand Down Expand Up @@ -98,18 +95,17 @@ Feature: CSM Threats
When the request is sent
Then the response status is 201 Created

@replay-only @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Delete a Workload Protection agent rule (US1-FED) returns "Not Found" response
Given new "DeleteCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter with value "non-existent-rule-id"
And request contains "agent_rule_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 404 Not Found

@replay-only @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Delete a Workload Protection agent rule (US1-FED) returns "OK" response
Given there is a valid "agent_rule" in the system
And new "DeleteCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "agent_rule.data.id"
Given new "DeleteCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 204 OK

Expand Down Expand Up @@ -164,11 +160,10 @@ Feature: CSM Threats
When the request is sent
Then the response status is 404 Not Found

@team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Get a Workload Protection agent rule (US1-FED) returns "OK" response
Given there is a valid "agent_rule" in the system
And new "GetCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "agent_rule.data.id"
Given new "GetCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 200 OK

Expand Down Expand Up @@ -222,38 +217,35 @@ Feature: CSM Threats
When the request is sent
Then the response status is 200 OK

@replay-only @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Update a Workload Protection agent rule (US1-FED) returns "Bad Request" response
Given there is a valid "agent_rule" in the system
And new "UpdateCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "agent_rule.data.id"
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name"}, "id": "{{ agent_rule.data.id }}", "type": "agent_rule"}}
Given new "UpdateCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"actions": [{"coredump": {}, "disabled": false, "hash": {}, "kill": {}, "log": {}, "metadata": {}, "network_filter": {}, "set": {}}], "blocking": [], "description": "My Agent rule", "disabled": [], "enabled": true, "expression": "exec.file.name == \"sh\"", "monitoring": [], "policy_id": "a8c8e364-6556-434d-b798-a4c23de29c0b", "product_tags": [], "silent": false}, "id": "3dd-0uc-h1s", "type": "agent_rule"}}
When the request is sent
Then the response status is 400 Bad Request

@skip @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Update a Workload Protection agent rule (US1-FED) returns "Concurrent Modification" response
Given there is a valid "agent_rule" in the system
And new "UpdateCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "agent_rule.data.id"
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name == \"sh\""}, "id": "{{ agent_rule.data.id }}", "type": "agent_rule"}}
Given new "UpdateCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"actions": [{"coredump": {}, "disabled": false, "hash": {}, "kill": {}, "log": {}, "metadata": {}, "network_filter": {}, "set": {}}], "blocking": [], "description": "My Agent rule", "disabled": [], "enabled": true, "expression": "exec.file.name == \"sh\"", "monitoring": [], "policy_id": "a8c8e364-6556-434d-b798-a4c23de29c0b", "product_tags": [], "silent": false}, "id": "3dd-0uc-h1s", "type": "agent_rule"}}
When the request is sent
Then the response status is 409 Concurrent Modification

@replay-only @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Update a Workload Protection agent rule (US1-FED) returns "Not Found" response
Given new "UpdateCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter with value "non-existent-rule-id"
And body with value {"data": {"attributes": {"description": "My Agent rule", "enabled": true, "expression": "exec.file.name == \"sh\""}, "id": "invalid-agent-rule-id", "type": "agent_rule"}}
And request contains "agent_rule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"actions": [{"coredump": {}, "disabled": false, "hash": {}, "kill": {}, "log": {}, "metadata": {}, "network_filter": {}, "set": {}}], "blocking": [], "description": "My Agent rule", "disabled": [], "enabled": true, "expression": "exec.file.name == \"sh\"", "monitoring": [], "policy_id": "a8c8e364-6556-434d-b798-a4c23de29c0b", "product_tags": [], "silent": false}, "id": "3dd-0uc-h1s", "type": "agent_rule"}}
When the request is sent
Then the response status is 404 Not Found

@replay-only @team:ddoghq/k9-cws-backend
@generated @skip @team:ddoghq/k9-cws-backend
Scenario: Update a Workload Protection agent rule (US1-FED) returns "OK" response
Given there is a valid "agent_rule" in the system
And new "UpdateCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "agent_rule.data.id"
And body with value {"data": {"attributes": {"description": "Updated Agent rule", "expression": "exec.file.name == \"sh\""}, "id": "{{ agent_rule.data.id }}", "type": "agent_rule"}}
Given new "UpdateCloudWorkloadSecurityAgentRule" request
And request contains "agent_rule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"actions": [{"coredump": {}, "disabled": false, "hash": {}, "kill": {}, "log": {}, "metadata": {}, "network_filter": {}, "set": {}}], "blocking": [], "description": "My Agent rule", "disabled": [], "enabled": true, "expression": "exec.file.name == \"sh\"", "monitoring": [], "policy_id": "a8c8e364-6556-434d-b798-a4c23de29c0b", "product_tags": [], "silent": false}, "id": "3dd-0uc-h1s", "type": "agent_rule"}}
When the request is sent
Then the response status is 200 OK

Expand Down
56 changes: 0 additions & 56 deletions generated-test/test-runner-data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4529,20 +4529,6 @@
"scenario": "Get the CSM Serverless Coverage Analysis returns \"OK\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/create-a-workload-protection-agent-rule-us1-fed-returns-bad-request-response.json",
"scenario": "Create a Workload Protection agent rule (US1-FED) returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/create-a-workload-protection-agent-rule-us1-fed-returns-ok-response.json",
"scenario": "Create a Workload Protection agent rule (US1-FED) returns \"OK\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
Expand Down Expand Up @@ -4585,20 +4571,6 @@
"scenario": "Create a Workload Protection policy returns \"Created\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/delete-a-workload-protection-agent-rule-us1-fed-returns-not-found-response.json",
"scenario": "Delete a Workload Protection agent rule (US1-FED) returns \"Not Found\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/delete-a-workload-protection-agent-rule-us1-fed-returns-ok-response.json",
"scenario": "Delete a Workload Protection agent rule (US1-FED) returns \"OK\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
Expand Down Expand Up @@ -4648,13 +4620,6 @@
"scenario": "Get a Workload Protection agent rule (US1-FED) returns \"Not Found\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/get-a-workload-protection-agent-rule-us1-fed-returns-ok-response.json",
"scenario": "Get a Workload Protection agent rule (US1-FED) returns \"OK\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
Expand Down Expand Up @@ -4704,27 +4669,6 @@
"scenario": "Get all Workload Protection policies returns \"OK\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/update-a-workload-protection-agent-rule-us1-fed-returns-bad-request-response.json",
"scenario": "Update a Workload Protection agent rule (US1-FED) returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/update-a-workload-protection-agent-rule-us1-fed-returns-not-found-response.json",
"scenario": "Update a Workload Protection agent rule (US1-FED) returns \"Not Found\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
"file": "v2/csm-threats/update-a-workload-protection-agent-rule-us1-fed-returns-ok-response.json",
"scenario": "Update a Workload Protection agent rule (US1-FED) returns \"OK\" response",
"version": "v2"
},
{
"feature": "CSM Threats",
"feature_file": "../../features/v2/csm_threats.feature",
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading