Skip to content

Commit 51c9774

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 6fe9b33 of spec repo
1 parent 9b047fc commit 51c9774

19 files changed

Lines changed: 4101 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 381 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// Ingest email transport webhook events returns "No Content" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.EmailTransportApi;
6+
import com.datadog.api.client.v2.model.TransportWebhookLog;
7+
import com.datadog.api.client.v2.model.TransportWebhookLogAttributes;
8+
import com.datadog.api.client.v2.model.TransportWebhookLogEmail;
9+
import com.datadog.api.client.v2.model.TransportWebhookLogIpAttribute;
10+
import com.datadog.api.client.v2.model.TransportWebhookLogMessage;
11+
import com.datadog.api.client.v2.model.TransportWebhookLogMessageAuth;
12+
import com.datadog.api.client.v2.model.TransportWebhookLogMessageCustomArgs;
13+
import com.datadog.api.client.v2.model.TransportWebhookLogMessageId;
14+
import com.datadog.api.client.v2.model.TransportWebhookLogMessageResponse;
15+
import com.datadog.api.client.v2.model.TransportWebhookLogMessageTimestamp;
16+
import com.datadog.api.client.v2.model.TransportWebhookLogNetwork;
17+
import com.datadog.api.client.v2.model.TransportWebhookLogNetworkIp;
18+
import com.datadog.api.client.v2.model.TransportWebhookLogOrgMetadata;
19+
import java.time.OffsetDateTime;
20+
import java.util.Collections;
21+
import java.util.List;
22+
23+
public class Example {
24+
public static void main(String[] args) {
25+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
26+
defaultClient.setUnstableOperationEnabled("v2.createEmailTransportWebhookIntake", true);
27+
EmailTransportApi apiInstance = new EmailTransportApi(defaultClient);
28+
29+
List<TransportWebhookLog> body =
30+
Collections.singletonList(
31+
new TransportWebhookLog()
32+
.attributes(
33+
new TransportWebhookLogAttributes()
34+
.category(Collections.singletonList("transactional"))
35+
.email(
36+
new TransportWebhookLogEmail()
37+
.address("user@example.com")
38+
.domain("example.com")
39+
.subject("[Monitor Alert] CPU usage is high")
40+
.type(Collections.singletonList("transactional")))
41+
.emailId("abc123-def456")
42+
.emailTypeDisplayName("Monitor Alert")
43+
.message(
44+
new TransportWebhookLogMessage()
45+
.auth(
46+
new TransportWebhookLogMessageAuth()
47+
.deliveredWithTls("TLSv1.2"))
48+
.customArgs(
49+
new TransportWebhookLogMessageCustomArgs()
50+
.emailId("abc123-def456")
51+
.emailTypeDisplayName("Monitor Alert")
52+
.orgUuid("8dee7c38-00cb-11ea-a77b-8b5a08d3b091")
53+
.queueTime("2024-01-15T10:29:00Z")
54+
.subject("[Monitor Alert] CPU usage is high"))
55+
.id(
56+
new TransportWebhookLogMessageId()
57+
.messageId("<message-id@example.com>")
58+
.smtpId("<abc123@mail.example.com>")
59+
.transportEventId("evt_abc123"))
60+
.name("delivered")
61+
.response(
62+
new TransportWebhookLogMessageResponse()
63+
.enhancedSmtpCode("2.0.0")
64+
.reason("250 2.0.0 OK")
65+
.smtpCode("250"))
66+
.senderIp("192.168.1.1")
67+
.timestamp(
68+
new TransportWebhookLogMessageTimestamp()
69+
.eventTimestamp(1705312200.0)
70+
.lifetime(3.2)
71+
.queueTime(1.5)
72+
.scheduledTime(1705312190.0)))
73+
.network(
74+
new TransportWebhookLogNetwork()
75+
.ip(
76+
new TransportWebhookLogNetworkIp()
77+
.attributes(
78+
Collections.singletonList(
79+
new TransportWebhookLogIpAttribute()
80+
.ip("192.168.1.1")
81+
.source(Collections.singletonList("sendgrid"))))
82+
.list(Collections.singletonList("192.168.1.1"))))
83+
.org(1234L)
84+
.orgMetadata(new TransportWebhookLogOrgMetadata())
85+
.orgUuid("8dee7c38-00cb-11ea-a77b-8b5a08d3b091")
86+
.queueTime("2024-01-15T10:29:00Z")
87+
.subject("[Monitor Alert] CPU usage is high")
88+
.useragent("Mozilla/5.0"))
89+
.date(OffsetDateTime.parse("2024-01-15T10:30:00Z"))
90+
.logId("AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR")
91+
.source("sendgrid")
92+
.status("info")
93+
.tags(Collections.singletonList("env:production")));
94+
95+
try {
96+
apiInstance.createEmailTransportWebhookIntake(body);
97+
} catch (ApiException e) {
98+
System.err.println(
99+
"Exception when calling EmailTransportApi#createEmailTransportWebhookIntake");
100+
System.err.println("Status code: " + e.getCode());
101+
System.err.println("Reason: " + e.getResponseBody());
102+
System.err.println("Response headers: " + e.getResponseHeaders());
103+
e.printStackTrace();
104+
}
105+
}
106+
}

