Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
381 changes: 381 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions api/datadog/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ func NewConfiguration() *Configuration {
"v2.TriggerDeploymentGatesEvaluation": false,
"v2.UpdateDeploymentGate": false,
"v2.UpdateDeploymentRule": false,
"v2.CreateEmailTransportWebhookIntake": false,
"v2.CreateHamrOrgConnection": false,
"v2.GetHamrOrgConnection": false,
"v2.CreateGlobalIncidentHandle": false,
Expand Down
115 changes: 115 additions & 0 deletions api/datadogV2/api_email_transport.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// 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.

package datadogV2

import (
_context "context"
_fmt "fmt"
_log "log"
_nethttp "net/http"
_neturl "net/url"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// EmailTransportApi service type
type EmailTransportApi datadog.Service

// CreateEmailTransportWebhookIntake 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.
func (a *EmailTransportApi) CreateEmailTransportWebhookIntake(ctx _context.Context, body []TransportWebhookLog) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
)

operationId := "v2.CreateEmailTransportWebhookIntake"
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
if !isOperationEnabled {
return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
}
if isOperationEnabled && a.Client.Cfg.Debug {
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
}

localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.EmailTransportApi.CreateEmailTransportWebhookIntake")
if err != nil {
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}

localVarPath := localBasePath + "/api/v2/email/transport/webhook_intake"

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
localVarHeaderParams["Content-Type"] = "application/json"
localVarHeaderParams["Accept"] = "*/*"

// body params
localVarPostBody = &body
if a.Client.Cfg.DelegatedTokenConfig != nil {
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
if err != nil {
return nil, err
}
} else {
datadog.SetAuthKeys(
ctx,
&localVarHeaderParams,
[2]string{"apiKeyAuth", "DD-API-KEY"},
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
)
}
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return nil, err
}

localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}

localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
return localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := datadog.GenericOpenAPIError{
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 {
var v JSONAPIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
return localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
return localVarHTTPResponse, newErr
}

return localVarHTTPResponse, nil
}

// NewEmailTransportApi Returns NewEmailTransportApi.
func NewEmailTransportApi(client *datadog.APIClient) *EmailTransportApi {
return &EmailTransportApi{
Client: client,
}
}
1 change: 1 addition & 0 deletions api/datadogV2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
// - [DowntimesApi.ListDowntimes]
// - [DowntimesApi.ListMonitorDowntimes]
// - [DowntimesApi.UpdateDowntime]
// - [EmailTransportApi.CreateEmailTransportWebhookIntake]
// - [EntityRiskScoresApi.ListEntityRiskScores]
// - [ErrorTrackingApi.DeleteIssueAssignee]
// - [ErrorTrackingApi.GetIssue]
Expand Down
Loading
Loading