Skip to content

Commit 2b4e9c2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Flag IP case action (DataDog#2549)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 4ecacb4 commit 2b4e9c2

10 files changed

+73
-13
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "06ccc32",
3-
"generated": "2025-07-21 13:55:17.296"
2+
"spec_repo_commit": "8ca2883",
3+
"generated": "2025-07-22 07:14:48.428"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34296,9 +34296,22 @@ components:
3429634296
format: int64
3429734297
minimum: 0
3429834298
type: integer
34299+
flaggedIPType:
34300+
$ref: '#/components/schemas/SecurityMonitoringRuleCaseActionOptionsFlaggedIPType'
3429934301
userBehaviorName:
3430034302
$ref: '#/components/schemas/SecurityMonitoringRuleCaseActionOptionsUserBehaviorName'
3430134303
type: object
34304+
SecurityMonitoringRuleCaseActionOptionsFlaggedIPType:
34305+
description: Used with the case action of type 'flag_ip'. The value specified
34306+
in this field is applied as a flag to the IP addresses.
34307+
enum:
34308+
- SUSPICIOUS
34309+
- FLAGGED
34310+
example: FLAGGED
34311+
type: string
34312+
x-enum-varnames:
34313+
- SUSPICIOUS
34314+
- FLAGGED
3430234315
SecurityMonitoringRuleCaseActionOptionsUserBehaviorName:
3430334316
description: Used with the case action of type 'user_behavior'. The value specified
3430434317
in this field is applied as a risk tag to all users affected by the rule.
@@ -34309,11 +34322,13 @@ components:
3430934322
- block_ip
3431034323
- block_user
3431134324
- user_behavior
34325+
- flag_ip
3431234326
type: string
3431334327
x-enum-varnames:
3431434328
- BLOCK_IP
3431534329
- BLOCK_USER
3431634330
- USER_BEHAVIOR
34331+
- FLAG_IP
3431734332
SecurityMonitoringRuleCaseCreate:
3431834333
description: Case when signal is generated.
3431934334
properties:
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025-04-09T15:02:05.047Z
1+
2025-07-17T10:35:24.061Z

cassettes/features/v2/security_monitoring/Create-a-detection-rule-with-type-application-security-returns-OK-response.yml

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/v2/security-monitoring/CreateSecurityMonitoringRule_1965169892.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
user_behavior_name: "behavior",
3838
}),
3939
}),
40+
DatadogAPIClient::V2::SecurityMonitoringRuleCaseAction.new({
41+
type: DatadogAPIClient::V2::SecurityMonitoringRuleCaseActionType::FLAG_IP,
42+
options: DatadogAPIClient::V2::SecurityMonitoringRuleCaseActionOptions.new({
43+
flagged_ip_type: DatadogAPIClient::V2::SecurityMonitoringRuleCaseActionOptionsFlaggedIPType::FLAGGED,
44+
}),
45+
}),
4046
],
4147
}),
4248
],

features/v2/security_monitoring.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Feature: Security Monitoring
225225
@skip-validation @team:DataDog/k9-cloud-security-platform
226226
Scenario: Create a detection rule with type 'application_security 'returns "OK" response
227227
Given new "CreateSecurityMonitoringRule" request
228-
And body with value {"type":"application_security","name":"{{unique}}_appsec_rule","queries":[{"query":"@appsec.security_activity:business_logic.users.login.failure","aggregation":"count","groupByFields":["service","@http.client_ip"],"distinctFields":[]}],"filters":[],"cases":[{"name":"","status":"info","notifications":[],"condition":"a > 100000","actions":[{"type":"block_ip","options":{"duration":900}}, {"type":"user_behavior","options":{"userBehaviorName":"behavior"}}]}],"options":{"keepAlive":3600,"maxSignalDuration":86400,"evaluationWindow":900,"detectionMethod":"threshold"},"isEnabled":true,"message":"Test rule","tags":[],"groupSignalsBy":["service"]}
228+
And body with value {"type":"application_security","name":"{{unique}}_appsec_rule","queries":[{"query":"@appsec.security_activity:business_logic.users.login.failure","aggregation":"count","groupByFields":["service","@http.client_ip"],"distinctFields":[]}],"filters":[],"cases":[{"name":"","status":"info","notifications":[],"condition":"a > 100000","actions":[{"type":"block_ip","options":{"duration":900}}, {"type":"user_behavior","options":{"userBehaviorName":"behavior"}}, {"type":"flag_ip","options":{"flaggedIPType":"FLAGGED"}}]}],"options":{"keepAlive":3600,"maxSignalDuration":86400,"evaluationWindow":900,"detectionMethod":"threshold"},"isEnabled":true,"message":"Test rule","tags":[],"groupSignalsBy":["service"]}
229229
When the request is sent
230230
Then the response status is 200 OK
231231
And the response "name" is equal to "{{ unique }}_appsec_rule"

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,6 +3058,7 @@ def overrides
30583058
"v2.security_monitoring_rule_case" => "SecurityMonitoringRuleCase",
30593059
"v2.security_monitoring_rule_case_action" => "SecurityMonitoringRuleCaseAction",
30603060
"v2.security_monitoring_rule_case_action_options" => "SecurityMonitoringRuleCaseActionOptions",
3061+
"v2.security_monitoring_rule_case_action_options_flagged_ip_type" => "SecurityMonitoringRuleCaseActionOptionsFlaggedIPType",
30613062
"v2.security_monitoring_rule_case_action_type" => "SecurityMonitoringRuleCaseActionType",
30623063
"v2.security_monitoring_rule_case_create" => "SecurityMonitoringRuleCaseCreate",
30633064
"v2.security_monitoring_rule_convert_payload" => "SecurityMonitoringRuleConvertPayload",