src/main/java/com/datadog/api/client/ApiClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ public class ApiClient {
883883
put("v2.triggerDeploymentGatesEvaluation", false);
884884
put("v2.updateDeploymentGate", false);
885885
put("v2.updateDeploymentRule", false);
886+
put("v2.createEmailTransportWebhookIntake", false);
886887
put("v2.createHamrOrgConnection", false);
887888
put("v2.getHamrOrgConnection", false);
888889
put("v2.createGlobalIncidentHandle", false);
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
package com.datadog.api.client.v2.api;
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.ApiResponse;
6+
import com.datadog.api.client.Pair;
7+
import com.datadog.api.client.v2.model.TransportWebhookLog;
8+
import jakarta.ws.rs.client.Invocation;
9+
import java.util.ArrayList;
10+
import java.util.HashMap;
11+
import java.util.List;
12+
import java.util.Map;
13+
import java.util.concurrent.CompletableFuture;
14+
15+
@jakarta.annotation.Generated(
16+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
17+
public class EmailTransportApi {
18+
private ApiClient apiClient;
19+
20+
public EmailTransportApi() {
21+
this(ApiClient.getDefaultApiClient());
22+
}
23+
24+
public EmailTransportApi(ApiClient apiClient) {
25+
this.apiClient = apiClient;
26+
}
27+
28+
/**
29+
* Get the API client.
30+
*
31+
* @return API client
32+
*/
33+
public ApiClient getApiClient() {
34+
return apiClient;
35+
}
36+
37+
/**
38+
* Set the API client.
39+
*
40+
* @param apiClient an instance of API client
41+
*/
42+
public void setApiClient(ApiClient apiClient) {
43+
this.apiClient = apiClient;
44+
}
45+
46+
/**
47+
* Ingest email transport webhook events.
48+
*
49+
* <p>See {@link #createEmailTransportWebhookIntakeWithHttpInfo}.
50+
*
51+
* @param body (required)
52+
* @throws ApiException if fails to make API call
53+
*/
54+
public void createEmailTransportWebhookIntake(List<TransportWebhookLog> body)
55+
throws ApiException {
56+
createEmailTransportWebhookIntakeWithHttpInfo(body);
57+
}
58+
59+
/**
60+
* Ingest email transport webhook events.
61+
*
62+
* <p>See {@link #createEmailTransportWebhookIntakeWithHttpInfoAsync}.
63+
*
64+
* @param body (required)
65+
* @return CompletableFuture
66+
*/
67+
public CompletableFuture<Void> createEmailTransportWebhookIntakeAsync(
68+
List<TransportWebhookLog> body) {
69+
return createEmailTransportWebhookIntakeWithHttpInfoAsync(body)
70+
.thenApply(
71+
response -> {
72+
return response.getData();
73+
});
74+
}
75+
76+
/**
77+
* Receives a batch of email transport webhook log events and emits an audit trail entry for each
78+
* event with a final delivery status (delivered, dropped, or bounced). Only authorized
79+
* organizations can submit events.
80+
*
81+
* @param body (required)
82+
* @return ApiResponse&lt;Void&gt;
83+
* @throws ApiException if fails to make API call
84+
* @http.response.details
85+
* <table border="1">
86+
* <caption>Response details</caption>
87+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
88+
* <tr><td> 204 </td><td> No Content </td><td> - </td></tr>
89+
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
90+
* <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr>
91+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
92+
* </table>
93+
*/
94+
public ApiResponse<Void> createEmailTransportWebhookIntakeWithHttpInfo(
95+
List<TransportWebhookLog> body) throws ApiException {
96+
// Check if unstable operation is enabled
97+
String operationId = "createEmailTransportWebhookIntake";
98+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
99+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
100+
} else {
101+
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
102+
}
103+
Object localVarPostBody = body;
104+
105+
// verify the required parameter 'body' is set
106+
if (body == null) {
107+
throw new ApiException(
108+
400,
109+
"Missing the required parameter 'body' when calling createEmailTransportWebhookIntake");
110+
}
111+
// create path and map variables
112+
String localVarPath = "/api/v2/email/transport/webhook_intake";
113+
114+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
115+
116+
Invocation.Builder builder =
117+
apiClient.createBuilder(
118+
"v2.EmailTransportApi.createEmailTransportWebhookIntake",
119+
localVarPath,
120+
new ArrayList<Pair>(),
121+
localVarHeaderParams,
122+
new HashMap<String, String>(),
123+
new String[] {"*/*"},
124+
new String[] {"apiKeyAuth", "appKeyAuth"});
125+
return apiClient.invokeAPI(
126+
"POST",
127+
builder,
128+
localVarHeaderParams,
129+
new String[] {"application/json"},
130+
localVarPostBody,
131+
new HashMap<String, Object>(),
132+
false,
133+
null);
134+
}
135+
136+
/**
137+
* Ingest email transport webhook events.
138+
*
139+
* <p>See {@link #createEmailTransportWebhookIntakeWithHttpInfo}.
140+
*
141+
* @param body (required)
142+
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
143+
*/
144+
public CompletableFuture<ApiResponse<Void>> createEmailTransportWebhookIntakeWithHttpInfoAsync(
145+
List<TransportWebhookLog> body) {
146+
// Check if unstable operation is enabled
147+
String operationId = "createEmailTransportWebhookIntake";
148+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
149+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
150+
} else {
151+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
152+
result.completeExceptionally(
153+
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
154+
return result;
155+
}
156+
Object localVarPostBody = body;
157+
158+
// verify the required parameter 'body' is set
159+
if (body == null) {
160+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
161+
result.completeExceptionally(
162+
new ApiException(
163+
400,
164+
"Missing the required parameter 'body' when calling"
165+
+ " createEmailTransportWebhookIntake"));
166+
return result;
167+
}
168+
// create path and map variables
169+
String localVarPath = "/api/v2/email/transport/webhook_intake";
170+
171+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
172+
173+
Invocation.Builder builder;
174+
try {
175+
builder =
176+
apiClient.createBuilder(
177+
"v2.EmailTransportApi.createEmailTransportWebhookIntake",
178+
localVarPath,
179+
new ArrayList<Pair>(),
180+
localVarHeaderParams,
181+
new HashMap<String, String>(),
182+
new String[] {"*/*"},
183+
new String[] {"apiKeyAuth", "appKeyAuth"});
184+
} catch (ApiException ex) {
185+
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
186+
result.completeExceptionally(ex);
187+
return result;
188+
}
189+
return apiClient.invokeAPIAsync(
190+
"POST",
191+
builder,
192+
localVarHeaderParams,
193+
new String[] {"application/json"},
194+
localVarPostBody,
195+
new HashMap<String, Object>(),
196+
false,
197+
null);
198+
}
199+
}

0 commit comments

Comments
 (0)