Skip to content

Commit 5054734

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add tags and description fields to the logs nested pipeline type LogsPipelineProcessor (#3633)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 81b929f commit 5054734

File tree

6 files changed

+187
-2
lines changed

6 files changed

+187
-2
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6236,6 +6236,9 @@ components:
62366236

62376237
A pipeline can contain Nested Pipelines and Processors whereas a Nested Pipeline can only contain Processors.
62386238
properties:
6239+
description:
6240+
description: A description of the pipeline.
6241+
type: string
62396242
filter:
62406243
$ref: "#/components/schemas/LogsFilter"
62416244
is_enabled:
@@ -6250,6 +6253,12 @@ components:
62506253
items:
62516254
$ref: "#/components/schemas/LogsProcessor"
62526255
type: array
6256+
tags:
6257+
description: A list of tags associated with the pipeline.
6258+
items:
6259+
description: A single tag using the format `key:value`.
6260+
type: string
6261+
type: array
62536262
type:
62546263
$ref: "#/components/schemas/LogsPipelineProcessorType"
62556264
required:
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Create a pipeline with nested pipeline processor returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v1.api.LogsPipelinesApi;
6+
import com.datadog.api.client.v1.model.LogsFilter;
7+
import com.datadog.api.client.v1.model.LogsPipeline;
8+
import com.datadog.api.client.v1.model.LogsPipelineProcessor;
9+
import com.datadog.api.client.v1.model.LogsPipelineProcessorType;
10+
import com.datadog.api.client.v1.model.LogsProcessor;
11+
import java.util.Arrays;
12+
import java.util.Collections;
13+
14+
public class Example {
15+
public static void main(String[] args) {
16+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
17+
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);
18+
19+
LogsPipeline body =
20+
new LogsPipeline()
21+
.filter(new LogsFilter().query("source:python"))
22+
.name("testPipelineWithNested")
23+
.processors(
24+
Collections.singletonList(
25+
new LogsProcessor(
26+
new LogsPipelineProcessor()
27+
.type(LogsPipelineProcessorType.PIPELINE)
28+
.isEnabled(true)
29+
.name("nested_pipeline_with_metadata")
30+
.filter(new LogsFilter().query("env:production"))
31+
.tags(Arrays.asList("env:prod", "type:nested"))
32+
.description("This is a nested pipeline for production logs"))))
33+
.tags(Collections.singletonList("team:test"))
34+
.description("Pipeline containing nested processor with tags and description");
35+
36+
try {
37+
LogsPipeline result = apiInstance.createLogsPipeline(body);
38+
System.out.println(result);
39+
} catch (ApiException e) {
40+
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
41+
System.err.println("Status code: " + e.getCode());
42+
System.err.println("Reason: " + e.getResponseBody());
43+
System.err.println("Response headers: " + e.getResponseHeaders());
44+
e.printStackTrace();
45+
}
46+
}
47+
}

