Skip to content
Open
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
495 changes: 495 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions examples/v2/on-call/CreateUserNotificationRule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Create an On-Call notification rule 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.CreateOnCallNotificationRuleRequest;
import com.datadog.api.client.v2.model.CreateOnCallNotificationRuleRequestData;
import com.datadog.api.client.v2.model.NotificationChannelType;
import com.datadog.api.client.v2.model.OnCallNotificationRule;
import com.datadog.api.client.v2.model.OnCallNotificationRuleCategory;
import com.datadog.api.client.v2.model.OnCallNotificationRuleChannelRelationship;
import com.datadog.api.client.v2.model.OnCallNotificationRuleChannelRelationshipData;
import com.datadog.api.client.v2.model.OnCallNotificationRuleRelationships;
import com.datadog.api.client.v2.model.OnCallNotificationRuleRequestAttributes;
import com.datadog.api.client.v2.model.OnCallNotificationRuleType;

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");

CreateOnCallNotificationRuleRequest body =
new CreateOnCallNotificationRuleRequest()
.data(
new CreateOnCallNotificationRuleRequestData()
.attributes(
new OnCallNotificationRuleRequestAttributes()
.category(OnCallNotificationRuleCategory.HIGH_URGENCY)
.delayMinutes(0L))
.relationships(
new OnCallNotificationRuleRelationships()
.channel(
new OnCallNotificationRuleChannelRelationship()
.data(
new OnCallNotificationRuleChannelRelationshipData()
.id(ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID)
.type(NotificationChannelType.NOTIFICATION_CHANNELS))))
.type(OnCallNotificationRuleType.NOTIFICATION_RULES));

try {
OnCallNotificationRule result = apiInstance.createUserNotificationRule(USER_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#createUserNotificationRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
29 changes: 29 additions & 0 deletions examples/v2/on-call/DeleteUserNotificationRule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Delete an On-Call notification rule 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_rule" in the system
String ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID =
System.getenv("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID");

try {
apiInstance.deleteUserNotificationRule(USER_DATA_ID, ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#deleteUserNotificationRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
36 changes: 36 additions & 0 deletions examples/v2/on-call/GetUserNotificationRule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Get an On-Call notification rule 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.api.OnCallApi.GetUserNotificationRuleOptionalParameters;
import com.datadog.api.client.v2.model.OnCallNotificationRule;

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_rule" in the system
String ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID =
System.getenv("ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID");

try {
OnCallNotificationRule result =
apiInstance.getUserNotificationRule(
USER_DATA_ID,
ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID,
new GetUserNotificationRuleOptionalParameters().include("channel"));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#getUserNotificationRule");
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/ListUserNotificationRules.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// List On-Call notification rules 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.api.OnCallApi.ListUserNotificationRulesOptionalParameters;
import com.datadog.api.client.v2.model.ListOnCallNotificationRulesResponse;

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 {
ListOnCallNotificationRulesResponse result =
apiInstance.listUserNotificationRules(
USER_DATA_ID, new ListUserNotificationRulesOptionalParameters().include("channel"));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#listUserNotificationRules");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
69 changes: 69 additions & 0 deletions examples/v2/on-call/UpdateUserNotificationRule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Update an On-Call notification rule 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.api.OnCallApi.UpdateUserNotificationRuleOptionalParameters;
import com.datadog.api.client.v2.model.NotificationChannelType;
import com.datadog.api.client.v2.model.OnCallNotificationRule;
import com.datadog.api.client.v2.model.OnCallNotificationRuleCategory;
import com.datadog.api.client.v2.model.OnCallNotificationRuleChannelRelationship;
import com.datadog.api.client.v2.model.OnCallNotificationRuleChannelRelationshipData;
import com.datadog.api.client.v2.model.OnCallNotificationRuleRelationships;
import com.datadog.api.client.v2.model.OnCallNotificationRuleType;
import com.datadog.api.client.v2.model.UpdateOnCallNotificationRuleRequest;
import com.datadog.api.client.v2.model.UpdateOnCallNotificationRuleRequestAttributes;
import com.datadog.api.client.v2.model.UpdateOnCallNotificationRuleRequestData;

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_rule" in the system
String ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID =
System.getenv("ONCALL_EMAIL_NOTIFICATION_RULE_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");

UpdateOnCallNotificationRuleRequest body =
new UpdateOnCallNotificationRuleRequest()
.data(
new UpdateOnCallNotificationRuleRequestData()
.attributes(
new UpdateOnCallNotificationRuleRequestAttributes()
.category(OnCallNotificationRuleCategory.HIGH_URGENCY)
.delayMinutes(1L))
.id(ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID)
.relationships(
new OnCallNotificationRuleRelationships()
.channel(
new OnCallNotificationRuleChannelRelationship()
.data(
new OnCallNotificationRuleChannelRelationshipData()
.id(ONCALL_EMAIL_NOTIFICATION_CHANNEL_DATA_ID)
.type(NotificationChannelType.NOTIFICATION_CHANNELS))))
.type(OnCallNotificationRuleType.NOTIFICATION_RULES));

try {
OnCallNotificationRule result =
apiInstance.updateUserNotificationRule(
USER_DATA_ID,
ONCALL_EMAIL_NOTIFICATION_RULE_DATA_ID,
body,
new UpdateUserNotificationRuleOptionalParameters().include("channel"));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#updateUserNotificationRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Loading
Loading