Skip to content

Commit 69e0160

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add tags support to Logs Indexes API (#3414)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 5ea3cb3 commit 69e0160

File tree

6 files changed

+105
-9
lines changed

6 files changed

+105
-9
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6152,6 +6152,16 @@ components:
61526152
example: 15
61536153
format: int64
61546154
type: integer
6155+
tags:
6156+
description: A list of tags associated with the index. Tags must be in `key:value`
6157+
format.
6158+
example:
6159+
- team:backend
6160+
- env:production
6161+
items:
6162+
description: A single tag using the format `key:value`.
6163+
type: string
6164+
type: array
61556165
required:
61566166
- name
61576167
- filter
@@ -6239,6 +6249,16 @@ components:
62396249
example: 15
62406250
format: int64
62416251
type: integer
6252+
tags:
6253+
description: A list of tags associated with the index. Tags must be in `key:value`
6254+
format.
6255+
example:
6256+
- team:backend
6257+
- env:production
6258+
items:
6259+
description: A single tag using the format `key:value`.
6260+
type: string
6261+
type: array
62426262
required:
62436263
- filter
62446264
type: object

examples/v1/logs-indexes/CreateLogsIndex.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.datadog.api.client.v1.model.LogsExclusionFilter;
99
import com.datadog.api.client.v1.model.LogsFilter;
1010
import com.datadog.api.client.v1.model.LogsIndex;
11+
import java.util.Arrays;
1112
import java.util.Collections;
1213

1314
public class Example {
@@ -28,7 +29,8 @@ public static void main(String[] args) {
2829
.filter(new LogsFilter().query("source:python"))
2930
.name("main")
3031
.numFlexLogsRetentionDays(360L)
31-
.numRetentionDays(15L);
32+
.numRetentionDays(15L)
33+
.tags(Arrays.asList("team:backend", "env:production"));
3234

3335
try {
3436
LogsIndex result = apiInstance.createLogsIndex(body);

examples/v1/logs-indexes/UpdateLogsIndex.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.datadog.api.client.v1.model.LogsFilter;
1010
import com.datadog.api.client.v1.model.LogsIndex;
1111
import com.datadog.api.client.v1.model.LogsIndexUpdateRequest;
12+
import java.util.Arrays;
1213
import java.util.Collections;
1314

1415
public class Example {
@@ -29,7 +30,8 @@ public static void main(String[] args) {
2930
.name("payment")))
3031
.filter(new LogsFilter().query("source:python"))
3132
.numFlexLogsRetentionDays(360L)
32-
.numRetentionDays(15L);
33+
.numRetentionDays(15L)
34+
.tags(Arrays.asList("team:backend", "env:production"));
3335

3436
try {
3537
LogsIndex result = apiInstance.updateLogsIndex("name", body);

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

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
LogsIndex.JSON_PROPERTY_IS_RATE_LIMITED,
3030
LogsIndex.JSON_PROPERTY_NAME,
3131
LogsIndex.JSON_PROPERTY_NUM_FLEX_LOGS_RETENTION_DAYS,
32-
LogsIndex.JSON_PROPERTY_NUM_RETENTION_DAYS
32+
LogsIndex.JSON_PROPERTY_NUM_RETENTION_DAYS,
33+
LogsIndex.JSON_PROPERTY_TAGS
3334
})
3435
@jakarta.annotation.Generated(
3536
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
@@ -64,6 +65,9 @@ public class LogsIndex {
6465
public static final String JSON_PROPERTY_NUM_RETENTION_DAYS = "num_retention_days";
6566
private Long numRetentionDays;
6667

68+
public static final String JSON_PROPERTY_TAGS = "tags";
69+
private List<String> tags = null;
70+
6771
public LogsIndex() {}
6872

6973
@JsonCreator
@@ -279,6 +283,35 @@ public void setNumRetentionDays(Long numRetentionDays) {
279283
this.numRetentionDays = numRetentionDays;
280284
}
281285

286+
public LogsIndex tags(List<String> tags) {
287+
this.tags = tags;
288+
return this;
289+
}
290+
291+
public LogsIndex addTagsItem(String tagsItem) {
292+
if (this.tags == null) {
293+
this.tags = new ArrayList<>();
294+
}
295+
this.tags.add(tagsItem);
296+
return this;
297+
}
298+
299+
/**
300+
* A list of tags associated with the index. Tags must be in <code>key:value</code> format.
301+
*
302+
* @return tags
303+
*/
304+
@jakarta.annotation.Nullable
305+
@JsonProperty(JSON_PROPERTY_TAGS)
306+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
307+
public List<String> getTags() {
308+
return tags;
309+
}
310+
311+
public void setTags(List<String> tags) {
312+
this.tags = tags;
313+
}
314+
282315
/**
283316
* A container for additional, undeclared properties. This is a holder for any undeclared
284317
* properties as specified with the 'additionalProperties' keyword in the OAS document.
@@ -346,6 +379,7 @@ public boolean equals(Object o) {
346379
&& Objects.equals(this.name, logsIndex.name)
347380
&& Objects.equals(this.numFlexLogsRetentionDays, logsIndex.numFlexLogsRetentionDays)
348381
&& Objects.equals(this.numRetentionDays, logsIndex.numRetentionDays)
382+
&& Objects.equals(this.tags, logsIndex.tags)
349383
&& Objects.equals(this.additionalProperties, logsIndex.additionalProperties);
350384
}
351385

@@ -361,6 +395,7 @@ public int hashCode() {
361395
name,
362396
numFlexLogsRetentionDays,
363397
numRetentionDays,
398+
tags,
364399
additionalProperties);
365400
}
366401

@@ -381,6 +416,7 @@ public String toString() {
381416
.append(toIndentedString(numFlexLogsRetentionDays))
382417
.append("\n");
383418
sb.append(" numRetentionDays: ").append(toIndentedString(numRetentionDays)).append("\n");
419+
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
384420
sb.append(" additionalProperties: ")
385421
.append(toIndentedString(additionalProperties))
386422
.append("\n");

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

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
LogsIndexUpdateRequest.JSON_PROPERTY_EXCLUSION_FILTERS,
2929
LogsIndexUpdateRequest.JSON_PROPERTY_FILTER,
3030
LogsIndexUpdateRequest.JSON_PROPERTY_NUM_FLEX_LOGS_RETENTION_DAYS,
31-
LogsIndexUpdateRequest.JSON_PROPERTY_NUM_RETENTION_DAYS
31+
LogsIndexUpdateRequest.JSON_PROPERTY_NUM_RETENTION_DAYS,
32+
LogsIndexUpdateRequest.JSON_PROPERTY_TAGS
3233
})
3334
@jakarta.annotation.Generated(
3435
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
@@ -60,6 +61,9 @@ public class LogsIndexUpdateRequest {
6061
public static final String JSON_PROPERTY_NUM_RETENTION_DAYS = "num_retention_days";
6162
private Long numRetentionDays;
6263

64+
public static final String JSON_PROPERTY_TAGS = "tags";
65+
private List<String> tags = null;
66+
6367
public LogsIndexUpdateRequest() {}
6468

6569
@JsonCreator
@@ -269,6 +273,35 @@ public void setNumRetentionDays(Long numRetentionDays) {
269273
this.numRetentionDays = numRetentionDays;
270274
}
271275

276+
public LogsIndexUpdateRequest tags(List<String> tags) {
277+
this.tags = tags;
278+
return this;
279+
}
280+
281+
public LogsIndexUpdateRequest addTagsItem(String tagsItem) {
282+
if (this.tags == null) {
283+
this.tags = new ArrayList<>();
284+
}
285+
this.tags.add(tagsItem);
286+
return this;
287+
}
288+
289+
/**
290+
* A list of tags associated with the index. Tags must be in <code>key:value</code> format.
291+
*
292+
* @return tags
293+
*/
294+
@jakarta.annotation.Nullable
295+
@JsonProperty(JSON_PROPERTY_TAGS)
296+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
297+
public List<String> getTags() {
298+
return tags;
299+
}
300+
301+
public void setTags(List<String> tags) {
302+
this.tags = tags;
303+
}
304+
272305
/**
273306
* A container for additional, undeclared properties. This is a holder for any undeclared
274307
* properties as specified with the 'additionalProperties' keyword in the OAS document.
@@ -336,6 +369,7 @@ public boolean equals(Object o) {
336369
&& Objects.equals(
337370
this.numFlexLogsRetentionDays, logsIndexUpdateRequest.numFlexLogsRetentionDays)
338371
&& Objects.equals(this.numRetentionDays, logsIndexUpdateRequest.numRetentionDays)
372+
&& Objects.equals(this.tags, logsIndexUpdateRequest.tags)
339373
&& Objects.equals(this.additionalProperties, logsIndexUpdateRequest.additionalProperties);
340374
}
341375

@@ -350,6 +384,7 @@ public int hashCode() {
350384
filter,
351385
numFlexLogsRetentionDays,
352386
numRetentionDays,
387+
tags,
353388
additionalProperties);
354389
}
355390

@@ -369,6 +404,7 @@ public String toString() {
369404
.append(toIndentedString(numFlexLogsRetentionDays))
370405
.append("\n");
371406
sb.append(" numRetentionDays: ").append(toIndentedString(numRetentionDays)).append("\n");
407+
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
372408
sb.append(" additionalProperties: ")
373409
.append(toIndentedString(additionalProperties))
374410
.append("\n");

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ Feature: Logs Indexes
1111
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
1212
Scenario: Create an index returns "Invalid Parameter Error" response
1313
Given new "CreateLogsIndex" request
14-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
14+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
1515
When the request is sent
1616
Then the response status is 400 Invalid Parameter Error
1717

1818
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
1919
Scenario: Create an index returns "OK" response
2020
Given new "CreateLogsIndex" request
21-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
21+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
2222
When the request is sent
2323
Then the response status is 200 OK
2424

2525
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
2626
Scenario: Create an index returns "Unprocessable Entity" response
2727
Given new "CreateLogsIndex" request
28-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
28+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
2929
When the request is sent
3030
Then the response status is 422 Unprocessable Entity
3131

@@ -73,15 +73,15 @@ Feature: Logs Indexes
7373
Scenario: Update an index returns "Invalid Parameter Error" response
7474
Given new "UpdateLogsIndex" request
7575
And request contains "name" parameter from "REPLACE.ME"
76-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15}
76+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
7777
When the request is sent
7878
Then the response status is 400 Invalid Parameter Error
7979

8080
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-core
8181
Scenario: Update an index returns "OK" response
8282
Given new "UpdateLogsIndex" request
8383
And request contains "name" parameter from "REPLACE.ME"
84-
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15}
84+
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15, "tags": ["team:backend", "env:production"]}
8585
When the request is sent
8686
Then the response status is 200 OK
8787

0 commit comments

Comments
 (0)