Skip to content

Commit 36bdc69

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 3325bb4 of spec repo
1 parent b481b06 commit 36bdc69

File tree

6 files changed

+152
-7
lines changed

6 files changed

+152
-7
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:

examples/v2/application-security/CreateApplicationSecurityWafCustomRule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.datadog.api.client.v2.model.ApplicationSecurityWafCustomRuleConditionOperator;
1313
import com.datadog.api.client.v2.model.ApplicationSecurityWafCustomRuleConditionOptions;
1414
import com.datadog.api.client.v2.model.ApplicationSecurityWafCustomRuleConditionParameters;
15+
import com.datadog.api.client.v2.model.ApplicationSecurityWafCustomRuleConditionParametersType;
1516
import com.datadog.api.client.v2.model.ApplicationSecurityWafCustomRuleCreateAttributes;
1617
import com.datadog.api.client.v2.model.ApplicationSecurityWafCustomRuleCreateData;
1718
import com.datadog.api.client.v2.model.ApplicationSecurityWafCustomRuleCreateRequest;
@@ -62,6 +63,9 @@ public static void main(String[] args) {
6263
.caseSensitive(false)
6364
.minLength(0L))
6465
.regex("path.*")
66+
.type(
67+
ApplicationSecurityWafCustomRuleConditionParametersType
68+
.STRING)
6569
.value("custom_tag"))))
6670
.enabled(false)
6771
.name("Block request from a bad useragent")

src/main/java/com/datadog/api/client/v2/model/ApplicationSecurityWafCustomRuleConditionOperator.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ public class ApplicationSecurityWafCustomRuleConditionOperator extends ModelEnum
3838
"!exact_match",
3939
"ip_match",
4040
"!ip_match",
41-
"capture_data"));
41+
"capture_data",
42+
"exists",
43+
"!exists",
44+
"equals",
45+
"!equals"));
4246

4347
public static final ApplicationSecurityWafCustomRuleConditionOperator MATCH_REGEX =
4448
new ApplicationSecurityWafCustomRuleConditionOperator("match_regex");
@@ -62,6 +66,14 @@ public class ApplicationSecurityWafCustomRuleConditionOperator extends ModelEnum
6266
new ApplicationSecurityWafCustomRuleConditionOperator("!ip_match");
6367
public static final ApplicationSecurityWafCustomRuleConditionOperator CAPTURE_DATA =
6468
new ApplicationSecurityWafCustomRuleConditionOperator("capture_data");
69+
public static final ApplicationSecurityWafCustomRuleConditionOperator EXISTS =
70+
new ApplicationSecurityWafCustomRuleConditionOperator("exists");
71+
public static final ApplicationSecurityWafCustomRuleConditionOperator NOT_EXISTS =
72+
new ApplicationSecurityWafCustomRuleConditionOperator("!exists");
73+
public static final ApplicationSecurityWafCustomRuleConditionOperator EQUALS =
74+
new ApplicationSecurityWafCustomRuleConditionOperator("equals");
75+
public static final ApplicationSecurityWafCustomRuleConditionOperator NOT_EQUALS =
76+
new ApplicationSecurityWafCustomRuleConditionOperator("!equals");
6577

