Skip to content

Commit 60457c9

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3325bb4 of spec repo
1 parent 0b3df26 commit 60457c9

File tree

8 files changed

+134
-6
lines changed

8 files changed

+134
-6
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4338,6 +4338,10 @@ components:
43384338
- ip_match
43394339
- "!ip_match"
43404340
- capture_data
4341+
- exists
4342+
- "!exists"
4343+
- equals
4344+
- "!equals"
43414345
example: "match_regex"
43424346
type: string
43434347
x-enum-varnames:
@@ -4352,6 +4356,10 @@ components:
43524356
- IP_MATCH
43534357
- NOT_IP_MATCH
43544358
- CAPTURE_DATA
4359+
- EXISTS
4360+
- NOT_EXISTS
4361+
- EQUALS
4362+
- NOT_EQUALS
43554363
ApplicationSecurityWafCustomRuleConditionOptions:
43564364
description: Options for the operator of this condition.
43574365
properties:
@@ -4392,6 +4400,8 @@ components:
43924400
description: "Regex to use with the condition. Only used with match_regex and !match_regex operator."
43934401
example: "path.*"
43944402
type: string
4403+
type:
4404+
$ref: "#/components/schemas/ApplicationSecurityWafCustomRuleConditionParametersType"
43954405
value:
43964406
description: |-
43974407
Store the captured value in the specified tag name. Only used with the capture_data operator.
@@ -4400,6 +4410,22 @@ components:
44004410
required:
44014411
- inputs
44024412
type: object
4413+
ApplicationSecurityWafCustomRuleConditionParametersType:
4414+
description: The type of the value to compare against. Only used with the equals and !equals operator.
4415+
enum:
4416+
- boolean
4417+
- signed
4418+
- unsigned
4419+
- float
4420+
- string
4421+
example: "string"
4422+
type: string
4423+
x-enum-varnames:
4424+
- BOOLEAN
4425+
- SIGNED
4426+
- UNSIGNED
4427+
- FLOAT
4428+
- STRING
44034429
ApplicationSecurityWafCustomRuleCreateAttributes:
44044430
description: "Create a new WAF custom rule."
44054431
properties:

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,13 @@ datadog\_api\_client.v2.model.application\_security\_waf\_custom\_rule\_conditio
844844
:members:
845845
:show-inheritance:
846846

847+
datadog\_api\_client.v2.model.application\_security\_waf\_custom\_rule\_condition\_parameters\_type module
848+
----------------------------------------------------------------------------------------------------------
849+
850+
.. automodule:: datadog_api_client.v2.model.application_security_waf_custom_rule_condition_parameters_type
851+
:members:
852+
:show-inheritance:
853+
847854
datadog\_api\_client.v2.model.application\_security\_waf\_custom\_rule\_create\_attributes module
848855
-------------------------------------------------------------------------------------------------
849856

examples/v2/application-security/CreateApplicationSecurityWafCustomRule.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_parameters import (
3232
ApplicationSecurityWafCustomRuleConditionParameters,
3333
)
34+
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_parameters_type import (
35+
ApplicationSecurityWafCustomRuleConditionParametersType,
36+
)
3437
from datadog_api_client.v2.model.application_security_waf_custom_rule_create_attributes import (
3538
ApplicationSecurityWafCustomRuleCreateAttributes,
3639
)
@@ -75,6 +78,7 @@
7578
min_length=0,
7679
),
7780
regex="path.*",
81+
type=ApplicationSecurityWafCustomRuleConditionParametersType.STRING,
7882
value="custom_tag",
7983
),
8084
),

src/datadog_api_client/v2/model/application_security_waf_custom_rule_condition_operator.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ApplicationSecurityWafCustomRuleConditionOperator(ModelSimple):
1616
"""
1717
Operator to use for the WAF Condition.
1818
19-
:param value: Must be one of ["match_regex", "!match_regex", "phrase_match", "!phrase_match", "is_xss", "is_sqli", "exact_match", "!exact_match", "ip_match", "!ip_match", "capture_data"].
19+
:param value: Must be one of ["match_regex", "!match_regex", "phrase_match", "!phrase_match", "is_xss", "is_sqli", "exact_match", "!exact_match", "ip_match", "!ip_match", "capture_data", "exists", "!exists", "equals", "!equals"].
2020
:type value: str
2121
"""
2222

@@ -32,6 +32,10 @@ class ApplicationSecurityWafCustomRuleConditionOperator(ModelSimple):
3232
"ip_match",
3333
"!ip_match",
3434
"capture_data",
35+
"exists",
36+
"!exists",
37+
"equals",
38+
"!equals",
3539
}
3640
MATCH_REGEX: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
3741
NOT_MATCH_REGEX: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
@@ -44,6 +48,10 @@ class ApplicationSecurityWafCustomRuleConditionOperator(ModelSimple):
4448
IP_MATCH: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
4549
NOT_IP_MATCH: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
4650
CAPTURE_DATA: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
51+
EXISTS: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
52+
NOT_EXISTS: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
53+
EQUALS: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
54+
NOT_EQUALS: ClassVar["ApplicationSecurityWafCustomRuleConditionOperator"]
4755

