diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 440627d7e6..ecadd5414e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -79306,6 +79306,321 @@ components: type: string x-enum-varnames: - SECRET + TransportWebhookLog: + description: A single email transport webhook log event. + properties: + attributes: + $ref: "#/components/schemas/TransportWebhookLogAttributes" + date: + description: The ISO 8601 timestamp of the event. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + log_id: + description: The unique log event identifier. + example: "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR" + type: string + source: + description: The email transport provider. + example: "sendgrid" + type: string + status: + description: The log status level. + example: "info" + type: string + tags: + description: A list of tags associated with the event. + example: ["env:production"] + items: + description: A tag in key:value or key-only form (for example, env:production). + type: string + type: array + required: + - date + - log_id + - source + - status + - tags + - attributes + type: object + TransportWebhookLogAttributes: + description: Top-level attributes for the webhook log event, including delivery status, recipient details, and provider metadata. + properties: + category: + description: The event categories. + example: ["transactional"] + items: + description: An event category assigned by the transport provider. + type: string + type: array + email: + $ref: "#/components/schemas/TransportWebhookLogEmail" + email_id: + description: The unique email identifier. + example: "abc123-def456" + type: string + email_type_display_name: + description: The human-readable email type name. + example: "Monitor Alert" + type: string + message: + $ref: "#/components/schemas/TransportWebhookLogMessage" + network: + $ref: "#/components/schemas/TransportWebhookLogNetwork" + org: + description: The numeric organization identifier. + example: 1234 + format: int64 + type: integer + org_metadata: + $ref: "#/components/schemas/TransportWebhookLogOrgMetadata" + org_uuid: + description: The organization UUID. + example: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091" + type: string + queue_time: + description: The timestamp when the email was queued. + example: "2024-01-15T10:29:00Z" + type: string + sg_machine_open: + description: Indicates whether the open event was triggered by automated machine activity rather than a human recipient (SendGrid-specific). + type: boolean + subject: + description: The email subject line. + example: "[Monitor Alert] CPU usage is high" + type: string + useragent: + description: The user agent string for open events. + example: "Mozilla/5.0" + type: string + type: object + TransportWebhookLogBatchRequest: + description: A batch of email transport webhook log events. + items: + $ref: "#/components/schemas/TransportWebhookLog" + type: array + TransportWebhookLogEmail: + description: The email address details. + properties: + address: + description: The recipient email address. + example: "user@example.com" + type: string + domain: + description: The recipient domain. + example: "example.com" + type: string + subject: + description: The email subject line. + example: "[Monitor Alert] CPU usage is high" + type: string + type: + description: Email categorization tags applied by the transport provider (for example, "transactional", "marketing"). + example: ["transactional"] + items: + description: An email type classification (for example, "transactional", "user"). + type: string + type: array + type: object + TransportWebhookLogIpAttribute: + description: An IP attribute with its sources. + properties: + ip: + description: The IP address. + example: "192.168.1.1" + type: string + source: + description: The transport providers or systems that reported this IP address. + example: ["sendgrid"] + items: + description: A transport provider or system that reported this IP address. + type: string + type: array + type: object + TransportWebhookLogMessage: + description: The message delivery event details. + properties: + auth: + $ref: "#/components/schemas/TransportWebhookLogMessageAuth" + custom_args: + $ref: "#/components/schemas/TransportWebhookLogMessageCustomArgs" + id: + $ref: "#/components/schemas/TransportWebhookLogMessageId" + name: + description: The delivery event type emitted by the transport provider (for example, "delivered", "dropped", "bounced"). + example: "delivered" + type: string + response: + $ref: "#/components/schemas/TransportWebhookLogMessageResponse" + sender_ip: + description: The IP address of the sending server. + example: "192.168.1.1" + type: string + timestamp: + $ref: "#/components/schemas/TransportWebhookLogMessageTimestamp" + type: object + TransportWebhookLogMessageAuth: + description: The message authentication details. + properties: + delivered_with_tls: + description: The TLS version or negotiation information. + example: "TLSv1.2" + type: string + type: object + TransportWebhookLogMessageCustomArgs: + description: Custom arguments passed through the email transport provider for tracking. + properties: + email_id: + description: The unique email identifier. + example: "abc123-def456" + type: string + email_type_display_name: + description: The human-readable email type name. + example: "Monitor Alert" + type: string + org_uuid: + description: The organization UUID. + example: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091" + type: string + queue_time: + description: The timestamp when the email was queued. + example: "2024-01-15T10:29:00Z" + type: string + subject: + description: The email subject line. + example: "[Monitor Alert] CPU usage is high" + type: string + type: object + TransportWebhookLogMessageId: + description: The message identifiers. + properties: + message_id: + description: The RFC 5322 Message-ID. + example: "" + type: string + smtp_id: + description: The SMTP transaction identifier. + example: "" + type: string + transport_event_id: + description: The transport provider event identifier. + example: "evt_abc123" + type: string + type: object + TransportWebhookLogMessageResponse: + description: The SMTP response information. + properties: + enhanced_smtp_code: + description: The enhanced SMTP status code. + example: "2.0.0" + type: string + reason: + description: The SMTP response message. + example: "250 2.0.0 OK" + type: string + smtp_code: + description: The SMTP status code. + example: "250" + type: string + type: object + TransportWebhookLogMessageTimestamp: + description: The message delivery timing information. + properties: + event_timestamp: + description: The Unix timestamp of the event. + example: 1705312200.0 + format: double + type: number + lifetime: + description: The total delivery time in seconds. + example: 3.2 + format: double + type: number + queue_time: + description: Number of seconds the message spent in the delivery queue. + example: 1.5 + format: double + type: number + scheduled_time: + description: The scheduled delivery time as a Unix timestamp. + example: 1705312190.0 + format: double + type: number + type: object + TransportWebhookLogNetwork: + description: The network information for the event. + properties: + ip: + $ref: "#/components/schemas/TransportWebhookLogNetworkIp" + type: object + TransportWebhookLogNetworkIp: + description: The IP address information. + properties: + attributes: + description: Per-IP attribute records, each pairing an IP address with the providers that observed it. + items: + $ref: "#/components/schemas/TransportWebhookLogIpAttribute" + type: array + list: + description: The list of IP addresses. + example: ["192.168.1.1"] + items: + description: An IP address observed during message delivery. + type: string + type: array + type: object + TransportWebhookLogOrgMetadata: + description: Metadata about the organization that sent the email. + properties: + billing_country: + description: Country code or name used for billing purposes. + type: string + billing_plan: + description: The Datadog billing plan for the organization (for example, "pro", "enterprise"). + type: string + customer_tier: + description: Support or account tier assigned to the organization (for example, "tier-1"). + type: string + domain: + description: Primary email domain associated with the organization (for example, "example.com"). + type: string + industry: + description: Industry classification of the organization (for example, "technology", "finance"). + type: string + is_bugbounty: + description: Whether the organization is enrolled in the Datadog bug bounty program. + type: string + is_msp: + description: Whether the organization operates as a Managed Service Provider managing child orgs. + type: string + name: + description: Display name of the organization as configured in Datadog account settings. + type: string + org_uuid: + description: Globally unique identifier for the Datadog organization (UUID v1 format). + type: string + parent_org_id: + description: Identifier of the immediate parent organization, if this is a child org. + type: string + premium_support: + description: Whether the organization has a premium support plan with Datadog. + type: string + root_org_id: + description: Identifier of the top-level parent organization in a multi-org account hierarchy. + type: string + root_org_name: + description: Display name of the top-level parent organization in a multi-org account hierarchy. + type: string + shipping_country: + description: Country code or name used for shipping or regional assignment. + type: string + website: + description: Website URL provided during organization registration. + type: string + when_created: + description: ISO 8601 timestamp of when the Datadog organization was created. + type: string + type: object Trigger: description: "One of the triggers that can start the execution of a workflow." oneOf: @@ -99657,6 +99972,70 @@ paths: operator: OR permissions: - monitors_downtime + /api/v2/email/transport/webhook_intake: + post: + description: |- + Receives a batch of email transport webhook log events and emits an audit trail entry + for each event with a final delivery status (delivered, dropped, or bounced). + Only authorized organizations can submit events. + operationId: CreateEmailTransportWebhookIntake + requestBody: + content: + application/json: + examples: + default: + value: + - attributes: + email: + address: "user@example.com" + domain: "example.com" + email_id: "abc123-def456" + email_type_display_name: "Monitor Alert" + message: + id: + message_id: "" + smtp_id: "" + name: "delivered" + response: + reason: "250 2.0.0 OK" + smtp_code: "250" + timestamp: + event_timestamp: 1705312200.0 + org: 1234 + org_uuid: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091" + subject: "[Monitor Alert] CPU usage is high" + date: "2024-01-15T10:30:00Z" + log_id: "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR" + source: "sendgrid" + status: "info" + tags: + - "env:production" + schema: + $ref: "#/components/schemas/TransportWebhookLogBatchRequest" + required: true + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Ingest email transport webhook events + tags: + - Email Transport + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/error-tracking/issues/search: post: description: Search issues endpoint allows you to programmatically search for issues within your organization. This endpoint returns a list of issues that match a given search query, following the event search syntax. The search results are limited to a maximum of 100 issues per request. @@ -145653,6 +146032,8 @@ tags: scopes from alerting. Downtime settings, which can be scheduled with start and end times, prevent all alerting related to specified Datadog tags. name: Downtimes + - description: Endpoints for receiving email transport webhook events for audit trail processing. + name: Email Transport - description: Retrieves security risk scores for entities in your organization. name: Entity Risk Scores - description: View and manage issues within Error Tracking. See the [Error Tracking page](https://docs.datadoghq.com/error_tracking/) for more information. diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 79ecbd0439..81b5337963 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -277,6 +277,13 @@ datadog\_api\_client.v2.api.downtimes\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.email\_transport\_api module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.email_transport_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.entity\_risk\_scores\_api module ------------------------------------------------------------ diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index a897eca3b3..4acfd1f380 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -35018,6 +35018,97 @@ datadog\_api\_client.v2.model.token\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.transport\_webhook\_log module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_attributes module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_email module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_email + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_ip\_attribute module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_ip_attribute + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_message module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_message + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_message\_auth module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_message_auth + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_message\_custom\_args module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_message_custom_args + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_message\_id module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_message_id + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_message\_response module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_message_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_message\_timestamp module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_message_timestamp + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_network module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_network + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_network\_ip module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_network_ip + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.transport\_webhook\_log\_org\_metadata module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.transport_webhook_log_org_metadata + :members: + :show-inheritance: + datadog\_api\_client.v2.model.trigger module -------------------------------------------- diff --git a/examples/v2/email-transport/CreateEmailTransportWebhookIntake.py b/examples/v2/email-transport/CreateEmailTransportWebhookIntake.py new file mode 100644 index 0000000000..5e7bee5337 --- /dev/null +++ b/examples/v2/email-transport/CreateEmailTransportWebhookIntake.py @@ -0,0 +1,105 @@ +""" +Ingest email transport webhook events returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.email_transport_api import EmailTransportApi +from datadog_api_client.v2.model.transport_webhook_log import TransportWebhookLog +from datadog_api_client.v2.model.transport_webhook_log_attributes import TransportWebhookLogAttributes +from datadog_api_client.v2.model.transport_webhook_log_email import TransportWebhookLogEmail +from datadog_api_client.v2.model.transport_webhook_log_ip_attribute import TransportWebhookLogIpAttribute +from datadog_api_client.v2.model.transport_webhook_log_message import TransportWebhookLogMessage +from datadog_api_client.v2.model.transport_webhook_log_message_auth import TransportWebhookLogMessageAuth +from datadog_api_client.v2.model.transport_webhook_log_message_custom_args import TransportWebhookLogMessageCustomArgs +from datadog_api_client.v2.model.transport_webhook_log_message_id import TransportWebhookLogMessageId +from datadog_api_client.v2.model.transport_webhook_log_message_response import TransportWebhookLogMessageResponse +from datadog_api_client.v2.model.transport_webhook_log_message_timestamp import TransportWebhookLogMessageTimestamp +from datadog_api_client.v2.model.transport_webhook_log_network import TransportWebhookLogNetwork +from datadog_api_client.v2.model.transport_webhook_log_network_ip import TransportWebhookLogNetworkIp +from datadog_api_client.v2.model.transport_webhook_log_org_metadata import TransportWebhookLogOrgMetadata +from datetime import datetime +from dateutil.tz import tzutc + +body = [ + TransportWebhookLog( + attributes=TransportWebhookLogAttributes( + category=[ + "transactional", + ], + email=TransportWebhookLogEmail( + address="user@example.com", + domain="example.com", + subject="[Monitor Alert] CPU usage is high", + type=[ + "transactional", + ], + ), + email_id="abc123-def456", + email_type_display_name="Monitor Alert", + message=TransportWebhookLogMessage( + auth=TransportWebhookLogMessageAuth( + delivered_with_tls="TLSv1.2", + ), + custom_args=TransportWebhookLogMessageCustomArgs( + email_id="abc123-def456", + email_type_display_name="Monitor Alert", + org_uuid="8dee7c38-00cb-11ea-a77b-8b5a08d3b091", + queue_time="2024-01-15T10:29:00Z", + subject="[Monitor Alert] CPU usage is high", + ), + id=TransportWebhookLogMessageId( + message_id="", + smtp_id="", + transport_event_id="evt_abc123", + ), + name="delivered", + response=TransportWebhookLogMessageResponse( + enhanced_smtp_code="2.0.0", + reason="250 2.0.0 OK", + smtp_code="250", + ), + sender_ip="192.168.1.1", + timestamp=TransportWebhookLogMessageTimestamp( + event_timestamp=1705312200.0, + lifetime=3.2, + queue_time=1.5, + scheduled_time=1705312190.0, + ), + ), + network=TransportWebhookLogNetwork( + ip=TransportWebhookLogNetworkIp( + attributes=[ + TransportWebhookLogIpAttribute( + ip="192.168.1.1", + source=[ + "sendgrid", + ], + ), + ], + list=[ + "192.168.1.1", + ], + ), + ), + org=1234, + org_metadata=TransportWebhookLogOrgMetadata(), + org_uuid="8dee7c38-00cb-11ea-a77b-8b5a08d3b091", + queue_time="2024-01-15T10:29:00Z", + subject="[Monitor Alert] CPU usage is high", + useragent="Mozilla/5.0", + ), + date=datetime(2024, 1, 15, 10, 30, tzinfo=tzutc()), + log_id="AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR", + source="sendgrid", + status="info", + tags=[ + "env:production", + ], + ), +] + +configuration = Configuration() +configuration.unstable_operations["create_email_transport_webhook_intake"] = True +with ApiClient(configuration) as api_client: + api_instance = EmailTransportApi(api_client) + api_instance.create_email_transport_webhook_intake(body=body) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 6e38061ac6..36e9294b5b 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -375,6 +375,7 @@ def __init__( "v2.trigger_deployment_gates_evaluation": False, "v2.update_deployment_gate": False, "v2.update_deployment_rule": False, + "v2.create_email_transport_webhook_intake": False, "v2.create_hamr_org_connection": False, "v2.get_hamr_org_connection": False, "v2.create_global_incident_handle": False, diff --git a/src/datadog_api_client/v2/api/email_transport_api.py b/src/datadog_api_client/v2/api/email_transport_api.py new file mode 100644 index 0000000000..76d3c35852 --- /dev/null +++ b/src/datadog_api_client/v2/api/email_transport_api.py @@ -0,0 +1,60 @@ +# 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 Any, Dict, List + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.v2.model.transport_webhook_log import TransportWebhookLog + + +class EmailTransportApi: + """ + Endpoints for receiving email transport webhook events for audit trail processing. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_email_transport_webhook_intake_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/email/transport/webhook_intake", + "operation_id": "create_email_transport_webhook_intake", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": ([TransportWebhookLog],), + "location": "body", + "collection_format": "multi", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_email_transport_webhook_intake( + self, + body: List[TransportWebhookLog], + ) -> None: + """Ingest email transport webhook events. + + Receives a batch of email transport webhook log events and emits an audit trail entry + for each event with a final delivery status (delivered, dropped, or bounced). + Only authorized organizations can submit events. + + :type body: [TransportWebhookLog] + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_email_transport_webhook_intake_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index 3d8270c1b1..4a24c3b8d3 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -37,6 +37,7 @@ from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi from datadog_api_client.v2.api.domain_allowlist_api import DomainAllowlistApi from datadog_api_client.v2.api.downtimes_api import DowntimesApi +from datadog_api_client.v2.api.email_transport_api import EmailTransportApi from datadog_api_client.v2.api.entity_risk_scores_api import EntityRiskScoresApi from datadog_api_client.v2.api.error_tracking_api import ErrorTrackingApi from datadog_api_client.v2.api.events_api import EventsApi @@ -149,6 +150,7 @@ "DeploymentGatesApi", "DomainAllowlistApi", "DowntimesApi", + "EmailTransportApi", "EntityRiskScoresApi", "ErrorTrackingApi", "EventsApi", diff --git a/src/datadog_api_client/v2/model/transport_webhook_log.py b/src/datadog_api_client/v2/model/transport_webhook_log.py new file mode 100644 index 0000000000..584de311e3 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log.py @@ -0,0 +1,80 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.transport_webhook_log_attributes import TransportWebhookLogAttributes + + +class TransportWebhookLog(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.transport_webhook_log_attributes import TransportWebhookLogAttributes + + return { + "attributes": (TransportWebhookLogAttributes,), + "date": (datetime,), + "log_id": (str,), + "source": (str,), + "status": (str,), + "tags": ([str],), + } + + attribute_map = { + "attributes": "attributes", + "date": "date", + "log_id": "log_id", + "source": "source", + "status": "status", + "tags": "tags", + } + + def __init__( + self_, + attributes: TransportWebhookLogAttributes, + date: datetime, + log_id: str, + source: str, + status: str, + tags: List[str], + **kwargs, + ): + """ + A single email transport webhook log event. + + :param attributes: Top-level attributes for the webhook log event, including delivery status, recipient details, and provider metadata. + :type attributes: TransportWebhookLogAttributes + + :param date: The ISO 8601 timestamp of the event. + :type date: datetime + + :param log_id: The unique log event identifier. + :type log_id: str + + :param source: The email transport provider. + :type source: str + + :param status: The log status level. + :type status: str + + :param tags: A list of tags associated with the event. + :type tags: [str] + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.date = date + self_.log_id = log_id + self_.source = source + self_.status = status + self_.tags = tags diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_attributes.py b/src/datadog_api_client/v2/model/transport_webhook_log_attributes.py new file mode 100644 index 0000000000..93bdbb1fa7 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_attributes.py @@ -0,0 +1,148 @@ +# 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.transport_webhook_log_email import TransportWebhookLogEmail + from datadog_api_client.v2.model.transport_webhook_log_message import TransportWebhookLogMessage + from datadog_api_client.v2.model.transport_webhook_log_network import TransportWebhookLogNetwork + from datadog_api_client.v2.model.transport_webhook_log_org_metadata import TransportWebhookLogOrgMetadata + + +class TransportWebhookLogAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.transport_webhook_log_email import TransportWebhookLogEmail + from datadog_api_client.v2.model.transport_webhook_log_message import TransportWebhookLogMessage + from datadog_api_client.v2.model.transport_webhook_log_network import TransportWebhookLogNetwork + from datadog_api_client.v2.model.transport_webhook_log_org_metadata import TransportWebhookLogOrgMetadata + + return { + "category": ([str],), + "email": (TransportWebhookLogEmail,), + "email_id": (str,), + "email_type_display_name": (str,), + "message": (TransportWebhookLogMessage,), + "network": (TransportWebhookLogNetwork,), + "org": (int,), + "org_metadata": (TransportWebhookLogOrgMetadata,), + "org_uuid": (str,), + "queue_time": (str,), + "sg_machine_open": (bool,), + "subject": (str,), + "useragent": (str,), + } + + attribute_map = { + "category": "category", + "email": "email", + "email_id": "email_id", + "email_type_display_name": "email_type_display_name", + "message": "message", + "network": "network", + "org": "org", + "org_metadata": "org_metadata", + "org_uuid": "org_uuid", + "queue_time": "queue_time", + "sg_machine_open": "sg_machine_open", + "subject": "subject", + "useragent": "useragent", + } + + def __init__( + self_, + category: Union[List[str], UnsetType] = unset, + email: Union[TransportWebhookLogEmail, UnsetType] = unset, + email_id: Union[str, UnsetType] = unset, + email_type_display_name: Union[str, UnsetType] = unset, + message: Union[TransportWebhookLogMessage, UnsetType] = unset, + network: Union[TransportWebhookLogNetwork, UnsetType] = unset, + org: Union[int, UnsetType] = unset, + org_metadata: Union[TransportWebhookLogOrgMetadata, UnsetType] = unset, + org_uuid: Union[str, UnsetType] = unset, + queue_time: Union[str, UnsetType] = unset, + sg_machine_open: Union[bool, UnsetType] = unset, + subject: Union[str, UnsetType] = unset, + useragent: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Top-level attributes for the webhook log event, including delivery status, recipient details, and provider metadata. + + :param category: The event categories. + :type category: [str], optional + + :param email: The email address details. + :type email: TransportWebhookLogEmail, optional + + :param email_id: The unique email identifier. + :type email_id: str, optional + + :param email_type_display_name: The human-readable email type name. + :type email_type_display_name: str, optional + + :param message: The message delivery event details. + :type message: TransportWebhookLogMessage, optional + + :param network: The network information for the event. + :type network: TransportWebhookLogNetwork, optional + + :param org: The numeric organization identifier. + :type org: int, optional + + :param org_metadata: Metadata about the organization that sent the email. + :type org_metadata: TransportWebhookLogOrgMetadata, optional + + :param org_uuid: The organization UUID. + :type org_uuid: str, optional + + :param queue_time: The timestamp when the email was queued. + :type queue_time: str, optional + + :param sg_machine_open: Indicates whether the open event was triggered by automated machine activity rather than a human recipient (SendGrid-specific). + :type sg_machine_open: bool, optional + + :param subject: The email subject line. + :type subject: str, optional + + :param useragent: The user agent string for open events. + :type useragent: str, optional + """ + if category is not unset: + kwargs["category"] = category + if email is not unset: + kwargs["email"] = email + if email_id is not unset: + kwargs["email_id"] = email_id + if email_type_display_name is not unset: + kwargs["email_type_display_name"] = email_type_display_name + if message is not unset: + kwargs["message"] = message + if network is not unset: + kwargs["network"] = network + if org is not unset: + kwargs["org"] = org + if org_metadata is not unset: + kwargs["org_metadata"] = org_metadata + if org_uuid is not unset: + kwargs["org_uuid"] = org_uuid + if queue_time is not unset: + kwargs["queue_time"] = queue_time + if sg_machine_open is not unset: + kwargs["sg_machine_open"] = sg_machine_open + if subject is not unset: + kwargs["subject"] = subject + if useragent is not unset: + kwargs["useragent"] = useragent + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_email.py b/src/datadog_api_client/v2/model/transport_webhook_log_email.py new file mode 100644 index 0000000000..8fd4bdcae0 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_email.py @@ -0,0 +1,64 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogEmail(ModelNormal): + @cached_property + def openapi_types(_): + return { + "address": (str,), + "domain": (str,), + "subject": (str,), + "type": ([str],), + } + + attribute_map = { + "address": "address", + "domain": "domain", + "subject": "subject", + "type": "type", + } + + def __init__( + self_, + address: Union[str, UnsetType] = unset, + domain: Union[str, UnsetType] = unset, + subject: Union[str, UnsetType] = unset, + type: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + The email address details. + + :param address: The recipient email address. + :type address: str, optional + + :param domain: The recipient domain. + :type domain: str, optional + + :param subject: The email subject line. + :type subject: str, optional + + :param type: Email categorization tags applied by the transport provider (for example, "transactional", "marketing"). + :type type: [str], optional + """ + if address is not unset: + kwargs["address"] = address + if domain is not unset: + kwargs["domain"] = domain + if subject is not unset: + kwargs["subject"] = subject + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_ip_attribute.py b/src/datadog_api_client/v2/model/transport_webhook_log_ip_attribute.py new file mode 100644 index 0000000000..843064995c --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_ip_attribute.py @@ -0,0 +1,43 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogIpAttribute(ModelNormal): + @cached_property + def openapi_types(_): + return { + "ip": (str,), + "source": ([str],), + } + + attribute_map = { + "ip": "ip", + "source": "source", + } + + def __init__(self_, ip: Union[str, UnsetType] = unset, source: Union[List[str], UnsetType] = unset, **kwargs): + """ + An IP attribute with its sources. + + :param ip: The IP address. + :type ip: str, optional + + :param source: The transport providers or systems that reported this IP address. + :type source: [str], optional + """ + if ip is not unset: + kwargs["ip"] = ip + if source is not unset: + kwargs["source"] = source + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_message.py b/src/datadog_api_client/v2/model/transport_webhook_log_message.py new file mode 100644 index 0000000000..0a295b71cd --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_message.py @@ -0,0 +1,110 @@ +# 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.transport_webhook_log_message_auth import TransportWebhookLogMessageAuth + from datadog_api_client.v2.model.transport_webhook_log_message_custom_args import ( + TransportWebhookLogMessageCustomArgs, + ) + from datadog_api_client.v2.model.transport_webhook_log_message_id import TransportWebhookLogMessageId + from datadog_api_client.v2.model.transport_webhook_log_message_response import TransportWebhookLogMessageResponse + from datadog_api_client.v2.model.transport_webhook_log_message_timestamp import TransportWebhookLogMessageTimestamp + + +class TransportWebhookLogMessage(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.transport_webhook_log_message_auth import TransportWebhookLogMessageAuth + from datadog_api_client.v2.model.transport_webhook_log_message_custom_args import ( + TransportWebhookLogMessageCustomArgs, + ) + from datadog_api_client.v2.model.transport_webhook_log_message_id import TransportWebhookLogMessageId + from datadog_api_client.v2.model.transport_webhook_log_message_response import ( + TransportWebhookLogMessageResponse, + ) + from datadog_api_client.v2.model.transport_webhook_log_message_timestamp import ( + TransportWebhookLogMessageTimestamp, + ) + + return { + "auth": (TransportWebhookLogMessageAuth,), + "custom_args": (TransportWebhookLogMessageCustomArgs,), + "id": (TransportWebhookLogMessageId,), + "name": (str,), + "response": (TransportWebhookLogMessageResponse,), + "sender_ip": (str,), + "timestamp": (TransportWebhookLogMessageTimestamp,), + } + + attribute_map = { + "auth": "auth", + "custom_args": "custom_args", + "id": "id", + "name": "name", + "response": "response", + "sender_ip": "sender_ip", + "timestamp": "timestamp", + } + + def __init__( + self_, + auth: Union[TransportWebhookLogMessageAuth, UnsetType] = unset, + custom_args: Union[TransportWebhookLogMessageCustomArgs, UnsetType] = unset, + id: Union[TransportWebhookLogMessageId, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + response: Union[TransportWebhookLogMessageResponse, UnsetType] = unset, + sender_ip: Union[str, UnsetType] = unset, + timestamp: Union[TransportWebhookLogMessageTimestamp, UnsetType] = unset, + **kwargs, + ): + """ + The message delivery event details. + + :param auth: The message authentication details. + :type auth: TransportWebhookLogMessageAuth, optional + + :param custom_args: Custom arguments passed through the email transport provider for tracking. + :type custom_args: TransportWebhookLogMessageCustomArgs, optional + + :param id: The message identifiers. + :type id: TransportWebhookLogMessageId, optional + + :param name: The delivery event type emitted by the transport provider (for example, "delivered", "dropped", "bounced"). + :type name: str, optional + + :param response: The SMTP response information. + :type response: TransportWebhookLogMessageResponse, optional + + :param sender_ip: The IP address of the sending server. + :type sender_ip: str, optional + + :param timestamp: The message delivery timing information. + :type timestamp: TransportWebhookLogMessageTimestamp, optional + """ + if auth is not unset: + kwargs["auth"] = auth + if custom_args is not unset: + kwargs["custom_args"] = custom_args + if id is not unset: + kwargs["id"] = id + if name is not unset: + kwargs["name"] = name + if response is not unset: + kwargs["response"] = response + if sender_ip is not unset: + kwargs["sender_ip"] = sender_ip + if timestamp is not unset: + kwargs["timestamp"] = timestamp + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_message_auth.py b/src/datadog_api_client/v2/model/transport_webhook_log_message_auth.py new file mode 100644 index 0000000000..7ad730659e --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_message_auth.py @@ -0,0 +1,36 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogMessageAuth(ModelNormal): + @cached_property + def openapi_types(_): + return { + "delivered_with_tls": (str,), + } + + attribute_map = { + "delivered_with_tls": "delivered_with_tls", + } + + def __init__(self_, delivered_with_tls: Union[str, UnsetType] = unset, **kwargs): + """ + The message authentication details. + + :param delivered_with_tls: The TLS version or negotiation information. + :type delivered_with_tls: str, optional + """ + if delivered_with_tls is not unset: + kwargs["delivered_with_tls"] = delivered_with_tls + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_message_custom_args.py b/src/datadog_api_client/v2/model/transport_webhook_log_message_custom_args.py new file mode 100644 index 0000000000..a12f9277cd --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_message_custom_args.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 Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogMessageCustomArgs(ModelNormal): + @cached_property + def openapi_types(_): + return { + "email_id": (str,), + "email_type_display_name": (str,), + "org_uuid": (str,), + "queue_time": (str,), + "subject": (str,), + } + + attribute_map = { + "email_id": "email_id", + "email_type_display_name": "email_type_display_name", + "org_uuid": "org_uuid", + "queue_time": "queue_time", + "subject": "subject", + } + + def __init__( + self_, + email_id: Union[str, UnsetType] = unset, + email_type_display_name: Union[str, UnsetType] = unset, + org_uuid: Union[str, UnsetType] = unset, + queue_time: Union[str, UnsetType] = unset, + subject: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Custom arguments passed through the email transport provider for tracking. + + :param email_id: The unique email identifier. + :type email_id: str, optional + + :param email_type_display_name: The human-readable email type name. + :type email_type_display_name: str, optional + + :param org_uuid: The organization UUID. + :type org_uuid: str, optional + + :param queue_time: The timestamp when the email was queued. + :type queue_time: str, optional + + :param subject: The email subject line. + :type subject: str, optional + """ + if email_id is not unset: + kwargs["email_id"] = email_id + if email_type_display_name is not unset: + kwargs["email_type_display_name"] = email_type_display_name + if org_uuid is not unset: + kwargs["org_uuid"] = org_uuid + if queue_time is not unset: + kwargs["queue_time"] = queue_time + if subject is not unset: + kwargs["subject"] = subject + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_message_id.py b/src/datadog_api_client/v2/model/transport_webhook_log_message_id.py new file mode 100644 index 0000000000..3f27d87a78 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_message_id.py @@ -0,0 +1,56 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogMessageId(ModelNormal): + @cached_property + def openapi_types(_): + return { + "message_id": (str,), + "smtp_id": (str,), + "transport_event_id": (str,), + } + + attribute_map = { + "message_id": "message_id", + "smtp_id": "smtp_id", + "transport_event_id": "transport_event_id", + } + + def __init__( + self_, + message_id: Union[str, UnsetType] = unset, + smtp_id: Union[str, UnsetType] = unset, + transport_event_id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The message identifiers. + + :param message_id: The RFC 5322 Message-ID. + :type message_id: str, optional + + :param smtp_id: The SMTP transaction identifier. + :type smtp_id: str, optional + + :param transport_event_id: The transport provider event identifier. + :type transport_event_id: str, optional + """ + if message_id is not unset: + kwargs["message_id"] = message_id + if smtp_id is not unset: + kwargs["smtp_id"] = smtp_id + if transport_event_id is not unset: + kwargs["transport_event_id"] = transport_event_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_message_response.py b/src/datadog_api_client/v2/model/transport_webhook_log_message_response.py new file mode 100644 index 0000000000..fc77c730e0 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_message_response.py @@ -0,0 +1,56 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogMessageResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "enhanced_smtp_code": (str,), + "reason": (str,), + "smtp_code": (str,), + } + + attribute_map = { + "enhanced_smtp_code": "enhanced_smtp_code", + "reason": "reason", + "smtp_code": "smtp_code", + } + + def __init__( + self_, + enhanced_smtp_code: Union[str, UnsetType] = unset, + reason: Union[str, UnsetType] = unset, + smtp_code: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The SMTP response information. + + :param enhanced_smtp_code: The enhanced SMTP status code. + :type enhanced_smtp_code: str, optional + + :param reason: The SMTP response message. + :type reason: str, optional + + :param smtp_code: The SMTP status code. + :type smtp_code: str, optional + """ + if enhanced_smtp_code is not unset: + kwargs["enhanced_smtp_code"] = enhanced_smtp_code + if reason is not unset: + kwargs["reason"] = reason + if smtp_code is not unset: + kwargs["smtp_code"] = smtp_code + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_message_timestamp.py b/src/datadog_api_client/v2/model/transport_webhook_log_message_timestamp.py new file mode 100644 index 0000000000..48589d9e55 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_message_timestamp.py @@ -0,0 +1,64 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogMessageTimestamp(ModelNormal): + @cached_property + def openapi_types(_): + return { + "event_timestamp": (float,), + "lifetime": (float,), + "queue_time": (float,), + "scheduled_time": (float,), + } + + attribute_map = { + "event_timestamp": "event_timestamp", + "lifetime": "lifetime", + "queue_time": "queue_time", + "scheduled_time": "scheduled_time", + } + + def __init__( + self_, + event_timestamp: Union[float, UnsetType] = unset, + lifetime: Union[float, UnsetType] = unset, + queue_time: Union[float, UnsetType] = unset, + scheduled_time: Union[float, UnsetType] = unset, + **kwargs, + ): + """ + The message delivery timing information. + + :param event_timestamp: The Unix timestamp of the event. + :type event_timestamp: float, optional + + :param lifetime: The total delivery time in seconds. + :type lifetime: float, optional + + :param queue_time: Number of seconds the message spent in the delivery queue. + :type queue_time: float, optional + + :param scheduled_time: The scheduled delivery time as a Unix timestamp. + :type scheduled_time: float, optional + """ + if event_timestamp is not unset: + kwargs["event_timestamp"] = event_timestamp + if lifetime is not unset: + kwargs["lifetime"] = lifetime + if queue_time is not unset: + kwargs["queue_time"] = queue_time + if scheduled_time is not unset: + kwargs["scheduled_time"] = scheduled_time + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_network.py b/src/datadog_api_client/v2/model/transport_webhook_log_network.py new file mode 100644 index 0000000000..bbcad5a11c --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_network.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.transport_webhook_log_network_ip import TransportWebhookLogNetworkIp + + +class TransportWebhookLogNetwork(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.transport_webhook_log_network_ip import TransportWebhookLogNetworkIp + + return { + "ip": (TransportWebhookLogNetworkIp,), + } + + attribute_map = { + "ip": "ip", + } + + def __init__(self_, ip: Union[TransportWebhookLogNetworkIp, UnsetType] = unset, **kwargs): + """ + The network information for the event. + + :param ip: The IP address information. + :type ip: TransportWebhookLogNetworkIp, optional + """ + if ip is not unset: + kwargs["ip"] = ip + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_network_ip.py b/src/datadog_api_client/v2/model/transport_webhook_log_network_ip.py new file mode 100644 index 0000000000..cbd784e0b7 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_network_ip.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 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.transport_webhook_log_ip_attribute import TransportWebhookLogIpAttribute + + +class TransportWebhookLogNetworkIp(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.transport_webhook_log_ip_attribute import TransportWebhookLogIpAttribute + + return { + "attributes": ([TransportWebhookLogIpAttribute],), + "list": ([str],), + } + + attribute_map = { + "attributes": "attributes", + "list": "list", + } + + def __init__( + self_, + attributes: Union[List[TransportWebhookLogIpAttribute], UnsetType] = unset, + list: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + The IP address information. + + :param attributes: Per-IP attribute records, each pairing an IP address with the providers that observed it. + :type attributes: [TransportWebhookLogIpAttribute], optional + + :param list: The list of IP addresses. + :type list: [str], optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if list is not unset: + kwargs["list"] = list + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/transport_webhook_log_org_metadata.py b/src/datadog_api_client/v2/model/transport_webhook_log_org_metadata.py new file mode 100644 index 0000000000..bdd62a0862 --- /dev/null +++ b/src/datadog_api_client/v2/model/transport_webhook_log_org_metadata.py @@ -0,0 +1,160 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TransportWebhookLogOrgMetadata(ModelNormal): + @cached_property + def openapi_types(_): + return { + "billing_country": (str,), + "billing_plan": (str,), + "customer_tier": (str,), + "domain": (str,), + "industry": (str,), + "is_bugbounty": (str,), + "is_msp": (str,), + "name": (str,), + "org_uuid": (str,), + "parent_org_id": (str,), + "premium_support": (str,), + "root_org_id": (str,), + "root_org_name": (str,), + "shipping_country": (str,), + "website": (str,), + "when_created": (str,), + } + + attribute_map = { + "billing_country": "billing_country", + "billing_plan": "billing_plan", + "customer_tier": "customer_tier", + "domain": "domain", + "industry": "industry", + "is_bugbounty": "is_bugbounty", + "is_msp": "is_msp", + "name": "name", + "org_uuid": "org_uuid", + "parent_org_id": "parent_org_id", + "premium_support": "premium_support", + "root_org_id": "root_org_id", + "root_org_name": "root_org_name", + "shipping_country": "shipping_country", + "website": "website", + "when_created": "when_created", + } + + def __init__( + self_, + billing_country: Union[str, UnsetType] = unset, + billing_plan: Union[str, UnsetType] = unset, + customer_tier: Union[str, UnsetType] = unset, + domain: Union[str, UnsetType] = unset, + industry: Union[str, UnsetType] = unset, + is_bugbounty: Union[str, UnsetType] = unset, + is_msp: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + org_uuid: Union[str, UnsetType] = unset, + parent_org_id: Union[str, UnsetType] = unset, + premium_support: Union[str, UnsetType] = unset, + root_org_id: Union[str, UnsetType] = unset, + root_org_name: Union[str, UnsetType] = unset, + shipping_country: Union[str, UnsetType] = unset, + website: Union[str, UnsetType] = unset, + when_created: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Metadata about the organization that sent the email. + + :param billing_country: Country code or name used for billing purposes. + :type billing_country: str, optional + + :param billing_plan: The Datadog billing plan for the organization (for example, "pro", "enterprise"). + :type billing_plan: str, optional + + :param customer_tier: Support or account tier assigned to the organization (for example, "tier-1"). + :type customer_tier: str, optional + + :param domain: Primary email domain associated with the organization (for example, "example.com"). + :type domain: str, optional + + :param industry: Industry classification of the organization (for example, "technology", "finance"). + :type industry: str, optional + + :param is_bugbounty: Whether the organization is enrolled in the Datadog bug bounty program. + :type is_bugbounty: str, optional + + :param is_msp: Whether the organization operates as a Managed Service Provider managing child orgs. + :type is_msp: str, optional + + :param name: Display name of the organization as configured in Datadog account settings. + :type name: str, optional + + :param org_uuid: Globally unique identifier for the Datadog organization (UUID v1 format). + :type org_uuid: str, optional + + :param parent_org_id: Identifier of the immediate parent organization, if this is a child org. + :type parent_org_id: str, optional + + :param premium_support: Whether the organization has a premium support plan with Datadog. + :type premium_support: str, optional + + :param root_org_id: Identifier of the top-level parent organization in a multi-org account hierarchy. + :type root_org_id: str, optional + + :param root_org_name: Display name of the top-level parent organization in a multi-org account hierarchy. + :type root_org_name: str, optional + + :param shipping_country: Country code or name used for shipping or regional assignment. + :type shipping_country: str, optional + + :param website: Website URL provided during organization registration. + :type website: str, optional + + :param when_created: ISO 8601 timestamp of when the Datadog organization was created. + :type when_created: str, optional + """ + if billing_country is not unset: + kwargs["billing_country"] = billing_country + if billing_plan is not unset: + kwargs["billing_plan"] = billing_plan + if customer_tier is not unset: + kwargs["customer_tier"] = customer_tier + if domain is not unset: + kwargs["domain"] = domain + if industry is not unset: + kwargs["industry"] = industry + if is_bugbounty is not unset: + kwargs["is_bugbounty"] = is_bugbounty + if is_msp is not unset: + kwargs["is_msp"] = is_msp + if name is not unset: + kwargs["name"] = name + if org_uuid is not unset: + kwargs["org_uuid"] = org_uuid + if parent_org_id is not unset: + kwargs["parent_org_id"] = parent_org_id + if premium_support is not unset: + kwargs["premium_support"] = premium_support + if root_org_id is not unset: + kwargs["root_org_id"] = root_org_id + if root_org_name is not unset: + kwargs["root_org_name"] = root_org_name + if shipping_country is not unset: + kwargs["shipping_country"] = shipping_country + if website is not unset: + kwargs["website"] = website + if when_created is not unset: + kwargs["when_created"] = when_created + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index f1cb60da57..05eb4d066a 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -7155,6 +7155,19 @@ from datadog_api_client.v2.model.timeseries_response_values import TimeseriesResponseValues from datadog_api_client.v2.model.timeseries_response_values_list import TimeseriesResponseValuesList from datadog_api_client.v2.model.token_type import TokenType +from datadog_api_client.v2.model.transport_webhook_log import TransportWebhookLog +from datadog_api_client.v2.model.transport_webhook_log_attributes import TransportWebhookLogAttributes +from datadog_api_client.v2.model.transport_webhook_log_email import TransportWebhookLogEmail +from datadog_api_client.v2.model.transport_webhook_log_ip_attribute import TransportWebhookLogIpAttribute +from datadog_api_client.v2.model.transport_webhook_log_message import TransportWebhookLogMessage +from datadog_api_client.v2.model.transport_webhook_log_message_auth import TransportWebhookLogMessageAuth +from datadog_api_client.v2.model.transport_webhook_log_message_custom_args import TransportWebhookLogMessageCustomArgs +from datadog_api_client.v2.model.transport_webhook_log_message_id import TransportWebhookLogMessageId +from datadog_api_client.v2.model.transport_webhook_log_message_response import TransportWebhookLogMessageResponse +from datadog_api_client.v2.model.transport_webhook_log_message_timestamp import TransportWebhookLogMessageTimestamp +from datadog_api_client.v2.model.transport_webhook_log_network import TransportWebhookLogNetwork +from datadog_api_client.v2.model.transport_webhook_log_network_ip import TransportWebhookLogNetworkIp +from datadog_api_client.v2.model.transport_webhook_log_org_metadata import TransportWebhookLogOrgMetadata from datadog_api_client.v2.model.trigger import Trigger from datadog_api_client.v2.model.trigger_attributes import TriggerAttributes from datadog_api_client.v2.model.trigger_investigation_request import TriggerInvestigationRequest @@ -12507,6 +12520,19 @@ "TimeseriesResponseValues", "TimeseriesResponseValuesList", "TokenType", + "TransportWebhookLog", + "TransportWebhookLogAttributes", + "TransportWebhookLogEmail", + "TransportWebhookLogIpAttribute", + "TransportWebhookLogMessage", + "TransportWebhookLogMessageAuth", + "TransportWebhookLogMessageCustomArgs", + "TransportWebhookLogMessageId", + "TransportWebhookLogMessageResponse", + "TransportWebhookLogMessageTimestamp", + "TransportWebhookLogNetwork", + "TransportWebhookLogNetworkIp", + "TransportWebhookLogOrgMetadata", "Trigger", "TriggerAttributes", "TriggerInvestigationRequest", diff --git a/tests/v2/features/email_transport.feature b/tests/v2/features/email_transport.feature new file mode 100644 index 0000000000..f2b014905e --- /dev/null +++ b/tests/v2/features/email_transport.feature @@ -0,0 +1,22 @@ +@endpoint(email-transport) @endpoint(email-transport-v2) +Feature: Email Transport + Endpoints for receiving email transport webhook events for audit trail + processing. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "EmailTransport" API + And operation "CreateEmailTransportWebhookIntake" enabled + And new "CreateEmailTransportWebhookIntake" request + And body with value [{"attributes": {"category": ["transactional"], "email": {"address": "user@example.com", "domain": "example.com", "subject": "[Monitor Alert] CPU usage is high", "type": ["transactional"]}, "email_id": "abc123-def456", "email_type_display_name": "Monitor Alert", "message": {"auth": {"delivered_with_tls": "TLSv1.2"}, "custom_args": {"email_id": "abc123-def456", "email_type_display_name": "Monitor Alert", "org_uuid": "8dee7c38-00cb-11ea-a77b-8b5a08d3b091", "queue_time": "2024-01-15T10:29:00Z", "subject": "[Monitor Alert] CPU usage is high"}, "id": {"message_id": "", "smtp_id": "", "transport_event_id": "evt_abc123"}, "name": "delivered", "response": {"enhanced_smtp_code": "2.0.0", "reason": "250 2.0.0 OK", "smtp_code": "250"}, "sender_ip": "192.168.1.1", "timestamp": {"event_timestamp": 1705312200.0, "lifetime": 3.2, "queue_time": 1.5, "scheduled_time": 1705312190.0}}, "network": {"ip": {"attributes": [{"ip": "192.168.1.1", "source": ["sendgrid"]}], "list": ["192.168.1.1"]}}, "org": 1234, "org_metadata": {}, "org_uuid": "8dee7c38-00cb-11ea-a77b-8b5a08d3b091", "queue_time": "2024-01-15T10:29:00Z", "subject": "[Monitor Alert] CPU usage is high", "useragent": "Mozilla/5.0"}, "date": "2024-01-15T10:30:00Z", "log_id": "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR", "source": "sendgrid", "status": "info", "tags": ["env:production"]}] + + @generated @skip @team:DataDog/dogmail + Scenario: Ingest email transport webhook events returns "Bad Request" response + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/dogmail + Scenario: Ingest email transport webhook events returns "No Content" response + When the request is sent + Then the response status is 204 No Content diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index d5a8323e27..96d9f3eb5d 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1863,6 +1863,12 @@ "type": "idempotent" } }, + "CreateEmailTransportWebhookIntake": { + "tag": "Email Transport", + "undo": { + "type": "safe" + } + }, "SearchIssues": { "tag": "Error Tracking", "undo": {