Skip to content

Commit c0668ec

Browse files
api-clients-generation-pipeline[bot]nkzouci.datadog-api-spec
authored
Add encryption field to logs archive destination (#2667)
* add encryption to test * Regenerate client from commit 2350cf2b of spec repo --------- Co-authored-by: Kevin Zou <kevin.zou@datadoghq.com> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 5f2d57d commit c0668ec

File tree

6 files changed

+302
-5
lines changed

6 files changed

+302
-5
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-01-23 20:01:35.387372",
8-
"spec_repo_commit": "f985f8bc"
7+
"regenerated": "2025-01-23 20:45:57.563563",
8+
"spec_repo_commit": "2350cf2b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-23 20:01:35.402563",
13-
"spec_repo_commit": "f985f8bc"
12+
"regenerated": "2025-01-23 20:45:57.578961",
13+
"spec_repo_commit": "2350cf2b"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16762,6 +16762,8 @@ components:
1676216762
description: The bucket where the archive will be stored.
1676316763
example: bucket-name
1676416764
type: string
16765+
encryption:
16766+
$ref: '#/components/schemas/LogsArchiveEncryptionS3'
1676516767
integration:
1676616768
$ref: '#/components/schemas/LogsArchiveIntegrationS3'
1676716769
path:
@@ -16783,6 +16785,30 @@ components:
1678316785
type: string
1678416786
x-enum-varnames:
1678516787
- S3
16788+
LogsArchiveEncryptionS3:
16789+
description: The S3 encryption settings.
16790+
properties:
16791+
key:
16792+
description: An Amazon Resource Name (ARN) used to identify an AWS KMS key.
16793+
example: arn:aws:kms:us-east-1:012345678901:key/DatadogIntegrationRoleKms
16794+
type: string
16795+
type:
16796+
$ref: '#/components/schemas/LogsArchiveEncryptionS3Type'
16797+
required:
16798+
- type
16799+
type: object
16800+
LogsArchiveEncryptionS3Type:
16801+
description: Type of S3 encryption for a destination.
16802+
enum:
16803+
- NO_OVERRIDE
16804+
- SSE_S3
16805+
- SSE_KMS
16806+
example: SSE_S3
16807+
type: string
16808+
x-enum-varnames:
16809+
- NO_OVERRIDE
16810+
- SSE_S3
16811+
- SSE_KMS
1678616812
LogsArchiveIntegrationAzure:
1678716813
description: The Azure archive's integration destination.
1678816814
properties:

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

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/** The S3 archive destination. */
2121
@JsonPropertyOrder({
2222
LogsArchiveDestinationS3.JSON_PROPERTY_BUCKET,
23+
LogsArchiveDestinationS3.JSON_PROPERTY_ENCRYPTION,
2324
LogsArchiveDestinationS3.JSON_PROPERTY_INTEGRATION,
2425
LogsArchiveDestinationS3.JSON_PROPERTY_PATH,
2526
LogsArchiveDestinationS3.JSON_PROPERTY_TYPE
@@ -31,6 +32,9 @@ public class LogsArchiveDestinationS3 {
3132
public static final String JSON_PROPERTY_BUCKET = "bucket";
3233
private String bucket;
3334

35+
public static final String JSON_PROPERTY_ENCRYPTION = "encryption";
36+
private LogsArchiveEncryptionS3 encryption;
37+
3438
public static final String JSON_PROPERTY_INTEGRATION = "integration";
3539
private LogsArchiveIntegrationS3 integration;
3640

@@ -76,6 +80,28 @@ public void setBucket(String bucket) {
7680
this.bucket = bucket;
7781
}
7882

83+
public LogsArchiveDestinationS3 encryption(LogsArchiveEncryptionS3 encryption) {
84+
this.encryption = encryption;
85+
this.unparsed |= encryption.unparsed;
86+
return this;
87+
}
88+
89+
/**
90+
* The S3 encryption settings.
91+
*
92+
* @return encryption
93+
*/
94+
@jakarta.annotation.Nullable
95+
@JsonProperty(JSON_PROPERTY_ENCRYPTION)
96+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
97+
public LogsArchiveEncryptionS3 getEncryption() {
98+
return encryption;
99+
}
100+
101+
public void setEncryption(LogsArchiveEncryptionS3 encryption) {
102+
this.encryption = encryption;
103+
}
104+
79105
public LogsArchiveDestinationS3 integration(LogsArchiveIntegrationS3 integration) {
80106
this.integration = integration;
81107
this.unparsed |= integration.unparsed;
@@ -199,6 +225,7 @@ public boolean equals(Object o) {
199225
}
200226
LogsArchiveDestinationS3 logsArchiveDestinationS3 = (LogsArchiveDestinationS3) o;
201227
return Objects.equals(this.bucket, logsArchiveDestinationS3.bucket)
228+
&& Objects.equals(this.encryption, logsArchiveDestinationS3.encryption)
202229
&& Objects.equals(this.integration, logsArchiveDestinationS3.integration)
203230
&& Objects.equals(this.path, logsArchiveDestinationS3.path)
204231
&& Objects.equals(this.type, logsArchiveDestinationS3.type)
@@ -207,14 +234,15 @@ public boolean equals(Object o) {
207234

208235
@Override
209236
public int hashCode() {
210-
return Objects.hash(bucket, integration, path, type, additionalProperties);
237+
return Objects.hash(bucket, encryption, integration, path, type, additionalProperties);
211238
}
212239

213240
@Override
214241
public String toString() {
215242
StringBuilder sb = new StringBuilder();
216243
sb.append("class LogsArchiveDestinationS3 {\n");
217244
sb.append(" bucket: ").append(toIndentedString(bucket)).append("\n");
245+
sb.append(" encryption: ").append(toIndentedString(encryption)).append("\n");
218246
sb.append(" integration: ").append(toIndentedString(integration)).append("\n");
219247
sb.append(" path: ").append(toIndentedString(path)).append("\n");
220248
sb.append(" type: ").append(toIndentedString(type)).append("\n");
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
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.fasterxml.jackson.annotation.JsonAnyGetter;
10+
import com.fasterxml.jackson.annotation.JsonAnySetter;
11+
import com.fasterxml.jackson.annotation.JsonCreator;
12+
import com.fasterxml.jackson.annotation.JsonIgnore;
13+
import com.fasterxml.jackson.annotation.JsonInclude;
14+
import com.fasterxml.jackson.annotation.JsonProperty;
15+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
16+
import java.util.HashMap;
17+
import java.util.Map;
18+
import java.util.Objects;
19+
20+
/** The S3 encryption settings. */
21+
@JsonPropertyOrder({
22+
LogsArchiveEncryptionS3.JSON_PROPERTY_KEY,
23+
LogsArchiveEncryptionS3.JSON_PROPERTY_TYPE
24+
})
25+
@jakarta.annotation.Generated(
26+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
27+
public class LogsArchiveEncryptionS3 {
28+
@JsonIgnore public boolean unparsed = false;
29+
public static final String JSON_PROPERTY_KEY = "key";
30+
private String key;
31+
32+
public static final String JSON_PROPERTY_TYPE = "type";
33+
private LogsArchiveEncryptionS3Type type;
34+
35+
public LogsArchiveEncryptionS3() {}
36+
37+
@JsonCreator
38+
public LogsArchiveEncryptionS3(
39+
@JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LogsArchiveEncryptionS3Type type) {
40+
this.type = type;
41+
this.unparsed |= !type.isValid();
42+
}
43+
44+
public LogsArchiveEncryptionS3 key(String key) {
45+
this.key = key;
46+
return this;
47+
}
48+
49+
/**
50+
* An Amazon Resource Name (ARN) used to identify an AWS KMS key.
51+
*
52+
* @return key
53+
*/
54+
@jakarta.annotation.Nullable
55+
@JsonProperty(JSON_PROPERTY_KEY)
56+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
57+
public String getKey() {
58+
return key;
59+
}
60+
61+
public void setKey(String key) {
62+
this.key = key;
63+
}
64+
65+
public LogsArchiveEncryptionS3 type(LogsArchiveEncryptionS3Type type) {
66+
this.type = type;
67+
this.unparsed |= !type.isValid();
68+
return this;
69+
}
70+
71+
/**
72+
* Type of S3 encryption for a destination.
73+
*
74+
* @return type
75+
*/
76+
@JsonProperty(JSON_PROPERTY_TYPE)
77+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
78+
public LogsArchiveEncryptionS3Type getType() {
79+
return type;
80+
}
81+
82+
public void setType(LogsArchiveEncryptionS3Type type) {
83+
if (!type.isValid()) {
84+
this.unparsed = true;
85+
}
86+
this.type = type;
87+
}
88+
89+
/**
90+
* A container for additional, undeclared properties. This is a holder for any undeclared
91+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
92+
*/
93+
private Map<String, Object> additionalProperties;
94+
95+
/**
96+
* Set the additional (undeclared) property with the specified name and value. If the property
97+
* does not already exist, create it otherwise replace it.
98+
*
99+
* @param key The arbitrary key to set
100+
* @param value The associated value
101+
* @return LogsArchiveEncryptionS3
102+
*/
103+
@JsonAnySetter
104+
public LogsArchiveEncryptionS3 putAdditionalProperty(String key, Object value) {
105+
if (this.additionalProperties == null) {
106+
this.additionalProperties = new HashMap<String, Object>();
107+
}
108+
this.additionalProperties.put(key, value);
109+
return this;
110+
}
111+
112+
/**
113+
* Return the additional (undeclared) property.
114+
*
115+
* @return The additional properties
116+
*/
117+
@JsonAnyGetter
118+
public Map<String, Object> getAdditionalProperties() {
119+
return additionalProperties;
120+
}
121+
122+
/**
123+
* Return the additional (undeclared) property with the specified name.
124+
*
125+
* @param key The arbitrary key to get
126+
* @return The specific additional property for the given key
127+
*/
128+
public Object getAdditionalProperty(String key) {
129+
if (this.additionalProperties == null) {
130+
return null;
131+
}
132+
return this.additionalProperties.get(key);
133+
}
134+
135+
/** Return true if this LogsArchiveEncryptionS3 object is equal to o. */
136+
@Override
137+
public boolean equals(Object o) {
138+
if (this == o) {
139+
return true;
140+
}
141+
if (o == null || getClass() != o.getClass()) {
142+
return false;
143+
}
144+
LogsArchiveEncryptionS3 logsArchiveEncryptionS3 = (LogsArchiveEncryptionS3) o;
145+
return Objects.equals(this.key, logsArchiveEncryptionS3.key)
146+
&& Objects.equals(this.type, logsArchiveEncryptionS3.type)
147+
&& Objects.equals(this.additionalProperties, logsArchiveEncryptionS3.additionalProperties);
148+
}
149+
150+
@Override
151+
public int hashCode() {
152+
return Objects.hash(key, type, additionalProperties);
153+
}
154+
155+
@Override
156+
public String toString() {
157+
StringBuilder sb = new StringBuilder();
158+
sb.append("class LogsArchiveEncryptionS3 {\n");
159+
sb.append(" key: ").append(toIndentedString(key)).append("\n");
160+
sb.append(" type: ").append(toIndentedString(type)).append("\n");
161+
sb.append(" additionalProperties: ")
162+
.append(toIndentedString(additionalProperties))
163+
.append("\n");
164+
sb.append('}');
165+
return sb.toString();
166+
}
167+
168+
/**
169+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
170+
*/
171+
private String toIndentedString(Object o) {
172+
if (o == null) {
173+
return "null";
174+
}
175+
return o.toString().replace("\n", "\n ");
176+
}
177+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
/** Type of S3 encryption for a destination. */
22+
@JsonSerialize(using = LogsArchiveEncryptionS3Type.LogsArchiveEncryptionS3TypeSerializer.class)
23+
public class LogsArchiveEncryptionS3Type extends ModelEnum<String> {
24+
25+
private static final Set<String> allowedValues =
26+
new HashSet<String>(Arrays.asList("NO_OVERRIDE", "SSE_S3", "SSE_KMS"));
27+
28+
public static final LogsArchiveEncryptionS3Type NO_OVERRIDE =
29+
new LogsArchiveEncryptionS3Type("NO_OVERRIDE");
30+
public static final LogsArchiveEncryptionS3Type SSE_S3 =
31+
new LogsArchiveEncryptionS3Type("SSE_S3");
32+
public static final LogsArchiveEncryptionS3Type SSE_KMS =
33+
new LogsArchiveEncryptionS3Type("SSE_KMS");
34+
35+
LogsArchiveEncryptionS3Type(String value) {
36+
super(value, allowedValues);
37+
}
38+
39+
public static class LogsArchiveEncryptionS3TypeSerializer
40+
extends StdSerializer<LogsArchiveEncryptionS3Type> {
41+
public LogsArchiveEncryptionS3TypeSerializer(Class<LogsArchiveEncryptionS3Type> t) {
42+
super(t);
43+
}
44+
45+
public LogsArchiveEncryptionS3TypeSerializer() {
46+
this(null);
47+
}
48+
49+
@Override
50+
public void serialize(
51+
LogsArchiveEncryptionS3Type value, JsonGenerator jgen, SerializerProvider provider)
52+
throws IOException, JsonProcessingException {
53+
jgen.writeObject(value.value);
54+
}
55+
}
56+
57+
@JsonCreator
58+
public static LogsArchiveEncryptionS3Type fromValue(String value) {
59+
return new LogsArchiveEncryptionS3Type(value);
60+
}
61+
}

src/test/java/com/datadog/api/client/v2/api/LogsArchivesApiTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import com.datadog.api.client.v2.model.LogsArchiveDestinationGCSType;
3535
import com.datadog.api.client.v2.model.LogsArchiveDestinationS3;
3636
import com.datadog.api.client.v2.model.LogsArchiveDestinationS3Type;
37+
import com.datadog.api.client.v2.model.LogsArchiveEncryptionS3;
38+
import com.datadog.api.client.v2.model.LogsArchiveEncryptionS3Type;
3739
import com.datadog.api.client.v2.model.LogsArchiveIntegrationAzure;
3840
import com.datadog.api.client.v2.model.LogsArchiveIntegrationGCS;
3941
import com.datadog.api.client.v2.model.LogsArchiveIntegrationS3;
@@ -287,9 +289,12 @@ private LogsArchiveCreateRequest createLogsArchiveCreateRequestS3() {
287289
new LogsArchiveIntegrationS3()
288290
.accountId("711111111111")
289291
.roleName("DatadogGoClientTestIntegrationRole");
292+
LogsArchiveEncryptionS3 encryptionS3 =
293+
new LogsArchiveEncryptionS3().key("test").type(LogsArchiveEncryptionS3Type.NO_OVERRIDE);
290294
LogsArchiveDestinationS3 destination =
291295
new LogsArchiveDestinationS3()
292296
.integration(integration)
297+
.encryption(encryptionS3)
293298
.bucket("dd-logs-test-datadog-api-client-go")
294299
.path("/path/toto")
295300
.type(LogsArchiveDestinationS3Type.S3);

0 commit comments

Comments
 (0)