From 57bd8440797f9344fb8c11983bfb6525cebf358d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 20 Jun 2025 13:49:46 +0000 Subject: [PATCH] Regenerate client from commit 78730ba3 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 316 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 126 +++++++ examples/v2/events/GetEvent.py | 15 + src/datadog_api_client/v2/api/events_api.py | 41 +++ .../v2/model/alert_event_attributes.py | 106 ++++++ .../alert_event_attributes_links_item.py | 66 ++++ ...rt_event_attributes_links_item_category.py | 41 +++ .../model/alert_event_attributes_priority.py | 47 +++ .../v2/model/change_event_attributes.py | 140 ++++++++ .../model/change_event_attributes_author.py | 54 +++ .../change_event_attributes_author_type.py | 38 +++ ...hange_event_attributes_changed_resource.py | 58 ++++ ..._event_attributes_changed_resource_type.py | 38 +++ ...vent_attributes_impacted_resources_item.py | 58 ++++ ...attributes_impacted_resources_item_type.py | 35 ++ .../v2/model/event_system_attributes.py | 82 +++++ .../model/event_system_attributes_category.py | 38 +++ .../event_system_attributes_integration_id.py | 35 ++ src/datadog_api_client/v2/model/v2_event.py | 62 ++++ .../v2/model/v2_event_attributes.py | 72 ++++ .../model/v2_event_attributes_attributes.py | 79 +++++ .../v2/model/v2_event_response.py | 42 +++ src/datadog_api_client/v2/models/__init__.py | 42 +++ tests/v2/features/events.feature | 21 ++ tests/v2/features/undo.json | 6 + 26 files changed, 1662 insertions(+), 4 deletions(-) create mode 100644 examples/v2/events/GetEvent.py create mode 100644 src/datadog_api_client/v2/model/alert_event_attributes.py create mode 100644 src/datadog_api_client/v2/model/alert_event_attributes_links_item.py create mode 100644 src/datadog_api_client/v2/model/alert_event_attributes_links_item_category.py create mode 100644 src/datadog_api_client/v2/model/alert_event_attributes_priority.py create mode 100644 src/datadog_api_client/v2/model/change_event_attributes.py create mode 100644 src/datadog_api_client/v2/model/change_event_attributes_author.py create mode 100644 src/datadog_api_client/v2/model/change_event_attributes_author_type.py create mode 100644 src/datadog_api_client/v2/model/change_event_attributes_changed_resource.py create mode 100644 src/datadog_api_client/v2/model/change_event_attributes_changed_resource_type.py create mode 100644 src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item.py create mode 100644 src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item_type.py create mode 100644 src/datadog_api_client/v2/model/event_system_attributes.py create mode 100644 src/datadog_api_client/v2/model/event_system_attributes_category.py create mode 100644 src/datadog_api_client/v2/model/event_system_attributes_integration_id.py create mode 100644 src/datadog_api_client/v2/model/v2_event.py create mode 100644 src/datadog_api_client/v2/model/v2_event_attributes.py create mode 100644 src/datadog_api_client/v2/model/v2_event_attributes_attributes.py create mode 100644 src/datadog_api_client/v2/model/v2_event_response.py diff --git a/.apigentools-info b/.apigentools-info index 5cc580398d..c598e67875 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-19 12:11:27.987573", - "spec_repo_commit": "a171e0a8" + "regenerated": "2025-06-20 13:49:06.121685", + "spec_repo_commit": "78730ba3" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-19 12:11:28.060491", - "spec_repo_commit": "a171e0a8" + "regenerated": "2025-06-20 13:49:06.153043", + "spec_repo_commit": "78730ba3" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6e5229840f..749f21e95b 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2227,6 +2227,74 @@ components: - id - base_severity type: object + AlertEventAttributes: + description: Alert event attributes. + properties: + aggregation_key: + $ref: '#/components/schemas/V2EventAggregationKey' + custom: + description: JSON object of custom attributes. + example: {} + type: object + evt: + $ref: '#/components/schemas/EventSystemAttributes' + links: + description: The links related to the event. + example: + - category: runbook + title: Runbook Link + url: https://app.datadoghq.com/runbook + items: + $ref: '#/components/schemas/AlertEventAttributesLinksItem' + type: array + priority: + $ref: '#/components/schemas/AlertEventAttributesPriority' + service: + $ref: '#/components/schemas/V2EventService' + timestamp: + $ref: '#/components/schemas/V2EventTimestamp' + title: + $ref: '#/components/schemas/V2EventTitle' + type: object + AlertEventAttributesLinksItem: + description: A link. + properties: + category: + $ref: '#/components/schemas/AlertEventAttributesLinksItemCategory' + title: + description: The display text of the link. + type: string + url: + description: The URL of the link. + type: string + type: object + AlertEventAttributesLinksItemCategory: + description: The category of the link. + enum: + - runbook + - documentation + - dashboard + type: string + x-enum-varnames: + - RUNBOOK + - DOCUMENTATION + - DASHBOARD + AlertEventAttributesPriority: + description: The priority of the alert. + enum: + - '1' + - '2' + - '3' + - '4' + - '5' + example: '5' + type: string + x-enum-varnames: + - PRIORITY_ONE + - PRIORITY_TWO + - PRIORITY_THREE + - PRIORITY_FOUR + - PRIORITY_FIVE AlertEventCustomAttributes: additionalProperties: false description: Alert event attributes. @@ -7009,6 +7077,112 @@ components: format: int64 type: integer type: object + ChangeEventAttributes: + description: Change event attributes. + properties: + aggregation_key: + $ref: '#/components/schemas/V2EventAggregationKey' + author: + $ref: '#/components/schemas/ChangeEventAttributesAuthor' + change_metadata: + description: JSON object of change metadata. + example: + dd: + team: datadog_team + user_email: datadog@datadog.com + user_id: datadog_user_id + user_name: datadog_username + type: object + changed_resource: + $ref: '#/components/schemas/ChangeEventAttributesChangedResource' + evt: + $ref: '#/components/schemas/EventSystemAttributes' + impacted_resources: + description: A list of resources impacted by this change. + example: + - name: service-name + type: service + items: + $ref: '#/components/schemas/ChangeEventAttributesImpactedResourcesItem' + type: array + new_value: + description: The new state of the changed resource. + example: + enabled: true + percentage: 50% + rule: + datacenter: devcycle.us1.prod + type: object + prev_value: + description: The previous state of the changed resource. + example: + enabled: true + percentage: 10% + rule: + datacenter: devcycle.us1.prod + type: object + service: + $ref: '#/components/schemas/V2EventService' + timestamp: + $ref: '#/components/schemas/V2EventTimestamp' + title: + $ref: '#/components/schemas/V2EventTitle' + type: object + ChangeEventAttributesAuthor: + description: The entity that made the change. + properties: + name: + description: The name of the user or system that made the change. + example: example@datadog.com + type: string + type: + $ref: '#/components/schemas/ChangeEventAttributesAuthorType' + type: object + ChangeEventAttributesAuthorType: + description: The type of the author. + enum: + - user + - system + example: user + type: string + x-enum-varnames: + - USER + - SYSTEM + ChangeEventAttributesChangedResource: + description: A uniquely identified resource. + properties: + name: + description: The name of the changed resource. + type: string + type: + $ref: '#/components/schemas/ChangeEventAttributesChangedResourceType' + type: object + ChangeEventAttributesChangedResourceType: + description: The type of the changed resource. + enum: + - feature_flag + - configuration + example: feature_flag + type: string + x-enum-varnames: + - FEATURE_FLAG + - CONFIGURATION + ChangeEventAttributesImpactedResourcesItem: + description: A uniquely identified resource. + properties: + name: + description: The name of the impacted resource. + type: string + type: + $ref: '#/components/schemas/ChangeEventAttributesImpactedResourcesItemType' + type: object + ChangeEventAttributesImpactedResourcesItemType: + description: The type of the impacted resource. + enum: + - service + type: string + x-enum-varnames: + - SERVICE ChangeEventCustomAttributes: additionalProperties: false description: Change event attributes. @@ -14925,6 +15099,44 @@ components: - USER_UPDATE - RECOMMENDATION - SNAPSHOT + EventSystemAttributes: + description: JSON object of event system attributes. + properties: + category: + $ref: '#/components/schemas/EventSystemAttributesCategory' + id: + description: Event identifier. This field is deprecated and will be removed + in a future version. Use the `uid` field instead. + type: string + integration_id: + $ref: '#/components/schemas/EventSystemAttributesIntegrationId' + source_id: + description: The source type ID of the event. + format: int64 + type: integer + uid: + description: A unique identifier for the event. You can use this identifier + to query or reference the event. + type: string + type: object + EventSystemAttributesCategory: + description: Event category identifying the type of event. + enum: + - change + - alert + example: change + type: string + x-enum-varnames: + - CHANGE + - ALERT + EventSystemAttributesIntegrationId: + description: Integration ID sourced from integration manifests. + enum: + - custom-events + example: custom-events + type: string + x-enum-varnames: + - CUSTOM_EVENTS EventType: default: event description: Type of the event. @@ -40580,6 +40792,70 @@ components: type: string x-enum-varnames: - USERS + V2Event: + description: An event object. + properties: + attributes: + $ref: '#/components/schemas/V2EventAttributes' + id: + description: The event's ID. + example: '' + type: string + type: + description: Entity type. + example: event + type: string + type: object + V2EventAggregationKey: + description: Aggregation key of the event. + example: aggregation-key + type: string + V2EventAttributes: + description: Event attributes. + properties: + attributes: + $ref: '#/components/schemas/V2EventAttributesAttributes' + message: + description: Free-formed text associated with the event. + example: The event message + type: string + tags: + description: A list of tags associated with the event. + example: + - env:api_client_test + items: + description: A tag. + type: string + type: array + timestamp: + description: Timestamp when the event occurred. + example: '2017-01-15T01:30:15.010000Z' + type: string + type: object + V2EventAttributesAttributes: + description: JSON object for category-specific attributes. + oneOf: + - $ref: '#/components/schemas/ChangeEventAttributes' + - $ref: '#/components/schemas/AlertEventAttributes' + V2EventResponse: + description: Get an event response. + properties: + data: + $ref: '#/components/schemas/V2Event' + type: object + V2EventService: + description: Service that triggered the event. + example: service-name + type: string + V2EventTimestamp: + description: POSIX timestamp of the event. + example: 175019386627 + format: int64 + type: integer + V2EventTitle: + description: The title of the event. + example: The event title + type: string ValidationError: description: Represents a single validation error, including a human-readable title and metadata. @@ -47374,6 +47650,46 @@ paths: operator: OR permissions: - events_read + /api/v2/events/{event_id}: + get: + description: Get the details of an event by `event_id`. + operationId: GetEvent + parameters: + - description: The UID of the event. + in: path + name: event_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/V2EventResponse' + 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: + - events_read + summary: Get an event + tags: + - Events + x-permission: + operator: OR + permissions: + - events_read /api/v2/incidents: get: description: Get all incidents for the user's organization. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 32fedc94f9..8fbd087188 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -221,6 +221,34 @@ datadog\_api\_client.v2.model.advisory module :members: :show-inheritance: +datadog\_api\_client.v2.model.alert\_event\_attributes module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.alert_event_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.alert\_event\_attributes\_links\_item module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.alert_event_attributes_links_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.alert\_event\_attributes\_links\_item\_category module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.alert_event_attributes_links_item_category + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.alert\_event\_attributes\_priority module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.alert_event_attributes_priority + :members: + :show-inheritance: + datadog\_api\_client.v2.model.alert\_event\_custom\_attributes module --------------------------------------------------------------------- @@ -2167,6 +2195,55 @@ datadog\_api\_client.v2.model.cases\_response\_meta\_pagination module :members: :show-inheritance: +datadog\_api\_client.v2.model.change\_event\_attributes module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.change_event_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.change\_event\_attributes\_author module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.change_event_attributes_author + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.change\_event\_attributes\_author\_type module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.change_event_attributes_author_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.change\_event\_attributes\_changed\_resource module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.change_event_attributes_changed_resource + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.change\_event\_attributes\_changed\_resource\_type module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.change_event_attributes_changed_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.change\_event\_attributes\_impacted\_resources\_item module +----------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.change_event_attributes_impacted_resources_item + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.change\_event\_attributes\_impacted\_resources\_item\_type module +----------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.change_event_attributes_impacted_resources_item_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.change\_event\_custom\_attributes module ---------------------------------------------------------------------- @@ -6073,6 +6150,27 @@ datadog\_api\_client.v2.model.event\_status\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.event\_system\_attributes module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.event_system_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.event\_system\_attributes\_category module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.event_system_attributes_category + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.event\_system\_attributes\_integration\_id module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.event_system_attributes_integration_id + :members: + :show-inheritance: + datadog\_api\_client.v2.model.event\_type module ------------------------------------------------ @@ -17763,6 +17861,34 @@ datadog\_api\_client.v2.model.users\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.v2\_event module +---------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.v2_event + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.v2\_event\_attributes module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.v2_event_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.v2\_event\_attributes\_attributes module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.v2_event_attributes_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.v2\_event\_response module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.v2_event_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.validation\_error module ------------------------------------------------------ diff --git a/examples/v2/events/GetEvent.py b/examples/v2/events/GetEvent.py new file mode 100644 index 0000000000..44ac51f25a --- /dev/null +++ b/examples/v2/events/GetEvent.py @@ -0,0 +1,15 @@ +""" +Get an event returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.events_api import EventsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = EventsApi(api_client) + response = api_instance.get_event( + event_id="AZeF-nTCAABzkAgGXzYPtgAA", + ) + + print(response) diff --git a/src/datadog_api_client/v2/api/events_api.py b/src/datadog_api_client/v2/api/events_api.py index 0285d24c3a..d1a2bbe11c 100644 --- a/src/datadog_api_client/v2/api/events_api.py +++ b/src/datadog_api_client/v2/api/events_api.py @@ -20,6 +20,7 @@ from datadog_api_client.v2.model.event_create_response_payload import EventCreateResponsePayload from datadog_api_client.v2.model.event_create_request_payload import EventCreateRequestPayload from datadog_api_client.v2.model.events_list_request import EventsListRequest +from datadog_api_client.v2.model.v2_event_response import V2EventResponse class EventsApi: @@ -103,6 +104,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_event_endpoint = _Endpoint( + settings={ + "response_type": (V2EventResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/events/{event_id}", + "operation_id": "get_event", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "event_id": { + "required": True, + "openapi_types": (str,), + "attribute": "event_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_events_endpoint = _Endpoint( settings={ "response_type": (EventsListResponse,), @@ -197,6 +221,23 @@ def create_event( return self._create_event_endpoint.call_with_http_info(**kwargs) + def get_event( + self, + event_id: str, + ) -> V2EventResponse: + """Get an event. + + Get the details of an event by ``event_id``. + + :param event_id: The UID of the event. + :type event_id: str + :rtype: V2EventResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["event_id"] = event_id + + return self._get_event_endpoint.call_with_http_info(**kwargs) + def list_events( self, *, diff --git a/src/datadog_api_client/v2/model/alert_event_attributes.py b/src/datadog_api_client/v2/model/alert_event_attributes.py new file mode 100644 index 0000000000..93bbde2ecb --- /dev/null +++ b/src/datadog_api_client/v2/model/alert_event_attributes.py @@ -0,0 +1,106 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.event_system_attributes import EventSystemAttributes + from datadog_api_client.v2.model.alert_event_attributes_links_item import AlertEventAttributesLinksItem + from datadog_api_client.v2.model.alert_event_attributes_priority import AlertEventAttributesPriority + + +class AlertEventAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.event_system_attributes import EventSystemAttributes + from datadog_api_client.v2.model.alert_event_attributes_links_item import AlertEventAttributesLinksItem + from datadog_api_client.v2.model.alert_event_attributes_priority import AlertEventAttributesPriority + + return { + "aggregation_key": (str,), + "custom": (dict,), + "evt": (EventSystemAttributes,), + "links": ([AlertEventAttributesLinksItem],), + "priority": (AlertEventAttributesPriority,), + "service": (str,), + "timestamp": (int,), + "title": (str,), + } + + attribute_map = { + "aggregation_key": "aggregation_key", + "custom": "custom", + "evt": "evt", + "links": "links", + "priority": "priority", + "service": "service", + "timestamp": "timestamp", + "title": "title", + } + + def __init__( + self_, + aggregation_key: Union[str, UnsetType] = unset, + custom: Union[dict, UnsetType] = unset, + evt: Union[EventSystemAttributes, UnsetType] = unset, + links: Union[List[AlertEventAttributesLinksItem], UnsetType] = unset, + priority: Union[AlertEventAttributesPriority, UnsetType] = unset, + service: Union[str, UnsetType] = unset, + timestamp: Union[int, UnsetType] = unset, + title: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Alert event attributes. + + :param aggregation_key: Aggregation key of the event. + :type aggregation_key: str, optional + + :param custom: JSON object of custom attributes. + :type custom: dict, optional + + :param evt: JSON object of event system attributes. + :type evt: EventSystemAttributes, optional + + :param links: The links related to the event. + :type links: [AlertEventAttributesLinksItem], optional + + :param priority: The priority of the alert. + :type priority: AlertEventAttributesPriority, optional + + :param service: Service that triggered the event. + :type service: str, optional + + :param timestamp: POSIX timestamp of the event. + :type timestamp: int, optional + + :param title: The title of the event. + :type title: str, optional + """ + if aggregation_key is not unset: + kwargs["aggregation_key"] = aggregation_key + if custom is not unset: + kwargs["custom"] = custom + if evt is not unset: + kwargs["evt"] = evt + if links is not unset: + kwargs["links"] = links + if priority is not unset: + kwargs["priority"] = priority + if service is not unset: + kwargs["service"] = service + if timestamp is not unset: + kwargs["timestamp"] = timestamp + if title is not unset: + kwargs["title"] = title + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/alert_event_attributes_links_item.py b/src/datadog_api_client/v2/model/alert_event_attributes_links_item.py new file mode 100644 index 0000000000..8e2c12f27c --- /dev/null +++ b/src/datadog_api_client/v2/model/alert_event_attributes_links_item.py @@ -0,0 +1,66 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.alert_event_attributes_links_item_category import ( + AlertEventAttributesLinksItemCategory, + ) + + +class AlertEventAttributesLinksItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.alert_event_attributes_links_item_category import ( + AlertEventAttributesLinksItemCategory, + ) + + return { + "category": (AlertEventAttributesLinksItemCategory,), + "title": (str,), + "url": (str,), + } + + attribute_map = { + "category": "category", + "title": "title", + "url": "url", + } + + def __init__( + self_, + category: Union[AlertEventAttributesLinksItemCategory, UnsetType] = unset, + title: Union[str, UnsetType] = unset, + url: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A link. + + :param category: The category of the link. + :type category: AlertEventAttributesLinksItemCategory, optional + + :param title: The display text of the link. + :type title: str, optional + + :param url: The URL of the link. + :type url: str, optional + """ + if category is not unset: + kwargs["category"] = category + if title is not unset: + kwargs["title"] = title + if url is not unset: + kwargs["url"] = url + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/alert_event_attributes_links_item_category.py b/src/datadog_api_client/v2/model/alert_event_attributes_links_item_category.py new file mode 100644 index 0000000000..7474a14222 --- /dev/null +++ b/src/datadog_api_client/v2/model/alert_event_attributes_links_item_category.py @@ -0,0 +1,41 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AlertEventAttributesLinksItemCategory(ModelSimple): + """ + The category of the link. + + :param value: Must be one of ["runbook", "documentation", "dashboard"]. + :type value: str + """ + + allowed_values = { + "runbook", + "documentation", + "dashboard", + } + RUNBOOK: ClassVar["AlertEventAttributesLinksItemCategory"] + DOCUMENTATION: ClassVar["AlertEventAttributesLinksItemCategory"] + DASHBOARD: ClassVar["AlertEventAttributesLinksItemCategory"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AlertEventAttributesLinksItemCategory.RUNBOOK = AlertEventAttributesLinksItemCategory("runbook") +AlertEventAttributesLinksItemCategory.DOCUMENTATION = AlertEventAttributesLinksItemCategory("documentation") +AlertEventAttributesLinksItemCategory.DASHBOARD = AlertEventAttributesLinksItemCategory("dashboard") diff --git a/src/datadog_api_client/v2/model/alert_event_attributes_priority.py b/src/datadog_api_client/v2/model/alert_event_attributes_priority.py new file mode 100644 index 0000000000..e0fb3e777d --- /dev/null +++ b/src/datadog_api_client/v2/model/alert_event_attributes_priority.py @@ -0,0 +1,47 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AlertEventAttributesPriority(ModelSimple): + """ + The priority of the alert. + + :param value: Must be one of ["1", "2", "3", "4", "5"]. + :type value: str + """ + + allowed_values = { + "1", + "2", + "3", + "4", + "5", + } + PRIORITY_ONE: ClassVar["AlertEventAttributesPriority"] + PRIORITY_TWO: ClassVar["AlertEventAttributesPriority"] + PRIORITY_THREE: ClassVar["AlertEventAttributesPriority"] + PRIORITY_FOUR: ClassVar["AlertEventAttributesPriority"] + PRIORITY_FIVE: ClassVar["AlertEventAttributesPriority"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AlertEventAttributesPriority.PRIORITY_ONE = AlertEventAttributesPriority("1") +AlertEventAttributesPriority.PRIORITY_TWO = AlertEventAttributesPriority("2") +AlertEventAttributesPriority.PRIORITY_THREE = AlertEventAttributesPriority("3") +AlertEventAttributesPriority.PRIORITY_FOUR = AlertEventAttributesPriority("4") +AlertEventAttributesPriority.PRIORITY_FIVE = AlertEventAttributesPriority("5") diff --git a/src/datadog_api_client/v2/model/change_event_attributes.py b/src/datadog_api_client/v2/model/change_event_attributes.py new file mode 100644 index 0000000000..3d5d26eb4e --- /dev/null +++ b/src/datadog_api_client/v2/model/change_event_attributes.py @@ -0,0 +1,140 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.change_event_attributes_author import ChangeEventAttributesAuthor + from datadog_api_client.v2.model.change_event_attributes_changed_resource import ( + ChangeEventAttributesChangedResource, + ) + from datadog_api_client.v2.model.event_system_attributes import EventSystemAttributes + from datadog_api_client.v2.model.change_event_attributes_impacted_resources_item import ( + ChangeEventAttributesImpactedResourcesItem, + ) + + +class ChangeEventAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.change_event_attributes_author import ChangeEventAttributesAuthor + from datadog_api_client.v2.model.change_event_attributes_changed_resource import ( + ChangeEventAttributesChangedResource, + ) + from datadog_api_client.v2.model.event_system_attributes import EventSystemAttributes + from datadog_api_client.v2.model.change_event_attributes_impacted_resources_item import ( + ChangeEventAttributesImpactedResourcesItem, + ) + + return { + "aggregation_key": (str,), + "author": (ChangeEventAttributesAuthor,), + "change_metadata": (dict,), + "changed_resource": (ChangeEventAttributesChangedResource,), + "evt": (EventSystemAttributes,), + "impacted_resources": ([ChangeEventAttributesImpactedResourcesItem],), + "new_value": (dict,), + "prev_value": (dict,), + "service": (str,), + "timestamp": (int,), + "title": (str,), + } + + attribute_map = { + "aggregation_key": "aggregation_key", + "author": "author", + "change_metadata": "change_metadata", + "changed_resource": "changed_resource", + "evt": "evt", + "impacted_resources": "impacted_resources", + "new_value": "new_value", + "prev_value": "prev_value", + "service": "service", + "timestamp": "timestamp", + "title": "title", + } + + def __init__( + self_, + aggregation_key: Union[str, UnsetType] = unset, + author: Union[ChangeEventAttributesAuthor, UnsetType] = unset, + change_metadata: Union[dict, UnsetType] = unset, + changed_resource: Union[ChangeEventAttributesChangedResource, UnsetType] = unset, + evt: Union[EventSystemAttributes, UnsetType] = unset, + impacted_resources: Union[List[ChangeEventAttributesImpactedResourcesItem], UnsetType] = unset, + new_value: Union[dict, UnsetType] = unset, + prev_value: Union[dict, UnsetType] = unset, + service: Union[str, UnsetType] = unset, + timestamp: Union[int, UnsetType] = unset, + title: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Change event attributes. + + :param aggregation_key: Aggregation key of the event. + :type aggregation_key: str, optional + + :param author: The entity that made the change. + :type author: ChangeEventAttributesAuthor, optional + + :param change_metadata: JSON object of change metadata. + :type change_metadata: dict, optional + + :param changed_resource: A uniquely identified resource. + :type changed_resource: ChangeEventAttributesChangedResource, optional + + :param evt: JSON object of event system attributes. + :type evt: EventSystemAttributes, optional + + :param impacted_resources: A list of resources impacted by this change. + :type impacted_resources: [ChangeEventAttributesImpactedResourcesItem], optional + + :param new_value: The new state of the changed resource. + :type new_value: dict, optional + + :param prev_value: The previous state of the changed resource. + :type prev_value: dict, optional + + :param service: Service that triggered the event. + :type service: str, optional + + :param timestamp: POSIX timestamp of the event. + :type timestamp: int, optional + + :param title: The title of the event. + :type title: str, optional + """ + if aggregation_key is not unset: + kwargs["aggregation_key"] = aggregation_key + if author is not unset: + kwargs["author"] = author + if change_metadata is not unset: + kwargs["change_metadata"] = change_metadata + if changed_resource is not unset: + kwargs["changed_resource"] = changed_resource + if evt is not unset: + kwargs["evt"] = evt + if impacted_resources is not unset: + kwargs["impacted_resources"] = impacted_resources + if new_value is not unset: + kwargs["new_value"] = new_value + if prev_value is not unset: + kwargs["prev_value"] = prev_value + if service is not unset: + kwargs["service"] = service + if timestamp is not unset: + kwargs["timestamp"] = timestamp + if title is not unset: + kwargs["title"] = title + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/change_event_attributes_author.py b/src/datadog_api_client/v2/model/change_event_attributes_author.py new file mode 100644 index 0000000000..68685cc812 --- /dev/null +++ b/src/datadog_api_client/v2/model/change_event_attributes_author.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.change_event_attributes_author_type import ChangeEventAttributesAuthorType + + +class ChangeEventAttributesAuthor(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.change_event_attributes_author_type import ChangeEventAttributesAuthorType + + return { + "name": (str,), + "type": (ChangeEventAttributesAuthorType,), + } + + attribute_map = { + "name": "name", + "type": "type", + } + + def __init__( + self_, + name: Union[str, UnsetType] = unset, + type: Union[ChangeEventAttributesAuthorType, UnsetType] = unset, + **kwargs, + ): + """ + The entity that made the change. + + :param name: The name of the user or system that made the change. + :type name: str, optional + + :param type: The type of the author. + :type type: ChangeEventAttributesAuthorType, optional + """ + if name is not unset: + kwargs["name"] = name + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/change_event_attributes_author_type.py b/src/datadog_api_client/v2/model/change_event_attributes_author_type.py new file mode 100644 index 0000000000..7197583248 --- /dev/null +++ b/src/datadog_api_client/v2/model/change_event_attributes_author_type.py @@ -0,0 +1,38 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ChangeEventAttributesAuthorType(ModelSimple): + """ + The type of the author. + + :param value: Must be one of ["user", "system"]. + :type value: str + """ + + allowed_values = { + "user", + "system", + } + USER: ClassVar["ChangeEventAttributesAuthorType"] + SYSTEM: ClassVar["ChangeEventAttributesAuthorType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ChangeEventAttributesAuthorType.USER = ChangeEventAttributesAuthorType("user") +ChangeEventAttributesAuthorType.SYSTEM = ChangeEventAttributesAuthorType("system") diff --git a/src/datadog_api_client/v2/model/change_event_attributes_changed_resource.py b/src/datadog_api_client/v2/model/change_event_attributes_changed_resource.py new file mode 100644 index 0000000000..0a01a06069 --- /dev/null +++ b/src/datadog_api_client/v2/model/change_event_attributes_changed_resource.py @@ -0,0 +1,58 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.change_event_attributes_changed_resource_type import ( + ChangeEventAttributesChangedResourceType, + ) + + +class ChangeEventAttributesChangedResource(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.change_event_attributes_changed_resource_type import ( + ChangeEventAttributesChangedResourceType, + ) + + return { + "name": (str,), + "type": (ChangeEventAttributesChangedResourceType,), + } + + attribute_map = { + "name": "name", + "type": "type", + } + + def __init__( + self_, + name: Union[str, UnsetType] = unset, + type: Union[ChangeEventAttributesChangedResourceType, UnsetType] = unset, + **kwargs, + ): + """ + A uniquely identified resource. + + :param name: The name of the changed resource. + :type name: str, optional + + :param type: The type of the changed resource. + :type type: ChangeEventAttributesChangedResourceType, optional + """ + if name is not unset: + kwargs["name"] = name + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/change_event_attributes_changed_resource_type.py b/src/datadog_api_client/v2/model/change_event_attributes_changed_resource_type.py new file mode 100644 index 0000000000..6f07733a28 --- /dev/null +++ b/src/datadog_api_client/v2/model/change_event_attributes_changed_resource_type.py @@ -0,0 +1,38 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ChangeEventAttributesChangedResourceType(ModelSimple): + """ + The type of the changed resource. + + :param value: Must be one of ["feature_flag", "configuration"]. + :type value: str + """ + + allowed_values = { + "feature_flag", + "configuration", + } + FEATURE_FLAG: ClassVar["ChangeEventAttributesChangedResourceType"] + CONFIGURATION: ClassVar["ChangeEventAttributesChangedResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ChangeEventAttributesChangedResourceType.FEATURE_FLAG = ChangeEventAttributesChangedResourceType("feature_flag") +ChangeEventAttributesChangedResourceType.CONFIGURATION = ChangeEventAttributesChangedResourceType("configuration") diff --git a/src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item.py b/src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item.py new file mode 100644 index 0000000000..543bf5572b --- /dev/null +++ b/src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item.py @@ -0,0 +1,58 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.change_event_attributes_impacted_resources_item_type import ( + ChangeEventAttributesImpactedResourcesItemType, + ) + + +class ChangeEventAttributesImpactedResourcesItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.change_event_attributes_impacted_resources_item_type import ( + ChangeEventAttributesImpactedResourcesItemType, + ) + + return { + "name": (str,), + "type": (ChangeEventAttributesImpactedResourcesItemType,), + } + + attribute_map = { + "name": "name", + "type": "type", + } + + def __init__( + self_, + name: Union[str, UnsetType] = unset, + type: Union[ChangeEventAttributesImpactedResourcesItemType, UnsetType] = unset, + **kwargs, + ): + """ + A uniquely identified resource. + + :param name: The name of the impacted resource. + :type name: str, optional + + :param type: The type of the impacted resource. + :type type: ChangeEventAttributesImpactedResourcesItemType, optional + """ + if name is not unset: + kwargs["name"] = name + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item_type.py b/src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item_type.py new file mode 100644 index 0000000000..f85a8e115a --- /dev/null +++ b/src/datadog_api_client/v2/model/change_event_attributes_impacted_resources_item_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ChangeEventAttributesImpactedResourcesItemType(ModelSimple): + """ + The type of the impacted resource. + + :param value: If omitted defaults to "service". Must be one of ["service"]. + :type value: str + """ + + allowed_values = { + "service", + } + SERVICE: ClassVar["ChangeEventAttributesImpactedResourcesItemType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ChangeEventAttributesImpactedResourcesItemType.SERVICE = ChangeEventAttributesImpactedResourcesItemType("service") diff --git a/src/datadog_api_client/v2/model/event_system_attributes.py b/src/datadog_api_client/v2/model/event_system_attributes.py new file mode 100644 index 0000000000..43c2e2320d --- /dev/null +++ b/src/datadog_api_client/v2/model/event_system_attributes.py @@ -0,0 +1,82 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.event_system_attributes_category import EventSystemAttributesCategory + from datadog_api_client.v2.model.event_system_attributes_integration_id import EventSystemAttributesIntegrationId + + +class EventSystemAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.event_system_attributes_category import EventSystemAttributesCategory + from datadog_api_client.v2.model.event_system_attributes_integration_id import ( + EventSystemAttributesIntegrationId, + ) + + return { + "category": (EventSystemAttributesCategory,), + "id": (str,), + "integration_id": (EventSystemAttributesIntegrationId,), + "source_id": (int,), + "uid": (str,), + } + + attribute_map = { + "category": "category", + "id": "id", + "integration_id": "integration_id", + "source_id": "source_id", + "uid": "uid", + } + + def __init__( + self_, + category: Union[EventSystemAttributesCategory, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + integration_id: Union[EventSystemAttributesIntegrationId, UnsetType] = unset, + source_id: Union[int, UnsetType] = unset, + uid: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + JSON object of event system attributes. + + :param category: Event category identifying the type of event. + :type category: EventSystemAttributesCategory, optional + + :param id: Event identifier. This field is deprecated and will be removed in a future version. Use the ``uid`` field instead. + :type id: str, optional + + :param integration_id: Integration ID sourced from integration manifests. + :type integration_id: EventSystemAttributesIntegrationId, optional + + :param source_id: The source type ID of the event. + :type source_id: int, optional + + :param uid: A unique identifier for the event. You can use this identifier to query or reference the event. + :type uid: str, optional + """ + if category is not unset: + kwargs["category"] = category + if id is not unset: + kwargs["id"] = id + if integration_id is not unset: + kwargs["integration_id"] = integration_id + if source_id is not unset: + kwargs["source_id"] = source_id + if uid is not unset: + kwargs["uid"] = uid + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/event_system_attributes_category.py b/src/datadog_api_client/v2/model/event_system_attributes_category.py new file mode 100644 index 0000000000..8702d7f80c --- /dev/null +++ b/src/datadog_api_client/v2/model/event_system_attributes_category.py @@ -0,0 +1,38 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class EventSystemAttributesCategory(ModelSimple): + """ + Event category identifying the type of event. + + :param value: Must be one of ["change", "alert"]. + :type value: str + """ + + allowed_values = { + "change", + "alert", + } + CHANGE: ClassVar["EventSystemAttributesCategory"] + ALERT: ClassVar["EventSystemAttributesCategory"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +EventSystemAttributesCategory.CHANGE = EventSystemAttributesCategory("change") +EventSystemAttributesCategory.ALERT = EventSystemAttributesCategory("alert") diff --git a/src/datadog_api_client/v2/model/event_system_attributes_integration_id.py b/src/datadog_api_client/v2/model/event_system_attributes_integration_id.py new file mode 100644 index 0000000000..2bea07e0c0 --- /dev/null +++ b/src/datadog_api_client/v2/model/event_system_attributes_integration_id.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class EventSystemAttributesIntegrationId(ModelSimple): + """ + Integration ID sourced from integration manifests. + + :param value: If omitted defaults to "custom-events". Must be one of ["custom-events"]. + :type value: str + """ + + allowed_values = { + "custom-events", + } + CUSTOM_EVENTS: ClassVar["EventSystemAttributesIntegrationId"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +EventSystemAttributesIntegrationId.CUSTOM_EVENTS = EventSystemAttributesIntegrationId("custom-events") diff --git a/src/datadog_api_client/v2/model/v2_event.py b/src/datadog_api_client/v2/model/v2_event.py new file mode 100644 index 0000000000..1219929ace --- /dev/null +++ b/src/datadog_api_client/v2/model/v2_event.py @@ -0,0 +1,62 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.v2_event_attributes import V2EventAttributes + + +class V2Event(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.v2_event_attributes import V2EventAttributes + + return { + "attributes": (V2EventAttributes,), + "id": (str,), + "type": (str,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[V2EventAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + An event object. + + :param attributes: Event attributes. + :type attributes: V2EventAttributes, optional + + :param id: The event's ID. + :type id: str, optional + + :param type: Entity type. + :type type: str, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/v2_event_attributes.py b/src/datadog_api_client/v2/model/v2_event_attributes.py new file mode 100644 index 0000000000..4d6ba3dd40 --- /dev/null +++ b/src/datadog_api_client/v2/model/v2_event_attributes.py @@ -0,0 +1,72 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.v2_event_attributes_attributes import V2EventAttributesAttributes + from datadog_api_client.v2.model.change_event_attributes import ChangeEventAttributes + from datadog_api_client.v2.model.alert_event_attributes import AlertEventAttributes + + +class V2EventAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.v2_event_attributes_attributes import V2EventAttributesAttributes + + return { + "attributes": (V2EventAttributesAttributes,), + "message": (str,), + "tags": ([str],), + "timestamp": (str,), + } + + attribute_map = { + "attributes": "attributes", + "message": "message", + "tags": "tags", + "timestamp": "timestamp", + } + + def __init__( + self_, + attributes: Union[V2EventAttributesAttributes, ChangeEventAttributes, AlertEventAttributes, UnsetType] = unset, + message: Union[str, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + timestamp: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Event attributes. + + :param attributes: JSON object for category-specific attributes. + :type attributes: V2EventAttributesAttributes, optional + + :param message: Free-formed text associated with the event. + :type message: str, optional + + :param tags: A list of tags associated with the event. + :type tags: [str], optional + + :param timestamp: Timestamp when the event occurred. + :type timestamp: str, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if message is not unset: + kwargs["message"] = message + if tags is not unset: + kwargs["tags"] = tags + if timestamp is not unset: + kwargs["timestamp"] = timestamp + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/v2_event_attributes_attributes.py b/src/datadog_api_client/v2/model/v2_event_attributes_attributes.py new file mode 100644 index 0000000000..4d6793e0a3 --- /dev/null +++ b/src/datadog_api_client/v2/model/v2_event_attributes_attributes.py @@ -0,0 +1,79 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class V2EventAttributesAttributes(ModelComposed): + def __init__(self, **kwargs): + """ + JSON object for category-specific attributes. + + :param aggregation_key: Aggregation key of the event. + :type aggregation_key: str, optional + + :param author: The entity that made the change. + :type author: ChangeEventAttributesAuthor, optional + + :param change_metadata: JSON object of change metadata. + :type change_metadata: dict, optional + + :param changed_resource: A uniquely identified resource. + :type changed_resource: ChangeEventAttributesChangedResource, optional + + :param evt: JSON object of event system attributes. + :type evt: EventSystemAttributes, optional + + :param impacted_resources: A list of resources impacted by this change. + :type impacted_resources: [ChangeEventAttributesImpactedResourcesItem], optional + + :param new_value: The new state of the changed resource. + :type new_value: dict, optional + + :param prev_value: The previous state of the changed resource. + :type prev_value: dict, optional + + :param service: Service that triggered the event. + :type service: str, optional + + :param timestamp: POSIX timestamp of the event. + :type timestamp: int, optional + + :param title: The title of the event. + :type title: str, optional + + :param custom: JSON object of custom attributes. + :type custom: dict, optional + + :param links: The links related to the event. + :type links: [AlertEventAttributesLinksItem], optional + + :param priority: The priority of the alert. + :type priority: AlertEventAttributesPriority, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.change_event_attributes import ChangeEventAttributes + from datadog_api_client.v2.model.alert_event_attributes import AlertEventAttributes + + return { + "oneOf": [ + ChangeEventAttributes, + AlertEventAttributes, + ], + } diff --git a/src/datadog_api_client/v2/model/v2_event_response.py b/src/datadog_api_client/v2/model/v2_event_response.py new file mode 100644 index 0000000000..ad4de2adf1 --- /dev/null +++ b/src/datadog_api_client/v2/model/v2_event_response.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.v2_event import V2Event + + +class V2EventResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.v2_event import V2Event + + return { + "data": (V2Event,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[V2Event, UnsetType] = unset, **kwargs): + """ + Get an event response. + + :param data: An event object. + :type data: V2Event, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 15d561cee7..46db56edcd 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -93,6 +93,10 @@ from datadog_api_client.v2.model.active_billing_dimensions_type import ActiveBillingDimensionsType from datadog_api_client.v2.model.add_member_team_request import AddMemberTeamRequest from datadog_api_client.v2.model.advisory import Advisory +from datadog_api_client.v2.model.alert_event_attributes import AlertEventAttributes +from datadog_api_client.v2.model.alert_event_attributes_links_item import AlertEventAttributesLinksItem +from datadog_api_client.v2.model.alert_event_attributes_links_item_category import AlertEventAttributesLinksItemCategory +from datadog_api_client.v2.model.alert_event_attributes_priority import AlertEventAttributesPriority from datadog_api_client.v2.model.alert_event_custom_attributes import AlertEventCustomAttributes from datadog_api_client.v2.model.alert_event_custom_attributes_custom import AlertEventCustomAttributesCustom from datadog_api_client.v2.model.alert_event_custom_attributes_links_items import AlertEventCustomAttributesLinksItems @@ -478,6 +482,19 @@ from datadog_api_client.v2.model.cases_response import CasesResponse from datadog_api_client.v2.model.cases_response_meta import CasesResponseMeta from datadog_api_client.v2.model.cases_response_meta_pagination import CasesResponseMetaPagination +from datadog_api_client.v2.model.change_event_attributes import ChangeEventAttributes +from datadog_api_client.v2.model.change_event_attributes_author import ChangeEventAttributesAuthor +from datadog_api_client.v2.model.change_event_attributes_author_type import ChangeEventAttributesAuthorType +from datadog_api_client.v2.model.change_event_attributes_changed_resource import ChangeEventAttributesChangedResource +from datadog_api_client.v2.model.change_event_attributes_changed_resource_type import ( + ChangeEventAttributesChangedResourceType, +) +from datadog_api_client.v2.model.change_event_attributes_impacted_resources_item import ( + ChangeEventAttributesImpactedResourcesItem, +) +from datadog_api_client.v2.model.change_event_attributes_impacted_resources_item_type import ( + ChangeEventAttributesImpactedResourcesItemType, +) from datadog_api_client.v2.model.change_event_custom_attributes import ChangeEventCustomAttributes from datadog_api_client.v2.model.change_event_custom_attributes_author import ChangeEventCustomAttributesAuthor from datadog_api_client.v2.model.change_event_custom_attributes_author_type import ChangeEventCustomAttributesAuthorType @@ -1166,6 +1183,9 @@ from datadog_api_client.v2.model.event_response import EventResponse from datadog_api_client.v2.model.event_response_attributes import EventResponseAttributes from datadog_api_client.v2.model.event_status_type import EventStatusType +from datadog_api_client.v2.model.event_system_attributes import EventSystemAttributes +from datadog_api_client.v2.model.event_system_attributes_category import EventSystemAttributesCategory +from datadog_api_client.v2.model.event_system_attributes_integration_id import EventSystemAttributesIntegrationId from datadog_api_client.v2.model.event_type import EventType from datadog_api_client.v2.model.events_aggregation import EventsAggregation from datadog_api_client.v2.model.events_compute import EventsCompute @@ -3456,6 +3476,10 @@ from datadog_api_client.v2.model.users_relationship import UsersRelationship from datadog_api_client.v2.model.users_response import UsersResponse from datadog_api_client.v2.model.users_type import UsersType +from datadog_api_client.v2.model.v2_event import V2Event +from datadog_api_client.v2.model.v2_event_attributes import V2EventAttributes +from datadog_api_client.v2.model.v2_event_attributes_attributes import V2EventAttributesAttributes +from datadog_api_client.v2.model.v2_event_response import V2EventResponse from datadog_api_client.v2.model.validation_error import ValidationError from datadog_api_client.v2.model.validation_error_meta import ValidationErrorMeta from datadog_api_client.v2.model.validation_response import ValidationResponse @@ -3600,6 +3624,10 @@ "ActiveBillingDimensionsType", "AddMemberTeamRequest", "Advisory", + "AlertEventAttributes", + "AlertEventAttributesLinksItem", + "AlertEventAttributesLinksItemCategory", + "AlertEventAttributesPriority", "AlertEventCustomAttributes", "AlertEventCustomAttributesCustom", "AlertEventCustomAttributesLinksItems", @@ -3891,6 +3919,13 @@ "CasesResponse", "CasesResponseMeta", "CasesResponseMetaPagination", + "ChangeEventAttributes", + "ChangeEventAttributesAuthor", + "ChangeEventAttributesAuthorType", + "ChangeEventAttributesChangedResource", + "ChangeEventAttributesChangedResourceType", + "ChangeEventAttributesImpactedResourcesItem", + "ChangeEventAttributesImpactedResourcesItemType", "ChangeEventCustomAttributes", "ChangeEventCustomAttributesAuthor", "ChangeEventCustomAttributesAuthorType", @@ -4375,6 +4410,9 @@ "EventResponse", "EventResponseAttributes", "EventStatusType", + "EventSystemAttributes", + "EventSystemAttributesCategory", + "EventSystemAttributesIntegrationId", "EventType", "EventsAggregation", "EventsCompute", @@ -6051,6 +6089,10 @@ "UsersRelationship", "UsersResponse", "UsersType", + "V2Event", + "V2EventAttributes", + "V2EventAttributesAttributes", + "V2EventResponse", "ValidationError", "ValidationErrorMeta", "ValidationResponse", diff --git a/tests/v2/features/events.feature b/tests/v2/features/events.feature index 0a69d19520..61d824ce10 100644 --- a/tests/v2/features/events.feature +++ b/tests/v2/features/events.feature @@ -50,6 +50,27 @@ Feature: Events Then the response status is 200 OK And the response "data" has length 0 + @generated @skip @team:DataDog/event-management + Scenario: Get an event returns "Bad Request" response + Given new "GetEvent" request + And request contains "event_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/event-management + Scenario: Get an event returns "Not Found" response + Given new "GetEvent" request + And request contains "event_id" parameter with value "AAAAAAAAAAAAAAAAAAAAAAAA" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/event-management + Scenario: Get an event returns "OK" response + Given new "GetEvent" request + And request contains "event_id" parameter with value "AZeF-nTCAABzkAgGXzYPtgAA" + When the request is sent + Then the response status is 200 OK + @team:DataDog/event-management Scenario: Post an event returns "Bad request" response Given new "CreateEvent" request diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3cc857a736..a08bd9af31 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -943,6 +943,12 @@ "type": "safe" } }, + "GetEvent": { + "tag": "Events", + "undo": { + "type": "safe" + } + }, "ListIncidents": { "tag": "Incidents", "undo": {