src/main/java/com/datadog/api/client/v1/model/LogsPipelineProcessor.java

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,21 @@
2828
* contain Processors.
2929
*/
3030
@JsonPropertyOrder({
31+
LogsPipelineProcessor.JSON_PROPERTY_DESCRIPTION,
3132
LogsPipelineProcessor.JSON_PROPERTY_FILTER,
3233
LogsPipelineProcessor.JSON_PROPERTY_IS_ENABLED,
3334
LogsPipelineProcessor.JSON_PROPERTY_NAME,
3435
LogsPipelineProcessor.JSON_PROPERTY_PROCESSORS,
36+
LogsPipelineProcessor.JSON_PROPERTY_TAGS,
3537
LogsPipelineProcessor.JSON_PROPERTY_TYPE
3638
})
3739
@jakarta.annotation.Generated(
3840
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
3941
public class LogsPipelineProcessor {
4042
@JsonIgnore public boolean unparsed = false;
43+
public static final String JSON_PROPERTY_DESCRIPTION = "description";
44+
private String description;
45+
4146
public static final String JSON_PROPERTY_FILTER = "filter";
4247
private LogsFilter filter;
4348

@@ -50,6 +55,9 @@ public class LogsPipelineProcessor {
5055
public static final String JSON_PROPERTY_PROCESSORS = "processors";
5156
private List<LogsProcessor> processors = null;
5257

58+
public static final String JSON_PROPERTY_TAGS = "tags";
59+
private List<String> tags = null;
60+
5361
public static final String JSON_PROPERTY_TYPE = "type";
5462
private LogsPipelineProcessorType type = LogsPipelineProcessorType.PIPELINE;
5563

@@ -62,6 +70,27 @@ public LogsPipelineProcessor(
6270
this.unparsed |= !type.isValid();
6371
}
6472

73+
public LogsPipelineProcessor description(String description) {
74+
this.description = description;
75+
return this;
76+
}
77+
78+
/**
79+
* A description of the pipeline.
80+
*
81+
* @return description
82+
*/
83+
@jakarta.annotation.Nullable
84+
@JsonProperty(JSON_PROPERTY_DESCRIPTION)
85+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
86+
public String getDescription() {
87+
return description;
88+
}
89+
90+
public void setDescription(String description) {
91+
this.description = description;
92+
}
93+
6594
public LogsPipelineProcessor filter(LogsFilter filter) {
6695
this.filter = filter;
6796
this.unparsed |= filter.unparsed;
@@ -159,6 +188,35 @@ public void setProcessors(List<LogsProcessor> processors) {
159188
this.processors = processors;
160189
}
161190

191+
public LogsPipelineProcessor tags(List<String> tags) {
192+
this.tags = tags;
193+
return this;
194+
}
195+
196+
public LogsPipelineProcessor addTagsItem(String tagsItem) {
197+
if (this.tags == null) {
198+
this.tags = new ArrayList<>();
199+
}
200+
this.tags.add(tagsItem);
201+
return this;
202+
}
203+
204+
/**
205+
* A list of tags associated with the pipeline.
206+
*
207+
* @return tags
208+
*/
209+
@jakarta.annotation.Nullable
210+
@JsonProperty(JSON_PROPERTY_TAGS)
211+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
212+
public List<String> getTags() {
213+
return tags;
214+
}
215+
216+
public void setTags(List<String> tags) {
217+
this.tags = tags;
218+
}
219+
162220
public LogsPipelineProcessor type(LogsPipelineProcessorType type) {
163221
this.type = type;
164222
this.unparsed |= !type.isValid();
@@ -239,27 +297,32 @@ public boolean equals(Object o) {
239297
return false;
240298
}
241299
LogsPipelineProcessor logsPipelineProcessor = (LogsPipelineProcessor) o;
242-
return Objects.equals(this.filter, logsPipelineProcessor.filter)
300+
return Objects.equals(this.description, logsPipelineProcessor.description)
301+
&& Objects.equals(this.filter, logsPipelineProcessor.filter)
243302
&& Objects.equals(this.isEnabled, logsPipelineProcessor.isEnabled)
244303
&& Objects.equals(this.name, logsPipelineProcessor.name)
245304
&& Objects.equals(this.processors, logsPipelineProcessor.processors)
305+
&& Objects.equals(this.tags, logsPipelineProcessor.tags)
246306
&& Objects.equals(this.type, logsPipelineProcessor.type)
247307
&& Objects.equals(this.additionalProperties, logsPipelineProcessor.additionalProperties);
248308
}
249309

250310
@Override
251311
public int hashCode() {
252-
return Objects.hash(filter, isEnabled, name, processors, type, additionalProperties);
312+
return Objects.hash(
313+
description, filter, isEnabled, name, processors, tags, type, additionalProperties);
253314
}
254315

255316
@Override
256317
public String toString() {
257318
StringBuilder sb = new StringBuilder();
258319
sb.append("class LogsPipelineProcessor {\n");
320+
sb.append(" description: ").append(toIndentedString(description)).append("\n");
259321
sb.append(" filter: ").append(toIndentedString(filter)).append("\n");
260322
sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n");
261323
sb.append(" name: ").append(toIndentedString(name)).append("\n");
262324
sb.append(" processors: ").append(toIndentedString(processors)).append("\n");
325+
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
263326
sb.append(" type: ").append(toIndentedString(type)).append("\n");
264327
sb.append(" additionalProperties: ")
265328
.append(toIndentedString(additionalProperties))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-03-18T17:10:40.108Z
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
"httpRequest": {
4+
"body": {
5+
"type": "JSON",
6+
"json": "{\"description\":\"Pipeline containing nested processor with tags and description\",\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineWithNested\",\"processors\":[{\"description\":\"This is a nested pipeline for production logs\",\"filter\":{\"query\":\"env:production\"},\"is_enabled\":true,\"name\":\"nested_pipeline_with_metadata\",\"tags\":[\"env:prod\",\"type:nested\"],\"type\":\"pipeline\"}],\"tags\":[\"team:test\"]}"
7+
},
8+
"headers": {},
9+
"method": "POST",
10+
"path": "/api/v1/logs/config/pipelines",
11+
"keepAlive": false,
12+
"secure": true
13+
},
14+
"httpResponse": {
15+
"body": "{\"id\":\"GyYNpCrVQtOB3KhqJSpOOA\",\"type\":\"pipeline\",\"name\":\"testPipelineWithNested\",\"is_enabled\":false,\"is_read_only\":false,\"filter\":{\"query\":\"source:python\"},\"processors\":[{\"type\":\"pipeline\",\"name\":\"nested_pipeline_with_metadata\",\"is_enabled\":true,\"filter\":{\"query\":\"env:production\"},\"processors\":[],\"tags\":[\"env:prod\",\"type:nested\"],\"description\":\"This is a nested pipeline for production logs\"}],\"tags\":[\"team:test\"],\"description\":\"Pipeline containing nested processor with tags and description\"}\n",
16+
"headers": {
17+
"Content-Type": [
18+
"application/json"
19+
]
20+
},
21+
"statusCode": 200,
22+
"reasonPhrase": "OK"
23+
},
24+
"times": {
25+
"remainingTimes": 1
26+
},
27+
"timeToLive": {
28+
"unlimited": true
29+
},
30+
"id": "43e467db-3052-c3f2-f66c-542643a0e3a7"
31+
},
32+
{
33+
"httpRequest": {
34+
"headers": {},
35+
"method": "DELETE",
36+
"path": "/api/v1/logs/config/pipelines/GyYNpCrVQtOB3KhqJSpOOA",
37+
"keepAlive": false,
38+
"secure": true
39+
},
40+
"httpResponse": {
41+
"body": "{}\n",
42+
"headers": {
43+
"Content-Type": [
44+
"application/json"
45+
]
46+
},
47+
"statusCode": 200,
48+
"reasonPhrase": "OK"
49+
},
50+
"times": {
51+
"remainingTimes": 1
52+
},
53+
"timeToLive": {
54+
"unlimited": true
55+
},
56+
"id": "9d46b7bd-ff78-f8c6-c944-e3cd37cf4ca4"
57+
}
58+
]

src/test/resources/com/datadog/api/client/v1/api/logs_pipelines.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ Feature: Logs Pipelines
9898
When the request is sent
9999
Then the response status is 200 OK
100100

101+
@team:DataDog/event-platform-experience
102+
Scenario: Create a pipeline with nested pipeline processor returns "OK" response
103+
Given new "CreateLogsPipeline" request
104+
And body with value {"filter": {"query": "source:python"}, "name": "testPipelineWithNested", "processors": [{"type": "pipeline", "is_enabled": true, "name": "nested_pipeline_with_metadata", "filter": {"query": "env:production"}, "tags": ["env:prod", "type:nested"], "description": "This is a nested pipeline for production logs"}], "tags": ["team:test"], "description": "Pipeline containing nested processor with tags and description"}
105+
When the request is sent
106+
Then the response status is 200 OK
107+
101108
@team:DataDog/event-platform-experience
102109
Scenario: Create a pipeline with schema processor
103110
Given new "CreateLogsPipeline" request

0 commit comments

Comments
 (0)