lib/datadog_api_client/v2/models/security_monitoring_rule_case_action_options.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class SecurityMonitoringRuleCaseActionOptions
2424
# Duration of the action in seconds. 0 indicates no expiration.
2525
attr_reader :duration
2626

27+
# Used with the case action of type 'flag_ip'. The value specified in this field is applied as a flag to the IP addresses.
28+
attr_accessor :flagged_ip_type
29+
2730
# Used with the case action of type 'user_behavior'. The value specified in this field is applied as a risk tag to all users affected by the rule.
2831
attr_accessor :user_behavior_name
2932

@@ -34,6 +37,7 @@ class SecurityMonitoringRuleCaseActionOptions
3437
def self.attribute_map
3538
{
3639
:'duration' => :'duration',
40+
:'flagged_ip_type' => :'flaggedIPType',
3741
:'user_behavior_name' => :'userBehaviorName'
3842
}
3943
end
@@ -43,6 +47,7 @@ def self.attribute_map
4347
def self.openapi_types
4448
{
4549
:'duration' => :'Integer',
50+
:'flagged_ip_type' => :'SecurityMonitoringRuleCaseActionOptionsFlaggedIPType',
4651
:'user_behavior_name' => :'String'
4752
}
4853
end
@@ -69,6 +74,10 @@ def initialize(attributes = {})
6974
self.duration = attributes[:'duration']
7075
end
7176

77+
if attributes.key?(:'flagged_ip_type')
78+
self.flagged_ip_type = attributes[:'flagged_ip_type']
79+
end
80+
7281
if attributes.key?(:'user_behavior_name')
7382
self.user_behavior_name = attributes[:'user_behavior_name']
7483
end
@@ -119,6 +128,7 @@ def ==(o)
119128
return true if self.equal?(o)
120129
self.class == o.class &&
121130
duration == o.duration &&
131+
flagged_ip_type == o.flagged_ip_type &&
122132
user_behavior_name == o.user_behavior_name &&
123133
additional_properties == o.additional_properties
124134
end
@@ -127,7 +137,7 @@ def ==(o)
127137
# @return [Integer] Hash code
128138
# @!visibility private
129139
def hash
130-
[duration, user_behavior_name, additional_properties].hash
140+
[duration, flagged_ip_type, user_behavior_name, additional_properties].hash
131141
end
132142
end
133143
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Used with the case action of type 'flag_ip'. The value specified in this field is applied as a flag to the IP addresses.
21+
class SecurityMonitoringRuleCaseActionOptionsFlaggedIPType
22+
include BaseEnumModel
23+
24+
SUSPICIOUS = "SUSPICIOUS".freeze
25+
FLAGGED = "FLAGGED".freeze
26+
end
27+
end

lib/datadog_api_client/v2/models/security_monitoring_rule_case_action_type.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ class SecurityMonitoringRuleCaseActionType
2424
BLOCK_IP = "block_ip".freeze
2525
BLOCK_USER = "block_user".freeze
2626
USER_BEHAVIOR = "user_behavior".freeze
27+
FLAG_IP = "flag_ip".freeze
2728
end
2829
end

0 commit comments

Comments
 (0)