Skip to content

Commit c95861b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add compression_method field to Log Archives (#3780)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent dde009a commit c95861b

7 files changed

Lines changed: 162 additions & 7 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41615,6 +41615,8 @@ components:
4161541615
LogsArchiveAttributes:
4161641616
description: The attributes associated with the archive.
4161741617
properties:
41618+
compression_method:
41619+
$ref: "#/components/schemas/LogsArchiveAttributesCompressionMethod"
4161841620
destination:
4161941621
$ref: "#/components/schemas/LogsArchiveDestination"
4162041622
include_tags:
@@ -41652,6 +41654,17 @@ components:
4165241654
- query
4165341655
- destination
4165441656
type: object
41657+
LogsArchiveAttributesCompressionMethod:
41658+
default: GZIP
41659+
description: The type of compression for the archive.
41660+
enum:
41661+
- GZIP
41662+
- ZSTD
41663+
example: GZIP
41664+
type: string
41665+
x-enum-varnames:
41666+
- GZIP
41667+
- ZSTD
4165541668
LogsArchiveCreateRequest:
4165641669
description: The logs archive.
4165741670
properties:
@@ -41661,6 +41674,8 @@ components:
4166141674
LogsArchiveCreateRequestAttributes:
4166241675
description: The attributes associated with the archive.
4166341676
properties:
41677+
compression_method:
41678+
$ref: "#/components/schemas/LogsArchiveAttributesCompressionMethod"
4166441679
destination:
4166541680
$ref: "#/components/schemas/LogsArchiveCreateRequestDestination"
4166641681
include_tags:
@@ -111745,6 +111760,7 @@ paths:
111745111760
value:
111746111761
data:
111747111762
attributes:
111763+
compression_method: GZIP
111748111764
destination:
111749111765
container: container-name
111750111766
storage_account: account-name
@@ -111918,6 +111934,7 @@ paths:
111918111934
value:
111919111935
data:
111920111936
attributes:
111937+
compression_method: GZIP
111921111938
destination:
111922111939
container: container-name
111923111940
storage_account: account-name

examples/v2/logs-archives/CreateLogsArchive.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.v2.api.LogsArchivesApi;
66
import com.datadog.api.client.v2.model.LogsArchive;
7+
import com.datadog.api.client.v2.model.LogsArchiveAttributesCompressionMethod;
78
import com.datadog.api.client.v2.model.LogsArchiveCreateRequest;
89
import com.datadog.api.client.v2.model.LogsArchiveCreateRequestAttributes;
910
import com.datadog.api.client.v2.model.LogsArchiveCreateRequestDefinition;
@@ -24,6 +25,7 @@ public static void main(String[] args) {
2425
new LogsArchiveCreateRequestDefinition()
2526
.attributes(
2627
new LogsArchiveCreateRequestAttributes()
28+
.compressionMethod(LogsArchiveAttributesCompressionMethod.GZIP)
2729
.destination(
2830
new LogsArchiveCreateRequestDestination(
2931
new LogsArchiveDestinationAzure()

examples/v2/logs-archives/UpdateLogsArchive.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.datadog.api.client.ApiException;
55
import com.datadog.api.client.v2.api.LogsArchivesApi;
66
import com.datadog.api.client.v2.model.LogsArchive;
7+
import com.datadog.api.client.v2.model.LogsArchiveAttributesCompressionMethod;
78
import com.datadog.api.client.v2.model.LogsArchiveCreateRequest;
89
import com.datadog.api.client.v2.model.LogsArchiveCreateRequestAttributes;
910
import com.datadog.api.client.v2.model.LogsArchiveCreateRequestDefinition;
@@ -24,6 +25,7 @@ public static void main(String[] args) {
2425
new LogsArchiveCreateRequestDefinition()
2526
.attributes(
2627
new LogsArchiveCreateRequestAttributes()
28+
.compressionMethod(LogsArchiveAttributesCompressionMethod.GZIP)
2729
.destination(
2830
new LogsArchiveCreateRequestDestination(
2931
new LogsArchiveDestinationAzure()

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

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
/** The attributes associated with the archive. */
2424
@JsonPropertyOrder({
25+
LogsArchiveAttributes.JSON_PROPERTY_COMPRESSION_METHOD,
2526
LogsArchiveAttributes.JSON_PROPERTY_DESTINATION,
2627
LogsArchiveAttributes.JSON_PROPERTY_INCLUDE_TAGS,
2728
LogsArchiveAttributes.JSON_PROPERTY_NAME,
@@ -34,6 +35,10 @@
3435
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
3536
public class LogsArchiveAttributes {
3637
@JsonIgnore public boolean unparsed = false;
38+
public static final String JSON_PROPERTY_COMPRESSION_METHOD = "compression_method";
39+
private LogsArchiveAttributesCompressionMethod compressionMethod =
40+
LogsArchiveAttributesCompressionMethod.GZIP;
41+
3742
public static final String JSON_PROPERTY_DESTINATION = "destination";
3843
private LogsArchiveDestination destination;
3944

@@ -72,6 +77,32 @@ public LogsArchiveAttributes(
7277
this.query = query;
7378
}
7479

80+
public LogsArchiveAttributes compressionMethod(
81+
LogsArchiveAttributesCompressionMethod compressionMethod) {
82+
this.compressionMethod = compressionMethod;
83+
this.unparsed |= !compressionMethod.isValid();
84+
return this;
85+
}
86+
87+
/**
88+
* The type of compression for the archive.
89+
*
90+
* @return compressionMethod
91+
*/
92+
@jakarta.annotation.Nullable
93+
@JsonProperty(JSON_PROPERTY_COMPRESSION_METHOD)
94+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
95+
public LogsArchiveAttributesCompressionMethod getCompressionMethod() {
96+
return compressionMethod;
97+
}
98+
99+
public void setCompressionMethod(LogsArchiveAttributesCompressionMethod compressionMethod) {
100+
if (!compressionMethod.isValid()) {
101+
this.unparsed = true;
102+
}
103+
this.compressionMethod = compressionMethod;
104+
}
105+
75106
public LogsArchiveAttributes destination(LogsArchiveDestination destination) {
76107
this.destination = destination;
77108
if (destination != null) {
@@ -300,7 +331,8 @@ public boolean equals(Object o) {
300331
return false;
301332
}
302333
LogsArchiveAttributes logsArchiveAttributes = (LogsArchiveAttributes) o;
303-
return Objects.equals(this.destination, logsArchiveAttributes.destination)
334+
return Objects.equals(this.compressionMethod, logsArchiveAttributes.compressionMethod)
335+
&& Objects.equals(this.destination, logsArchiveAttributes.destination)
304336
&& Objects.equals(this.includeTags, logsArchiveAttributes.includeTags)
305337
&& Objects.equals(this.name, logsArchiveAttributes.name)
306338
&& Objects.equals(this.query, logsArchiveAttributes.query)
@@ -314,6 +346,7 @@ public boolean equals(Object o) {
314346
@Override
315347
public int hashCode() {
316348
return Objects.hash(
349+
compressionMethod,
317350
destination,
318351
includeTags,
319352
name,
@@ -328,6 +361,7 @@ public int hashCode() {
328361
public String toString() {
329362
StringBuilder sb = new StringBuilder();
330363
sb.append("class LogsArchiveAttributes {\n");
364+
sb.append(" compressionMethod: ").append(toIndentedString(compressionMethod)).append("\n");
331365
sb.append(" destination: ").append(toIndentedString(destination)).append("\n");
332366
sb.append(" includeTags: ").append(toIndentedString(includeTags)).append("\n");
333367
sb.append(" name: ").append(toIndentedString(name)).append("\n");
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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 compression for the archive. */
22+
@JsonSerialize(
23+
using =
24+
LogsArchiveAttributesCompressionMethod.LogsArchiveAttributesCompressionMethodSerializer
25+
.class)
26+
public class LogsArchiveAttributesCompressionMethod extends ModelEnum<String> {
27+
28+
private static final Set<String> allowedValues =
29+
new HashSet<String>(Arrays.asList("GZIP", "ZSTD"));
30+
31+
public static final LogsArchiveAttributesCompressionMethod GZIP =
32+
new LogsArchiveAttributesCompressionMethod("GZIP");
33+
public static final LogsArchiveAttributesCompressionMethod ZSTD =
34+
new LogsArchiveAttributesCompressionMethod("ZSTD");
35+
36+
LogsArchiveAttributesCompressionMethod(String value) {
37+
super(value, allowedValues);
38+
}
39+
40+
public static class LogsArchiveAttributesCompressionMethodSerializer
41+
extends StdSerializer<LogsArchiveAttributesCompressionMethod> {
42+
public LogsArchiveAttributesCompressionMethodSerializer(
43+
Class<LogsArchiveAttributesCompressionMethod> t) {
44+
super(t);
45+
}
46+
47+
public LogsArchiveAttributesCompressionMethodSerializer() {
48+
this(null);
49+
}
50+
51+
@Override
52+
public void serialize(
53+
LogsArchiveAttributesCompressionMethod value,
54+
JsonGenerator jgen,
55+
SerializerProvider provider)
56+
throws IOException, JsonProcessingException {
57+
jgen.writeObject(value.value);
58+
}
59+
}
60+
61+
@JsonCreator
62+
public static LogsArchiveAttributesCompressionMethod fromValue(String value) {
63+
return new LogsArchiveAttributesCompressionMethod(value);
64+
}
65+
}

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
/** The attributes associated with the archive. */
2424
@JsonPropertyOrder({
25+
LogsArchiveCreateRequestAttributes.JSON_PROPERTY_COMPRESSION_METHOD,
2526
LogsArchiveCreateRequestAttributes.JSON_PROPERTY_DESTINATION,
2627
LogsArchiveCreateRequestAttributes.JSON_PROPERTY_INCLUDE_TAGS,
2728
LogsArchiveCreateRequestAttributes.JSON_PROPERTY_NAME,
@@ -33,6 +34,10 @@
3334
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
3435
public class LogsArchiveCreateRequestAttributes {
3536
@JsonIgnore public boolean unparsed = false;
37+
public static final String JSON_PROPERTY_COMPRESSION_METHOD = "compression_method";
38+
private LogsArchiveAttributesCompressionMethod compressionMethod =
39+
LogsArchiveAttributesCompressionMethod.GZIP;
40+
3641
public static final String JSON_PROPERTY_DESTINATION = "destination";
3742
private LogsArchiveCreateRequestDestination destination;
3843

@@ -66,6 +71,32 @@ public LogsArchiveCreateRequestAttributes(
6671
this.query = query;
6772
}
6873

74+
public LogsArchiveCreateRequestAttributes compressionMethod(
75+
LogsArchiveAttributesCompressionMethod compressionMethod) {
76+
this.compressionMethod = compressionMethod;
77+
this.unparsed |= !compressionMethod.isValid();
78+
return this;
79+
}
80+
81+
/**
82+
* The type of compression for the archive.
83+
*
84+
* @return compressionMethod
85+
*/
86+
@jakarta.annotation.Nullable
87+
@JsonProperty(JSON_PROPERTY_COMPRESSION_METHOD)
88+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
89+
public LogsArchiveAttributesCompressionMethod getCompressionMethod() {
90+
return compressionMethod;
91+
}
92+
93+
public void setCompressionMethod(LogsArchiveAttributesCompressionMethod compressionMethod) {
94+
if (!compressionMethod.isValid()) {
95+
this.unparsed = true;
96+
}
97+
this.compressionMethod = compressionMethod;
98+
}
99+
69100
public LogsArchiveCreateRequestAttributes destination(
70101
LogsArchiveCreateRequestDestination destination) {
71102
this.destination = destination;
@@ -269,7 +300,9 @@ public boolean equals(Object o) {
269300
}
270301
LogsArchiveCreateRequestAttributes logsArchiveCreateRequestAttributes =
271302
(LogsArchiveCreateRequestAttributes) o;
272-
return Objects.equals(this.destination, logsArchiveCreateRequestAttributes.destination)
303+
return Objects.equals(
304+
this.compressionMethod, logsArchiveCreateRequestAttributes.compressionMethod)
305+
&& Objects.equals(this.destination, logsArchiveCreateRequestAttributes.destination)
273306
&& Objects.equals(this.includeTags, logsArchiveCreateRequestAttributes.includeTags)
274307
&& Objects.equals(this.name, logsArchiveCreateRequestAttributes.name)
275308
&& Objects.equals(this.query, logsArchiveCreateRequestAttributes.query)
@@ -284,6 +317,7 @@ public boolean equals(Object o) {
284317
@Override
285318
public int hashCode() {
286319
return Objects.hash(
320+
compressionMethod,
287321
destination,
288322
includeTags,
289323
name,
@@ -297,6 +331,7 @@ public int hashCode() {
297331
public String toString() {
298332
StringBuilder sb = new StringBuilder();
299333
sb.append("class LogsArchiveCreateRequestAttributes {\n");
334+
sb.append(" compressionMethod: ").append(toIndentedString(compressionMethod)).append("\n");
300335
sb.append(" destination: ").append(toIndentedString(destination)).append("\n");
301336
sb.append(" includeTags: ").append(toIndentedString(includeTags)).append("\n");
302337
sb.append(" name: ").append(toIndentedString(name)).append("\n");

src/test/resources/com/datadog/api/client/v2/api/logs_archives.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Feature: Logs Archives
1212
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-forwarding
1313
Scenario: Create an archive returns "Bad Request" response
1414
Given new "CreateLogsArchive" request
15-
And body with value {"data": {"attributes": {"destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
15+
And body with value {"data": {"attributes": {"compression_method": "GZIP", "destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
1616
When the request is sent
1717
Then the response status is 400 Bad Request
1818

1919
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-forwarding
2020
Scenario: Create an archive returns "OK" response
2121
Given new "CreateLogsArchive" request
22-
And body with value {"data": {"attributes": {"destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
22+
And body with value {"data": {"attributes": {"compression_method": "GZIP", "destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
2323
When the request is sent
2424
Then the response status is 200 OK
2525

@@ -150,23 +150,23 @@ Feature: Logs Archives
150150
Scenario: Update an archive returns "Bad Request" response
151151
Given new "UpdateLogsArchive" request
152152
And request contains "archive_id" parameter from "REPLACE.ME"
153-
And body with value {"data": {"attributes": {"destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
153+
And body with value {"data": {"attributes": {"compression_method": "GZIP", "destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
154154
When the request is sent
155155
Then the response status is 400 Bad Request
156156

157157
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-forwarding
158158
Scenario: Update an archive returns "Not found" response
159159
Given new "UpdateLogsArchive" request
160160
And request contains "archive_id" parameter from "REPLACE.ME"
161-
And body with value {"data": {"attributes": {"destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
161+
And body with value {"data": {"attributes": {"compression_method": "GZIP", "destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
162162
When the request is sent
163163
Then the response status is 404 Not found
164164

165165
@generated @skip @team:DataDog/logs-backend @team:DataDog/logs-forwarding
166166
Scenario: Update an archive returns "OK" response
167167
Given new "UpdateLogsArchive" request
168168
And request contains "archive_id" parameter from "REPLACE.ME"
169-
And body with value {"data": {"attributes": {"destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
169+
And body with value {"data": {"attributes": {"compression_method": "GZIP", "destination": {"container": "container-name", "integration": {"client_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa", "tenant_id": "aaaaaaaa-1a1a-1a1a-1a1a-aaaaaaaaaaaa"}, "storage_account": "account-name", "type": "azure"}, "include_tags": false, "name": "Nginx Archive", "query": "source:nginx", "rehydration_max_scan_size_in_gb": 100, "rehydration_tags": ["team:intake", "team:app"]}, "type": "archives"}}
170170
When the request is sent
171171
Then the response status is 200 OK
172172

0 commit comments

Comments
 (0)