From 0b14d1f8e3de49d6dfc02e82bf0fdaf8c8b2ec30 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 17 Sep 2025 17:23:45 +0000 Subject: [PATCH] Regenerate client from commit 9a71e9d of spec repo --- .generator/schemas/v2/openapi.yaml | 341 +++++++++ .../v2/incidents/CreateIncidentImpact.java | 44 ++ .../v2/incidents/DeleteIncidentImpact.java | 29 + .../v2/incidents/ListIncidentImpacts.java | 28 + .../com/datadog/api/client/ApiClient.java | 3 + .../api/client/v2/api/IncidentsApi.java | 655 ++++++++++++++++++ .../v2/model/IncidentImpactAttributes.java | 325 +++++++++ .../model/IncidentImpactCreateAttributes.java | 263 +++++++ .../v2/model/IncidentImpactCreateData.java | 181 +++++ .../v2/model/IncidentImpactCreateRequest.java | 146 ++++ .../v2/model/IncidentImpactRelatedObject.java | 61 ++ .../v2/model/IncidentImpactRelationships.java | 195 ++++++ .../v2/model/IncidentImpactResponse.java | 166 +++++ .../v2/model/IncidentImpactResponseData.java | 235 +++++++ .../client/v2/model/IncidentImpactType.java | 55 ++ .../v2/model/IncidentImpactsResponse.java | 175 +++++ .../v2/model/IncidentResponseAttributes.java | 96 +++ .../model/IncidentResponseRelationships.java | 29 + .../v2/model/RelationshipToIncident.java | 145 ++++ .../v2/model/RelationshipToIncidentData.java | 179 +++++ ...impact_returns_Bad_Request_response.freeze | 1 + ...t_impact_returns_Bad_Request_response.json | 32 + ...ent_impact_returns_CREATED_response.freeze | 1 + ...ident_impact_returns_CREATED_response.json | 108 +++ ...t_impact_returns_Not_Found_response.freeze | 1 + ...ent_impact_returns_Not_Found_response.json | 32 + ..._impact_returns_No_Content_response.freeze | 1 + ...nt_impact_returns_No_Content_response.json | 134 ++++ ...t_impact_returns_Not_Found_response.freeze | 1 + ...ent_impact_returns_Not_Found_response.json | 28 + ...und_response_different_invalid_IDs_.freeze | 1 + ...Found_response_different_invalid_IDs_.json | 28 + ...sponse_invalid_incident_and_impact_.freeze | 1 + ...response_invalid_incident_and_impact_.json | 28 + ...ident_s_impacts_returns_OK_response.freeze | 1 + ...ncident_s_impacts_returns_OK_response.json | 83 +++ .../com/datadog/api/client/v2/api/given.json | 16 + .../api/client/v2/api/incidents.feature | 75 ++ .../com/datadog/api/client/v2/api/undo.json | 29 + 39 files changed, 3952 insertions(+) create mode 100644 examples/v2/incidents/CreateIncidentImpact.java create mode 100644 examples/v2/incidents/DeleteIncidentImpact.java create mode 100644 examples/v2/incidents/ListIncidentImpacts.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactRelatedObject.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactRelationships.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentImpactsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RelationshipToIncident.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentData.java create mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.json create mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.json create mode 100644 src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 42b12a3fb05..4ed0b352040 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -467,6 +467,23 @@ components: required: true schema: type: string + IncidentImpactIDPathParameter: + description: The UUID of the incident impact. + in: path + name: impact_id + required: true + schema: + type: string + IncidentImpactIncludeQueryParameter: + description: Specifies which related resources should be included in the response. + explode: false + in: query + name: include + required: false + schema: + items: + $ref: '#/components/schemas/IncidentImpactRelatedObject' + type: array IncidentIncludeQueryParameter: description: Specifies which types of related objects should be included in the response. @@ -20120,6 +20137,177 @@ components: - TEXTARRAY - METRICTAG - AUTOCOMPLETE + IncidentImpactAttributes: + description: The incident impact's attributes. + properties: + created: + description: Timestamp when the impact was created. + example: '2025-08-29T13:17:00Z' + format: date-time + readOnly: true + type: string + description: + description: Description of the impact. + example: Service was unavailable for external users + type: string + end_at: + description: Timestamp when the impact ended. + example: '2025-08-29T13:17:00Z' + format: date-time + nullable: true + type: string + fields: + $ref: '#/components/schemas/IncidentImpactFieldsObject' + impact_type: + description: The type of impact. + example: customer + type: string + modified: + description: Timestamp when the impact was last modified. + example: '2025-08-29T13:17:00Z' + format: date-time + readOnly: true + type: string + start_at: + description: Timestamp representing when the impact started. + example: '2025-08-28T13:17:00Z' + format: date-time + type: string + required: + - description + - start_at + type: object + IncidentImpactCreateAttributes: + description: The incident impact's attributes for a create request. + properties: + description: + description: Description of the impact. + example: Service was unavailable for external users + type: string + end_at: + description: Timestamp when the impact ended. + example: '2025-08-29T13:17:00Z' + format: date-time + nullable: true + type: string + fields: + $ref: '#/components/schemas/IncidentImpactFieldsObject' + start_at: + description: Timestamp when the impact started. + example: '2025-08-28T13:17:00Z' + format: date-time + type: string + required: + - description + - start_at + type: object + IncidentImpactCreateData: + description: Incident impact data for a create request. + properties: + attributes: + $ref: '#/components/schemas/IncidentImpactCreateAttributes' + type: + $ref: '#/components/schemas/IncidentImpactType' + required: + - type + - attributes + type: object + IncidentImpactCreateRequest: + description: Create request for an incident impact. + properties: + data: + $ref: '#/components/schemas/IncidentImpactCreateData' + required: + - data + type: object + IncidentImpactFieldsObject: + additionalProperties: {} + description: An object mapping impact field names to field values. + example: + customers_impacted: all + products_impacted: + - shopping + - marketing + nullable: true + type: object + IncidentImpactRelatedObject: + description: A reference to a resource related to an incident impact. + enum: + - incident + - created_by_user + - last_modified_by_user + type: string + x-enum-varnames: + - INCIDENT + - CREATED_BY_USER + - LAST_MODIFIED_BY_USER + IncidentImpactRelationships: + description: The incident impact's resource relationships. + properties: + created_by_user: + $ref: '#/components/schemas/RelationshipToUser' + incident: + $ref: '#/components/schemas/RelationshipToIncident' + last_modified_by_user: + $ref: '#/components/schemas/RelationshipToUser' + type: object + IncidentImpactResponse: + description: Response with an incident impact. + properties: + data: + $ref: '#/components/schemas/IncidentImpactResponseData' + included: + description: Included related resources that the user requested. + items: + $ref: '#/components/schemas/IncidentUserData' + readOnly: true + type: array + required: + - data + type: object + IncidentImpactResponseData: + description: Incident impact data from a response. + properties: + attributes: + $ref: '#/components/schemas/IncidentImpactAttributes' + id: + description: The incident impact's ID. + example: 00000000-0000-0000-1234-000000000000 + type: string + relationships: + $ref: '#/components/schemas/IncidentImpactRelationships' + type: + $ref: '#/components/schemas/IncidentImpactType' + required: + - id + - type + type: object + IncidentImpactType: + default: incident_impacts + description: Incident impact resource type. + enum: + - incident_impacts + example: incident_impacts + type: string + x-enum-varnames: + - INCIDENT_IMPACTS + IncidentImpactsResponse: + description: Response with a list of incident impacts. + properties: + data: + description: An array of incident impacts. + items: + $ref: '#/components/schemas/IncidentImpactResponseData' + type: array + included: + description: Included related resources that the user requested. + items: + $ref: '#/components/schemas/IncidentUserData' + readOnly: true + type: array + required: + - data + type: object IncidentImpactsType: description: The incident impacts type. enum: @@ -20897,6 +21085,7 @@ components: - data type: object IncidentResponseAttributes: + additionalProperties: {} description: The incident's attributes from a response. properties: archived: @@ -20941,6 +21130,17 @@ components: description: A flag indicating whether the incident caused customer impact. example: false type: boolean + declared: + description: Timestamp when the incident was declared. + format: date-time + readOnly: true + type: string + declared_by: + $ref: '#/components/schemas/IncidentNonDatadogCreator' + declared_by_uuid: + description: UUID of the user who declared the incident. + nullable: true + type: string detected: description: Timestamp when the incident was detected. format: date-time @@ -21096,6 +21296,8 @@ components: $ref: '#/components/schemas/NullableRelationshipToUser' created_by_user: $ref: '#/components/schemas/RelationshipToUser' + declared_by_user: + $ref: '#/components/schemas/RelationshipToUser' impacts: $ref: '#/components/schemas/RelationshipToIncidentImpacts' integrations: @@ -35408,6 +35610,14 @@ components: description: Relationship type. type: string type: object + RelationshipToIncident: + description: Relationship to incident. + properties: + data: + $ref: '#/components/schemas/RelationshipToIncidentData' + required: + - data + type: object RelationshipToIncidentAttachment: description: A relationship reference for attachments. properties: @@ -35432,6 +35642,19 @@ components: - id - type type: object + RelationshipToIncidentData: + description: Relationship to incident object. + properties: + id: + description: A unique identifier that represents the incident. + example: 00000000-0000-0000-1234-000000000000 + type: string + type: + $ref: '#/components/schemas/IncidentType' + required: + - id + - type + type: object RelationshipToIncidentImpactData: description: Relationship to impact object. properties: @@ -56351,6 +56574,124 @@ paths: - incident_write x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/impacts: + get: + description: Get all impacts for an incident. + operationId: ListIncidentImpacts + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentImpactIncludeQueryParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentImpactsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: List an incident's impacts + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_read + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create an impact for an incident. + operationId: CreateIncidentImpact + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentImpactIncludeQueryParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentImpactCreateRequest' + description: Incident impact payload. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentImpactResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create an incident impact + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_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/{incident_id}/impacts/{impact_id}: + delete: + description: Delete an incident impact. + operationId: DeleteIncidentImpact + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentImpactIDPathParameter' + responses: + '204': + description: No Content + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Delete an incident impact + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_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/{incident_id}/relationships/integrations: get: diff --git a/examples/v2/incidents/CreateIncidentImpact.java b/examples/v2/incidents/CreateIncidentImpact.java new file mode 100644 index 00000000000..2e894d07b8b --- /dev/null +++ b/examples/v2/incidents/CreateIncidentImpact.java @@ -0,0 +1,44 @@ +// Create an incident impact 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.IncidentImpactCreateAttributes; +import com.datadog.api.client.v2.model.IncidentImpactCreateData; +import com.datadog.api.client.v2.model.IncidentImpactCreateRequest; +import com.datadog.api.client.v2.model.IncidentImpactResponse; +import com.datadog.api.client.v2.model.IncidentImpactType; +import java.time.OffsetDateTime; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createIncidentImpact", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + // there is a valid "incident" in the system + String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID"); + + IncidentImpactCreateRequest body = + new IncidentImpactCreateRequest() + .data( + new IncidentImpactCreateData() + .type(IncidentImpactType.INCIDENT_IMPACTS) + .attributes( + new IncidentImpactCreateAttributes() + .startAt(OffsetDateTime.parse("2025-09-12T13:50:00.000Z")) + .endAt(OffsetDateTime.parse("2025-09-12T14:50:00.000Z")) + .description("Outage in the us-east-1 region"))); + + try { + IncidentImpactResponse result = apiInstance.createIncidentImpact(INCIDENT_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#createIncidentImpact"); + 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/DeleteIncidentImpact.java b/examples/v2/incidents/DeleteIncidentImpact.java new file mode 100644 index 00000000000..49cb1bb2b8e --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentImpact.java @@ -0,0 +1,29 @@ +// Delete an incident impact 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.deleteIncidentImpact", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + // the "incident" has an "incident_impact" + String INCIDENT_IMPACT_DATA_ID = System.getenv("INCIDENT_IMPACT_DATA_ID"); + String INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID = + System.getenv("INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID"); + + try { + apiInstance.deleteIncidentImpact( + INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID, INCIDENT_IMPACT_DATA_ID); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#deleteIncidentImpact"); + 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/ListIncidentImpacts.java b/examples/v2/incidents/ListIncidentImpacts.java new file mode 100644 index 00000000000..15f6df42a27 --- /dev/null +++ b/examples/v2/incidents/ListIncidentImpacts.java @@ -0,0 +1,28 @@ +// List an incident's impacts 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.IncidentImpactsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listIncidentImpacts", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + // there is a valid "incident" in the system + String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID"); + + try { + IncidentImpactsResponse result = apiInstance.listIncidentImpacts(INCIDENT_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#listIncidentImpacts"); + 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 2991a7bd15a..3ace2e31e0f 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -719,12 +719,14 @@ public class ApiClient { put("v2.createDataDeletionRequest", false); put("v2.getDataDeletionRequests", false); put("v2.createIncident", false); + put("v2.createIncidentImpact", false); put("v2.createIncidentIntegration", false); put("v2.createIncidentNotificationRule", false); put("v2.createIncidentNotificationTemplate", false); put("v2.createIncidentTodo", false); put("v2.createIncidentType", false); put("v2.deleteIncident", false); + put("v2.deleteIncidentImpact", false); put("v2.deleteIncidentIntegration", false); put("v2.deleteIncidentNotificationRule", false); put("v2.deleteIncidentNotificationTemplate", false); @@ -737,6 +739,7 @@ public class ApiClient { put("v2.getIncidentTodo", false); put("v2.getIncidentType", false); put("v2.listIncidentAttachments", false); + put("v2.listIncidentImpacts", false); put("v2.listIncidentIntegrations", false); put("v2.listIncidentNotificationRules", false); put("v2.listIncidentNotificationTemplates", 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 60d9b0eeede..190e750f515 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 @@ -13,6 +13,10 @@ import com.datadog.api.client.v2.model.IncidentAttachmentUpdateResponse; import com.datadog.api.client.v2.model.IncidentAttachmentsResponse; import com.datadog.api.client.v2.model.IncidentCreateRequest; +import com.datadog.api.client.v2.model.IncidentImpactCreateRequest; +import com.datadog.api.client.v2.model.IncidentImpactRelatedObject; +import com.datadog.api.client.v2.model.IncidentImpactResponse; +import com.datadog.api.client.v2.model.IncidentImpactsResponse; import com.datadog.api.client.v2.model.IncidentIntegrationMetadataCreateRequest; import com.datadog.api.client.v2.model.IncidentIntegrationMetadataListResponse; import com.datadog.api.client.v2.model.IncidentIntegrationMetadataPatchRequest; @@ -230,6 +234,261 @@ public CompletableFuture> createIncidentWithHttpIn new GenericType() {}); } + /** Manage optional parameters to createIncidentImpact. */ + public static class CreateIncidentImpactOptionalParameters { + private List include; + + /** + * Set include. + * + * @param include Specifies which related resources should be included in the response. + * (optional) + * @return CreateIncidentImpactOptionalParameters + */ + public CreateIncidentImpactOptionalParameters include( + List include) { + this.include = include; + return this; + } + } + + /** + * Create an incident impact. + * + *