6678
ApplicationSecurityWafCustomRuleConditionOperator(String value) {
6779
super(value, allowedValues);

src/main/java/com/datadog/api/client/v2/model/ApplicationSecurityWafCustomRuleConditionParameters.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
ApplicationSecurityWafCustomRuleConditionParameters.JSON_PROPERTY_LIST,
2727
ApplicationSecurityWafCustomRuleConditionParameters.JSON_PROPERTY_OPTIONS,
2828
ApplicationSecurityWafCustomRuleConditionParameters.JSON_PROPERTY_REGEX,
29+
ApplicationSecurityWafCustomRuleConditionParameters.JSON_PROPERTY_TYPE,
2930
ApplicationSecurityWafCustomRuleConditionParameters.JSON_PROPERTY_VALUE
3031
})
3132
@jakarta.annotation.Generated(
@@ -47,6 +48,9 @@ public class ApplicationSecurityWafCustomRuleConditionParameters {
4748
public static final String JSON_PROPERTY_REGEX = "regex";
4849
private String regex;
4950

51+
public static final String JSON_PROPERTY_TYPE = "type";
52+
private ApplicationSecurityWafCustomRuleConditionParametersType type;
53+
5054
public static final String JSON_PROPERTY_VALUE = "value";
5155
private String value;
5256

@@ -186,6 +190,32 @@ public void setRegex(String regex) {
186190
this.regex = regex;
187191
}
188192

193+
public ApplicationSecurityWafCustomRuleConditionParameters type(
194+
ApplicationSecurityWafCustomRuleConditionParametersType type) {
195+
this.type = type;
196+
this.unparsed |= !type.isValid();
197+
return this;
198+
}
199+
200+
/**
201+
* The type of the value to compare against. Only used with the equals and !equals operator.
202+
*
203+
* @return type
204+
*/
205+
@jakarta.annotation.Nullable
206+
@JsonProperty(JSON_PROPERTY_TYPE)
207+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
208+
public ApplicationSecurityWafCustomRuleConditionParametersType getType() {
209+
return type;
210+
}
211+
212+
public void setType(ApplicationSecurityWafCustomRuleConditionParametersType type) {
213+
if (!type.isValid()) {
214+
this.unparsed = true;
215+
}
216+
this.type = type;
217+
}
218+
189219
public ApplicationSecurityWafCustomRuleConditionParameters value(String value) {
190220
this.value = value;
191221
return this;
@@ -273,6 +303,7 @@ public boolean equals(Object o) {
273303
&& Objects.equals(this.list, applicationSecurityWafCustomRuleConditionParameters.list)
274304
&& Objects.equals(this.options, applicationSecurityWafCustomRuleConditionParameters.options)
275305
&& Objects.equals(this.regex, applicationSecurityWafCustomRuleConditionParameters.regex)
306+
&& Objects.equals(this.type, applicationSecurityWafCustomRuleConditionParameters.type)
276307
&& Objects.equals(this.value, applicationSecurityWafCustomRuleConditionParameters.value)
277308
&& Objects.equals(
278309
this.additionalProperties,
@@ -281,7 +312,7 @@ public boolean equals(Object o) {
281312

282313
@Override
283314
public int hashCode() {
284-
return Objects.hash(data, inputs, list, options, regex, value, additionalProperties);
315+
return Objects.hash(data, inputs, list, options, regex, type, value, additionalProperties);
285316
}
286317

287318
@Override
@@ -293,6 +324,7 @@ public String toString() {
293324
sb.append(" list: ").append(toIndentedString(list)).append("\n");
294325
sb.append(" options: ").append(toIndentedString(options)).append("\n");
295326
sb.append(" regex: ").append(toIndentedString(regex)).append("\n");
327+
sb.append(" type: ").append(toIndentedString(type)).append("\n");
296328
sb.append(" value: ").append(toIndentedString(value)).append("\n");
297329
sb.append(" additionalProperties: ")
298330
.append(toIndentedString(additionalProperties))
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
package com.datadog.api.client.v2.model;
8+
9+
import com.datadog.api.client.ModelEnum;
10+
import com.fasterxml.jackson.annotation.JsonCreator;
11+
import com.fasterxml.jackson.core.JsonGenerator;
12+
import com.fasterxml.jackson.core.JsonProcessingException;
13+
import com.fasterxml.jackson.databind.SerializerProvider;
14+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
15+
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
16+
import java.io.IOException;
17+
import java.util.Arrays;
18+
import java.util.HashSet;
19+
import java.util.Set;
20+
21+
/** The type of the value to compare against. Only used with the equals and !equals operator. */
22+
@JsonSerialize(
23+
using =
24+
ApplicationSecurityWafCustomRuleConditionParametersType
25+
.ApplicationSecurityWafCustomRuleConditionParametersTypeSerializer.class)
26+
public class ApplicationSecurityWafCustomRuleConditionParametersType extends ModelEnum<String> {
27+
28+
private static final Set<String> allowedValues =
29+
new HashSet<String>(Arrays.asList("boolean", "signed", "unsigned", "float", "string"));
30+
31+
public static final ApplicationSecurityWafCustomRuleConditionParametersType BOOLEAN =
32+
new ApplicationSecurityWafCustomRuleConditionParametersType("boolean");
33+
public static final ApplicationSecurityWafCustomRuleConditionParametersType SIGNED =
34+
new ApplicationSecurityWafCustomRuleConditionParametersType("signed");
35+
public static final ApplicationSecurityWafCustomRuleConditionParametersType UNSIGNED =
36+
new ApplicationSecurityWafCustomRuleConditionParametersType("unsigned");
37+
public static final ApplicationSecurityWafCustomRuleConditionParametersType FLOAT =
38+
new ApplicationSecurityWafCustomRuleConditionParametersType("float");
39+
public static final ApplicationSecurityWafCustomRuleConditionParametersType STRING =
40+
new ApplicationSecurityWafCustomRuleConditionParametersType("string");
41+
42+
ApplicationSecurityWafCustomRuleConditionParametersType(String value) {
43+
super(value, allowedValues);
44+
}
45+
46+
public static class ApplicationSecurityWafCustomRuleConditionParametersTypeSerializer
47+
extends StdSerializer<ApplicationSecurityWafCustomRuleConditionParametersType> {
48+
public ApplicationSecurityWafCustomRuleConditionParametersTypeSerializer(
49+
Class<ApplicationSecurityWafCustomRuleConditionParametersType> t) {
50+
super(t);
51+
}
52+
53+
public ApplicationSecurityWafCustomRuleConditionParametersTypeSerializer() {
54+
this(null);
55+
}
56+
57+
@Override
58+
public void serialize(
59+
ApplicationSecurityWafCustomRuleConditionParametersType value,
60+
JsonGenerator jgen,
61+
SerializerProvider provider)
62+
throws IOException, JsonProcessingException {
63+
jgen.writeObject(value.value);
64+
}
65+
}
66+
67+
@JsonCreator
68+
public static ApplicationSecurityWafCustomRuleConditionParametersType fromValue(String value) {
69+
return new ApplicationSecurityWafCustomRuleConditionParametersType(value);
70+
}
71+
}

src/test/resources/com/datadog/api/client/v2/api/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)