|
| 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