-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathTriggerInvestigation.java
More file actions
48 lines (44 loc) · 2.29 KB
/
TriggerInvestigation.java
File metadata and controls
48 lines (44 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Trigger a Bits AI investigation returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.BitsAiApi;
import com.datadog.api.client.v2.model.MonitorAlertTriggerAttributes;
import com.datadog.api.client.v2.model.TriggerAttributes;
import com.datadog.api.client.v2.model.TriggerInvestigationRequest;
import com.datadog.api.client.v2.model.TriggerInvestigationRequestData;
import com.datadog.api.client.v2.model.TriggerInvestigationRequestDataAttributes;
import com.datadog.api.client.v2.model.TriggerInvestigationRequestType;
import com.datadog.api.client.v2.model.TriggerInvestigationResponse;
import com.datadog.api.client.v2.model.TriggerType;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.triggerInvestigation", true);
BitsAiApi apiInstance = new BitsAiApi(defaultClient);
TriggerInvestigationRequest body =
new TriggerInvestigationRequest()
.data(
new TriggerInvestigationRequestData()
.attributes(
new TriggerInvestigationRequestDataAttributes()
.trigger(
new TriggerAttributes()
.monitorAlertTrigger(
new MonitorAlertTriggerAttributes()
.eventId("1234567890123456789")
.eventTs(1700000000000L)
.monitorId(12345678L))
.type(TriggerType.MONITOR_ALERT_TRIGGER)))
.type(TriggerInvestigationRequestType.TRIGGER_INVESTIGATION_REQUEST));
try {
TriggerInvestigationResponse result = apiInstance.triggerInvestigation(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BitsAiApi#triggerInvestigation");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}