Skip to content

Commit 6ad8dae

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

21 files changed

Lines changed: 3893 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 381 additions & 0 deletions
Large diffs are not rendered by default.

api/datadog/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ func NewConfiguration() *Configuration {
782782
"v2.TriggerDeploymentGatesEvaluation": false,
783783
"v2.UpdateDeploymentGate": false,
784784
"v2.UpdateDeploymentRule": false,
785+
"v2.CreateEmailTransportWebhookIntake": false,
785786
"v2.CreateHamrOrgConnection": false,
786787
"v2.GetHamrOrgConnection": false,
787788
"v2.CreateGlobalIncidentHandle": false,
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
_context "context"
9+
_fmt "fmt"
10+
_log "log"
11+
_nethttp "net/http"
12+
_neturl "net/url"
13+
14+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
15+
)
16+
17+
// EmailTransportApi service type
18+
type EmailTransportApi datadog.Service
19+
20+
// CreateEmailTransportWebhookIntake Ingest email transport webhook events.
21+
// Receives a batch of email transport webhook log events and emits an audit trail entry
22+
// for each event with a final delivery status (delivered, dropped, or bounced).
23+
// Only authorized organizations can submit events.
24+
func (a *EmailTransportApi) CreateEmailTransportWebhookIntake(ctx _context.Context, body []TransportWebhookLog) (*_nethttp.Response, error) {
25+
var (
26+
localVarHTTPMethod = _nethttp.MethodPost
27+
localVarPostBody interface{}
28+
)
29+
30+
operationId := "v2.CreateEmailTransportWebhookIntake"
31+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
32+
if !isOperationEnabled {
33+
return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
34+
}
35+
if isOperationEnabled && a.Client.Cfg.Debug {
36+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
37+
}
38+
39+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.EmailTransportApi.CreateEmailTransportWebhookIntake")
40+
if err != nil {
41+
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
42+
}
43+
44+
localVarPath := localBasePath + "/api/v2/email/transport/webhook_intake"
45+
46+
localVarHeaderParams := make(map[string]string)
47+
localVarQueryParams := _neturl.Values{}
48+
localVarFormParams := _neturl.Values{}
49+
localVarHeaderParams["Content-Type"] = "application/json"
50+
localVarHeaderParams["Accept"] = "*/*"
51+
52+
// body params
53+
localVarPostBody = &body
54+
if a.Client.Cfg.DelegatedTokenConfig != nil {
55+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
56+
if err != nil {
57+
return nil, err
58+
}
59+
} else {
60+
datadog.SetAuthKeys(
61+
ctx,
62+
&localVarHeaderParams,
63+
[2]string{"apiKeyAuth", "DD-API-KEY"},
64+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
65+
)
66+
}
67+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
68+
if err != nil {
69+
return nil, err
70+
}
71+
72+
localVarHTTPResponse, err := a.Client.CallAPI(req)
73+
if err != nil || localVarHTTPResponse == nil {
74+
return localVarHTTPResponse, err
75+
}
76+
77+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
78+
if err != nil {
79+
return localVarHTTPResponse, err
80+
}
81+
82+
if localVarHTTPResponse.StatusCode >= 300 {
83+
newErr := datadog.GenericOpenAPIError{
84+
ErrorBody: localVarBody,
85+
ErrorMessage: localVarHTTPResponse.Status,
86+
}
87+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 {
88+
var v JSONAPIErrorResponse
89+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
90+
if err != nil {
91+
return localVarHTTPResponse, newErr
92+
}
93+
newErr.ErrorModel = v
94+
return localVarHTTPResponse, newErr
95+
}
96+
if localVarHTTPResponse.StatusCode == 429 {
97+
var v APIErrorResponse
98+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
99+
if err != nil {
100+
return localVarHTTPResponse, newErr
101+
}
102+
newErr.ErrorModel = v
103+
}
104+
return localVarHTTPResponse, newErr
105+
}
106+
107+
return localVarHTTPResponse, nil
108+
}
109+
110+
// NewEmailTransportApi Returns NewEmailTransportApi.
111+
func NewEmailTransportApi(client *datadog.APIClient) *EmailTransportApi {
112+
return &EmailTransportApi{
113+
Client: client,
114+
}
115+
}

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@
282282
// - [DowntimesApi.ListDowntimes]
283283
// - [DowntimesApi.ListMonitorDowntimes]
284284
// - [DowntimesApi.UpdateDowntime]
285+
// - [EmailTransportApi.CreateEmailTransportWebhookIntake]
285286
// - [EntityRiskScoresApi.ListEntityRiskScores]
286287
// - [ErrorTrackingApi.DeleteIssueAssignee]
287288
// - [ErrorTrackingApi.GetIssue]

0 commit comments

Comments
 (0)