From 5306955065dad1f6b1e59008c3a0e6d383995999 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 3 Apr 2026 13:01:43 +0000 Subject: [PATCH] Regenerate client from commit b9e35a4 of spec repo --- .generator/schemas/v2/openapi.yaml | 20 +++ ...s_CreateLogsCustomDestination_140188544.rs | 42 ++++++ ..._CreateLogsCustomDestination_1718754520.rs | 39 ++++++ ..._CreateLogsCustomDestination_2534546779.rs | 42 ++++++ ..._CreateLogsCustomDestination_3120242932.rs | 43 ++++++ ..._UpdateLogsCustomDestination_2034509257.rs | 48 +++++++ ...s_UpdateLogsCustomDestination_213195663.rs | 47 +++++++ ..._UpdateLogsCustomDestination_2612469098.rs | 50 +++++++ ..._UpdateLogsCustomDestination_2701272624.rs | 35 +++++ ..._UpdateLogsCustomDestination_3227001838.rs | 48 +++++++ ..._destination_forward_destination_splunk.rs | 22 +++ ...ion_response_forward_destination_splunk.rs | 22 +++ ...null-sourcetype-returns-OK-response.frozen | 1 + ...a-null-sourcetype-returns-OK-response.json | 67 +++++++++ ...th-a-sourcetype-returns-OK-response.frozen | 1 + ...with-a-sourcetype-returns-OK-response.json | 67 +++++++++ ...ring-sourcetype-returns-OK-response.frozen | 1 + ...string-sourcetype-returns-OK-response.json | 67 +++++++++ ...cetype-returns-Bad-Request-response.frozen | 1 + ...urcetype-returns-Bad-Request-response.json | 39 ++++++ ...ut-a-sourcetype-returns-OK-response.frozen | 1 + ...hout-a-sourcetype-returns-OK-response.json | 67 +++++++++ ...sent-sourcetype-returns-OK-response.frozen | 1 + ...absent-sourcetype-returns-OK-response.json | 101 ++++++++++++++ ...null-sourcetype-returns-OK-response.frozen | 1 + ...e-null-sourcetype-returns-OK-response.json | 101 ++++++++++++++ ...-the-sourcetype-returns-OK-response.frozen | 1 + ...es-the-sourcetype-returns-OK-response.json | 101 ++++++++++++++ ...null-sourcetype-returns-OK-response.frozen | 1 + ...a-null-sourcetype-returns-OK-response.json | 101 ++++++++++++++ ...th-a-sourcetype-returns-OK-response.frozen | 1 + ...with-a-sourcetype-returns-OK-response.json | 101 ++++++++++++++ tests/scenarios/features/v2/given.json | 36 +++++ .../v2/logs_custom_destinations.feature | 127 ++++++++++++++++++ 34 files changed, 1443 insertions(+) create mode 100644 examples/v2_logs-custom-destinations_CreateLogsCustomDestination_140188544.rs create mode 100644 examples/v2_logs-custom-destinations_CreateLogsCustomDestination_1718754520.rs create mode 100644 examples/v2_logs-custom-destinations_CreateLogsCustomDestination_2534546779.rs create mode 100644 examples/v2_logs-custom-destinations_CreateLogsCustomDestination_3120242932.rs create mode 100644 examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2034509257.rs create mode 100644 examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_213195663.rs create mode 100644 examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2612469098.rs create mode 100644 examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2701272624.rs create mode 100644 examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_3227001838.rs create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen create mode 100644 tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441b..b2d75ef44d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17420,6 +17420,16 @@ components: Must have HTTPS scheme and forwarding back to Datadog is not allowed. example: https://example.com type: string + sourcetype: + description: |- + The Splunk sourcetype for the events sent to this Splunk destination. + + If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype` + field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string + value is used as the sourcetype. + example: my-source + nullable: true + type: string type: $ref: "#/components/schemas/CustomDestinationForwardDestinationSplunkType" required: @@ -17695,6 +17705,16 @@ components: Must have HTTPS scheme and forwarding back to Datadog is not allowed. example: https://example.com type: string + sourcetype: + description: |- + The Splunk sourcetype for the events sent to this Splunk destination. + + If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype` + field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string + value is used as the sourcetype. + example: my-source + nullable: true + type: string type: $ref: "#/components/schemas/CustomDestinationResponseForwardDestinationSplunkType" required: diff --git a/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_140188544.rs b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_140188544.rs new file mode 100644 index 0000000000..c8ed38a809 --- /dev/null +++ b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_140188544.rs @@ -0,0 +1,42 @@ +// Create a Splunk custom destination with a sourcetype returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; + +#[tokio::main] +async fn main() { + let body = + CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new( + CustomDestinationCreateRequestAttributes::new( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new( + CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + ) + .sourcetype(Some("my-sourcetype".to_string())), + ), + ), + "Nginx logs".to_string(), + ) + .enabled(false) + .forward_tags(false) + .query("source:nginx".to_string()), + CustomDestinationType::CUSTOM_DESTINATION, + )); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api.create_logs_custom_destination(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_1718754520.rs b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_1718754520.rs new file mode 100644 index 0000000000..771b0f4e51 --- /dev/null +++ b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_1718754520.rs @@ -0,0 +1,39 @@ +// Create a Splunk custom destination without a sourcetype returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; + +#[tokio::main] +async fn main() { + let body = + CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new( + CustomDestinationCreateRequestAttributes::new( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new(CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + )), + ), + "Nginx logs".to_string(), + ) + .enabled(false) + .forward_tags(false) + .query("source:nginx".to_string()), + CustomDestinationType::CUSTOM_DESTINATION, + )); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api.create_logs_custom_destination(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_2534546779.rs b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_2534546779.rs new file mode 100644 index 0000000000..2e73c5f007 --- /dev/null +++ b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_2534546779.rs @@ -0,0 +1,42 @@ +// Create a Splunk custom destination with a null sourcetype returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; + +#[tokio::main] +async fn main() { + let body = + CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new( + CustomDestinationCreateRequestAttributes::new( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new( + CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + ) + .sourcetype(None), + ), + ), + "Nginx logs".to_string(), + ) + .enabled(false) + .forward_tags(false) + .query("source:nginx".to_string()), + CustomDestinationType::CUSTOM_DESTINATION, + )); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api.create_logs_custom_destination(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_3120242932.rs b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_3120242932.rs new file mode 100644 index 0000000000..5aa8dd0054 --- /dev/null +++ b/examples/v2_logs-custom-destinations_CreateLogsCustomDestination_3120242932.rs @@ -0,0 +1,43 @@ +// Create a Splunk custom destination with an empty string sourcetype returns "OK" +// response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationCreateRequestDefinition; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; + +#[tokio::main] +async fn main() { + let body = + CustomDestinationCreateRequest::new().data(CustomDestinationCreateRequestDefinition::new( + CustomDestinationCreateRequestAttributes::new( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new( + CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + ) + .sourcetype(Some("".to_string())), + ), + ), + "Nginx logs".to_string(), + ) + .enabled(false) + .forward_tags(false) + .query("source:nginx".to_string()), + CustomDestinationType::CUSTOM_DESTINATION, + )); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api.create_logs_custom_destination(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2034509257.rs b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2034509257.rs new file mode 100644 index 0000000000..7f9b6683d0 --- /dev/null +++ b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2034509257.rs @@ -0,0 +1,48 @@ +// Update a Splunk custom destination's destination preserves the null sourcetype +// returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition; + +#[tokio::main] +async fn main() { + // there is a valid "custom_destination_splunk_with_null_sourcetype" in the system + let custom_destination_splunk_with_null_sourcetype_data_id = + std::env::var("CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID").unwrap(); + let body = CustomDestinationUpdateRequest::new().data( + CustomDestinationUpdateRequestDefinition::new( + custom_destination_splunk_with_null_sourcetype_data_id.clone(), + CustomDestinationType::CUSTOM_DESTINATION, + ) + .attributes( + CustomDestinationUpdateRequestAttributes::new().forwarder_destination( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new(CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://updated-example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + )), + ), + ), + ), + ); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api + .update_logs_custom_destination( + custom_destination_splunk_with_null_sourcetype_data_id.clone(), + body, + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_213195663.rs b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_213195663.rs new file mode 100644 index 0000000000..66bb0728c2 --- /dev/null +++ b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_213195663.rs @@ -0,0 +1,47 @@ +// Update a Splunk custom destination with a sourcetype returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition; + +#[tokio::main] +async fn main() { + // there is a valid "custom_destination_splunk" in the system + let custom_destination_splunk_data_id = + std::env::var("CUSTOM_DESTINATION_SPLUNK_DATA_ID").unwrap(); + let body = CustomDestinationUpdateRequest::new().data( + CustomDestinationUpdateRequestDefinition::new( + custom_destination_splunk_data_id.clone(), + CustomDestinationType::CUSTOM_DESTINATION, + ) + .attributes( + CustomDestinationUpdateRequestAttributes::new().forwarder_destination( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new( + CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + ) + .sourcetype(Some("new-sourcetype".to_string())), + ), + ), + ), + ), + ); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api + .update_logs_custom_destination(custom_destination_splunk_data_id.clone(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2612469098.rs b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2612469098.rs new file mode 100644 index 0000000000..d792918505 --- /dev/null +++ b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2612469098.rs @@ -0,0 +1,50 @@ +// Update a Splunk custom destination with a null sourcetype returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition; + +#[tokio::main] +async fn main() { + // there is a valid "custom_destination_splunk_with_sourcetype" in the system + let custom_destination_splunk_with_sourcetype_data_id = + std::env::var("CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID").unwrap(); + let body = CustomDestinationUpdateRequest::new().data( + CustomDestinationUpdateRequestDefinition::new( + custom_destination_splunk_with_sourcetype_data_id.clone(), + CustomDestinationType::CUSTOM_DESTINATION, + ) + .attributes( + CustomDestinationUpdateRequestAttributes::new().forwarder_destination( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new( + CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + ) + .sourcetype(None), + ), + ), + ), + ), + ); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api + .update_logs_custom_destination( + custom_destination_splunk_with_sourcetype_data_id.clone(), + body, + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2701272624.rs b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2701272624.rs new file mode 100644 index 0000000000..e7575ecd60 --- /dev/null +++ b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_2701272624.rs @@ -0,0 +1,35 @@ +// Update a Splunk custom destination's attributes preserves the absent sourcetype +// returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationType; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition; + +#[tokio::main] +async fn main() { + // there is a valid "custom_destination_splunk" in the system + let custom_destination_splunk_data_id = + std::env::var("CUSTOM_DESTINATION_SPLUNK_DATA_ID").unwrap(); + let body = CustomDestinationUpdateRequest::new().data( + CustomDestinationUpdateRequestDefinition::new( + custom_destination_splunk_data_id.clone(), + CustomDestinationType::CUSTOM_DESTINATION, + ) + .attributes( + CustomDestinationUpdateRequestAttributes::new() + .name("Nginx logs (Updated)".to_string()), + ), + ); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api + .update_logs_custom_destination(custom_destination_splunk_data_id.clone(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_3227001838.rs b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_3227001838.rs new file mode 100644 index 0000000000..4ae60c6d01 --- /dev/null +++ b/examples/v2_logs-custom-destinations_UpdateLogsCustomDestination_3227001838.rs @@ -0,0 +1,48 @@ +// Update a Splunk custom destination's destination preserves the sourcetype +// returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_logs_custom_destinations::LogsCustomDestinationsAPI; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestination; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunk; +use datadog_api_client::datadogV2::model::CustomDestinationForwardDestinationSplunkType; +use datadog_api_client::datadogV2::model::CustomDestinationType; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequest; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestAttributes; +use datadog_api_client::datadogV2::model::CustomDestinationUpdateRequestDefinition; + +#[tokio::main] +async fn main() { + // there is a valid "custom_destination_splunk_with_sourcetype" in the system + let custom_destination_splunk_with_sourcetype_data_id = + std::env::var("CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID").unwrap(); + let body = CustomDestinationUpdateRequest::new().data( + CustomDestinationUpdateRequestDefinition::new( + custom_destination_splunk_with_sourcetype_data_id.clone(), + CustomDestinationType::CUSTOM_DESTINATION, + ) + .attributes( + CustomDestinationUpdateRequestAttributes::new().forwarder_destination( + CustomDestinationForwardDestination::CustomDestinationForwardDestinationSplunk( + Box::new(CustomDestinationForwardDestinationSplunk::new( + "my-access-token".to_string(), + "https://updated-example.com".to_string(), + CustomDestinationForwardDestinationSplunkType::SPLUNK_HEC, + )), + ), + ), + ), + ); + let configuration = datadog::Configuration::new(); + let api = LogsCustomDestinationsAPI::with_config(configuration); + let resp = api + .update_logs_custom_destination( + custom_destination_splunk_with_sourcetype_data_id.clone(), + body, + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadogV2/model/model_custom_destination_forward_destination_splunk.rs b/src/datadogV2/model/model_custom_destination_forward_destination_splunk.rs index 287d5f05c9..a4185ac8b0 100644 --- a/src/datadogV2/model/model_custom_destination_forward_destination_splunk.rs +++ b/src/datadogV2/model/model_custom_destination_forward_destination_splunk.rs @@ -18,6 +18,17 @@ pub struct CustomDestinationForwardDestinationSplunk { /// Must have HTTPS scheme and forwarding back to Datadog is not allowed. #[serde(rename = "endpoint")] pub endpoint: String, + /// The Splunk sourcetype for the events sent to this Splunk destination. + /// + /// If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype` + /// field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string + /// value is used as the sourcetype. + #[serde( + rename = "sourcetype", + default, + with = "::serde_with::rust::double_option" + )] + pub sourcetype: Option>, /// Type of the Splunk HTTP Event Collector (HEC) destination. #[serde(rename = "type")] pub type_: crate::datadogV2::model::CustomDestinationForwardDestinationSplunkType, @@ -37,12 +48,18 @@ impl CustomDestinationForwardDestinationSplunk { CustomDestinationForwardDestinationSplunk { access_token, endpoint, + sourcetype: None, type_, additional_properties: std::collections::BTreeMap::new(), _unparsed: false, } } + pub fn sourcetype(mut self, value: Option) -> Self { + self.sourcetype = Some(value); + self + } + pub fn additional_properties( mut self, value: std::collections::BTreeMap, @@ -71,6 +88,7 @@ impl<'de> Deserialize<'de> for CustomDestinationForwardDestinationSplunk { { let mut access_token: Option = None; let mut endpoint: Option = None; + let mut sourcetype: Option> = None; let mut type_: Option< crate::datadogV2::model::CustomDestinationForwardDestinationSplunkType, > = None; @@ -89,6 +107,9 @@ impl<'de> Deserialize<'de> for CustomDestinationForwardDestinationSplunk { "endpoint" => { endpoint = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "sourcetype" => { + sourcetype = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "type" => { type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); if let Some(ref _type_) = type_ { @@ -115,6 +136,7 @@ impl<'de> Deserialize<'de> for CustomDestinationForwardDestinationSplunk { let content = CustomDestinationForwardDestinationSplunk { access_token, endpoint, + sourcetype, type_, additional_properties, _unparsed, diff --git a/src/datadogV2/model/model_custom_destination_response_forward_destination_splunk.rs b/src/datadogV2/model/model_custom_destination_response_forward_destination_splunk.rs index ceacf85705..c58c4d7f9f 100644 --- a/src/datadogV2/model/model_custom_destination_response_forward_destination_splunk.rs +++ b/src/datadogV2/model/model_custom_destination_response_forward_destination_splunk.rs @@ -15,6 +15,17 @@ pub struct CustomDestinationResponseForwardDestinationSplunk { /// Must have HTTPS scheme and forwarding back to Datadog is not allowed. #[serde(rename = "endpoint")] pub endpoint: String, + /// The Splunk sourcetype for the events sent to this Splunk destination. + /// + /// If absent, the default sourcetype `_json` is used. If set to null, the `sourcetype` + /// field is omitted from the Splunk HEC payload entirely. Otherwise, the provided string + /// value is used as the sourcetype. + #[serde( + rename = "sourcetype", + default, + with = "::serde_with::rust::double_option" + )] + pub sourcetype: Option>, /// Type of the Splunk HTTP Event Collector (HEC) destination. #[serde(rename = "type")] pub type_: crate::datadogV2::model::CustomDestinationResponseForwardDestinationSplunkType, @@ -32,12 +43,18 @@ impl CustomDestinationResponseForwardDestinationSplunk { ) -> CustomDestinationResponseForwardDestinationSplunk { CustomDestinationResponseForwardDestinationSplunk { endpoint, + sourcetype: None, type_, additional_properties: std::collections::BTreeMap::new(), _unparsed: false, } } + pub fn sourcetype(mut self, value: Option) -> Self { + self.sourcetype = Some(value); + self + } + pub fn additional_properties( mut self, value: std::collections::BTreeMap, @@ -65,6 +82,7 @@ impl<'de> Deserialize<'de> for CustomDestinationResponseForwardDestinationSplunk M: MapAccess<'a>, { let mut endpoint: Option = None; + let mut sourcetype: Option> = None; let mut type_: Option< crate::datadogV2::model::CustomDestinationResponseForwardDestinationSplunkType, > = None; @@ -79,6 +97,9 @@ impl<'de> Deserialize<'de> for CustomDestinationResponseForwardDestinationSplunk "endpoint" => { endpoint = Some(serde_json::from_value(v).map_err(M::Error::custom)?); } + "sourcetype" => { + sourcetype = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } "type" => { type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); if let Some(ref _type_) = type_ { @@ -102,6 +123,7 @@ impl<'de> Deserialize<'de> for CustomDestinationResponseForwardDestinationSplunk let content = CustomDestinationResponseForwardDestinationSplunk { endpoint, + sourcetype, type_, additional_properties, _unparsed, diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..47253f50af --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:47.455Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..70f35ede0c --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":null,\"type\":\"splunk_hec\"},\"name\":\"Nginx logs\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d328c779-9b3b-41c7-a952-20a7446eb7d1\",\"attributes\":{\"name\":\"Nginx logs\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":null},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:47 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/d328c779-9b3b-41c7-a952-20a7446eb7d1" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:47 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..a1c69fc551 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:49.008Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..6dcaef3845 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":\"my-sourcetype\",\"type\":\"splunk_hec\"},\"name\":\"Nginx logs\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"429e154f-5cf5-41ce-ae15-4bc41563f46f\",\"attributes\":{\"name\":\"Nginx logs\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":\"my-sourcetype\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:49 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/429e154f-5cf5-41ce-ae15-4bc41563f46f" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:49 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..da14a342ca --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:50.210Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..b9e1cdec93 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-empty-string-sourcetype-returns-OK-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":\"\",\"type\":\"splunk_hec\"},\"name\":\"Nginx logs\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"cb6c24f4-f420-42dd-bc86-ce51e03f7968\",\"attributes\":{\"name\":\"Nginx logs\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":\"\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:50 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/cb6c24f4-f420-42dd-bc86-ce51e03f7968" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:50 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.frozen new file mode 100644 index 0000000000..fd52717727 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:51.766Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.json new file mode 100644 index 0000000000..d4cc2ccf5d --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-with-an-invalid-sourcetype-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":123,\"type\":\"splunk_hec\"},\"name\":\"Nginx logs\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"errors\":[\"Invalid custom destination configuration\",\"Sourcetype must be a string or null\"]}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:51 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..d66033d530 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:52.120Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..51828c8d16 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Create-a-Splunk-custom-destination-without-a-sourcetype-returns-OK-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\"},\"name\":\"Nginx logs\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c475e180-758a-4503-a2ab-3ff1779c738a\",\"attributes\":{\"name\":\"Nginx logs\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:52 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/c475e180-758a-4503-a2ab-3ff1779c738a" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:52 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..81e7c73875 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:55.981Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..b80db7d280 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-attributes-preserves-the-absent-sourcetype-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\"},\"name\":\"Test-Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response-1774455835\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9ac57fd5-857f-4082-badc-463ecd1e990d\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response-1774455835\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:55 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"name\":\"Nginx logs (Updated)\"},\"id\":\"9ac57fd5-857f-4082-badc-463ecd1e990d\",\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/9ac57fd5-857f-4082-badc-463ecd1e990d" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9ac57fd5-857f-4082-badc-463ecd1e990d\",\"attributes\":{\"name\":\"Nginx logs (Updated)\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:55 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/9ac57fd5-857f-4082-badc-463ecd1e990d" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:55 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..1bb65534b8 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:59.087Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..b4a6720ae3 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-null-sourcetype-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":null,\"type\":\"splunk_hec\"},\"name\":\"Test-Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response-1774455839\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response-1774455839\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":null},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:59 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://updated-example.com\",\"type\":\"splunk_hec\"}},\"id\":\"1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5\",\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response-1774455839\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://updated-example.com\",\"type\":\"splunk_hec\",\"sourcetype\":null},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:59 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:59 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..788849b084 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:24:00.500Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..28eefe3200 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-s-destination-preserves-the-sourcetype-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":\"my-sourcetype\",\"type\":\"splunk_hec\"},\"name\":\"Test-Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response-1774455840\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"fa416048-c8e1-4b5a-a3e1-b6c2538d5903\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response-1774455840\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":\"my-sourcetype\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:24:00 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://updated-example.com\",\"type\":\"splunk_hec\"}},\"id\":\"fa416048-c8e1-4b5a-a3e1-b6c2538d5903\",\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/fa416048-c8e1-4b5a-a3e1-b6c2538d5903" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"fa416048-c8e1-4b5a-a3e1-b6c2538d5903\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response-1774455840\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://updated-example.com\",\"type\":\"splunk_hec\",\"sourcetype\":\"my-sourcetype\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:24:00 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/fa416048-c8e1-4b5a-a3e1-b6c2538d5903" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:24:00 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..43ba7b8a91 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:53.183Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..029e05e1c6 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-null-sourcetype-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":\"my-sourcetype\",\"type\":\"splunk_hec\"},\"name\":\"Test-Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response-1774455833\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"f718e9ba-6676-46f9-ae62-1e63b0348dbc\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response-1774455833\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":\"my-sourcetype\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:53 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":null,\"type\":\"splunk_hec\"}},\"id\":\"f718e9ba-6676-46f9-ae62-1e63b0348dbc\",\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/f718e9ba-6676-46f9-ae62-1e63b0348dbc" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"f718e9ba-6676-46f9-ae62-1e63b0348dbc\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response-1774455833\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":null},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:53 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/f718e9ba-6676-46f9-ae62-1e63b0348dbc" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen new file mode 100644 index 0000000000..a2f5a72828 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-03-25T16:23:54.709Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json new file mode 100644 index 0000000000..8ea13fd9c9 --- /dev/null +++ b/tests/scenarios/cassettes/v2/logs_custom_destinations/Update-a-Splunk-custom-destination-with-a-sourcetype-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"enabled\":false,\"forward_tags\":false,\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\"},\"name\":\"Test-Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response-1774455834\",\"query\":\"source:nginx\"},\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"12f30686-f946-4eb1-8988-643d55ad0cb9\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response-1774455834\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:54 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"forwarder_destination\":{\"access_token\":\"my-access-token\",\"endpoint\":\"https://example.com\",\"sourcetype\":\"new-sourcetype\",\"type\":\"splunk_hec\"}},\"id\":\"12f30686-f946-4eb1-8988-643d55ad0cb9\",\"type\":\"custom_destination\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/12f30686-f946-4eb1-8988-643d55ad0cb9" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"12f30686-f946-4eb1-8988-643d55ad0cb9\",\"attributes\":{\"name\":\"Test-Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response-1774455834\",\"query\":\"source:nginx\",\"enabled\":false,\"forwarder_destination\":{\"endpoint\":\"https://example.com\",\"type\":\"splunk_hec\",\"sourcetype\":\"new-sourcetype\"},\"forward_tags_restriction_list_type\":\"ALLOW_LIST\",\"forward_tags_restriction_list\":[],\"forward_tags\":false},\"type\":\"custom_destination\"}}\n", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:54 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/logs/config/custom-destinations/12f30686-f946-4eb1-8988-643d55ad0cb9" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 25 Mar 2026 16:23:54 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 8413be265a..11013dcb01 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -737,6 +737,42 @@ "tag": "Logs Custom Destinations", "operationId": "CreateLogsCustomDestination" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"query\": \"source:nginx\",\n \"enabled\": false,\n \"forwarder_destination\": {\n \"type\": \"splunk_hec\",\n \"endpoint\": \"https://example.com\",\n \"access_token\": \"my-access-token\"\n },\n \"forward_tags\": false\n },\n \"type\": \"custom_destination\"\n }\n}" + } + ], + "step": "there is a valid \"custom_destination_splunk\" in the system", + "key": "custom_destination_splunk", + "tag": "Logs Custom Destinations", + "operationId": "CreateLogsCustomDestination" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"query\": \"source:nginx\",\n \"enabled\": false,\n \"forwarder_destination\": {\n \"type\": \"splunk_hec\",\n \"endpoint\": \"https://example.com\",\n \"access_token\": \"my-access-token\",\n \"sourcetype\": null\n },\n \"forward_tags\": false\n },\n \"type\": \"custom_destination\"\n }\n}" + } + ], + "step": "there is a valid \"custom_destination_splunk_with_null_sourcetype\" in the system", + "key": "custom_destination_splunk_with_null_sourcetype", + "tag": "Logs Custom Destinations", + "operationId": "CreateLogsCustomDestination" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"query\": \"source:nginx\",\n \"enabled\": false,\n \"forwarder_destination\": {\n \"type\": \"splunk_hec\",\n \"endpoint\": \"https://example.com\",\n \"access_token\": \"my-access-token\",\n \"sourcetype\": \"my-sourcetype\"\n },\n \"forward_tags\": false\n },\n \"type\": \"custom_destination\"\n }\n}" + } + ], + "step": "there is a valid \"custom_destination_splunk_with_sourcetype\" in the system", + "key": "custom_destination_splunk_with_sourcetype", + "tag": "Logs Custom Destinations", + "operationId": "CreateLogsCustomDestination" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/logs_custom_destinations.feature b/tests/scenarios/features/v2/logs_custom_destinations.feature index 44b8540485..e9aa229099 100644 --- a/tests/scenarios/features/v2/logs_custom_destinations.feature +++ b/tests/scenarios/features/v2/logs_custom_destinations.feature @@ -93,6 +93,7 @@ Feature: Logs Custom Destinations And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination" does not have field "sourcetype" And the response "data.attributes.enabled" is false And the response "data.attributes.forward_tags" is false And the response "data.attributes.forward_tags_restriction_list" has length 2 @@ -100,6 +101,58 @@ Feature: Logs Custom Destinations And the response "data.attributes.forward_tags_restriction_list" array contains value "host" And the response "data.attributes.forward_tags_restriction_list_type" is equal to "ALLOW_LIST" + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Create a Splunk custom destination with a null sourcetype returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forwarder_destination": {"access_token": "my-access-token", "endpoint": "https://example.com", "type": "splunk_hec", "sourcetype": null}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination.sourcetype" is equal to null + + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Create a Splunk custom destination with a sourcetype returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forwarder_destination": {"access_token": "my-access-token", "endpoint": "https://example.com", "type": "splunk_hec", "sourcetype": "my-sourcetype"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination.sourcetype" is equal to "my-sourcetype" + + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Create a Splunk custom destination with an empty string sourcetype returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forwarder_destination": {"access_token": "my-access-token", "endpoint": "https://example.com", "type": "splunk_hec", "sourcetype": ""}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination.sourcetype" is equal to "" + + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Create a Splunk custom destination without a sourcetype returns "OK" response + Given new "CreateLogsCustomDestination" request + And body with value {"data": {"attributes": {"enabled": false, "forward_tags": false, "forwarder_destination": {"access_token": "my-access-token", "endpoint": "https://example.com", "type": "splunk_hec"}, "name": "Nginx logs", "query": "source:nginx"}, "type": "custom_destination"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data" has field "id" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination" does not have field "sourcetype" + @skip-java @skip-python @skip-rust @skip-typescript @team:DataDog/logs-backend @team:DataDog/logs-forwarding Scenario: Create a custom destination returns "Bad Request" response Given new "CreateLogsCustomDestination" request @@ -219,6 +272,80 @@ Feature: Logs Custom Destinations And the response "data" has item with field "attributes.forward_tags" with value false And the response "data" has item with field "attributes.forward_tags_restriction_list_type" with value "{{ custom_destination.data.attributes.forward_tags_restriction_list_type }}" + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Update a Splunk custom destination with a null sourcetype returns "OK" response + Given new "UpdateLogsCustomDestination" request + And there is a valid "custom_destination_splunk_with_sourcetype" in the system + And request contains "custom_destination_id" parameter from "custom_destination_splunk_with_sourcetype.data.id" + And body with value {"data": {"attributes": {"forwarder_destination": {"type": "splunk_hec", "endpoint": "https://example.com", "access_token": "my-access-token", "sourcetype": null}}, "type": "custom_destination", "id": "{{ custom_destination_splunk_with_sourcetype.data.id }}"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data.id" is equal to "{{ custom_destination_splunk_with_sourcetype.data.id }}" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination.sourcetype" is equal to null + + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Update a Splunk custom destination with a sourcetype returns "OK" response + Given new "UpdateLogsCustomDestination" request + And there is a valid "custom_destination_splunk" in the system + And request contains "custom_destination_id" parameter from "custom_destination_splunk.data.id" + And body with value {"data": {"attributes": {"forwarder_destination": {"type": "splunk_hec", "endpoint": "https://example.com", "access_token": "my-access-token", "sourcetype": "new-sourcetype"}}, "type": "custom_destination", "id": "{{ custom_destination_splunk.data.id }}"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data.id" is equal to "{{ custom_destination_splunk.data.id }}" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination.sourcetype" is equal to "new-sourcetype" + + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Update a Splunk custom destination's attributes preserves the absent sourcetype returns "OK" response + Given new "UpdateLogsCustomDestination" request + And there is a valid "custom_destination_splunk" in the system + And request contains "custom_destination_id" parameter from "custom_destination_splunk.data.id" + And body with value {"data": {"attributes": {"name": "Nginx logs (Updated)"}, "type": "custom_destination", "id": "{{ custom_destination_splunk.data.id }}"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data.id" is equal to "{{ custom_destination_splunk.data.id }}" + And the response "data.attributes.name" is equal to "Nginx logs (Updated)" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination" does not have field "sourcetype" + + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Update a Splunk custom destination's destination preserves the null sourcetype returns "OK" response + Given new "UpdateLogsCustomDestination" request + And there is a valid "custom_destination_splunk_with_null_sourcetype" in the system + And request contains "custom_destination_id" parameter from "custom_destination_splunk_with_null_sourcetype.data.id" + And body with value {"data": {"attributes": {"forwarder_destination": {"type": "splunk_hec", "endpoint": "https://updated-example.com", "access_token": "my-access-token"}}, "type": "custom_destination", "id": "{{ custom_destination_splunk_with_null_sourcetype.data.id }}"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data.id" is equal to "{{ custom_destination_splunk_with_null_sourcetype.data.id }}" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://updated-example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination.sourcetype" is equal to null + + @team:DataDog/logs-backend @team:DataDog/logs-forwarding + Scenario: Update a Splunk custom destination's destination preserves the sourcetype returns "OK" response + Given new "UpdateLogsCustomDestination" request + And there is a valid "custom_destination_splunk_with_sourcetype" in the system + And request contains "custom_destination_id" parameter from "custom_destination_splunk_with_sourcetype.data.id" + And body with value {"data": {"attributes": {"forwarder_destination": {"type": "splunk_hec", "endpoint": "https://updated-example.com", "access_token": "my-access-token"}}, "type": "custom_destination", "id": "{{ custom_destination_splunk_with_sourcetype.data.id }}"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "custom_destination" + And the response "data.id" is equal to "{{ custom_destination_splunk_with_sourcetype.data.id }}" + And the response "data.attributes.forwarder_destination.type" is equal to "splunk_hec" + And the response "data.attributes.forwarder_destination.endpoint" is equal to "https://updated-example.com" + And the response "data.attributes.forwarder_destination" does not have field "access_token" + And the response "data.attributes.forwarder_destination.sourcetype" is equal to "my-sourcetype" + @team:DataDog/logs-backend @team:DataDog/logs-forwarding Scenario: Update a custom destination returns "Bad Request" response Given new "UpdateLogsCustomDestination" request