Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
428 changes: 428 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions examples/v2/on-call/CreateUserNotificationChannel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Create an On-Call notification channel for a user returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OnCallApi;
import com.datadog.api.client.v2.model.CreateEmailNotificationChannelConfig;
import com.datadog.api.client.v2.model.CreateNotificationChannelAttributes;
import com.datadog.api.client.v2.model.CreateNotificationChannelConfig;
import com.datadog.api.client.v2.model.CreateNotificationChannelData;
import com.datadog.api.client.v2.model.CreateUserNotificationChannelRequest;
import com.datadog.api.client.v2.model.NotificationChannel;
import com.datadog.api.client.v2.model.NotificationChannelEmailConfigType;
import com.datadog.api.client.v2.model.NotificationChannelEmailFormatType;
import com.datadog.api.client.v2.model.NotificationChannelType;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
OnCallApi apiInstance = new OnCallApi(defaultClient);

// there is a valid "user" in the system
String USER_DATA_ID = System.getenv("USER_DATA_ID");

CreateUserNotificationChannelRequest body =
new CreateUserNotificationChannelRequest()
.data(
new CreateNotificationChannelData()
.attributes(
new CreateNotificationChannelAttributes()
.config(
new CreateNotificationChannelConfig(
new CreateEmailNotificationChannelConfig()
.address("foo@bar.com")
.formats(
Collections.singletonList(
NotificationChannelEmailFormatType.HTML))
.type(NotificationChannelEmailConfigType.EMAIL))))
.type(NotificationChannelType.NOTIFICATION_CHANNELS));

try {
NotificationChannel result = apiInstance.createUserNotificationChannel(USER_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#createUserNotificationChannel");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
30 changes: 30 additions & 0 deletions examples/v2/on-call/DeleteUserNotificationChannel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Delete an On-Call notification channel for a user returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OnCallApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
OnCallApi apiInstance = new OnCallApi(defaultClient);

// there is a valid "user" in the system
String USER_DATA_ID = System.getenv("USER_DATA_ID");

// there is a valid "oncall_email_notification_channel" in the system
String ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID =
System.getenv("ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID");

try {
apiInstance.deleteUserNotificationChannel(
USER_DATA_ID, ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#deleteUserNotificationChannel");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
33 changes: 33 additions & 0 deletions examples/v2/on-call/GetUserNotificationChannel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Get an On-Call notification channel for a user returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OnCallApi;
import com.datadog.api.client.v2.model.NotificationChannel;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
OnCallApi apiInstance = new OnCallApi(defaultClient);

// there is a valid "user" in the system
String USER_DATA_ID = System.getenv("USER_DATA_ID");

// there is a valid "oncall_email_notification_channel" in the system
String ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID =
System.getenv("ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID");

try {
NotificationChannel result =
apiInstance.getUserNotificationChannel(
USER_DATA_ID, ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#getUserNotificationChannel");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
28 changes: 28 additions & 0 deletions examples/v2/on-call/ListUserNotificationChannels.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// List On-Call notification channels for a user returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OnCallApi;
import com.datadog.api.client.v2.model.ListNotificationChannelsResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
OnCallApi apiInstance = new OnCallApi(defaultClient);

// there is a valid "user" in the system
String USER_DATA_ID = System.getenv("USER_DATA_ID");

try {
ListNotificationChannelsResponse result =
apiInstance.listUserNotificationChannels(USER_DATA_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#listUserNotificationChannels");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Loading
Loading