-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathUpdateWebIntegrationAccount.java
More file actions
47 lines (43 loc) · 2.19 KB
/
UpdateWebIntegrationAccount.java
File metadata and controls
47 lines (43 loc) · 2.19 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 integration account returns "OK: The account was successfully updated." response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IntegrationAccountsApi;
import com.datadog.api.client.v2.model.WebIntegrationAccountResponse;
import com.datadog.api.client.v2.model.WebIntegrationAccountType;
import com.datadog.api.client.v2.model.WebIntegrationAccountUpdateRequest;
import com.datadog.api.client.v2.model.WebIntegrationAccountUpdateRequestAttributes;
import com.datadog.api.client.v2.model.WebIntegrationAccountUpdateRequestData;
import java.util.Map;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
IntegrationAccountsApi apiInstance = new IntegrationAccountsApi(defaultClient);
WebIntegrationAccountUpdateRequest body =
new WebIntegrationAccountUpdateRequest()
.data(
new WebIntegrationAccountUpdateRequestData()
.attributes(
new WebIntegrationAccountUpdateRequestAttributes()
.name("My Production Account (Updated)")
.secrets(
Map.ofEntries(Map.entry("api_key_token", "new_secret_token_value")))
.settings(
Map.ofEntries(
Map.entry("ccm_enabled", "True"),
Map.entry("events", "True"),
Map.entry("messages", "False"))))
.type(WebIntegrationAccountType.ACCOUNT));
try {
WebIntegrationAccountResponse result =
apiInstance.updateWebIntegrationAccount("twilio", "abc123def456", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling IntegrationAccountsApi#updateWebIntegrationAccount");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}