See {@link #createIncidentImpactWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Incident impact payload. (required) + * @return IncidentImpactResponse + * @throws ApiException if fails to make API call + */ + public IncidentImpactResponse createIncidentImpact( + String incidentId, IncidentImpactCreateRequest body) throws ApiException { + return createIncidentImpactWithHttpInfo( + incidentId, body, new CreateIncidentImpactOptionalParameters()) + .getData(); + } + + /** + * Create an incident impact. + * + *

See {@link #createIncidentImpactWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Incident impact payload. (required) + * @return CompletableFuture<IncidentImpactResponse> + */ + public CompletableFuture createIncidentImpactAsync( + String incidentId, IncidentImpactCreateRequest body) { + return createIncidentImpactWithHttpInfoAsync( + incidentId, body, new CreateIncidentImpactOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create an incident impact. + * + *

See {@link #createIncidentImpactWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Incident impact payload. (required) + * @param parameters Optional parameters for the request. + * @return IncidentImpactResponse + * @throws ApiException if fails to make API call + */ + public IncidentImpactResponse createIncidentImpact( + String incidentId, + IncidentImpactCreateRequest body, + CreateIncidentImpactOptionalParameters parameters) + throws ApiException { + return createIncidentImpactWithHttpInfo(incidentId, body, parameters).getData(); + } + + /** + * Create an incident impact. + * + *

See {@link #createIncidentImpactWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Incident impact payload. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentImpactResponse> + */ + public CompletableFuture createIncidentImpactAsync( + String incidentId, + IncidentImpactCreateRequest body, + CreateIncidentImpactOptionalParameters parameters) { + return createIncidentImpactWithHttpInfoAsync(incidentId, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create an impact for an incident. + * + * @param incidentId The UUID of the incident. (required) + * @param body Incident impact payload. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentImpactResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse createIncidentImpactWithHttpInfo( + String incidentId, + IncidentImpactCreateRequest body, + CreateIncidentImpactOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createIncidentImpact"; + 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 'incidentId' is set + if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling createIncidentImpact"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createIncidentImpact"); + } + List include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/impacts" + .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 = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentImpact", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create an incident impact. + * + *

See {@link #createIncidentImpactWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Incident impact payload. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentImpactResponse>> + */ + public CompletableFuture> + createIncidentImpactWithHttpInfoAsync( + String incidentId, + IncidentImpactCreateRequest body, + CreateIncidentImpactOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "createIncidentImpact"; + 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 'incidentId' is set + if (incidentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'incidentId' when calling createIncidentImpact")); + 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 createIncidentImpact")); + return result; + } + List include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/impacts" + .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.createIncidentImpact", + 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( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Create an incident integration metadata. * @@ -1209,6 +1468,182 @@ public CompletableFuture> deleteIncidentWithHttpInfoAsync(Stri null); } + /** + * Delete an incident impact. + * + *

See {@link #deleteIncidentImpactWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param impactId The UUID of the incident impact. (required) + * @throws ApiException if fails to make API call + */ + public void deleteIncidentImpact(String incidentId, String impactId) throws ApiException { + deleteIncidentImpactWithHttpInfo(incidentId, impactId); + } + + /** + * Delete an incident impact. + * + *

See {@link #deleteIncidentImpactWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param impactId The UUID of the incident impact. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteIncidentImpactAsync(String incidentId, String impactId) { + return deleteIncidentImpactWithHttpInfoAsync(incidentId, impactId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an incident impact. + * + * @param incidentId The UUID of the incident. (required) + * @param impactId The UUID of the incident impact. (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 -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteIncidentImpactWithHttpInfo(String incidentId, String impactId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteIncidentImpact"; + 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 'incidentId' is set + if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling deleteIncidentImpact"); + } + + // verify the required parameter 'impactId' is set + if (impactId == null) { + throw new ApiException( + 400, "Missing the required parameter 'impactId' when calling deleteIncidentImpact"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/impacts/{impact_id}" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll("\\{" + "impact_id" + "\\}", apiClient.escapeString(impactId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentImpact", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an incident impact. + * + *

See {@link #deleteIncidentImpactWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param impactId The UUID of the incident impact. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteIncidentImpactWithHttpInfoAsync( + String incidentId, String impactId) { + // Check if unstable operation is enabled + String operationId = "deleteIncidentImpact"; + 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 deleteIncidentImpact")); + return result; + } + + // verify the required parameter 'impactId' is set + if (impactId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'impactId' when calling deleteIncidentImpact")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/impacts/{impact_id}" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll("\\{" + "impact_id" + "\\}", apiClient.escapeString(impactId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentImpact", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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 integration metadata. * @@ -3603,6 +4038,226 @@ public ApiResponse listIncidentAttachmentsWithHttpI new GenericType() {}); } + /** Manage optional parameters to listIncidentImpacts. */ + public static class ListIncidentImpactsOptionalParameters { + private List include; + + /** + * Set include. + * + * @param include Specifies which related resources should be included in the response. + * (optional) + * @return ListIncidentImpactsOptionalParameters + */ + public ListIncidentImpactsOptionalParameters include( + List include) { + this.include = include; + return this; + } + } + + /** + * List an incident's impacts. + * + *

See {@link #listIncidentImpactsWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @return IncidentImpactsResponse + * @throws ApiException if fails to make API call + */ + public IncidentImpactsResponse listIncidentImpacts(String incidentId) throws ApiException { + return listIncidentImpactsWithHttpInfo(incidentId, new ListIncidentImpactsOptionalParameters()) + .getData(); + } + + /** + * List an incident's impacts. + * + *

See {@link #listIncidentImpactsWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @return CompletableFuture<IncidentImpactsResponse> + */ + public CompletableFuture listIncidentImpactsAsync(String incidentId) { + return listIncidentImpactsWithHttpInfoAsync( + incidentId, new ListIncidentImpactsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List an incident's impacts. + * + *

See {@link #listIncidentImpactsWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param parameters Optional parameters for the request. + * @return IncidentImpactsResponse + * @throws ApiException if fails to make API call + */ + public IncidentImpactsResponse listIncidentImpacts( + String incidentId, ListIncidentImpactsOptionalParameters parameters) throws ApiException { + return listIncidentImpactsWithHttpInfo(incidentId, parameters).getData(); + } + + /** + * List an incident's impacts. + * + *

See {@link #listIncidentImpactsWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentImpactsResponse> + */ + public CompletableFuture listIncidentImpactsAsync( + String incidentId, ListIncidentImpactsOptionalParameters parameters) { + return listIncidentImpactsWithHttpInfoAsync(incidentId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all impacts for an incident. + * + * @param incidentId The UUID of the incident. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentImpactsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse listIncidentImpactsWithHttpInfo( + String incidentId, ListIncidentImpactsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listIncidentImpacts"; + 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 'incidentId' is set + if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling listIncidentImpacts"); + } + List include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/impacts" + .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 = + apiClient.createBuilder( + "v2.IncidentsApi.listIncidentImpacts", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List an incident's impacts. + * + *

See {@link #listIncidentImpactsWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentImpactsResponse>> + */ + public CompletableFuture> + listIncidentImpactsWithHttpInfoAsync( + String incidentId, ListIncidentImpactsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listIncidentImpacts"; + 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 listIncidentImpacts")); + return result; + } + List include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/impacts" + .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.listIncidentImpacts", + 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 a list of an incident's integration metadata. * diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentImpactAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactAttributes.java new file mode 100644 index 00000000000..18e42bf6d50 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactAttributes.java @@ -0,0 +1,325 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The incident impact's attributes. */ +@JsonPropertyOrder({ + IncidentImpactAttributes.JSON_PROPERTY_CREATED, + IncidentImpactAttributes.JSON_PROPERTY_DESCRIPTION, + IncidentImpactAttributes.JSON_PROPERTY_END_AT, + IncidentImpactAttributes.JSON_PROPERTY_FIELDS, + IncidentImpactAttributes.JSON_PROPERTY_IMPACT_TYPE, + IncidentImpactAttributes.JSON_PROPERTY_MODIFIED, + IncidentImpactAttributes.JSON_PROPERTY_START_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED = "created"; + private OffsetDateTime created; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_END_AT = "end_at"; + private JsonNullable endAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FIELDS = "fields"; + private JsonNullable> fields = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_IMPACT_TYPE = "impact_type"; + private String impactType; + + public static final String JSON_PROPERTY_MODIFIED = "modified"; + private OffsetDateTime modified; + + public static final String JSON_PROPERTY_START_AT = "start_at"; + private OffsetDateTime startAt; + + public IncidentImpactAttributes() {} + + @JsonCreator + public IncidentImpactAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_START_AT) OffsetDateTime startAt) { + this.description = description; + this.startAt = startAt; + } + + /** + * Timestamp when the impact was created. + * + * @return created + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreated() { + return created; + } + + public IncidentImpactAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Description of the impact. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public IncidentImpactAttributes endAt(OffsetDateTime endAt) { + this.endAt = JsonNullable.of(endAt); + return this; + } + + /** + * Timestamp when the impact ended. + * + * @return endAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getEndAt() { + return endAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_END_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getEndAt_JsonNullable() { + return endAt; + } + + @JsonProperty(JSON_PROPERTY_END_AT) + public void setEndAt_JsonNullable(JsonNullable endAt) { + this.endAt = endAt; + } + + public void setEndAt(OffsetDateTime endAt) { + this.endAt = JsonNullable.of(endAt); + } + + public IncidentImpactAttributes fields(Map fields) { + this.fields = JsonNullable.>of(fields); + return this; + } + + public IncidentImpactAttributes putFieldsItem(String key, Object fieldsItem) { + if (this.fields == null || !this.fields.isPresent()) { + this.fields = JsonNullable.>of(new HashMap<>()); + } + try { + this.fields.get().put(key, fieldsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * An object mapping impact field names to field values. + * + * @return fields + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Map getFields() { + return fields.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getFields_JsonNullable() { + return fields; + } + + @JsonProperty(JSON_PROPERTY_FIELDS) + public void setFields_JsonNullable(JsonNullable> fields) { + this.fields = fields; + } + + public void setFields(Map fields) { + this.fields = JsonNullable.>of(fields); + } + + public IncidentImpactAttributes impactType(String impactType) { + this.impactType = impactType; + return this; + } + + /** + * The type of impact. + * + * @return impactType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IMPACT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getImpactType() { + return impactType; + } + + public void setImpactType(String impactType) { + this.impactType = impactType; + } + + /** + * Timestamp when the impact was last modified. + * + * @return modified + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MODIFIED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getModified() { + return modified; + } + + public IncidentImpactAttributes startAt(OffsetDateTime startAt) { + this.startAt = startAt; + return this; + } + + /** + * Timestamp representing when the impact started. + * + * @return startAt + */ + @JsonProperty(JSON_PROPERTY_START_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStartAt() { + return startAt; + } + + public void setStartAt(OffsetDateTime startAt) { + this.startAt = startAt; + } + + /** + * 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 IncidentImpactAttributes + */ + @JsonAnySetter + public IncidentImpactAttributes 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 IncidentImpactAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactAttributes incidentImpactAttributes = (IncidentImpactAttributes) o; + return Objects.equals(this.created, incidentImpactAttributes.created) + && Objects.equals(this.description, incidentImpactAttributes.description) + && Objects.equals(this.endAt, incidentImpactAttributes.endAt) + && Objects.equals(this.fields, incidentImpactAttributes.fields) + && Objects.equals(this.impactType, incidentImpactAttributes.impactType) + && Objects.equals(this.modified, incidentImpactAttributes.modified) + && Objects.equals(this.startAt, incidentImpactAttributes.startAt) + && Objects.equals(this.additionalProperties, incidentImpactAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + created, description, endAt, fields, impactType, modified, startAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactAttributes {\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" endAt: ").append(toIndentedString(endAt)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" impactType: ").append(toIndentedString(impactType)).append("\n"); + sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); + sb.append(" startAt: ").append(toIndentedString(startAt)).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/IncidentImpactCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateAttributes.java new file mode 100644 index 00000000000..bbab56dfede --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateAttributes.java @@ -0,0 +1,263 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The incident impact's attributes for a create request. */ +@JsonPropertyOrder({ + IncidentImpactCreateAttributes.JSON_PROPERTY_DESCRIPTION, + IncidentImpactCreateAttributes.JSON_PROPERTY_END_AT, + IncidentImpactCreateAttributes.JSON_PROPERTY_FIELDS, + IncidentImpactCreateAttributes.JSON_PROPERTY_START_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_END_AT = "end_at"; + private JsonNullable endAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_FIELDS = "fields"; + private JsonNullable> fields = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_START_AT = "start_at"; + private OffsetDateTime startAt; + + public IncidentImpactCreateAttributes() {} + + @JsonCreator + public IncidentImpactCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_START_AT) OffsetDateTime startAt) { + this.description = description; + this.startAt = startAt; + } + + public IncidentImpactCreateAttributes description(String description) { + this.description = description; + return this; + } + + /** + * Description of the impact. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public IncidentImpactCreateAttributes endAt(OffsetDateTime endAt) { + this.endAt = JsonNullable.of(endAt); + return this; + } + + /** + * Timestamp when the impact ended. + * + * @return endAt + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getEndAt() { + return endAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_END_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getEndAt_JsonNullable() { + return endAt; + } + + @JsonProperty(JSON_PROPERTY_END_AT) + public void setEndAt_JsonNullable(JsonNullable endAt) { + this.endAt = endAt; + } + + public void setEndAt(OffsetDateTime endAt) { + this.endAt = JsonNullable.of(endAt); + } + + public IncidentImpactCreateAttributes fields(Map fields) { + this.fields = JsonNullable.>of(fields); + return this; + } + + public IncidentImpactCreateAttributes putFieldsItem(String key, Object fieldsItem) { + if (this.fields == null || !this.fields.isPresent()) { + this.fields = JsonNullable.>of(new HashMap<>()); + } + try { + this.fields.get().put(key, fieldsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * An object mapping impact field names to field values. + * + * @return fields + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Map getFields() { + return fields.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getFields_JsonNullable() { + return fields; + } + + @JsonProperty(JSON_PROPERTY_FIELDS) + public void setFields_JsonNullable(JsonNullable> fields) { + this.fields = fields; + } + + public void setFields(Map fields) { + this.fields = JsonNullable.>of(fields); + } + + public IncidentImpactCreateAttributes startAt(OffsetDateTime startAt) { + this.startAt = startAt; + return this; + } + + /** + * Timestamp when the impact started. + * + * @return startAt + */ + @JsonProperty(JSON_PROPERTY_START_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStartAt() { + return startAt; + } + + public void setStartAt(OffsetDateTime startAt) { + this.startAt = startAt; + } + + /** + * 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 IncidentImpactCreateAttributes + */ + @JsonAnySetter + public IncidentImpactCreateAttributes 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 IncidentImpactCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactCreateAttributes incidentImpactCreateAttributes = + (IncidentImpactCreateAttributes) o; + return Objects.equals(this.description, incidentImpactCreateAttributes.description) + && Objects.equals(this.endAt, incidentImpactCreateAttributes.endAt) + && Objects.equals(this.fields, incidentImpactCreateAttributes.fields) + && Objects.equals(this.startAt, incidentImpactCreateAttributes.startAt) + && Objects.equals( + this.additionalProperties, incidentImpactCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, endAt, fields, startAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactCreateAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" endAt: ").append(toIndentedString(endAt)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" startAt: ").append(toIndentedString(startAt)).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/IncidentImpactCreateData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateData.java new file mode 100644 index 00000000000..0d420de0071 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateData.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; + +/** Incident impact data for a create request. */ +@JsonPropertyOrder({ + IncidentImpactCreateData.JSON_PROPERTY_ATTRIBUTES, + IncidentImpactCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentImpactCreateAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentImpactType type = IncidentImpactType.INCIDENT_IMPACTS; + + public IncidentImpactCreateData() {} + + @JsonCreator + public IncidentImpactCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentImpactCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentImpactType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentImpactCreateData attributes(IncidentImpactCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The incident impact's attributes for a create request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentImpactCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(IncidentImpactCreateAttributes attributes) { + this.attributes = attributes; + } + + public IncidentImpactCreateData type(IncidentImpactType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident impact resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentImpactType getType() { + return type; + } + + public void setType(IncidentImpactType 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 IncidentImpactCreateData + */ + @JsonAnySetter + public IncidentImpactCreateData 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 IncidentImpactCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactCreateData incidentImpactCreateData = (IncidentImpactCreateData) o; + return Objects.equals(this.attributes, incidentImpactCreateData.attributes) + && Objects.equals(this.type, incidentImpactCreateData.type) + && Objects.equals(this.additionalProperties, incidentImpactCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactCreateData {\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/IncidentImpactCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateRequest.java new file mode 100644 index 00000000000..c69997f775c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactCreateRequest.java @@ -0,0 +1,146 @@ +/* + * 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; + +/** Create request for an incident impact. */ +@JsonPropertyOrder({IncidentImpactCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentImpactCreateData data; + + public IncidentImpactCreateRequest() {} + + @JsonCreator + public IncidentImpactCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) IncidentImpactCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentImpactCreateRequest data(IncidentImpactCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Incident impact data for a create request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentImpactCreateData getData() { + return data; + } + + public void setData(IncidentImpactCreateData 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 IncidentImpactCreateRequest + */ + @JsonAnySetter + public IncidentImpactCreateRequest 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 IncidentImpactCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactCreateRequest incidentImpactCreateRequest = (IncidentImpactCreateRequest) o; + return Objects.equals(this.data, incidentImpactCreateRequest.data) + && Objects.equals( + this.additionalProperties, incidentImpactCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactCreateRequest {\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/IncidentImpactRelatedObject.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactRelatedObject.java new file mode 100644 index 00000000000..f553cfce450 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactRelatedObject.java @@ -0,0 +1,61 @@ +/* + * 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; + +/** A reference to a resource related to an incident impact. */ +@JsonSerialize(using = IncidentImpactRelatedObject.IncidentImpactRelatedObjectSerializer.class) +public class IncidentImpactRelatedObject extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("incident", "created_by_user", "last_modified_by_user")); + + public static final IncidentImpactRelatedObject INCIDENT = + new IncidentImpactRelatedObject("incident"); + public static final IncidentImpactRelatedObject CREATED_BY_USER = + new IncidentImpactRelatedObject("created_by_user"); + public static final IncidentImpactRelatedObject LAST_MODIFIED_BY_USER = + new IncidentImpactRelatedObject("last_modified_by_user"); + + IncidentImpactRelatedObject(String value) { + super(value, allowedValues); + } + + public static class IncidentImpactRelatedObjectSerializer + extends StdSerializer { + public IncidentImpactRelatedObjectSerializer(Class t) { + super(t); + } + + public IncidentImpactRelatedObjectSerializer() { + this(null); + } + + @Override + public void serialize( + IncidentImpactRelatedObject value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentImpactRelatedObject fromValue(String value) { + return new IncidentImpactRelatedObject(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentImpactRelationships.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactRelationships.java new file mode 100644 index 00000000000..770d8ae2185 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactRelationships.java @@ -0,0 +1,195 @@ +/* + * 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.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; + +/** The incident impact's resource relationships. */ +@JsonPropertyOrder({ + IncidentImpactRelationships.JSON_PROPERTY_CREATED_BY_USER, + IncidentImpactRelationships.JSON_PROPERTY_INCIDENT, + IncidentImpactRelationships.JSON_PROPERTY_LAST_MODIFIED_BY_USER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_BY_USER = "created_by_user"; + private RelationshipToUser createdByUser; + + public static final String JSON_PROPERTY_INCIDENT = "incident"; + private RelationshipToIncident incident; + + public static final String JSON_PROPERTY_LAST_MODIFIED_BY_USER = "last_modified_by_user"; + private RelationshipToUser lastModifiedByUser; + + public IncidentImpactRelationships createdByUser(RelationshipToUser createdByUser) { + this.createdByUser = createdByUser; + this.unparsed |= createdByUser.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return createdByUser + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getCreatedByUser() { + return createdByUser; + } + + public void setCreatedByUser(RelationshipToUser createdByUser) { + this.createdByUser = createdByUser; + } + + public IncidentImpactRelationships incident(RelationshipToIncident incident) { + this.incident = incident; + this.unparsed |= incident.unparsed; + return this; + } + + /** + * Relationship to incident. + * + * @return incident + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCIDENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToIncident getIncident() { + return incident; + } + + public void setIncident(RelationshipToIncident incident) { + this.incident = incident; + } + + public IncidentImpactRelationships lastModifiedByUser(RelationshipToUser lastModifiedByUser) { + this.lastModifiedByUser = lastModifiedByUser; + this.unparsed |= lastModifiedByUser.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return lastModifiedByUser + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_MODIFIED_BY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getLastModifiedByUser() { + return lastModifiedByUser; + } + + public void setLastModifiedByUser(RelationshipToUser lastModifiedByUser) { + this.lastModifiedByUser = lastModifiedByUser; + } + + /** + * 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 IncidentImpactRelationships + */ + @JsonAnySetter + public IncidentImpactRelationships 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 IncidentImpactRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactRelationships incidentImpactRelationships = (IncidentImpactRelationships) o; + return Objects.equals(this.createdByUser, incidentImpactRelationships.createdByUser) + && Objects.equals(this.incident, incidentImpactRelationships.incident) + && Objects.equals(this.lastModifiedByUser, incidentImpactRelationships.lastModifiedByUser) + && Objects.equals( + this.additionalProperties, incidentImpactRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdByUser, incident, lastModifiedByUser, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactRelationships {\n"); + sb.append(" createdByUser: ").append(toIndentedString(createdByUser)).append("\n"); + sb.append(" incident: ").append(toIndentedString(incident)).append("\n"); + sb.append(" lastModifiedByUser: ").append(toIndentedString(lastModifiedByUser)).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/IncidentImpactResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactResponse.java new file mode 100644 index 00000000000..c6c925fb626 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactResponse.java @@ -0,0 +1,166 @@ +/* + * 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.List; +import java.util.Map; +import java.util.Objects; + +/** Response with an incident impact. */ +@JsonPropertyOrder({ + IncidentImpactResponse.JSON_PROPERTY_DATA, + IncidentImpactResponse.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentImpactResponseData data; + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public IncidentImpactResponse() {} + + @JsonCreator + public IncidentImpactResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) IncidentImpactResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentImpactResponse data(IncidentImpactResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Incident impact data from a response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentImpactResponseData getData() { + return data; + } + + public void setData(IncidentImpactResponseData data) { + this.data = data; + } + + /** + * Included related resources that the user requested. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + /** + * 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 IncidentImpactResponse + */ + @JsonAnySetter + public IncidentImpactResponse 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 IncidentImpactResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactResponse incidentImpactResponse = (IncidentImpactResponse) o; + return Objects.equals(this.data, incidentImpactResponse.data) + && Objects.equals(this.included, incidentImpactResponse.included) + && Objects.equals(this.additionalProperties, incidentImpactResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).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/IncidentImpactResponseData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactResponseData.java new file mode 100644 index 00000000000..3573e1d01d5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactResponseData.java @@ -0,0 +1,235 @@ +/* + * 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; + +/** Incident impact data from a response. */ +@JsonPropertyOrder({ + IncidentImpactResponseData.JSON_PROPERTY_ATTRIBUTES, + IncidentImpactResponseData.JSON_PROPERTY_ID, + IncidentImpactResponseData.JSON_PROPERTY_RELATIONSHIPS, + IncidentImpactResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentImpactAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private IncidentImpactRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentImpactType type = IncidentImpactType.INCIDENT_IMPACTS; + + public IncidentImpactResponseData() {} + + @JsonCreator + public IncidentImpactResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentImpactType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentImpactResponseData attributes(IncidentImpactAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The incident impact's attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentImpactAttributes getAttributes() { + return attributes; + } + + public void setAttributes(IncidentImpactAttributes attributes) { + this.attributes = attributes; + } + + public IncidentImpactResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The incident impact's ID. + * + * @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 IncidentImpactResponseData relationships(IncidentImpactRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * The incident impact's resource relationships. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentImpactRelationships getRelationships() { + return relationships; + } + + public void setRelationships(IncidentImpactRelationships relationships) { + this.relationships = relationships; + } + + public IncidentImpactResponseData type(IncidentImpactType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident impact resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentImpactType getType() { + return type; + } + + public void setType(IncidentImpactType 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 IncidentImpactResponseData + */ + @JsonAnySetter + public IncidentImpactResponseData 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 IncidentImpactResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactResponseData incidentImpactResponseData = (IncidentImpactResponseData) o; + return Objects.equals(this.attributes, incidentImpactResponseData.attributes) + && Objects.equals(this.id, incidentImpactResponseData.id) + && Objects.equals(this.relationships, incidentImpactResponseData.relationships) + && Objects.equals(this.type, incidentImpactResponseData.type) + && Objects.equals( + this.additionalProperties, incidentImpactResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).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/IncidentImpactType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactType.java new file mode 100644 index 00000000000..c1d580effa3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactType.java @@ -0,0 +1,55 @@ +/* + * 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 impact resource type. */ +@JsonSerialize(using = IncidentImpactType.IncidentImpactTypeSerializer.class) +public class IncidentImpactType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("incident_impacts")); + + public static final IncidentImpactType INCIDENT_IMPACTS = + new IncidentImpactType("incident_impacts"); + + IncidentImpactType(String value) { + super(value, allowedValues); + } + + public static class IncidentImpactTypeSerializer extends StdSerializer { + public IncidentImpactTypeSerializer(Class t) { + super(t); + } + + public IncidentImpactTypeSerializer() { + this(null); + } + + @Override + public void serialize(IncidentImpactType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentImpactType fromValue(String value) { + return new IncidentImpactType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentImpactsResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactsResponse.java new file mode 100644 index 00000000000..c4992d3390c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentImpactsResponse.java @@ -0,0 +1,175 @@ +/* + * 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; + +/** Response with a list of incident impacts. */ +@JsonPropertyOrder({ + IncidentImpactsResponse.JSON_PROPERTY_DATA, + IncidentImpactsResponse.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentImpactsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public IncidentImpactsResponse() {} + + @JsonCreator + public IncidentImpactsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public IncidentImpactsResponse data(List data) { + this.data = data; + for (IncidentImpactResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentImpactsResponse addDataItem(IncidentImpactResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * An array of incident impacts. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * Included related resources that the user requested. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + /** + * 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 IncidentImpactsResponse + */ + @JsonAnySetter + public IncidentImpactsResponse 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 IncidentImpactsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentImpactsResponse incidentImpactsResponse = (IncidentImpactsResponse) o; + return Objects.equals(this.data, incidentImpactsResponse.data) + && Objects.equals(this.included, incidentImpactsResponse.included) + && Objects.equals(this.additionalProperties, incidentImpactsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentImpactsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).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/IncidentResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentResponseAttributes.java index cd2d18fd858..ffe9102d166 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentResponseAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentResponseAttributes.java @@ -31,6 +31,9 @@ IncidentResponseAttributes.JSON_PROPERTY_CUSTOMER_IMPACT_SCOPE, IncidentResponseAttributes.JSON_PROPERTY_CUSTOMER_IMPACT_START, IncidentResponseAttributes.JSON_PROPERTY_CUSTOMER_IMPACTED, + IncidentResponseAttributes.JSON_PROPERTY_DECLARED, + IncidentResponseAttributes.JSON_PROPERTY_DECLARED_BY, + IncidentResponseAttributes.JSON_PROPERTY_DECLARED_BY_UUID, IncidentResponseAttributes.JSON_PROPERTY_DETECTED, IncidentResponseAttributes.JSON_PROPERTY_FIELDS, IncidentResponseAttributes.JSON_PROPERTY_INCIDENT_TYPE_UUID, @@ -78,6 +81,16 @@ public class IncidentResponseAttributes { public static final String JSON_PROPERTY_CUSTOMER_IMPACTED = "customer_impacted"; private Boolean customerImpacted; + public static final String JSON_PROPERTY_DECLARED = "declared"; + private OffsetDateTime declared; + + public static final String JSON_PROPERTY_DECLARED_BY = "declared_by"; + private JsonNullable declaredBy = + JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DECLARED_BY_UUID = "declared_by_uuid"; + private JsonNullable declaredByUuid = JsonNullable.undefined(); + public static final String JSON_PROPERTY_DETECTED = "detected"; private JsonNullable detected = JsonNullable.undefined(); @@ -336,6 +349,80 @@ public void setCustomerImpacted(Boolean customerImpacted) { this.customerImpacted = customerImpacted; } + /** + * Timestamp when the incident was declared. + * + * @return declared + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DECLARED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDeclared() { + return declared; + } + + public IncidentResponseAttributes declaredBy(IncidentNonDatadogCreator declaredBy) { + this.declaredBy = JsonNullable.of(declaredBy); + return this; + } + + /** + * Incident's non Datadog creator. + * + * @return declaredBy + */ + @jakarta.annotation.Nullable + @JsonIgnore + public IncidentNonDatadogCreator getDeclaredBy() { + return declaredBy.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DECLARED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDeclaredBy_JsonNullable() { + return declaredBy; + } + + @JsonProperty(JSON_PROPERTY_DECLARED_BY) + public void setDeclaredBy_JsonNullable(JsonNullable declaredBy) { + this.declaredBy = declaredBy; + } + + public void setDeclaredBy(IncidentNonDatadogCreator declaredBy) { + this.declaredBy = JsonNullable.of(declaredBy); + } + + public IncidentResponseAttributes declaredByUuid(String declaredByUuid) { + this.declaredByUuid = JsonNullable.of(declaredByUuid); + return this; + } + + /** + * UUID of the user who declared the incident. + * + * @return declaredByUuid + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDeclaredByUuid() { + return declaredByUuid.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DECLARED_BY_UUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDeclaredByUuid_JsonNullable() { + return declaredByUuid; + } + + @JsonProperty(JSON_PROPERTY_DECLARED_BY_UUID) + public void setDeclaredByUuid_JsonNullable(JsonNullable declaredByUuid) { + this.declaredByUuid = declaredByUuid; + } + + public void setDeclaredByUuid(String declaredByUuid) { + this.declaredByUuid = JsonNullable.of(declaredByUuid); + } + public IncidentResponseAttributes detected(OffsetDateTime detected) { this.detected = JsonNullable.of(detected); return this; @@ -808,6 +895,9 @@ public boolean equals(Object o) { && Objects.equals(this.customerImpactScope, incidentResponseAttributes.customerImpactScope) && Objects.equals(this.customerImpactStart, incidentResponseAttributes.customerImpactStart) && Objects.equals(this.customerImpacted, incidentResponseAttributes.customerImpacted) + && Objects.equals(this.declared, incidentResponseAttributes.declared) + && Objects.equals(this.declaredBy, incidentResponseAttributes.declaredBy) + && Objects.equals(this.declaredByUuid, incidentResponseAttributes.declaredByUuid) && Objects.equals(this.detected, incidentResponseAttributes.detected) && Objects.equals(this.fields, incidentResponseAttributes.fields) && Objects.equals(this.incidentTypeUuid, incidentResponseAttributes.incidentTypeUuid) @@ -841,6 +931,9 @@ public int hashCode() { customerImpactScope, customerImpactStart, customerImpacted, + declared, + declaredBy, + declaredByUuid, detected, fields, incidentTypeUuid, @@ -879,6 +972,9 @@ public String toString() { .append(toIndentedString(customerImpactStart)) .append("\n"); sb.append(" customerImpacted: ").append(toIndentedString(customerImpacted)).append("\n"); + sb.append(" declared: ").append(toIndentedString(declared)).append("\n"); + sb.append(" declaredBy: ").append(toIndentedString(declaredBy)).append("\n"); + sb.append(" declaredByUuid: ").append(toIndentedString(declaredByUuid)).append("\n"); sb.append(" detected: ").append(toIndentedString(detected)).append("\n"); sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); sb.append(" incidentTypeUuid: ").append(toIndentedString(incidentTypeUuid)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentResponseRelationships.java b/src/main/java/com/datadog/api/client/v2/model/IncidentResponseRelationships.java index 0b1436b729c..c2942a6a403 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentResponseRelationships.java +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentResponseRelationships.java @@ -22,6 +22,7 @@ IncidentResponseRelationships.JSON_PROPERTY_ATTACHMENTS, IncidentResponseRelationships.JSON_PROPERTY_COMMANDER_USER, IncidentResponseRelationships.JSON_PROPERTY_CREATED_BY_USER, + IncidentResponseRelationships.JSON_PROPERTY_DECLARED_BY_USER, IncidentResponseRelationships.JSON_PROPERTY_IMPACTS, IncidentResponseRelationships.JSON_PROPERTY_INTEGRATIONS, IncidentResponseRelationships.JSON_PROPERTY_LAST_MODIFIED_BY_USER, @@ -42,6 +43,9 @@ public class IncidentResponseRelationships { public static final String JSON_PROPERTY_CREATED_BY_USER = "created_by_user"; private RelationshipToUser createdByUser; + public static final String JSON_PROPERTY_DECLARED_BY_USER = "declared_by_user"; + private RelationshipToUser declaredByUser; + public static final String JSON_PROPERTY_IMPACTS = "impacts"; private RelationshipToIncidentImpacts impacts; @@ -133,6 +137,28 @@ public void setCreatedByUser(RelationshipToUser createdByUser) { this.createdByUser = createdByUser; } + public IncidentResponseRelationships declaredByUser(RelationshipToUser declaredByUser) { + this.declaredByUser = declaredByUser; + this.unparsed |= declaredByUser.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return declaredByUser + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DECLARED_BY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getDeclaredByUser() { + return declaredByUser; + } + + public void setDeclaredByUser(RelationshipToUser declaredByUser) { + this.declaredByUser = declaredByUser; + } + public IncidentResponseRelationships impacts(RelationshipToIncidentImpacts impacts) { this.impacts = impacts; this.unparsed |= impacts.unparsed; @@ -304,6 +330,7 @@ public boolean equals(Object o) { return Objects.equals(this.attachments, incidentResponseRelationships.attachments) && Objects.equals(this.commanderUser, incidentResponseRelationships.commanderUser) && Objects.equals(this.createdByUser, incidentResponseRelationships.createdByUser) + && Objects.equals(this.declaredByUser, incidentResponseRelationships.declaredByUser) && Objects.equals(this.impacts, incidentResponseRelationships.impacts) && Objects.equals(this.integrations, incidentResponseRelationships.integrations) && Objects.equals(this.lastModifiedByUser, incidentResponseRelationships.lastModifiedByUser) @@ -319,6 +346,7 @@ public int hashCode() { attachments, commanderUser, createdByUser, + declaredByUser, impacts, integrations, lastModifiedByUser, @@ -334,6 +362,7 @@ public String toString() { sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); sb.append(" commanderUser: ").append(toIndentedString(commanderUser)).append("\n"); sb.append(" createdByUser: ").append(toIndentedString(createdByUser)).append("\n"); + sb.append(" declaredByUser: ").append(toIndentedString(declaredByUser)).append("\n"); sb.append(" impacts: ").append(toIndentedString(impacts)).append("\n"); sb.append(" integrations: ").append(toIndentedString(integrations)).append("\n"); sb.append(" lastModifiedByUser: ").append(toIndentedString(lastModifiedByUser)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncident.java b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncident.java new file mode 100644 index 00000000000..affc1dac743 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncident.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; + +/** Relationship to incident. */ +@JsonPropertyOrder({RelationshipToIncident.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RelationshipToIncident { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RelationshipToIncidentData data; + + public RelationshipToIncident() {} + + @JsonCreator + public RelationshipToIncident( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) RelationshipToIncidentData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RelationshipToIncident data(RelationshipToIncidentData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Relationship to incident object. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RelationshipToIncidentData getData() { + return data; + } + + public void setData(RelationshipToIncidentData 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 RelationshipToIncident + */ + @JsonAnySetter + public RelationshipToIncident 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 RelationshipToIncident object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipToIncident relationshipToIncident = (RelationshipToIncident) o; + return Objects.equals(this.data, relationshipToIncident.data) + && Objects.equals(this.additionalProperties, relationshipToIncident.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipToIncident {\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/RelationshipToIncidentData.java b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentData.java new file mode 100644 index 00000000000..6cd8820e150 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentData.java @@ -0,0 +1,179 @@ +/* + * 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; + +/** Relationship to incident object. */ +@JsonPropertyOrder({ + RelationshipToIncidentData.JSON_PROPERTY_ID, + RelationshipToIncidentData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RelationshipToIncidentData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentType type = IncidentType.INCIDENTS; + + public RelationshipToIncidentData() {} + + @JsonCreator + public RelationshipToIncidentData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RelationshipToIncidentData id(String id) { + this.id = id; + return this; + } + + /** + * A unique identifier that represents the incident. + * + * @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 RelationshipToIncidentData type(IncidentType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentType getType() { + return type; + } + + public void setType(IncidentType 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 RelationshipToIncidentData + */ + @JsonAnySetter + public RelationshipToIncidentData 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 RelationshipToIncidentData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipToIncidentData relationshipToIncidentData = (RelationshipToIncidentData) o; + return Objects.equals(this.id, relationshipToIncidentData.id) + && Objects.equals(this.type, relationshipToIncidentData.type) + && Objects.equals( + this.additionalProperties, relationshipToIncidentData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipToIncidentData {\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/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..0016a9985ba --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-16T19:46:43.553Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.json new file mode 100644 index 00000000000..0110815e08d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Service was unavailable for external users\",\"end_at\":\"2025-08-29T13:17:00Z\",\"fields\":{\"customers_impacted\":\"all\",\"products_impacted\":[\"shopping\",\"marketing\"]},\"start_at\":\"2025-08-28T13:17:00Z\"},\"type\":\"incident_impacts\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/incidents/00000000-0000-0000-0000-000000000000/impacts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Bad Request\",\"detail\":\"invalid impact data: incident id is required: invalid impact\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a3e7e76c-3b9d-a157-f731-eeac4bcccecd" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.freeze new file mode 100644 index 00000000000..aa2f3172f89 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.freeze @@ -0,0 +1 @@ +2025-09-16T19:46:53.892Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.json b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.json new file mode 100644 index 00000000000..aa673467915 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_CREATED_response.json @@ -0,0 +1,108 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"customer_impacted\":false,\"title\":\"Test-Create_an_incident_impact_returns_CREATED_response-1758052013\"},\"type\":\"incidents\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/incidents", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"incidents\",\"id\":\"5826fc99-ad8c-54cb-8c18-cd270bfe42fb\",\"attributes\":{\"public_id\":309851,\"incident_type_uuid\":\"41d2e10b-4108-4736-92d7-791d00ea0702\",\"title\":\"Test-Create_an_incident_impact_returns_CREATED_response-1758052013\",\"resolved\":null,\"customer_impact_scope\":null,\"customer_impact_start\":null,\"customer_impact_end\":null,\"customer_impacted\":false,\"notification_handles\":null,\"last_modified_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"last_modified_by_uuid\":null,\"created\":\"2025-09-16T19:46:54.038695+00:00\",\"modified\":\"2025-09-16T19:46:54.038695+00:00\",\"commander\":null,\"detected\":\"2025-09-16T19:46:54.027387+00:00\",\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"created_by_uuid\":null,\"creation_idempotency_key\":null,\"customer_impact_duration\":0,\"time_to_detect\":0,\"time_to_repair\":0,\"time_to_internal_response\":0,\"time_to_resolve\":0,\"archived\":null,\"is_test\":false,\"declared\":\"2025-09-16T19:46:54.038695+00:00\",\"declared_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"declared_by_uuid\":null,\"fields\":{\"severity\":{\"type\":\"dropdown\",\"value\":\"UNKNOWN\"},\"state\":{\"type\":\"dropdown\",\"value\":\"active\"},\"detection_method\":{\"type\":\"dropdown\",\"value\":\"unknown\"},\"root_cause\":{\"type\":\"textbox\",\"value\":null},\"summary\":{\"type\":\"textbox\",\"value\":null},\"services\":{\"type\":\"autocomplete\",\"value\":null},\"teams\":{\"type\":\"autocomplete\",\"value\":null}},\"field_analytics\":null,\"severity\":\"UNKNOWN\",\"state\":\"active\",\"non_datadog_creator\":null,\"visibility\":\"organization\",\"case_id\":null},\"relationships\":{\"created_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"commander_user\":{\"data\":null},\"declared_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"user_defined_fields\":{\"data\":[{\"type\":\"user_defined_field\",\"id\":\"33457d2a-570c-5567-b4af-979a2a8f1164\"},{\"type\":\"user_defined_field\",\"id\":\"d003693c-bee9-5420-8d46-859269c20914\"},{\"type\":\"user_defined_field\",\"id\":\"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d\"},{\"type\":\"user_defined_field\",\"id\":\"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf\"},{\"type\":\"user_defined_field\",\"id\":\"95c53547-2ba3-5d8a-9c3b-cf245bc0c629\"},{\"type\":\"user_defined_field\",\"id\":\"39044b03-cee4-555f-b1e0-3eb3aa759a86\"},{\"type\":\"user_defined_field\",\"id\":\"3cbe9e60-d794-532c-acc0-73641f782813\"}]},\"integrations\":{\"data\":[]},\"attachments\":{\"data\":[]},\"responders\":{\"data\":[]},\"impacts\":{\"data\":[]}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "bb82dfd0-55ab-cee6-2280-b9563312ab98" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Outage in the us-east-1 region\",\"end_at\":\"2025-09-12T14:50:00.000Z\",\"start_at\":\"2025-09-12T13:50:00.000Z\"},\"type\":\"incident_impacts\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/incidents/5826fc99-ad8c-54cb-8c18-cd270bfe42fb/impacts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"7d4f5663-7c01-4727-b90b-323953603092\",\"type\":\"incident_impacts\",\"attributes\":{\"created\":\"2025-09-16T19:46:54.291754Z\",\"description\":\"Outage in the us-east-1 region\",\"end_at\":\"2025-09-12T14:50:00Z\",\"fields\":null,\"impact_type\":\"customer\",\"modified\":\"2025-09-16T19:46:54.291754Z\",\"start_at\":\"2025-09-12T13:50:00Z\"},\"relationships\":{\"created_by_user\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}},\"incident\":{\"data\":{\"id\":\"5826fc99-ad8c-54cb-8c18-cd270bfe42fb\",\"type\":\"incidents\"}},\"last_modified_by_user\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "d1aa1119-cb13-a179-6c6b-8307b576ecac" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/5826fc99-ad8c-54cb-8c18-cd270bfe42fb/impacts/7d4f5663-7c01-4727-b90b-323953603092", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f5585aa0-8462-385d-0f2e-6baae60a3a89" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/5826fc99-ad8c-54cb-8c18-cd270bfe42fb", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e39ee108-92c7-2251-286f-f1399ec9bdf1" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..112e404d116 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-16T19:47:06.306Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.json new file mode 100644 index 00000000000..196cee95405 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_an_incident_impact_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Service was unavailable for external users\",\"end_at\":\"2025-08-29T13:17:00Z\",\"fields\":{\"customers_impacted\":\"all\",\"products_impacted\":[\"shopping\",\"marketing\"]},\"start_at\":\"2025-08-28T13:17:00Z\"},\"type\":\"incident_impacts\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/incidents/00000000-0000-0000-0000-000000000001/impacts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rpc error: code = NotFound desc = incident not found: failed to get incident: incident not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "83334db7-2687-7d4b-12bd-05d082969661" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.freeze new file mode 100644 index 00000000000..69564fd4b00 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-09-16T19:47:17.707Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.json new file mode 100644 index 00000000000..1a294e2e171 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_No_Content_response.json @@ -0,0 +1,134 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"customer_impacted\":false,\"title\":\"Test-Delete_an_incident_impact_returns_No_Content_response-1758052037\"},\"type\":\"incidents\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/incidents", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"incidents\",\"id\":\"1a838ffb-9c95-5df6-978c-4cf21f854fd1\",\"attributes\":{\"public_id\":309852,\"incident_type_uuid\":\"41d2e10b-4108-4736-92d7-791d00ea0702\",\"title\":\"Test-Delete_an_incident_impact_returns_No_Content_response-1758052037\",\"resolved\":null,\"customer_impact_scope\":null,\"customer_impact_start\":null,\"customer_impact_end\":null,\"customer_impacted\":false,\"notification_handles\":null,\"last_modified_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"last_modified_by_uuid\":null,\"created\":\"2025-09-16T19:47:17.862681+00:00\",\"modified\":\"2025-09-16T19:47:17.862681+00:00\",\"commander\":null,\"detected\":\"2025-09-16T19:47:17.850799+00:00\",\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"created_by_uuid\":null,\"creation_idempotency_key\":null,\"customer_impact_duration\":0,\"time_to_detect\":0,\"time_to_repair\":0,\"time_to_internal_response\":0,\"time_to_resolve\":0,\"archived\":null,\"is_test\":false,\"declared\":\"2025-09-16T19:47:17.862681+00:00\",\"declared_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"declared_by_uuid\":null,\"fields\":{\"severity\":{\"type\":\"dropdown\",\"value\":\"UNKNOWN\"},\"state\":{\"type\":\"dropdown\",\"value\":\"active\"},\"detection_method\":{\"type\":\"dropdown\",\"value\":\"unknown\"},\"root_cause\":{\"type\":\"textbox\",\"value\":null},\"summary\":{\"type\":\"textbox\",\"value\":null},\"services\":{\"type\":\"autocomplete\",\"value\":null},\"teams\":{\"type\":\"autocomplete\",\"value\":null}},\"field_analytics\":null,\"severity\":\"UNKNOWN\",\"state\":\"active\",\"non_datadog_creator\":null,\"visibility\":\"organization\",\"case_id\":null},\"relationships\":{\"created_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"commander_user\":{\"data\":null},\"declared_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"user_defined_fields\":{\"data\":[{\"type\":\"user_defined_field\",\"id\":\"33457d2a-570c-5567-b4af-979a2a8f1164\"},{\"type\":\"user_defined_field\",\"id\":\"d003693c-bee9-5420-8d46-859269c20914\"},{\"type\":\"user_defined_field\",\"id\":\"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d\"},{\"type\":\"user_defined_field\",\"id\":\"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf\"},{\"type\":\"user_defined_field\",\"id\":\"95c53547-2ba3-5d8a-9c3b-cf245bc0c629\"},{\"type\":\"user_defined_field\",\"id\":\"39044b03-cee4-555f-b1e0-3eb3aa759a86\"},{\"type\":\"user_defined_field\",\"id\":\"3cbe9e60-d794-532c-acc0-73641f782813\"}]},\"integrations\":{\"data\":[]},\"attachments\":{\"data\":[]},\"responders\":{\"data\":[]},\"impacts\":{\"data\":[]}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e97bb752-99f9-65af-5d97-3ab9047c0dcf" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"Outage in the us-east-1 region\",\"end_at\":\"2025-09-12T14:50:00.000Z\",\"start_at\":\"2025-09-12T13:50:00.000Z\"},\"type\":\"incident_impacts\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"id\":\"db11b25d-0383-4f98-bde7-bfc4a10d16eb\",\"type\":\"incident_impacts\",\"attributes\":{\"created\":\"2025-09-16T19:47:18.208811Z\",\"description\":\"Outage in the us-east-1 region\",\"end_at\":\"2025-09-12T14:50:00Z\",\"fields\":null,\"impact_type\":\"customer\",\"modified\":\"2025-09-16T19:47:18.208811Z\",\"start_at\":\"2025-09-12T13:50:00Z\"},\"relationships\":{\"created_by_user\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}},\"incident\":{\"data\":{\"id\":\"1a838ffb-9c95-5df6-978c-4cf21f854fd1\",\"type\":\"incidents\"}},\"last_modified_by_user\":{\"data\":{\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"type\":\"users\"}}}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8fa89ff7-ea04-7405-1c61-cbce70421883" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts/db11b25d-0383-4f98-bde7-bfc4a10d16eb", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e6cb32e1-52ee-64bc-f336-3afd0ee58bef" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts/db11b25d-0383-4f98-bde7-bfc4a10d16eb", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rpc error: code = NotFound desc = impact not found: impact not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e6cb32e1-52ee-64bc-f336-3afd0ee58bf0" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ab183758-7c3e-75a7-21a2-dd6f37c9ae2c" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..84941944711 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-16T19:47:29.411Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.json new file mode 100644 index 00000000000..37792acea5d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/00000000-0000-0000-0000-000000000001/impacts/00000000-0000-0000-0000-000000000001", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rpc error: code = NotFound desc = impact not found: impact not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c0a9270f-d917-748d-aa0d-b67bdff9698c" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.freeze b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.freeze new file mode 100644 index 00000000000..81d2f935c84 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.freeze @@ -0,0 +1 @@ +2025-09-16T14:11:22.028Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.json b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.json new file mode 100644 index 00000000000..3362c727066 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_different_invalid_IDs_.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/00000000-0000-0000-0000-000000000002/impacts/00000000-0000-0000-0000-000000000002", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rpc error: code = NotFound desc = impact not found: impact not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4a561492-9445-9443-9101-5e0f4b996a48" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.freeze b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.freeze new file mode 100644 index 00000000000..17375a815d2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.freeze @@ -0,0 +1 @@ +2025-09-16T14:11:00.035Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.json b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.json new file mode 100644 index 00000000000..8359413da79 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_an_incident_impact_returns_Not_Found_response_invalid_incident_and_impact_.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/00000000-0000-0000-0000-000000000000/impacts/00000000-0000-0000-0000-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rpc error: code = NotFound desc = impact not found: impact not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a1291fe0-3f33-c9c8-9310-e291ddacd21d" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.freeze new file mode 100644 index 00000000000..55431a90fb8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-16T19:47:40.461Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.json new file mode 100644 index 00000000000..d7a3b60a1c6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_an_incident_s_impacts_returns_OK_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"customer_impacted\":false,\"title\":\"Test-List_an_incident_s_impacts_returns_OK_response-1758052060\"},\"type\":\"incidents\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/incidents", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"incidents\",\"id\":\"81b6cd9f-526a-5a08-a204-ac402f36ea5f\",\"attributes\":{\"public_id\":309853,\"incident_type_uuid\":\"41d2e10b-4108-4736-92d7-791d00ea0702\",\"title\":\"Test-List_an_incident_s_impacts_returns_OK_response-1758052060\",\"resolved\":null,\"customer_impact_scope\":null,\"customer_impact_start\":null,\"customer_impact_end\":null,\"customer_impacted\":false,\"notification_handles\":null,\"last_modified_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"last_modified_by_uuid\":null,\"created\":\"2025-09-16T19:47:40.679710+00:00\",\"modified\":\"2025-09-16T19:47:40.679710+00:00\",\"commander\":null,\"detected\":\"2025-09-16T19:47:40.668385+00:00\",\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"created_by_uuid\":null,\"creation_idempotency_key\":null,\"customer_impact_duration\":0,\"time_to_detect\":0,\"time_to_repair\":0,\"time_to_internal_response\":0,\"time_to_resolve\":0,\"archived\":null,\"is_test\":false,\"declared\":\"2025-09-16T19:47:40.679710+00:00\",\"declared_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"name\":\"frog\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\"}}},\"declared_by_uuid\":null,\"fields\":{\"severity\":{\"type\":\"dropdown\",\"value\":\"UNKNOWN\"},\"state\":{\"type\":\"dropdown\",\"value\":\"active\"},\"detection_method\":{\"type\":\"dropdown\",\"value\":\"unknown\"},\"root_cause\":{\"type\":\"textbox\",\"value\":null},\"summary\":{\"type\":\"textbox\",\"value\":null},\"services\":{\"type\":\"autocomplete\",\"value\":null},\"teams\":{\"type\":\"autocomplete\",\"value\":null}},\"field_analytics\":null,\"severity\":\"UNKNOWN\",\"state\":\"active\",\"non_datadog_creator\":null,\"visibility\":\"organization\",\"case_id\":null},\"relationships\":{\"created_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"last_modified_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"commander_user\":{\"data\":null},\"declared_by_user\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}},\"user_defined_fields\":{\"data\":[{\"type\":\"user_defined_field\",\"id\":\"33457d2a-570c-5567-b4af-979a2a8f1164\"},{\"type\":\"user_defined_field\",\"id\":\"d003693c-bee9-5420-8d46-859269c20914\"},{\"type\":\"user_defined_field\",\"id\":\"1ddff6f6-cb1f-51a0-9d81-dc18ef52cc9d\"},{\"type\":\"user_defined_field\",\"id\":\"6bc9d32b-c2cd-591e-9b7a-74c886a5ddcf\"},{\"type\":\"user_defined_field\",\"id\":\"95c53547-2ba3-5d8a-9c3b-cf245bc0c629\"},{\"type\":\"user_defined_field\",\"id\":\"39044b03-cee4-555f-b1e0-3eb3aa759a86\"},{\"type\":\"user_defined_field\",\"id\":\"3cbe9e60-d794-532c-acc0-73641f782813\"}]},\"integrations\":{\"data\":[]},\"attachments\":{\"data\":[]},\"responders\":{\"data\":[]},\"impacts\":{\"data\":[]}}}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5f129fcb-16ec-5ebc-217b-54052a230b5b" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/incidents/81b6cd9f-526a-5a08-a204-ac402f36ea5f/impacts", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8f814345-de93-c4e7-c12b-8cf664443dd9" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/81b6cd9f-526a-5a08-a204-ac402f36ea5f", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e111a468-7e7f-1c95-ea86-148f7a31af2f" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index a4872ca4d57..06f7f855c1a 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -329,6 +329,22 @@ "tag": "Incidents", "operationId": "UpdateIncidentAttachments" }, + { + "operationId": "CreateIncidentImpact", + "parameters": [ + { + "name": "incident_id", + "source": "incident.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"incident_impacts\",\n \"attributes\": {\n \"start_at\": \"2025-09-12T13:50:00.000Z\",\n \"end_at\": \"2025-09-12T14:50:00.000Z\",\n \"description\": \"Outage in the us-east-1 region\"\n }\n }\n}" + } + ], + "step": "the \"incident\" has an \"incident_impact\"", + "key": "incident_impact", + "tag": "Incidents" + }, { "parameters": [ { 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 4f278f28160..74ae965968f 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 @@ -35,6 +35,36 @@ Feature: Incidents And the response "data[0].attributes.attachment_type" is equal to "link" And the response "data[0].attributes.attachment.documentUrl" is equal to "https://www.example.com/doc" + @skip @team:DataDog/incident-app + Scenario: Create an incident impact returns "Bad Request" response + Given operation "CreateIncidentImpact" enabled + And new "CreateIncidentImpact" request + And request contains "incident_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/incident-app + Scenario: Create an incident impact returns "CREATED" response + Given there is a valid "incident" in the system + And operation "CreateIncidentImpact" enabled + And new "CreateIncidentImpact" request + And request contains "incident_id" parameter from "incident.data.id" + And body with value {"data": {"type": "incident_impacts", "attributes": {"start_at": "2025-09-12T13:50:00.000Z", "end_at": "2025-09-12T14:50:00.000Z", "description": "Outage in the us-east-1 region"}}} + When the request is sent + Then the response status is 201 CREATED + And the response "data.type" is equal to "incident_impacts" + And the response "data.relationships.incident.data.id" has the same value as "incident.data.id" + + @skip @team:DataDog/incident-app + Scenario: Create an incident impact returns "Not Found" response + Given operation "CreateIncidentImpact" enabled + And new "CreateIncidentImpact" request + And request contains "incident_id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Create an incident integration metadata returns "Bad Request" response Given operation "CreateIncidentIntegration" enabled @@ -295,6 +325,26 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @skip @team:DataDog/incident-app + Scenario: Delete an incident impact returns "No Content" response + Given there is a valid "incident" in the system + And the "incident" has an "incident_impact" + And operation "DeleteIncidentImpact" enabled + And new "DeleteIncidentImpact" request + And request contains "incident_id" parameter from "incident_impact.data.relationships.incident.data.id" + And request contains "impact_id" parameter from "incident_impact.data.id" + When the request is sent + Then the response status is 204 No Content + + @skip @team:DataDog/incident-app + Scenario: Delete an incident impact returns "Not Found" response + Given operation "DeleteIncidentImpact" enabled + And new "DeleteIncidentImpact" request + And request contains "incident_id" parameter with value "00000000-0000-0000-0000-000000000001" + And request contains "impact_id" parameter with value "00000000-0000-0000-0000-000000000001" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Delete an incident integration metadata returns "Bad Request" response Given operation "DeleteIncidentIntegration" enabled @@ -754,6 +804,31 @@ Feature: Incidents Then the response status is 200 OK And the response "data.attributes.title" has the same value as "incident.data.attributes.title" + @generated @skip @team:DataDog/incident-app + Scenario: List an incident's impacts returns "Bad Request" response + Given operation "ListIncidentImpacts" enabled + And new "ListIncidentImpacts" request + And request contains "incident_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: List an incident's impacts returns "Not Found" response + Given operation "ListIncidentImpacts" enabled + And new "ListIncidentImpacts" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/incident-app + Scenario: List an incident's impacts returns "OK" response + Given there is a valid "incident" in the system + And operation "ListIncidentImpacts" enabled + And new "ListIncidentImpacts" request + And request contains "incident_id" parameter from "incident.data.id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app Scenario: List incident notification rules returns "Bad Request" response Given operation "ListIncidentNotificationRules" enabled 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 9aa936bc995..b2fe236d004 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 @@ -1297,6 +1297,35 @@ "type": "idempotent" } }, + "ListIncidentImpacts": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentImpact": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentImpact", + "parameters": [ + { + "name": "incident_id", + "source": "data.relationships.incident.data.id" + }, + { + "name": "impact_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentImpact": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListIncidentIntegrations": { "tag": "Incidents", "undo": {