From 9c81975e3d82ebd8352bc3cd6bdcd33c7a8b479e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 17 Sep 2025 17:22:01 +0000 Subject: [PATCH] Regenerate client from commit 9a71e9d of spec repo --- .generator/schemas/v2/openapi.yaml | 341 ++++++++++++++++++ ...impact-returns-Bad-Request-response.frozen | 1 + ...nt-impact-returns-Bad-Request-response.yml | 26 ++ ...ent-impact-returns-CREATED-response.frozen | 1 + ...cident-impact-returns-CREATED-response.yml | 83 +++++ ...t-impact-returns-Not-Found-response.frozen | 1 + ...dent-impact-returns-Not-Found-response.yml | 26 ++ ...-impact-returns-No-Content-response.frozen | 1 + ...ent-impact-returns-No-Content-response.yml | 102 ++++++ ...und-response-different-invalid-IDs-.frozen | 1 + ...-Found-response-different-invalid-IDs-.yml | 21 ++ ...sponse-invalid-incident-and-impact-.frozen | 1 + ...-response-invalid-incident-and-impact-.yml | 21 ++ ...t-impact-returns-Not-Found-response.frozen | 1 + ...dent-impact-returns-Not-Found-response.yml | 21 ++ ...ident-s-impacts-returns-OK-response.frozen | 1 + ...incident-s-impacts-returns-OK-response.yml | 62 ++++ examples/v2/incidents/CreateIncidentImpact.rb | 22 ++ examples/v2/incidents/DeleteIncidentImpact.rb | 12 + examples/v2/incidents/ListIncidentImpacts.rb | 11 + features/scenarios_model_mapping.rb | 13 + features/v2/given.json | 16 + features/v2/incidents.feature | 75 ++++ features/v2/undo.json | 29 ++ lib/datadog_api_client/configuration.rb | 3 + lib/datadog_api_client/inflector.rb | 12 + .../v2/api/incidents_api.rb | 229 ++++++++++++ .../v2/models/incident_impact_attributes.rb | 203 +++++++++++ .../incident_impact_create_attributes.rb | 173 +++++++++ .../v2/models/incident_impact_create_data.rb | 144 ++++++++ .../models/incident_impact_create_request.rb | 123 +++++++ .../models/incident_impact_related_object.rb | 28 ++ .../models/incident_impact_relationships.rb | 125 +++++++ .../v2/models/incident_impact_response.rb | 135 +++++++ .../models/incident_impact_response_data.rb | 164 +++++++++ .../v2/models/incident_impact_type.rb | 26 ++ .../v2/models/incident_impacts_response.rb | 137 +++++++ .../v2/models/incident_response_attributes.rb | 34 +- .../models/incident_response_relationships.rb | 12 +- .../v2/models/relationship_to_incident.rb | 123 +++++++ .../models/relationship_to_incident_data.rb | 144 ++++++++ 41 files changed, 2702 insertions(+), 2 deletions(-) create mode 100644 cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.frozen create mode 100644 cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.yml create mode 100644 cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.frozen create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.yml create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.frozen create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.yml create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.frozen create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.yml create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.frozen create mode 100644 cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.yml create mode 100644 examples/v2/incidents/CreateIncidentImpact.rb create mode 100644 examples/v2/incidents/DeleteIncidentImpact.rb create mode 100644 examples/v2/incidents/ListIncidentImpacts.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_create_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_related_object.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_response.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impact_type.rb create mode 100644 lib/datadog_api_client/v2/models/incident_impacts_response.rb create mode 100644 lib/datadog_api_client/v2/models/relationship_to_incident.rb create mode 100644 lib/datadog_api_client/v2/models/relationship_to_incident_data.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 42b12a3fb056..4ed0b352040f 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/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.frozen b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..0016a9985ba0 --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-09-16T19:46:43.553Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.yml b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..8c15a5394d60 --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Bad-Request-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 19:46:43 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000000/impacts + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Bad Request","detail":"invalid impact data: incident + id is required: invalid impact"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.frozen b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.frozen new file mode 100644 index 000000000000..aa2f3172f89c --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.frozen @@ -0,0 +1 @@ +2025-09-16T19:46:53.892Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.yml b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.yml new file mode 100644 index 000000000000..b3f6acd773a5 --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-CREATED-response.yml @@ -0,0 +1,83 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 19:46:53 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Create_an_incident_impact_returns_CREATED_response-1758052013"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"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":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Sep 2025 19:46:53 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/5826fc99-ad8c-54cb-8c18-cd270bfe42fb/impacts + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Sep 2025 19:46:53 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/5826fc99-ad8c-54cb-8c18-cd270bfe42fb/impacts/7d4f5663-7c01-4727-b90b-323953603092 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 16 Sep 2025 19:46:53 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/5826fc99-ad8c-54cb-8c18-cd270bfe42fb + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.frozen b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..112e404d116c --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:06.306Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.yml b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.yml new file mode 100644 index 000000000000..b65aa85b4cbe --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-impact-returns-Not-Found-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 19:47:06 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000001/impacts + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.frozen b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.frozen new file mode 100644 index 000000000000..69564fd4b002 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:17.707Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.yml b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.yml new file mode 100644 index 000000000000..7f24235e1265 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-No-Content-response.yml @@ -0,0 +1,102 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 19:47:17 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Delete_an_incident_impact_returns_No_Content_response-1758052037"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"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":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Sep 2025 19:47:17 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Sep 2025 19:47:17 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts/db11b25d-0383-4f98-bde7-bfc4a10d16eb + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 16 Sep 2025 19:47:17 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1/impacts/db11b25d-0383-4f98-bde7-bfc4a10d16eb + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- recorded_at: Tue, 16 Sep 2025 19:47:17 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/1a838ffb-9c95-5df6-978c-4cf21f854fd1 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.frozen b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.frozen new file mode 100644 index 000000000000..81d2f935c844 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.frozen @@ -0,0 +1 @@ +2025-09-16T14:11:22.028Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.yml b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.yml new file mode 100644 index 000000000000..10fabf13cc65 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-different-invalid-IDs-.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 14:11:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000002/impacts/00000000-0000-0000-0000-000000000002 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.frozen b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.frozen new file mode 100644 index 000000000000..17375a815d2b --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.frozen @@ -0,0 +1 @@ +2025-09-16T14:11:00.035Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.yml b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.yml new file mode 100644 index 000000000000..8fa59d9c0061 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response-invalid-incident-and-impact-.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 14:11:00 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000000/impacts/00000000-0000-0000-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.frozen b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..849419447113 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:29.411Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.yml b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.yml new file mode 100644 index 000000000000..df7667871e69 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-impact-returns-Not-Found-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 19:47:29 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/00000000-0000-0000-0000-000000000001/impacts/00000000-0000-0000-0000-000000000001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"rpc error: code = NotFound + desc = impact not found: impact not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.frozen b/cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.frozen new file mode 100644 index 000000000000..55431a90fb8c --- /dev/null +++ b/cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-09-16T19:47:40.461Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.yml b/cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.yml new file mode 100644 index 000000000000..07ee9cebf412 --- /dev/null +++ b/cassettes/features/v2/incidents/List-an-incident-s-impacts-returns-OK-response.yml @@ -0,0 +1,62 @@ +http_interactions: +- recorded_at: Tue, 16 Sep 2025 19:47:40 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-List_an_incident_s_impacts_returns_OK_response-1758052060"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"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":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 16 Sep 2025 19:47:40 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/81b6cd9f-526a-5a08-a204-ac402f36ea5f/impacts + response: + body: + encoding: UTF-8 + string: '{"data":[]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 16 Sep 2025 19:47:40 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/81b6cd9f-526a-5a08-a204-ac402f36ea5f + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/incidents/CreateIncidentImpact.rb b/examples/v2/incidents/CreateIncidentImpact.rb new file mode 100644 index 000000000000..62b75045601f --- /dev/null +++ b/examples/v2/incidents/CreateIncidentImpact.rb @@ -0,0 +1,22 @@ +# Create an incident impact returns "CREATED" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_impact".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] + +body = DatadogAPIClient::V2::IncidentImpactCreateRequest.new({ + data: DatadogAPIClient::V2::IncidentImpactCreateData.new({ + type: DatadogAPIClient::V2::IncidentImpactType::INCIDENT_IMPACTS, + attributes: DatadogAPIClient::V2::IncidentImpactCreateAttributes.new({ + start_at: "2025-09-12T13:50:00.000Z", + end_at: "2025-09-12T14:50:00.000Z", + description: "Outage in the us-east-1 region", + }), + }), +}) +p api_instance.create_incident_impact(INCIDENT_DATA_ID, body) diff --git a/examples/v2/incidents/DeleteIncidentImpact.rb b/examples/v2/incidents/DeleteIncidentImpact.rb new file mode 100644 index 000000000000..057874993ad0 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentImpact.rb @@ -0,0 +1,12 @@ +# Delete an incident impact returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_incident_impact".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# the "incident" has an "incident_impact" +INCIDENT_IMPACT_DATA_ID = ENV["INCIDENT_IMPACT_DATA_ID"] +INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID = ENV["INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID"] +api_instance.delete_incident_impact(INCIDENT_IMPACT_DATA_RELATIONSHIPS_INCIDENT_DATA_ID, INCIDENT_IMPACT_DATA_ID) diff --git a/examples/v2/incidents/ListIncidentImpacts.rb b/examples/v2/incidents/ListIncidentImpacts.rb new file mode 100644 index 000000000000..973d63c60a91 --- /dev/null +++ b/examples/v2/incidents/ListIncidentImpacts.rb @@ -0,0 +1,11 @@ +# List an incident's impacts returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_incident_impacts".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] +p api_instance.list_incident_impacts(INCIDENT_DATA_ID) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index a6a1bc93e8cb..e91830c2e666 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1869,6 +1869,19 @@ "include" => "Array", "body" => "IncidentAttachmentUpdateRequest", }, + "v2.ListIncidentImpacts" => { + "incident_id" => "String", + "include" => "Array", + }, + "v2.CreateIncidentImpact" => { + "incident_id" => "String", + "include" => "Array", + "body" => "IncidentImpactCreateRequest", + }, + "v2.DeleteIncidentImpact" => { + "incident_id" => "String", + "impact_id" => "String", + }, "v2.ListIncidentIntegrations" => { "incident_id" => "String", }, diff --git a/features/v2/given.json b/features/v2/given.json index a4872ca4d572..06f7f855c1a1 100644 --- a/features/v2/given.json +++ b/features/v2/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/features/v2/incidents.feature b/features/v2/incidents.feature index 4f278f281608..74ae965968fd 100644 --- a/features/v2/incidents.feature +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 9aa936bc9951..b2fe236d0042 100644 --- a/features/v2/undo.json +++ b/features/v2/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": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 533ac41e0d40..758ac77f7a99 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -221,12 +221,14 @@ def initialize "v2.create_data_deletion_request": false, "v2.get_data_deletion_requests": false, "v2.create_incident": false, + "v2.create_incident_impact": false, "v2.create_incident_integration": false, "v2.create_incident_notification_rule": false, "v2.create_incident_notification_template": false, "v2.create_incident_todo": false, "v2.create_incident_type": false, "v2.delete_incident": false, + "v2.delete_incident_impact": false, "v2.delete_incident_integration": false, "v2.delete_incident_notification_rule": false, "v2.delete_incident_notification_template": false, @@ -239,6 +241,7 @@ def initialize "v2.get_incident_todo": false, "v2.get_incident_type": false, "v2.list_incident_attachments": false, + "v2.list_incident_impacts": false, "v2.list_incident_integrations": false, "v2.list_incident_notification_rules": false, "v2.list_incident_notification_templates": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 763235d23329..f0a2f2a1c1f6 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2161,7 +2161,17 @@ def overrides "v2.incident_field_attributes_single_value" => "IncidentFieldAttributesSingleValue", "v2.incident_field_attributes_single_value_type" => "IncidentFieldAttributesSingleValueType", "v2.incident_field_attributes_value_type" => "IncidentFieldAttributesValueType", + "v2.incident_impact_attributes" => "IncidentImpactAttributes", + "v2.incident_impact_create_attributes" => "IncidentImpactCreateAttributes", + "v2.incident_impact_create_data" => "IncidentImpactCreateData", + "v2.incident_impact_create_request" => "IncidentImpactCreateRequest", + "v2.incident_impact_related_object" => "IncidentImpactRelatedObject", + "v2.incident_impact_relationships" => "IncidentImpactRelationships", + "v2.incident_impact_response" => "IncidentImpactResponse", + "v2.incident_impact_response_data" => "IncidentImpactResponseData", + "v2.incident_impacts_response" => "IncidentImpactsResponse", "v2.incident_impacts_type" => "IncidentImpactsType", + "v2.incident_impact_type" => "IncidentImpactType", "v2.incident_integration_metadata_attributes" => "IncidentIntegrationMetadataAttributes", "v2.incident_integration_metadata_create_data" => "IncidentIntegrationMetadataCreateData", "v2.incident_integration_metadata_create_request" => "IncidentIntegrationMetadataCreateRequest", @@ -3119,8 +3129,10 @@ def overrides "v2.relation_response_meta" => "RelationResponseMeta", "v2.relation_response_type" => "RelationResponseType", "v2.relationship_item" => "RelationshipItem", + "v2.relationship_to_incident" => "RelationshipToIncident", "v2.relationship_to_incident_attachment" => "RelationshipToIncidentAttachment", "v2.relationship_to_incident_attachment_data" => "RelationshipToIncidentAttachmentData", + "v2.relationship_to_incident_data" => "RelationshipToIncidentData", "v2.relationship_to_incident_impact_data" => "RelationshipToIncidentImpactData", "v2.relationship_to_incident_impacts" => "RelationshipToIncidentImpacts", "v2.relationship_to_incident_integration_metadata_data" => "RelationshipToIncidentIntegrationMetadataData", diff --git a/lib/datadog_api_client/v2/api/incidents_api.rb b/lib/datadog_api_client/v2/api/incidents_api.rb index b586257da8c9..32466309cba4 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -96,6 +96,86 @@ def create_incident_with_http_info(body, opts = {}) return data, status_code, headers end + # Create an incident impact. + # + # @see #create_incident_impact_with_http_info + def create_incident_impact(incident_id, body, opts = {}) + data, _status_code, _headers = create_incident_impact_with_http_info(incident_id, body, opts) + data + end + + # Create an incident impact. + # + # Create an impact for an incident. + # + # @param incident_id [String] The UUID of the incident. + # @param body [IncidentImpactCreateRequest] Incident impact payload. + # @param opts [Hash] the optional parameters + # @option opts [Array] :include Specifies which related resources should be included in the response. + # @return [Array<(IncidentImpactResponse, Integer, Hash)>] IncidentImpactResponse data, response status code and response headers + def create_incident_impact_with_http_info(incident_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_impact".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_impact") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_impact")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_impact ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.create_incident_impact" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.create_incident_impact" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/impacts'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'IncidentImpactResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_incident_impact, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#create_incident_impact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create an incident integration metadata. # # @see #create_incident_integration_with_http_info @@ -542,6 +622,82 @@ def delete_incident_with_http_info(incident_id, opts = {}) return data, status_code, headers end + # Delete an incident impact. + # + # @see #delete_incident_impact_with_http_info + def delete_incident_impact(incident_id, impact_id, opts = {}) + delete_incident_impact_with_http_info(incident_id, impact_id, opts) + nil + end + + # Delete an incident impact. + # + # Delete an incident impact. + # + # @param incident_id [String] The UUID of the incident. + # @param impact_id [String] The UUID of the incident impact. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_incident_impact_with_http_info(incident_id, impact_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_incident_impact".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_incident_impact") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_incident_impact")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.delete_incident_impact ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.delete_incident_impact" + end + # verify the required parameter 'impact_id' is set + if @api_client.config.client_side_validation && impact_id.nil? + fail ArgumentError, "Missing the required parameter 'impact_id' when calling IncidentsAPI.delete_incident_impact" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/impacts/{impact_id}'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')).sub('{impact_id}', CGI.escape(impact_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_incident_impact, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#delete_incident_impact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete an incident integration metadata. # # @see #delete_incident_integration_with_http_info @@ -1428,6 +1584,79 @@ def list_incident_attachments_with_http_info(incident_id, opts = {}) return data, status_code, headers end + # List an incident's impacts. + # + # @see #list_incident_impacts_with_http_info + def list_incident_impacts(incident_id, opts = {}) + data, _status_code, _headers = list_incident_impacts_with_http_info(incident_id, opts) + data + end + + # List an incident's impacts. + # + # Get all impacts for an incident. + # + # @param incident_id [String] The UUID of the incident. + # @param opts [Hash] the optional parameters + # @option opts [Array] :include Specifies which related resources should be included in the response. + # @return [Array<(IncidentImpactsResponse, Integer, Hash)>] IncidentImpactsResponse data, response status code and response headers + def list_incident_impacts_with_http_info(incident_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_incident_impacts".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_incident_impacts") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_incident_impacts")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.list_incident_impacts ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.list_incident_impacts" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/impacts'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IncidentImpactsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_incident_impacts, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#list_incident_impacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a list of an incident's integration metadata. # # @see #list_incident_integrations_with_http_info diff --git a/lib/datadog_api_client/v2/models/incident_impact_attributes.rb b/lib/datadog_api_client/v2/models/incident_impact_attributes.rb new file mode 100644 index 000000000000..a4fda06e19ba --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_attributes.rb @@ -0,0 +1,203 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The incident impact's attributes. + class IncidentImpactAttributes + include BaseGenericModel + + # Timestamp when the impact was created. + attr_accessor :created + + # Description of the impact. + attr_reader :description + + # Timestamp when the impact ended. + attr_accessor :end_at + + # An object mapping impact field names to field values. + attr_accessor :fields + + # The type of impact. + attr_accessor :impact_type + + # Timestamp when the impact was last modified. + attr_accessor :modified + + # Timestamp representing when the impact started. + attr_reader :start_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created' => :'created', + :'description' => :'description', + :'end_at' => :'end_at', + :'fields' => :'fields', + :'impact_type' => :'impact_type', + :'modified' => :'modified', + :'start_at' => :'start_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created' => :'Time', + :'description' => :'String', + :'end_at' => :'Time', + :'fields' => :'Hash', + :'impact_type' => :'String', + :'modified' => :'Time', + :'start_at' => :'Time' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'end_at', + :'fields', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'end_at') + self.end_at = attributes[:'end_at'] + end + + if attributes.key?(:'fields') + self.fields = attributes[:'fields'] + end + + if attributes.key?(:'impact_type') + self.impact_type = attributes[:'impact_type'] + end + + if attributes.key?(:'modified') + self.modified = attributes[:'modified'] + end + + if attributes.key?(:'start_at') + self.start_at = attributes[:'start_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @start_at.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param start_at [Object] Object to be assigned + # @!visibility private + def start_at=(start_at) + if start_at.nil? + fail ArgumentError, 'invalid value for "start_at", start_at cannot be nil.' + end + @start_at = start_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created == o.created && + description == o.description && + end_at == o.end_at && + fields == o.fields && + impact_type == o.impact_type && + modified == o.modified && + start_at == o.start_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created, description, end_at, fields, impact_type, modified, start_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_create_attributes.rb b/lib/datadog_api_client/v2/models/incident_impact_create_attributes.rb new file mode 100644 index 000000000000..05dd5576cf99 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_create_attributes.rb @@ -0,0 +1,173 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The incident impact's attributes for a create request. + class IncidentImpactCreateAttributes + include BaseGenericModel + + # Description of the impact. + attr_reader :description + + # Timestamp when the impact ended. + attr_accessor :end_at + + # An object mapping impact field names to field values. + attr_accessor :fields + + # Timestamp when the impact started. + attr_reader :start_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'end_at' => :'end_at', + :'fields' => :'fields', + :'start_at' => :'start_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'end_at' => :'Time', + :'fields' => :'Hash', + :'start_at' => :'Time' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'end_at', + :'fields', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'end_at') + self.end_at = attributes[:'end_at'] + end + + if attributes.key?(:'fields') + self.fields = attributes[:'fields'] + end + + if attributes.key?(:'start_at') + self.start_at = attributes[:'start_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @start_at.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param start_at [Object] Object to be assigned + # @!visibility private + def start_at=(start_at) + if start_at.nil? + fail ArgumentError, 'invalid value for "start_at", start_at cannot be nil.' + end + @start_at = start_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + end_at == o.end_at && + fields == o.fields && + start_at == o.start_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, end_at, fields, start_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_create_data.rb b/lib/datadog_api_client/v2/models/incident_impact_create_data.rb new file mode 100644 index 000000000000..5436f57b62f6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident impact data for a create request. + class IncidentImpactCreateData + include BaseGenericModel + + # The incident impact's attributes for a create request. + attr_reader :attributes + + # Incident impact resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentImpactCreateAttributes', + :'type' => :'IncidentImpactType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_create_request.rb b/lib/datadog_api_client/v2/models/incident_impact_create_request.rb new file mode 100644 index 000000000000..5fa0f4e88e84 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Create request for an incident impact. + class IncidentImpactCreateRequest + include BaseGenericModel + + # Incident impact data for a create request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentImpactCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_related_object.rb b/lib/datadog_api_client/v2/models/incident_impact_related_object.rb new file mode 100644 index 000000000000..3ccbca82f012 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_related_object.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A reference to a resource related to an incident impact. + class IncidentImpactRelatedObject + include BaseEnumModel + + INCIDENT = "incident".freeze + CREATED_BY_USER = "created_by_user".freeze + LAST_MODIFIED_BY_USER = "last_modified_by_user".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_relationships.rb b/lib/datadog_api_client/v2/models/incident_impact_relationships.rb new file mode 100644 index 000000000000..95b641a55cda --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_relationships.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The incident impact's resource relationships. + class IncidentImpactRelationships + include BaseGenericModel + + # Relationship to user. + attr_accessor :created_by_user + + # Relationship to incident. + attr_accessor :incident + + # Relationship to user. + attr_accessor :last_modified_by_user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_by_user' => :'created_by_user', + :'incident' => :'incident', + :'last_modified_by_user' => :'last_modified_by_user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_by_user' => :'RelationshipToUser', + :'incident' => :'RelationshipToIncident', + :'last_modified_by_user' => :'RelationshipToUser' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_by_user') + self.created_by_user = attributes[:'created_by_user'] + end + + if attributes.key?(:'incident') + self.incident = attributes[:'incident'] + end + + if attributes.key?(:'last_modified_by_user') + self.last_modified_by_user = attributes[:'last_modified_by_user'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_by_user == o.created_by_user && + incident == o.incident && + last_modified_by_user == o.last_modified_by_user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_by_user, incident, last_modified_by_user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_response.rb b/lib/datadog_api_client/v2/models/incident_impact_response.rb new file mode 100644 index 000000000000..70d060f02c99 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_response.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response with an incident impact. + class IncidentImpactResponse + include BaseGenericModel + + # Incident impact data from a response. + attr_reader :data + + # Included related resources that the user requested. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentImpactResponseData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_response_data.rb b/lib/datadog_api_client/v2/models/incident_impact_response_data.rb new file mode 100644 index 000000000000..02a6c08c650a --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_response_data.rb @@ -0,0 +1,164 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident impact data from a response. + class IncidentImpactResponseData + include BaseGenericModel + + # The incident impact's attributes. + attr_accessor :attributes + + # The incident impact's ID. + attr_reader :id + + # The incident impact's resource relationships. + attr_accessor :relationships + + # Incident impact resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentImpactAttributes', + :'id' => :'String', + :'relationships' => :'IncidentImpactRelationships', + :'type' => :'IncidentImpactType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impact_type.rb b/lib/datadog_api_client/v2/models/incident_impact_type.rb new file mode 100644 index 000000000000..dfee24e47251 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impact_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident impact resource type. + class IncidentImpactType + include BaseEnumModel + + INCIDENT_IMPACTS = "incident_impacts".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_impacts_response.rb b/lib/datadog_api_client/v2/models/incident_impacts_response.rb new file mode 100644 index 000000000000..e26f9de38ad9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_impacts_response.rb @@ -0,0 +1,137 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response with a list of incident impacts. + class IncidentImpactsResponse + include BaseGenericModel + + # An array of incident impacts. + attr_reader :data + + # Included related resources that the user requested. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentImpactsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_response_attributes.rb b/lib/datadog_api_client/v2/models/incident_response_attributes.rb index daeb23185316..9d32cae825d3 100644 --- a/lib/datadog_api_client/v2/models/incident_response_attributes.rb +++ b/lib/datadog_api_client/v2/models/incident_response_attributes.rb @@ -46,6 +46,15 @@ class IncidentResponseAttributes # A flag indicating whether the incident caused customer impact. attr_accessor :customer_impacted + # Timestamp when the incident was declared. + attr_accessor :declared + + # Incident's non Datadog creator. + attr_accessor :declared_by + + # UUID of the user who declared the incident. + attr_accessor :declared_by_uuid + # Timestamp when the incident was detected. attr_accessor :detected @@ -112,6 +121,9 @@ def self.attribute_map :'customer_impact_scope' => :'customer_impact_scope', :'customer_impact_start' => :'customer_impact_start', :'customer_impacted' => :'customer_impacted', + :'declared' => :'declared', + :'declared_by' => :'declared_by', + :'declared_by_uuid' => :'declared_by_uuid', :'detected' => :'detected', :'fields' => :'fields', :'incident_type_uuid' => :'incident_type_uuid', @@ -144,6 +156,9 @@ def self.openapi_types :'customer_impact_scope' => :'String', :'customer_impact_start' => :'Time', :'customer_impacted' => :'Boolean', + :'declared' => :'Time', + :'declared_by' => :'IncidentNonDatadogCreator', + :'declared_by_uuid' => :'String', :'detected' => :'Time', :'fields' => :'Hash', :'incident_type_uuid' => :'String', @@ -173,6 +188,8 @@ def self.openapi_nullable :'customer_impact_end', :'customer_impact_scope', :'customer_impact_start', + :'declared_by', + :'declared_by_uuid', :'detected', :'non_datadog_creator', :'notification_handles', @@ -232,6 +249,18 @@ def initialize(attributes = {}) self.customer_impacted = attributes[:'customer_impacted'] end + if attributes.key?(:'declared') + self.declared = attributes[:'declared'] + end + + if attributes.key?(:'declared_by') + self.declared_by = attributes[:'declared_by'] + end + + if attributes.key?(:'declared_by_uuid') + self.declared_by_uuid = attributes[:'declared_by_uuid'] + end + if attributes.key?(:'detected') self.detected = attributes[:'detected'] end @@ -355,6 +384,9 @@ def ==(o) customer_impact_scope == o.customer_impact_scope && customer_impact_start == o.customer_impact_start && customer_impacted == o.customer_impacted && + declared == o.declared && + declared_by == o.declared_by && + declared_by_uuid == o.declared_by_uuid && detected == o.detected && fields == o.fields && incident_type_uuid == o.incident_type_uuid && @@ -379,7 +411,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [archived, case_id, created, customer_impact_duration, customer_impact_end, customer_impact_scope, customer_impact_start, customer_impacted, detected, fields, incident_type_uuid, is_test, modified, non_datadog_creator, notification_handles, public_id, resolved, severity, state, time_to_detect, time_to_internal_response, time_to_repair, time_to_resolve, title, visibility, additional_properties].hash + [archived, case_id, created, customer_impact_duration, customer_impact_end, customer_impact_scope, customer_impact_start, customer_impacted, declared, declared_by, declared_by_uuid, detected, fields, incident_type_uuid, is_test, modified, non_datadog_creator, notification_handles, public_id, resolved, severity, state, time_to_detect, time_to_internal_response, time_to_repair, time_to_resolve, title, visibility, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/incident_response_relationships.rb b/lib/datadog_api_client/v2/models/incident_response_relationships.rb index aa1bfcc0ad2c..9e59881c10af 100644 --- a/lib/datadog_api_client/v2/models/incident_response_relationships.rb +++ b/lib/datadog_api_client/v2/models/incident_response_relationships.rb @@ -30,6 +30,9 @@ class IncidentResponseRelationships # Relationship to user. attr_accessor :created_by_user + # Relationship to user. + attr_accessor :declared_by_user + # Relationship to impacts. attr_accessor :impacts @@ -54,6 +57,7 @@ def self.attribute_map :'attachments' => :'attachments', :'commander_user' => :'commander_user', :'created_by_user' => :'created_by_user', + :'declared_by_user' => :'declared_by_user', :'impacts' => :'impacts', :'integrations' => :'integrations', :'last_modified_by_user' => :'last_modified_by_user', @@ -69,6 +73,7 @@ def self.openapi_types :'attachments' => :'RelationshipToIncidentAttachment', :'commander_user' => :'NullableRelationshipToUser', :'created_by_user' => :'RelationshipToUser', + :'declared_by_user' => :'RelationshipToUser', :'impacts' => :'RelationshipToIncidentImpacts', :'integrations' => :'RelationshipToIncidentIntegrationMetadatas', :'last_modified_by_user' => :'RelationshipToUser', @@ -115,6 +120,10 @@ def initialize(attributes = {}) self.created_by_user = attributes[:'created_by_user'] end + if attributes.key?(:'declared_by_user') + self.declared_by_user = attributes[:'declared_by_user'] + end + if attributes.key?(:'impacts') self.impacts = attributes[:'impacts'] end @@ -165,6 +174,7 @@ def ==(o) attachments == o.attachments && commander_user == o.commander_user && created_by_user == o.created_by_user && + declared_by_user == o.declared_by_user && impacts == o.impacts && integrations == o.integrations && last_modified_by_user == o.last_modified_by_user && @@ -177,7 +187,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [attachments, commander_user, created_by_user, impacts, integrations, last_modified_by_user, responders, user_defined_fields, additional_properties].hash + [attachments, commander_user, created_by_user, declared_by_user, impacts, integrations, last_modified_by_user, responders, user_defined_fields, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/relationship_to_incident.rb b/lib/datadog_api_client/v2/models/relationship_to_incident.rb new file mode 100644 index 000000000000..e1ff4821b493 --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_incident.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship to incident. + class RelationshipToIncident + include BaseGenericModel + + # Relationship to incident object. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'RelationshipToIncidentData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RelationshipToIncident` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/relationship_to_incident_data.rb b/lib/datadog_api_client/v2/models/relationship_to_incident_data.rb new file mode 100644 index 000000000000..332df1db4394 --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_incident_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship to incident object. + class RelationshipToIncidentData + include BaseGenericModel + + # A unique identifier that represents the incident. + attr_reader :id + + # Incident resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'IncidentType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RelationshipToIncidentData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end