-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathUpdateEventEmailAddress.java
More file actions
47 lines (43 loc) · 2.13 KB
/
UpdateEventEmailAddress.java
File metadata and controls
47 lines (43 loc) · 2.13 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
// Update an event email address returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.EventsApi;
import com.datadog.api.client.v2.model.EventEmailAddressAlertType;
import com.datadog.api.client.v2.model.EventEmailAddressResourceType;
import com.datadog.api.client.v2.model.EventEmailAddressSingleResponse;
import com.datadog.api.client.v2.model.EventEmailAddressUpdateAttributes;
import com.datadog.api.client.v2.model.EventEmailAddressUpdateData;
import com.datadog.api.client.v2.model.EventEmailAddressUpdateRequest;
import java.util.Arrays;
import java.util.Collections;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.updateEventEmailAddress", true);
EventsApi apiInstance = new EventsApi(defaultClient);
EventEmailAddressUpdateRequest body =
new EventEmailAddressUpdateRequest()
.data(
new EventEmailAddressUpdateData()
.attributes(
new EventEmailAddressUpdateAttributes()
.alertType(EventEmailAddressAlertType.INFO)
.description("Updated description for the email address.")
.notifyHandles(Collections.singletonList("@slack-my-channel"))
.tags(Arrays.asList("env:production", "team:my-team")))
.type(EventEmailAddressResourceType.EVENT_EMAILS));
try {
EventEmailAddressSingleResponse result =
apiInstance.updateEventEmailAddress(
UUID.fromString("00000000-0000-0000-0000-000000000001"), body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EventsApi#updateEventEmailAddress");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}