From 4ee31d8046544ed5efbf34ee6bf4a09d5f686180 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 26 Jan 2026 10:33:08 +0000 Subject: [PATCH] Regenerate client from commit 15dbc5e of spec repo --- .generator/schemas/v2/openapi.yaml | 258 ++++++ .../incidents/CreateIncidentConfigRule.java | 36 + .../incidents/DeleteIncidentConfigRule.java | 23 + .../v2/incidents/GetIncidentConfigRule.java | 26 + .../v2/incidents/ListIncidentConfigRules.java | 25 + .../incidents/UpdateIncidentConfigRule.java | 37 + .../com/datadog/api/client/ApiClient.java | 5 + .../api/client/v2/api/IncidentsApi.java | 809 +++++++++++++++++- .../model/IncidentRuleAttributesRequest.java | 144 ++++ .../model/IncidentRuleAttributesResponse.java | 204 +++++ .../v2/model/IncidentRuleDataRequest.java | 181 ++++ .../v2/model/IncidentRuleDataResponse.java | 209 +++++ .../client/v2/model/IncidentRuleRequest.java | 145 ++++ .../client/v2/model/IncidentRuleResponse.java | 145 ++++ .../api/client/v2/model/IncidentRuleType.java | 54 ++ .../v2/model/IncidentRulesResponse.java | 155 ++++ .../api/client/v2/api/incidents.feature | 105 +++ .../com/datadog/api/client/v2/api/undo.json | 37 + 18 files changed, 2572 insertions(+), 26 deletions(-) create mode 100644 examples/v2/incidents/CreateIncidentConfigRule.java create mode 100644 examples/v2/incidents/DeleteIncidentConfigRule.java create mode 100644 examples/v2/incidents/GetIncidentConfigRule.java create mode 100644 examples/v2/incidents/ListIncidentConfigRules.java create mode 100644 examples/v2/incidents/UpdateIncidentConfigRule.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRuleRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRuleResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRuleType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentRulesResponse.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 70523726660..74bf0b38616 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -29120,6 +29120,92 @@ components: user_defined_fields: $ref: '#/components/schemas/RelationshipToIncidentUserDefinedFields' type: object + IncidentRuleAttributesRequest: + properties: + name: + description: The name of the rule + example: High Severity Rule + type: string + required: + - name + type: object + IncidentRuleAttributesResponse: + properties: + createdAt: + description: When the rule was created + example: '2026-01-13T17:15:53.208340Z' + format: date-time + type: string + modifiedAt: + description: When the rule was last modified + example: '2026-01-13T17:15:53.208340Z' + format: date-time + type: string + name: + description: The name of the rule + example: High Severity Rule + type: string + required: + - name + - createdAt + - modifiedAt + type: object + IncidentRuleDataRequest: + properties: + attributes: + $ref: '#/components/schemas/IncidentRuleAttributesRequest' + type: + $ref: '#/components/schemas/IncidentRuleType' + required: + - type + - attributes + type: object + IncidentRuleDataResponse: + properties: + attributes: + $ref: '#/components/schemas/IncidentRuleAttributesResponse' + id: + description: The ID of the rule + example: 612e0c88-9137-4bd2-8de4-9356867d4c6a + type: string + type: + $ref: '#/components/schemas/IncidentRuleType' + required: + - id + - type + - attributes + type: object + IncidentRuleRequest: + properties: + data: + $ref: '#/components/schemas/IncidentRuleDataRequest' + required: + - data + type: object + IncidentRuleResponse: + properties: + data: + $ref: '#/components/schemas/IncidentRuleDataResponse' + required: + - data + type: object + IncidentRuleType: + description: Incident rule resource type + enum: + - incident_rule + example: incident_rule + type: string + x-enum-varnames: + - INCIDENT_RULE + IncidentRulesResponse: + properties: + data: + items: + $ref: '#/components/schemas/IncidentRuleDataResponse' + type: array + required: + - data + type: object IncidentSearchResponse: description: Response with incidents and facets. properties: @@ -75865,6 +75951,178 @@ paths: - incident_notification_settings_write x-unstable: '**Note**: This endpoint is in Preview. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/config/rules: + get: + description: Retrieve a list of all incident rules for the organization. + operationId: ListIncidentConfigRules + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentRulesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List incident rules + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new incident rule for the organization. + operationId: CreateIncidentConfigRule + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentRuleRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentRuleResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create incident rule + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/config/rules/{rule_id}: + delete: + description: Delete an incident rule. + operationId: DeleteIncidentConfigRule + parameters: + - description: The ID of the incident rule + in: path + name: rule_id + required: true + schema: + example: 612e0c88-9137-4bd2-8de4-9356867d4c6a + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete incident rule + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Retrieve details of a specific incident rule. + operationId: GetIncidentConfigRule + parameters: + - description: The ID of the incident rule + in: path + name: rule_id + required: true + schema: + example: 612e0c88-9137-4bd2-8de4-9356867d4c6a + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentRuleResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get incident rule + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Update an existing incident rule. + operationId: UpdateIncidentConfigRule + parameters: + - description: The ID of the incident rule + in: path + name: rule_id + required: true + schema: + example: 612e0c88-9137-4bd2-8de4-9356867d4c6a + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentRuleRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentRuleResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update incident rule + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/config/types: get: diff --git a/examples/v2/incidents/CreateIncidentConfigRule.java b/examples/v2/incidents/CreateIncidentConfigRule.java new file mode 100644 index 00000000000..bc71f993fbb --- /dev/null +++ b/examples/v2/incidents/CreateIncidentConfigRule.java @@ -0,0 +1,36 @@ +// Create incident rule 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.IncidentRuleAttributesRequest; +import com.datadog.api.client.v2.model.IncidentRuleDataRequest; +import com.datadog.api.client.v2.model.IncidentRuleRequest; +import com.datadog.api.client.v2.model.IncidentRuleResponse; +import com.datadog.api.client.v2.model.IncidentRuleType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createIncidentConfigRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + IncidentRuleRequest body = + new IncidentRuleRequest() + .data( + new IncidentRuleDataRequest() + .attributes(new IncidentRuleAttributesRequest().name("High Severity Rule")) + .type(IncidentRuleType.INCIDENT_RULE)); + + try { + IncidentRuleResponse result = apiInstance.createIncidentConfigRule(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#createIncidentConfigRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/DeleteIncidentConfigRule.java b/examples/v2/incidents/DeleteIncidentConfigRule.java new file mode 100644 index 00000000000..c2f8d5cb783 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentConfigRule.java @@ -0,0 +1,23 @@ +// Delete incident rule returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteIncidentConfigRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + apiInstance.deleteIncidentConfigRule("612e0c88-9137-4bd2-8de4-9356867d4c6a"); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#deleteIncidentConfigRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/GetIncidentConfigRule.java b/examples/v2/incidents/GetIncidentConfigRule.java new file mode 100644 index 00000000000..90b15489f79 --- /dev/null +++ b/examples/v2/incidents/GetIncidentConfigRule.java @@ -0,0 +1,26 @@ +// Get incident rule 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.IncidentRuleResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getIncidentConfigRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + IncidentRuleResponse result = + apiInstance.getIncidentConfigRule("612e0c88-9137-4bd2-8de4-9356867d4c6a"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#getIncidentConfigRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/ListIncidentConfigRules.java b/examples/v2/incidents/ListIncidentConfigRules.java new file mode 100644 index 00000000000..c7bcbe92ab8 --- /dev/null +++ b/examples/v2/incidents/ListIncidentConfigRules.java @@ -0,0 +1,25 @@ +// List incident rules 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.IncidentRulesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listIncidentConfigRules", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + IncidentRulesResponse result = apiInstance.listIncidentConfigRules(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#listIncidentConfigRules"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/UpdateIncidentConfigRule.java b/examples/v2/incidents/UpdateIncidentConfigRule.java new file mode 100644 index 00000000000..2aa6f4d4ab1 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentConfigRule.java @@ -0,0 +1,37 @@ +// Update incident rule 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.IncidentRuleAttributesRequest; +import com.datadog.api.client.v2.model.IncidentRuleDataRequest; +import com.datadog.api.client.v2.model.IncidentRuleRequest; +import com.datadog.api.client.v2.model.IncidentRuleResponse; +import com.datadog.api.client.v2.model.IncidentRuleType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateIncidentConfigRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + IncidentRuleRequest body = + new IncidentRuleRequest() + .data( + new IncidentRuleDataRequest() + .attributes(new IncidentRuleAttributesRequest().name("High Severity Rule")) + .type(IncidentRuleType.INCIDENT_RULE)); + + try { + IncidentRuleResponse result = + apiInstance.updateIncidentConfigRule("612e0c88-9137-4bd2-8de4-9356867d4c6a", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#updateIncidentConfigRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index e18ff8356b4..3534aee52e5 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -816,6 +816,7 @@ public class ApiClient { put("v2.createGlobalIncidentHandle", false); put("v2.createIncident", false); put("v2.createIncidentAttachment", false); + put("v2.createIncidentConfigRule", false); put("v2.createIncidentIntegration", false); put("v2.createIncidentNotificationRule", false); put("v2.createIncidentNotificationTemplate", false); @@ -825,6 +826,7 @@ public class ApiClient { put("v2.deleteGlobalIncidentHandle", false); put("v2.deleteIncident", false); put("v2.deleteIncidentAttachment", false); + put("v2.deleteIncidentConfigRule", false); put("v2.deleteIncidentIntegration", false); put("v2.deleteIncidentNotificationRule", false); put("v2.deleteIncidentNotificationTemplate", false); @@ -832,6 +834,7 @@ public class ApiClient { put("v2.deleteIncidentType", false); put("v2.getGlobalIncidentSettings", false); put("v2.getIncident", false); + put("v2.getIncidentConfigRule", false); put("v2.getIncidentIntegration", false); put("v2.getIncidentNotificationRule", false); put("v2.getIncidentNotificationTemplate", false); @@ -839,6 +842,7 @@ public class ApiClient { put("v2.getIncidentType", false); put("v2.listGlobalIncidentHandles", false); put("v2.listIncidentAttachments", false); + put("v2.listIncidentConfigRules", false); put("v2.listIncidentIntegrations", false); put("v2.listIncidentNotificationRules", false); put("v2.listIncidentNotificationTemplates", false); @@ -850,6 +854,7 @@ public class ApiClient { put("v2.updateGlobalIncidentSettings", false); put("v2.updateIncident", false); put("v2.updateIncidentAttachment", false); + put("v2.updateIncidentConfigRule", false); put("v2.updateIncidentIntegration", false); put("v2.updateIncidentNotificationRule", false); put("v2.updateIncidentNotificationTemplate", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java index 75952e5c7cc..879a87b19c4 100644 --- a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java @@ -31,6 +31,9 @@ import com.datadog.api.client.v2.model.IncidentRelatedObject; import com.datadog.api.client.v2.model.IncidentResponse; import com.datadog.api.client.v2.model.IncidentResponseData; +import com.datadog.api.client.v2.model.IncidentRuleRequest; +import com.datadog.api.client.v2.model.IncidentRuleResponse; +import com.datadog.api.client.v2.model.IncidentRulesResponse; import com.datadog.api.client.v2.model.IncidentSearchResponse; import com.datadog.api.client.v2.model.IncidentSearchResponseIncidentsData; import com.datadog.api.client.v2.model.IncidentSearchSortOrder; @@ -706,6 +709,155 @@ public CompletableFuture> createIncidentAttachmentWithHt new GenericType() {}); } + /** + * Create incident rule. + * + *

