Skip to content

Commit a12da75

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 6fe9b33 of spec repo (#3299)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 25ce205 commit a12da75

21 files changed

Lines changed: 2604 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 381 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Ingest email transport webhook events returns "No Content" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.create_email_transport_webhook_intake".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::EmailTransportAPI.new
8+
9+
body = [
10+
DatadogAPIClient::V2::TransportWebhookLog.new({
11+
attributes: DatadogAPIClient::V2::TransportWebhookLogAttributes.new({
12+
category: [
13+
"transactional",
14+
],
15+
email: DatadogAPIClient::V2::TransportWebhookLogEmail.new({
16+
address: "user@example.com",
17+
domain: "example.com",
18+
subject: "[Monitor Alert] CPU usage is high",
19+
type: [
20+
"transactional",
21+
],
22+
}),
23+
email_id: "abc123-def456",
24+
email_type_display_name: "Monitor Alert",
25+
message: DatadogAPIClient::V2::TransportWebhookLogMessage.new({
26+
auth: DatadogAPIClient::V2::TransportWebhookLogMessageAuth.new({
27+
delivered_with_tls: "TLSv1.2",
28+
}),
29+
custom_args: DatadogAPIClient::V2::TransportWebhookLogMessageCustomArgs.new({
30+
email_id: "abc123-def456",
31+
email_type_display_name: "Monitor Alert",
32+
org_uuid: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091",
33+
queue_time: "2024-01-15T10:29:00Z",
34+
subject: "[Monitor Alert] CPU usage is high",
35+
}),
36+
id: DatadogAPIClient::V2::TransportWebhookLogMessageId.new({
37+
message_id: "<message-id@example.com>",
38+
smtp_id: "<abc123@mail.example.com>",
39+
transport_event_id: "evt_abc123",
40+
}),
41+
name: "delivered",
42+
response: DatadogAPIClient::V2::TransportWebhookLogMessageResponse.new({
43+
enhanced_smtp_code: "2.0.0",
44+
reason: "250 2.0.0 OK",
45+
smtp_code: "250",
46+
}),
47+
sender_ip: "192.168.1.1",
48+
timestamp: DatadogAPIClient::V2::TransportWebhookLogMessageTimestamp.new({
49+
event_timestamp: 1705312200.0,
50+
lifetime: 3.2,
51+
queue_time: 1.5,
52+
scheduled_time: 1705312190.0,
53+
}),
54+
}),
55+
network: DatadogAPIClient::V2::TransportWebhookLogNetwork.new({
56+
ip: DatadogAPIClient::V2::TransportWebhookLogNetworkIp.new({
57+
attributes: [
58+
DatadogAPIClient::V2::TransportWebhookLogIpAttribute.new({
59+
ip: "192.168.1.1",
60+
source: [
61+
"sendgrid",
62+
],
63+
}),
64+
],
65+
list: [
66+
"192.168.1.1",
67+
],
68+
}),
69+
}),
70+
org: 1234,
71+
org_metadata: DatadogAPIClient::V2::TransportWebhookLogOrgMetadata.new({}),
72+
org_uuid: "8dee7c38-00cb-11ea-a77b-8b5a08d3b091",
73+
queue_time: "2024-01-15T10:29:00Z",
74+
subject: "[Monitor Alert] CPU usage is high",
75+
useragent: "Mozilla/5.0",
76+
}),
77+
date: "2024-01-15T10:30:00Z",
78+
log_id: "AQAAAZPHnBT0TwJAdgAAAABBWlBIblVlNEFBQ0dFMmVkYTFDSnRR",
79+
source: "sendgrid",
80+
status: "info",
81+
tags: [
82+
"env:production",
83+
],
84+
}),
85+
]
86+
api_instance.create_email_transport_webhook_intake(body)

features/scenarios_model_mapping.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,9 @@
24342434
"page_offset" => "Integer",
24352435
"page_limit" => "Integer",
24362436
},
2437+
"v2.CreateEmailTransportWebhookIntake" => {
2438+
"body" => "Array<TransportWebhookLog>",
2439+
},
24372440
"v2.SearchIssues" => {
24382441
"include" => "Array<SearchIssuesIncludeQueryParameterItem>",
24392442
"body" => "IssuesSearchRequest",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@endpoint(email-transport) @endpoint(email-transport-v2)
2+
Feature: Email Transport
3+
Endpoints for receiving email transport webhook events for audit trail
4+
processing.
5+
6+
Background:
7+
Given a valid "apiKeyAuth" key in the system
8+
And a valid "appKeyAuth" key in the system
9+
And an instance of "EmailTransport" API
10+
And operation "CreateEmailTransportWebhookIntake" enabled
11+
And new "CreateEmailTransportWebhookIntake" request
12+
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": "<message-id@example.com>", "smtp_id": "<abc123@mail.example.com>", "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"]}]
13+
14+
@generated @skip @team:DataDog/dogmail
15+
Scenario: Ingest email transport webhook events returns "Bad Request" response
16+
When the request is sent
17+
Then the response status is 400 Bad Request
18+
19+
@generated @skip @team:DataDog/dogmail
20+
Scenario: Ingest email transport webhook events returns "No Content" response
21+
When the request is sent
22+
Then the response status is 204 No Content

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,12 @@
18631863
"type": "idempotent"
18641864
}
18651865
},
1866+
"CreateEmailTransportWebhookIntake": {
1867+
"tag": "Email Transport",
1868+
"undo": {
1869+
"type": "safe"
1870+
}
1871+
},
18661872
"SearchIssues": {
18671873
"tag": "Error Tracking",
18681874
"undo": {

lib/datadog_api_client/configuration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ def initialize
317317
"v2.trigger_deployment_gates_evaluation": false,
318318
"v2.update_deployment_gate": false,
319319
"v2.update_deployment_rule": false,
320+
"v2.create_email_transport_webhook_intake": false,
320321
"v2.create_hamr_org_connection": false,
321322
"v2.get_hamr_org_connection": false,
322323
"v2.create_global_incident_handle": false,

lib/datadog_api_client/inflector.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6068,6 +6068,19 @@ def overrides
60686068
"v2.timeseries_response_attributes" => "TimeseriesResponseAttributes",
60696069
"v2.timeseries_response_series" => "TimeseriesResponseSeries",
60706070
"v2.token_type" => "TokenType",
6071+
"v2.transport_webhook_log" => "TransportWebhookLog",
6072+
"v2.transport_webhook_log_attributes" => "TransportWebhookLogAttributes",
6073+
"v2.transport_webhook_log_email" => "TransportWebhookLogEmail",
6074+
"v2.transport_webhook_log_ip_attribute" => "TransportWebhookLogIpAttribute",
6075+
"v2.transport_webhook_log_message" => "TransportWebhookLogMessage",
6076+
"v2.transport_webhook_log_message_auth" => "TransportWebhookLogMessageAuth",
6077+
"v2.transport_webhook_log_message_custom_args" => "TransportWebhookLogMessageCustomArgs",
6078+
"v2.transport_webhook_log_message_id" => "TransportWebhookLogMessageId",
6079+
"v2.transport_webhook_log_message_response" => "TransportWebhookLogMessageResponse",
6080+
"v2.transport_webhook_log_message_timestamp" => "TransportWebhookLogMessageTimestamp",
6081+
"v2.transport_webhook_log_network" => "TransportWebhookLogNetwork",
6082+
"v2.transport_webhook_log_network_ip" => "TransportWebhookLogNetworkIp",
6083+
"v2.transport_webhook_log_org_metadata" => "TransportWebhookLogOrgMetadata",
60716084
"v2.trigger" => "Trigger",
60726085
"v2.trigger_attributes" => "TriggerAttributes",
60736086
"v2.trigger_investigation_request" => "TriggerInvestigationRequest",
@@ -6412,6 +6425,7 @@ def overrides
64126425
"v2.domain_allowlist_api" => "DomainAllowlistAPI",
64136426
"v2.dora_metrics_api" => "DORAMetricsAPI",
64146427
"v2.downtimes_api" => "DowntimesAPI",
6428+
"v2.email_transport_api" => "EmailTransportAPI",
64156429
"v2.entity_risk_scores_api" => "EntityRiskScoresAPI",
64166430
"v2.error_tracking_api" => "ErrorTrackingAPI",
64176431
"v2.events_api" => "EventsAPI",
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'cgi'
17+
18+
module DatadogAPIClient::V2
19+
class EmailTransportAPI
20+
attr_accessor :api_client
21+
22+
def initialize(api_client = DatadogAPIClient::APIClient.default)
23+
@api_client = api_client
24+
end
25+
26+
# Ingest email transport webhook events.
27+
#
28+
# @see #create_email_transport_webhook_intake_with_http_info
29+
def create_email_transport_webhook_intake(body, opts = {})
30+
create_email_transport_webhook_intake_with_http_info(body, opts)
31+
nil
32+
end
33+
34+
# Ingest email transport webhook events.
35+
#
36+
# Receives a batch of email transport webhook log events and emits an audit trail entry
37+
# for each event with a final delivery status (delivered, dropped, or bounced).
38+
# Only authorized organizations can submit events.
39+
#
40+
# @param body [Array<TransportWebhookLog>]
41+
# @param opts [Hash] the optional parameters
42+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
43+
def create_email_transport_webhook_intake_with_http_info(body, opts = {})
44+
unstable_enabled = @api_client.config.unstable_operations["v2.create_email_transport_webhook_intake".to_sym]
45+
if unstable_enabled
46+
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_email_transport_webhook_intake")
47+
else
48+
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_email_transport_webhook_intake"))
49+
end
50+
51+
if @api_client.config.debugging
52+
@api_client.config.logger.debug 'Calling API: EmailTransportAPI.create_email_transport_webhook_intake ...'
53+
end
54+
# verify the required parameter 'body' is set
55+
if @api_client.config.client_side_validation && body.nil?
56+
fail ArgumentError, "Missing the required parameter 'body' when calling EmailTransportAPI.create_email_transport_webhook_intake"
57+
end
58+
# resource path
59+
local_var_path = '/api/v2/email/transport/webhook_intake'
60+
61+
# query parameters
62+
query_params = opts[:query_params] || {}
63+
64+
# header parameters
65+
header_params = opts[:header_params] || {}
66+
# HTTP header 'Accept' (if needed)
67+
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
68+
# HTTP header 'Content-Type'
69+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
70+
71+
# form parameters
72+
form_params = opts[:form_params] || {}
73+
74+
# http body (model)
75+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
76+
77+
# return_type
78+
return_type = opts[:debug_return_type]
79+
80+
# auth_names
81+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
82+
83+
new_options = opts.merge(
84+
:operation => :create_email_transport_webhook_intake,
85+
:header_params => header_params,
86+
:query_params => query_params,
87+
:form_params => form_params,
88+
:body => post_body,
89+
:auth_names => auth_names,
90+
:return_type => return_type,
91+
:api_version => "V2"
92+
)
93+
94+
data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
95+
if @api_client.config.debugging
96+
@api_client.config.logger.debug "API called: EmailTransportAPI#create_email_transport_webhook_intake\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
97+
end
98+
return data, status_code, headers
99+
end
100+
end
101+
end

0 commit comments

Comments
 (0)