4856
@cached_property
4957
def openapi_types(_):
@@ -81,3 +89,11 @@ def openapi_types(_):
8189
ApplicationSecurityWafCustomRuleConditionOperator.CAPTURE_DATA = ApplicationSecurityWafCustomRuleConditionOperator(
8290
"capture_data"
8391
)
92+
ApplicationSecurityWafCustomRuleConditionOperator.EXISTS = ApplicationSecurityWafCustomRuleConditionOperator("exists")
93+
ApplicationSecurityWafCustomRuleConditionOperator.NOT_EXISTS = ApplicationSecurityWafCustomRuleConditionOperator(
94+
"!exists"
95+
)
96+
ApplicationSecurityWafCustomRuleConditionOperator.EQUALS = ApplicationSecurityWafCustomRuleConditionOperator("equals")
97+
ApplicationSecurityWafCustomRuleConditionOperator.NOT_EQUALS = ApplicationSecurityWafCustomRuleConditionOperator(
98+
"!equals"
99+
)

src/datadog_api_client/v2/model/application_security_waf_custom_rule_condition_parameters.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_options import (
2121
ApplicationSecurityWafCustomRuleConditionOptions,
2222
)
23+
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_parameters_type import (
24+
ApplicationSecurityWafCustomRuleConditionParametersType,
25+
)
2326

2427

2528
class ApplicationSecurityWafCustomRuleConditionParameters(ModelNormal):
@@ -31,13 +34,17 @@ def openapi_types(_):
3134
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_options import (
3235
ApplicationSecurityWafCustomRuleConditionOptions,
3336
)
37+
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_parameters_type import (
38+
ApplicationSecurityWafCustomRuleConditionParametersType,
39+
)
3440

3541
return {
3642
"data": (str,),
3743
"inputs": ([ApplicationSecurityWafCustomRuleConditionInput],),
3844
"list": ([str],),
3945
"options": (ApplicationSecurityWafCustomRuleConditionOptions,),
4046
"regex": (str,),
47+
"type": (ApplicationSecurityWafCustomRuleConditionParametersType,),
4148
"value": (str,),
4249
}
4350

@@ -47,6 +54,7 @@ def openapi_types(_):
4754
"list": "list",
4855
"options": "options",
4956
"regex": "regex",
57+
"type": "type",
5058
"value": "value",
5159
}
5260

@@ -57,6 +65,7 @@ def __init__(
5765
list: Union[List[str], UnsetType] = unset,
5866
options: Union[ApplicationSecurityWafCustomRuleConditionOptions, UnsetType] = unset,
5967
regex: Union[str, UnsetType] = unset,
68+
type: Union[ApplicationSecurityWafCustomRuleConditionParametersType, UnsetType] = unset,
6069
value: Union[str, UnsetType] = unset,
6170
**kwargs,
6271
):
@@ -79,6 +88,9 @@ def __init__(
7988
:param regex: Regex to use with the condition. Only used with match_regex and !match_regex operator.
8089
:type regex: str, optional
8190
91+
:param type: The type of the value to compare against. Only used with the equals and !equals operator.
92+
:type type: ApplicationSecurityWafCustomRuleConditionParametersType, optional
93+
8294
:param value: Store the captured value in the specified tag name. Only used with the capture_data operator.
8395
:type value: str, optional
8496
"""
@@ -90,6 +102,8 @@ def __init__(
90102
kwargs["options"] = options
91103
if regex is not unset:
92104
kwargs["regex"] = regex
105+
if type is not unset:
106+
kwargs["type"] = type
93107
if value is not unset:
94108
kwargs["value"] = value
95109
super().__init__(kwargs)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class ApplicationSecurityWafCustomRuleConditionParametersType(ModelSimple):
16+
"""
17+
The type of the value to compare against. Only used with the equals and !equals operator.
18+
19+
:param value: Must be one of ["boolean", "signed", "unsigned", "float", "string"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"boolean",
25+
"signed",
26+
"unsigned",
27+
"float",
28+
"string",
29+
}
30+
BOOLEAN: ClassVar["ApplicationSecurityWafCustomRuleConditionParametersType"]
31+
SIGNED: ClassVar["ApplicationSecurityWafCustomRuleConditionParametersType"]
32+
UNSIGNED: ClassVar["ApplicationSecurityWafCustomRuleConditionParametersType"]
33+
FLOAT: ClassVar["ApplicationSecurityWafCustomRuleConditionParametersType"]
34+
STRING: ClassVar["ApplicationSecurityWafCustomRuleConditionParametersType"]
35+
36+
@cached_property
37+
def openapi_types(_):
38+
return {
39+
"value": (str,),
40+
}
41+
42+
43+
ApplicationSecurityWafCustomRuleConditionParametersType.BOOLEAN = (
44+
ApplicationSecurityWafCustomRuleConditionParametersType("boolean")
45+
)
46+
ApplicationSecurityWafCustomRuleConditionParametersType.SIGNED = (
47+
ApplicationSecurityWafCustomRuleConditionParametersType("signed")
48+
)
49+
ApplicationSecurityWafCustomRuleConditionParametersType.UNSIGNED = (
50+
ApplicationSecurityWafCustomRuleConditionParametersType("unsigned")
51+
)
52+
ApplicationSecurityWafCustomRuleConditionParametersType.FLOAT = ApplicationSecurityWafCustomRuleConditionParametersType(
53+
"float"
54+
)
55+
ApplicationSecurityWafCustomRuleConditionParametersType.STRING = (
56+
ApplicationSecurityWafCustomRuleConditionParametersType("string")
57+
)

src/datadog_api_client/v2/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@
249249
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_parameters import (
250250
ApplicationSecurityWafCustomRuleConditionParameters,
251251
)
252+
from datadog_api_client.v2.model.application_security_waf_custom_rule_condition_parameters_type import (
253+
ApplicationSecurityWafCustomRuleConditionParametersType,
254+
)
252255
from datadog_api_client.v2.model.application_security_waf_custom_rule_create_attributes import (
253256
ApplicationSecurityWafCustomRuleCreateAttributes,
254257
)
@@ -7012,6 +7015,7 @@
70127015
"ApplicationSecurityWafCustomRuleConditionOperator",
70137016
"ApplicationSecurityWafCustomRuleConditionOptions",
70147017
"ApplicationSecurityWafCustomRuleConditionParameters",
7018+
"ApplicationSecurityWafCustomRuleConditionParametersType",
70157019
"ApplicationSecurityWafCustomRuleCreateAttributes",
70167020
"ApplicationSecurityWafCustomRuleCreateData",
70177021
"ApplicationSecurityWafCustomRuleCreateRequest",

tests/v2/features/application_security.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ Feature: Application Security
1616
@generated @skip @team:DataDog/asm-backend
1717
Scenario: Create a WAF custom rule returns "Bad Request" response
1818
Given new "CreateApplicationSecurityWafCustomRule" request
19-
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "value": "custom_tag"}}], "enabled": false, "name": "Block request from a bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
19+
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "type": "string", "value": "custom_tag"}}], "enabled": false, "name": "Block request from a bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
2020
When the request is sent
2121
Then the response status is 400 Bad Request
2222