See {@link #createIncidentConfigRuleWithHttpInfo}. + * + * @param body (required) + * @return IncidentRuleResponse + * @throws ApiException if fails to make API call + */ + public IncidentRuleResponse createIncidentConfigRule(IncidentRuleRequest body) + throws ApiException { + return createIncidentConfigRuleWithHttpInfo(body).getData(); + } + + /** + * Create incident rule. + * + *

See {@link #createIncidentConfigRuleWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<IncidentRuleResponse> + */ + public CompletableFuture createIncidentConfigRuleAsync( + IncidentRuleRequest body) { + return createIncidentConfigRuleWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new incident rule for the organization. + * + * @param body (required) + * @return ApiResponse<IncidentRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse createIncidentConfigRuleWithHttpInfo( + IncidentRuleRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createIncidentConfigRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createIncidentConfigRule"); + } + // create path and map variables + String localVarPath = "/api/v2/incidents/config/rules"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentConfigRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create incident rule. + * + *

See {@link #createIncidentConfigRuleWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<IncidentRuleResponse>> + */ + public CompletableFuture> + createIncidentConfigRuleWithHttpInfoAsync(IncidentRuleRequest body) { + // Check if unstable operation is enabled + String operationId = "createIncidentConfigRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createIncidentConfigRule")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/incidents/config/rules"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentConfigRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to createIncidentImpact. */ public static class CreateIncidentImpactOptionalParameters { private List include; @@ -2410,6 +2562,157 @@ public CompletableFuture> deleteIncidentAttachmentWithHttpInfo null); } + /** + * Delete incident rule. + * + *

See {@link #deleteIncidentConfigRuleWithHttpInfo}. + * + * @param ruleId The ID of the incident rule (required) + * @throws ApiException if fails to make API call + */ + public void deleteIncidentConfigRule(String ruleId) throws ApiException { + deleteIncidentConfigRuleWithHttpInfo(ruleId); + } + + /** + * Delete incident rule. + * + *

See {@link #deleteIncidentConfigRuleWithHttpInfoAsync}. + * + * @param ruleId The ID of the incident rule (required) + * @return CompletableFuture + */ + public CompletableFuture deleteIncidentConfigRuleAsync(String ruleId) { + return deleteIncidentConfigRuleWithHttpInfoAsync(ruleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an incident rule. + * + * @param ruleId The ID of the incident rule (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteIncidentConfigRuleWithHttpInfo(String ruleId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteIncidentConfigRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleId' when calling deleteIncidentConfigRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/rules/{rule_id}" + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentConfigRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete incident rule. + * + *

See {@link #deleteIncidentConfigRuleWithHttpInfo}. + * + * @param ruleId The ID of the incident rule (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteIncidentConfigRuleWithHttpInfoAsync( + String ruleId) { + // Check if unstable operation is enabled + String operationId = "deleteIncidentConfigRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleId' when calling deleteIncidentConfigRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/rules/{rule_id}" + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentConfigRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Delete an incident impact. * @@ -3801,65 +4104,217 @@ public ApiResponse getIncidentWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); + } + + /** + * Get the details of an incident. + * + *

See {@link #getIncidentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentResponse>> + */ + public CompletableFuture> getIncidentWithHttpInfoAsync( + String incidentId, GetIncidentOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getIncident"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'incidentId' when calling getIncident")); + return result; + } + List include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.getIncident", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get incident rule. + * + *

See {@link #getIncidentConfigRuleWithHttpInfo}. + * + * @param ruleId The ID of the incident rule (required) + * @return IncidentRuleResponse + * @throws ApiException if fails to make API call + */ + public IncidentRuleResponse getIncidentConfigRule(String ruleId) throws ApiException { + return getIncidentConfigRuleWithHttpInfo(ruleId).getData(); + } + + /** + * Get incident rule. + * + *

See {@link #getIncidentConfigRuleWithHttpInfoAsync}. + * + * @param ruleId The ID of the incident rule (required) + * @return CompletableFuture<IncidentRuleResponse> + */ + public CompletableFuture getIncidentConfigRuleAsync(String ruleId) { + return getIncidentConfigRuleWithHttpInfoAsync(ruleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve details of a specific incident rule. + * + * @param ruleId The ID of the incident rule (required) + * @return ApiResponse<IncidentRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getIncidentConfigRuleWithHttpInfo(String ruleId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getIncidentConfigRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleId' when calling getIncidentConfigRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/rules/{rule_id}" + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.getIncidentConfigRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); } /** - * Get the details of an incident. + * Get incident rule. * - *

See {@link #getIncidentWithHttpInfo}. + *

See {@link #getIncidentConfigRuleWithHttpInfo}. * - * @param incidentId The UUID of the incident. (required) - * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<IncidentResponse>> + * @param ruleId The ID of the incident rule (required) + * @return CompletableFuture<ApiResponse<IncidentRuleResponse>> */ - public CompletableFuture> getIncidentWithHttpInfoAsync( - String incidentId, GetIncidentOptionalParameters parameters) { + public CompletableFuture> + getIncidentConfigRuleWithHttpInfoAsync(String ruleId) { // Check if unstable operation is enabled - String operationId = "getIncident"; + String operationId = "getIncidentConfigRule"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } Object localVarPostBody = null; - // verify the required parameter 'incidentId' is set - if (incidentId == null) { - CompletableFuture> result = new CompletableFuture<>(); + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, "Missing the required parameter 'incidentId' when calling getIncident")); + 400, "Missing the required parameter 'ruleId' when calling getIncidentConfigRule")); return result; } - List include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/{incident_id}" - .replaceAll( - "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + "/api/v2/incidents/config/rules/{rule_id}" + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); - List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "include", include)); - Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.IncidentsApi.getIncident", + "v2.IncidentsApi.getIncidentConfigRule", localVarPath, - localVarQueryParams, + new ArrayList(), localVarHeaderParams, new HashMap(), new String[] {"application/json"}, - new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -3871,7 +4326,7 @@ public CompletableFuture> getIncidentWithHttpInfoA localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** @@ -5272,6 +5727,134 @@ public CompletableFuture> listIncidentAttachmentsWi new GenericType() {}); } + /** + * List incident rules. + * + *

See {@link #listIncidentConfigRulesWithHttpInfo}. + * + * @return IncidentRulesResponse + * @throws ApiException if fails to make API call + */ + public IncidentRulesResponse listIncidentConfigRules() throws ApiException { + return listIncidentConfigRulesWithHttpInfo().getData(); + } + + /** + * List incident rules. + * + *

See {@link #listIncidentConfigRulesWithHttpInfoAsync}. + * + * @return CompletableFuture<IncidentRulesResponse> + */ + public CompletableFuture listIncidentConfigRulesAsync() { + return listIncidentConfigRulesWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a list of all incident rules for the organization. + * + * @return ApiResponse<IncidentRulesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse listIncidentConfigRulesWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listIncidentConfigRules"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/incidents/config/rules"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.listIncidentConfigRules", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List incident rules. + * + *

See {@link #listIncidentConfigRulesWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<IncidentRulesResponse>> + */ + public CompletableFuture> + listIncidentConfigRulesWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listIncidentConfigRules"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + // create path and map variables + String localVarPath = "/api/v2/incidents/config/rules"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.listIncidentConfigRules", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to listIncidentImpacts. */ public static class ListIncidentImpactsOptionalParameters { private List include; @@ -7907,6 +8490,180 @@ public CompletableFuture> updateIncidentAttachmentWithHt new GenericType() {}); } + /** + * Update incident rule. + * + *

See {@link #updateIncidentConfigRuleWithHttpInfo}. + * + * @param ruleId The ID of the incident rule (required) + * @param body (required) + * @return IncidentRuleResponse + * @throws ApiException if fails to make API call + */ + public IncidentRuleResponse updateIncidentConfigRule(String ruleId, IncidentRuleRequest body) + throws ApiException { + return updateIncidentConfigRuleWithHttpInfo(ruleId, body).getData(); + } + + /** + * Update incident rule. + * + *

See {@link #updateIncidentConfigRuleWithHttpInfoAsync}. + * + * @param ruleId The ID of the incident rule (required) + * @param body (required) + * @return CompletableFuture<IncidentRuleResponse> + */ + public CompletableFuture updateIncidentConfigRuleAsync( + String ruleId, IncidentRuleRequest body) { + return updateIncidentConfigRuleWithHttpInfoAsync(ruleId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an existing incident rule. + * + * @param ruleId The ID of the incident rule (required) + * @param body (required) + * @return ApiResponse<IncidentRuleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateIncidentConfigRuleWithHttpInfo( + String ruleId, IncidentRuleRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateIncidentConfigRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + throw new ApiException( + 400, "Missing the required parameter 'ruleId' when calling updateIncidentConfigRule"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateIncidentConfigRule"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/rules/{rule_id}" + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.updateIncidentConfigRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update incident rule. + * + *

See {@link #updateIncidentConfigRuleWithHttpInfo}. + * + * @param ruleId The ID of the incident rule (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<IncidentRuleResponse>> + */ + public CompletableFuture> + updateIncidentConfigRuleWithHttpInfoAsync(String ruleId, IncidentRuleRequest body) { + // Check if unstable operation is enabled + String operationId = "updateIncidentConfigRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'ruleId' is set + if (ruleId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'ruleId' when calling updateIncidentConfigRule")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateIncidentConfigRule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/rules/{rule_id}" + .replaceAll("\\{" + "rule_id" + "\\}", apiClient.escapeString(ruleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.updateIncidentConfigRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Update an existing incident integration metadata. * diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesRequest.java new file mode 100644 index 00000000000..682c6e76bb7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesRequest.java @@ -0,0 +1,144 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({IncidentRuleAttributesRequest.JSON_PROPERTY_NAME}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentRuleAttributesRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public IncidentRuleAttributesRequest() {} + + @JsonCreator + public IncidentRuleAttributesRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public IncidentRuleAttributesRequest name(String name) { + this.name = name; + return this; + } + + /** + * The name of the rule + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentRuleAttributesRequest + */ + @JsonAnySetter + public IncidentRuleAttributesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentRuleAttributesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentRuleAttributesRequest incidentRuleAttributesRequest = (IncidentRuleAttributesRequest) o; + return Objects.equals(this.name, incidentRuleAttributesRequest.name) + && Objects.equals( + this.additionalProperties, incidentRuleAttributesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentRuleAttributesRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesResponse.java new file mode 100644 index 00000000000..0322a20f56f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleAttributesResponse.java @@ -0,0 +1,204 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + IncidentRuleAttributesResponse.JSON_PROPERTY_CREATED_AT, + IncidentRuleAttributesResponse.JSON_PROPERTY_MODIFIED_AT, + IncidentRuleAttributesResponse.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentRuleAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modifiedAt"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public IncidentRuleAttributesResponse() {} + + @JsonCreator + public IncidentRuleAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.createdAt = createdAt; + this.modifiedAt = modifiedAt; + this.name = name; + } + + public IncidentRuleAttributesResponse createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When the rule was created + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public IncidentRuleAttributesResponse modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * When the rule was last modified + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public IncidentRuleAttributesResponse name(String name) { + this.name = name; + return this; + } + + /** + * The name of the rule + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentRuleAttributesResponse + */ + @JsonAnySetter + public IncidentRuleAttributesResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentRuleAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentRuleAttributesResponse incidentRuleAttributesResponse = + (IncidentRuleAttributesResponse) o; + return Objects.equals(this.createdAt, incidentRuleAttributesResponse.createdAt) + && Objects.equals(this.modifiedAt, incidentRuleAttributesResponse.modifiedAt) + && Objects.equals(this.name, incidentRuleAttributesResponse.name) + && Objects.equals( + this.additionalProperties, incidentRuleAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, modifiedAt, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentRuleAttributesResponse {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataRequest.java new file mode 100644 index 00000000000..3d01e73af2b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataRequest.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + IncidentRuleDataRequest.JSON_PROPERTY_ATTRIBUTES, + IncidentRuleDataRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentRuleDataRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentRuleAttributesRequest attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentRuleType type; + + public IncidentRuleDataRequest() {} + + @JsonCreator + public IncidentRuleDataRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentRuleAttributesRequest attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentRuleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentRuleDataRequest attributes(IncidentRuleAttributesRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentRuleAttributesRequest getAttributes() { + return attributes; + } + + public void setAttributes(IncidentRuleAttributesRequest attributes) { + this.attributes = attributes; + } + + public IncidentRuleDataRequest type(IncidentRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident rule resource type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentRuleType getType() { + return type; + } + + public void setType(IncidentRuleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentRuleDataRequest + */ + @JsonAnySetter + public IncidentRuleDataRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentRuleDataRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentRuleDataRequest incidentRuleDataRequest = (IncidentRuleDataRequest) o; + return Objects.equals(this.attributes, incidentRuleDataRequest.attributes) + && Objects.equals(this.type, incidentRuleDataRequest.type) + && Objects.equals(this.additionalProperties, incidentRuleDataRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentRuleDataRequest {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataResponse.java new file mode 100644 index 00000000000..478efe53057 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleDataResponse.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({ + IncidentRuleDataResponse.JSON_PROPERTY_ATTRIBUTES, + IncidentRuleDataResponse.JSON_PROPERTY_ID, + IncidentRuleDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentRuleDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentRuleAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentRuleType type; + + public IncidentRuleDataResponse() {} + + @JsonCreator + public IncidentRuleDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentRuleAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentRuleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentRuleDataResponse attributes(IncidentRuleAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Getattributes + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentRuleAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(IncidentRuleAttributesResponse attributes) { + this.attributes = attributes; + } + + public IncidentRuleDataResponse id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the rule + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public IncidentRuleDataResponse type(IncidentRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident rule resource type + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentRuleType getType() { + return type; + } + + public void setType(IncidentRuleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentRuleDataResponse + */ + @JsonAnySetter + public IncidentRuleDataResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentRuleDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentRuleDataResponse incidentRuleDataResponse = (IncidentRuleDataResponse) o; + return Objects.equals(this.attributes, incidentRuleDataResponse.attributes) + && Objects.equals(this.id, incidentRuleDataResponse.id) + && Objects.equals(this.type, incidentRuleDataResponse.type) + && Objects.equals(this.additionalProperties, incidentRuleDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentRuleDataResponse {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleRequest.java new file mode 100644 index 00000000000..baa4b315d19 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleRequest.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({IncidentRuleRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentRuleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentRuleDataRequest data; + + public IncidentRuleRequest() {} + + @JsonCreator + public IncidentRuleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) IncidentRuleDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentRuleRequest data(IncidentRuleDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentRuleDataRequest getData() { + return data; + } + + public void setData(IncidentRuleDataRequest data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentRuleRequest + */ + @JsonAnySetter + public IncidentRuleRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentRuleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentRuleRequest incidentRuleRequest = (IncidentRuleRequest) o; + return Objects.equals(this.data, incidentRuleRequest.data) + && Objects.equals(this.additionalProperties, incidentRuleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentRuleRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRuleResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleResponse.java new file mode 100644 index 00000000000..e07cb1a3b31 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleResponse.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({IncidentRuleResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentRuleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentRuleDataResponse data; + + public IncidentRuleResponse() {} + + @JsonCreator + public IncidentRuleResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) IncidentRuleDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentRuleResponse data(IncidentRuleDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentRuleDataResponse getData() { + return data; + } + + public void setData(IncidentRuleDataResponse data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentRuleResponse + */ + @JsonAnySetter + public IncidentRuleResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentRuleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentRuleResponse incidentRuleResponse = (IncidentRuleResponse) o; + return Objects.equals(this.data, incidentRuleResponse.data) + && Objects.equals(this.additionalProperties, incidentRuleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentRuleResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRuleType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleType.java new file mode 100644 index 00000000000..0bac13d7b4f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRuleType.java @@ -0,0 +1,54 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Incident rule resource type */ +@JsonSerialize(using = IncidentRuleType.IncidentRuleTypeSerializer.class) +public class IncidentRuleType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("incident_rule")); + + public static final IncidentRuleType INCIDENT_RULE = new IncidentRuleType("incident_rule"); + + IncidentRuleType(String value) { + super(value, allowedValues); + } + + public static class IncidentRuleTypeSerializer extends StdSerializer { + public IncidentRuleTypeSerializer(Class t) { + super(t); + } + + public IncidentRuleTypeSerializer() { + this(null); + } + + @Override + public void serialize(IncidentRuleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentRuleType fromValue(String value) { + return new IncidentRuleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentRulesResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentRulesResponse.java new file mode 100644 index 00000000000..315ac3b3f6f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentRulesResponse.java @@ -0,0 +1,155 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** */ +@JsonPropertyOrder({IncidentRulesResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentRulesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public IncidentRulesResponse() {} + + @JsonCreator + public IncidentRulesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public IncidentRulesResponse data(List data) { + this.data = data; + for (IncidentRuleDataResponse item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentRulesResponse addDataItem(IncidentRuleDataResponse dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Getdata + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentRulesResponse + */ + @JsonAnySetter + public IncidentRulesResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentRulesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentRulesResponse incidentRulesResponse = (IncidentRulesResponse) o; + return Objects.equals(this.data, incidentRulesResponse.data) + && Objects.equals(this.additionalProperties, incidentRulesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentRulesResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature index db706355841..64c59703a9a 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature @@ -272,6 +272,22 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app + Scenario: Create incident rule returns "Bad Request" response + Given operation "CreateIncidentConfigRule" enabled + And new "CreateIncidentConfigRule" request + And body with value {"data": {"attributes": {"name": "High Severity Rule"}, "type": "incident_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create incident rule returns "Created" response + Given operation "CreateIncidentConfigRule" enabled + And new "CreateIncidentConfigRule" request + And body with value {"data": {"attributes": {"name": "High Severity Rule"}, "type": "incident_rule"}} + When the request is sent + Then the response status is 201 Created + @generated @skip @team:DataDog/incident-app Scenario: Create postmortem attachment returns "Bad Request" response Given operation "CreateIncidentPostmortemAttachment" enabled @@ -537,6 +553,30 @@ Feature: Incidents When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/incident-app + Scenario: Delete incident rule returns "Bad Request" response + Given operation "DeleteIncidentConfigRule" enabled + And new "DeleteIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Delete incident rule returns "No Content" response + Given operation "DeleteIncidentConfigRule" enabled + And new "DeleteIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/incident-app + Scenario: Delete incident rule returns "Not Found" response + Given operation "DeleteIncidentConfigRule" enabled + And new "DeleteIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Get a list of an incident's integration metadata returns "Bad Request" response Given operation "ListIncidentIntegrations" enabled @@ -756,6 +796,30 @@ Feature: Incidents And the response "data" has field "attributes" And the response "data" has field "relationships" + @generated @skip @team:DataDog/incident-app + Scenario: Get incident rule returns "Bad Request" response + Given operation "GetIncidentConfigRule" enabled + And new "GetIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Get incident rule returns "Not Found" response + Given operation "GetIncidentConfigRule" enabled + And new "GetIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Get incident rule returns "OK" response + Given operation "GetIncidentConfigRule" enabled + And new "GetIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app Scenario: Get incident todo details returns "Bad Request" response Given operation "GetIncidentTodo" enabled @@ -940,6 +1004,20 @@ Feature: Incidents Then the response status is 200 OK And the response "data" has length 0 + @generated @skip @team:DataDog/incident-app + Scenario: List incident rules returns "Bad Request" response + Given operation "ListIncidentConfigRules" enabled + And new "ListIncidentConfigRules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: List incident rules returns "OK" response + Given operation "ListIncidentConfigRules" enabled + And new "ListIncidentConfigRules" request + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Remove commander from an incident returns "OK" response Given operation "UpdateIncident" enabled @@ -1270,3 +1348,30 @@ Feature: Incidents And the response "data.id" has the same value as "notification_template.data.id" And the response "data.attributes.name" has the same value as "unique" And the response "data.attributes.category" is equal to "update" + + @generated @skip @team:DataDog/incident-app + Scenario: Update incident rule returns "Bad Request" response + Given operation "UpdateIncidentConfigRule" enabled + And new "UpdateIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "High Severity Rule"}, "type": "incident_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update incident rule returns "Not Found" response + Given operation "UpdateIncidentConfigRule" enabled + And new "UpdateIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "High Severity Rule"}, "type": "incident_rule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Update incident rule returns "OK" response + Given operation "UpdateIncidentConfigRule" enabled + And new "UpdateIncidentConfigRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"name": "High Severity Rule"}, "type": "incident_rule"}} + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 5a347bddf11..bae2754c7e8 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -1714,6 +1714,43 @@ "type": "idempotent" } }, + "ListIncidentConfigRules": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentConfigRule": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentConfigRule", + "parameters": [ + { + "name": "rule_id", + "source": "" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentConfigRule": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentConfigRule": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentConfigRule": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListIncidentTypes": { "tag": "Incidents", "undo": {