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
613 changes: 613 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions examples/v2/incidents/CreateIncidentNotificationTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Create incident notification template returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.CreateIncidentNotificationTemplateRequest;
import com.datadog.api.client.v2.model.IncidentNotificationTemplate;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateCreateAttributes;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateCreateData;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateCreateDataRelationships;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateType;
import com.datadog.api.client.v2.model.IncidentTypeType;
import com.datadog.api.client.v2.model.RelationshipToIncidentType;
import com.datadog.api.client.v2.model.RelationshipToIncidentTypeData;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.createIncidentNotificationTemplate", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);

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

CreateIncidentNotificationTemplateRequest body =
new CreateIncidentNotificationTemplateRequest()
.data(
new IncidentNotificationTemplateCreateData()
.attributes(
new IncidentNotificationTemplateCreateAttributes()
.category("alert")
.content(
"""
An incident has been declared.

Title: Sample Incident Title
Severity: SEV-2
Affected Services: web-service, database-service
Status: active

Please join the incident channel for updates.
""")
.name("Example-Incident")
.subject("SEV-2 Incident: Sample Incident Title"))
.relationships(
new IncidentNotificationTemplateCreateDataRelationships()
.incidentType(
new RelationshipToIncidentType()
.data(
new RelationshipToIncidentTypeData()
.id(INCIDENT_TYPE_DATA_ID)
.type(IncidentTypeType.INCIDENT_TYPES))))
.type(IncidentNotificationTemplateType.NOTIFICATION_TEMPLATES));

try {
IncidentNotificationTemplate result = apiInstance.createIncidentNotificationTemplate(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#createIncidentNotificationTemplate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
25 changes: 25 additions & 0 deletions examples/v2/incidents/DeleteIncidentNotificationTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Delete a notification template returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import java.util.UUID;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.deleteIncidentNotificationTemplate", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);

try {
apiInstance.deleteIncidentNotificationTemplate(
UUID.fromString("00000000-0000-0000-0000-000000000001"));
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#deleteIncidentNotificationTemplate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Delete incident notification template returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import java.util.UUID;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.deleteIncidentNotificationTemplate", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);

// there is a valid "notification_template" in the system
UUID NOTIFICATION_TEMPLATE_DATA_ID = null;
try {
NOTIFICATION_TEMPLATE_DATA_ID =
UUID.fromString(System.getenv("NOTIFICATION_TEMPLATE_DATA_ID"));
} catch (IllegalArgumentException e) {
System.err.println("Error parsing UUID: " + e.getMessage());
}

try {
apiInstance.deleteIncidentNotificationTemplate(NOTIFICATION_TEMPLATE_DATA_ID);
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#deleteIncidentNotificationTemplate");
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/incidents/GetIncidentNotificationTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Get incident notification template returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentNotificationTemplate;
import java.util.UUID;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.getIncidentNotificationTemplate", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);

// there is a valid "notification_template" in the system
UUID NOTIFICATION_TEMPLATE_DATA_ID = null;
try {
NOTIFICATION_TEMPLATE_DATA_ID =
UUID.fromString(System.getenv("NOTIFICATION_TEMPLATE_DATA_ID"));
} catch (IllegalArgumentException e) {
System.err.println("Error parsing UUID: " + e.getMessage());
}

try {
IncidentNotificationTemplate result =
apiInstance.getIncidentNotificationTemplate(NOTIFICATION_TEMPLATE_DATA_ID);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#getIncidentNotificationTemplate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
25 changes: 25 additions & 0 deletions examples/v2/incidents/ListIncidentNotificationTemplates.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// List incident notification templates returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateArray;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.listIncidentNotificationTemplates", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);

try {
IncidentNotificationTemplateArray result = apiInstance.listIncidentNotificationTemplates();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#listIncidentNotificationTemplates");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
64 changes: 64 additions & 0 deletions examples/v2/incidents/UpdateIncidentNotificationTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Update incident notification template returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentNotificationTemplate;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateType;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateUpdateAttributes;
import com.datadog.api.client.v2.model.IncidentNotificationTemplateUpdateData;
import com.datadog.api.client.v2.model.PatchIncidentNotificationTemplateRequest;
import java.util.UUID;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.updateIncidentNotificationTemplate", true);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);

// there is a valid "notification_template" in the system
UUID NOTIFICATION_TEMPLATE_DATA_ID = null;
try {
NOTIFICATION_TEMPLATE_DATA_ID =
UUID.fromString(System.getenv("NOTIFICATION_TEMPLATE_DATA_ID"));
} catch (IllegalArgumentException e) {
System.err.println("Error parsing UUID: " + e.getMessage());
}

PatchIncidentNotificationTemplateRequest body =
new PatchIncidentNotificationTemplateRequest()
.data(
new IncidentNotificationTemplateUpdateData()
.attributes(
new IncidentNotificationTemplateUpdateAttributes()
.category("update")
.content(
"""
Incident Status Update:

Title: Sample Incident Title
New Status: resolved
Severity: SEV-2
Services: web-service, database-service
Commander: John Doe

For more details, visit the incident page.
""")
.name("Example-Incident")
.subject("Incident Update: Sample Incident Title - resolved"))
.id(NOTIFICATION_TEMPLATE_DATA_ID)
.type(IncidentNotificationTemplateType.NOTIFICATION_TEMPLATES));

try {
IncidentNotificationTemplate result =
apiInstance.updateIncidentNotificationTemplate(NOTIFICATION_TEMPLATE_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling IncidentsApi#updateIncidentNotificationTemplate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
5 changes: 5 additions & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -720,25 +720,30 @@ public class ApiClient {
put("v2.getDataDeletionRequests", false);
put("v2.createIncident", false);
put("v2.createIncidentIntegration", false);
put("v2.createIncidentNotificationTemplate", false);
put("v2.createIncidentTodo", false);
put("v2.createIncidentType", false);
put("v2.deleteIncident", false);
put("v2.deleteIncidentIntegration", false);
put("v2.deleteIncidentNotificationTemplate", false);
put("v2.deleteIncidentTodo", false);
put("v2.deleteIncidentType", false);
put("v2.getIncident", false);
put("v2.getIncidentIntegration", false);
put("v2.getIncidentNotificationTemplate", false);
put("v2.getIncidentTodo", false);
put("v2.getIncidentType", false);
put("v2.listIncidentAttachments", false);
put("v2.listIncidentIntegrations", false);
put("v2.listIncidentNotificationTemplates", false);
put("v2.listIncidents", false);
put("v2.listIncidentTodos", false);
put("v2.listIncidentTypes", false);
put("v2.searchIncidents", false);
put("v2.updateIncident", false);
put("v2.updateIncidentAttachments", false);
put("v2.updateIncidentIntegration", false);
put("v2.updateIncidentNotificationTemplate", false);
put("v2.updateIncidentTodo", false);
put("v2.updateIncidentType", false);
put("v2.createAWSAccount", false);
Expand Down
Loading