2323
@generated @skip @team:DataDog/asm-backend
2424
Scenario: Create a WAF custom rule returns "Concurrent Modification" response
2525
Given new "CreateApplicationSecurityWafCustomRule" request
26-
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "value": "custom_tag"}}], "enabled": false, "name": "Block request from a bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
26+
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "type": "string", "value": "custom_tag"}}], "enabled": false, "name": "Block request from a bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
2727
When the request is sent
2828
Then the response status is 409 Concurrent Modification
2929

3030
@generated @skip @team:DataDog/asm-backend
3131
Scenario: Create a WAF custom rule returns "Created" response
3232
Given new "CreateApplicationSecurityWafCustomRule" request
33-
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "value": "custom_tag"}}], "enabled": false, "name": "Block request from a bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
33+
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "type": "string", "value": "custom_tag"}}], "enabled": false, "name": "Block request from a bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
3434
When the request is sent
3535
Then the response status is 201 Created
3636

@@ -153,15 +153,15 @@ Feature: Application Security
153153
Scenario: Update a WAF Custom Rule returns "Concurrent Modification" response
154154
Given new "UpdateApplicationSecurityWafCustomRule" request
155155
And request contains "custom_rule_id" parameter from "REPLACE.ME"
156-
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "value": "custom_tag"}}], "enabled": false, "name": "Block request from bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
156+
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "type": "string", "value": "custom_tag"}}], "enabled": false, "name": "Block request from bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
157157
When the request is sent
158158
Then the response status is 409 Concurrent Modification
159159

160160
@generated @skip @team:DataDog/asm-backend
161161
Scenario: Update a WAF Custom Rule returns "Not Found" response
162162
Given new "UpdateApplicationSecurityWafCustomRule" request
163163
And request contains "custom_rule_id" parameter from "REPLACE.ME"
164-
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "value": "custom_tag"}}], "enabled": false, "name": "Block request from bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
164+
And body with value {"data": {"attributes": {"action": {"action": "block_request", "parameters": {"location": "/blocking", "status_code": 403}}, "blocking": false, "conditions": [{"operator": "match_regex", "parameters": {"data": "blocked_users", "inputs": [{"address": "server.db.statement", "key_path": []}], "list": [], "options": {"case_sensitive": false, "min_length": 0}, "regex": "path.*", "type": "string", "value": "custom_tag"}}], "enabled": false, "name": "Block request from bad useragent", "path_glob": "/api/search/*", "scope": [{"env": "prod", "service": "billing-service"}], "tags": {"category": "business_logic", "type": "users.login.success"}}, "type": "custom_rule"}}
165165
When the request is sent
166166
Then the response status is 404 Not Found
167167

0 commit comments

Comments
 (0)