From 506547b194ce9c79c72a42068438f3c8bff7ae56 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 3 Apr 2026 12:55:18 +0000 Subject: [PATCH] Regenerate client from commit b9e35a4 of spec repo --- .generator/schemas/v2/openapi.yaml | 20 +++ .../CreateLogsCustomDestination_140188544.py | 45 +++++++ .../CreateLogsCustomDestination_1718754520.py | 44 ++++++ .../CreateLogsCustomDestination_2534546779.py | 45 +++++++ .../CreateLogsCustomDestination_3120242932.py | 45 +++++++ .../UpdateLogsCustomDestination_2034509257.py | 49 +++++++ .../UpdateLogsCustomDestination_213195663.py | 48 +++++++ .../UpdateLogsCustomDestination_2612469098.py | 48 +++++++ .../UpdateLogsCustomDestination_2701272624.py | 37 +++++ .../UpdateLogsCustomDestination_3227001838.py | 47 +++++++ .../custom_destination_forward_destination.py | 7 + ..._destination_forward_destination_splunk.py | 23 +++- ...estination_response_forward_destination.py | 7 + ...ion_response_forward_destination_splunk.py | 24 +++- ...null_sourcetype_returns_ok_response.frozen | 1 + ...a_null_sourcetype_returns_ok_response.yaml | 40 ++++++ ...th_a_sourcetype_returns_ok_response.frozen | 1 + ...with_a_sourcetype_returns_ok_response.yaml | 40 ++++++ ...ring_sourcetype_returns_ok_response.frozen | 1 + ...string_sourcetype_returns_ok_response.yaml | 40 ++++++ ...cetype_returns_bad_request_response.frozen | 1 + ...urcetype_returns_bad_request_response.yaml | 24 ++++ ...ut_a_sourcetype_returns_ok_response.frozen | 1 + ...hout_a_sourcetype_returns_ok_response.yaml | 40 ++++++ ...null_sourcetype_returns_ok_response.frozen | 1 + ...a_null_sourcetype_returns_ok_response.yaml | 58 ++++++++ ...th_a_sourcetype_returns_ok_response.frozen | 1 + ...with_a_sourcetype_returns_ok_response.yaml | 58 ++++++++ ...sent_sourcetype_returns_ok_response.frozen | 1 + ...absent_sourcetype_returns_ok_response.yaml | 59 ++++++++ ...null_sourcetype_returns_ok_response.frozen | 1 + ...e_null_sourcetype_returns_ok_response.yaml | 58 ++++++++ ..._the_sourcetype_returns_ok_response.frozen | 1 + ...es_the_sourcetype_returns_ok_response.yaml | 58 ++++++++ tests/v2/features/given.json | 36 +++++ .../features/logs_custom_destinations.feature | 127 ++++++++++++++++++ 36 files changed, 1133 insertions(+), 4 deletions(-) create mode 100644 examples/v2/logs-custom-destinations/CreateLogsCustomDestination_140188544.py create mode 100644 examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1718754520.py create mode 100644 examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2534546779.py create mode 100644 examples/v2/logs-custom-destinations/CreateLogsCustomDestination_3120242932.py create mode 100644 examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2034509257.py create mode 100644 examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_213195663.py create mode 100644 examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2612469098.py create mode 100644 examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2701272624.py create mode 100644 examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_3227001838.py create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_empty_string_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_empty_string_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_invalid_sourcetype_returns_bad_request_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_invalid_sourcetype_returns_bad_request_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_without_a_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_without_a_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_attributes_preserves_the_absent_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_attributes_preserves_the_absent_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_null_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_null_sourcetype_returns_ok_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_sourcetype_returns_ok_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_sourcetype_returns_ok_response.yaml 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.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_140188544.py new file mode 100644 index 0000000000..7d7da65d9d --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_140188544.py @@ -0,0 +1,45 @@ +""" +Create a Splunk custom destination with a sourcetype returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forwarder_destination=CustomDestinationForwardDestinationSplunk( + access_token="my-access-token", + endpoint="https://example.com", + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + sourcetype="my-sourcetype", + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1718754520.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1718754520.py new file mode 100644 index 0000000000..c072fd16f9 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1718754520.py @@ -0,0 +1,44 @@ +""" +Create a Splunk custom destination without a sourcetype returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forwarder_destination=CustomDestinationForwardDestinationSplunk( + access_token="my-access-token", + endpoint="https://example.com", + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2534546779.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2534546779.py new file mode 100644 index 0000000000..a02b9b8b55 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2534546779.py @@ -0,0 +1,45 @@ +""" +Create a Splunk custom destination with a null sourcetype returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forwarder_destination=CustomDestinationForwardDestinationSplunk( + access_token="my-access-token", + endpoint="https://example.com", + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + sourcetype=None, + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_3120242932.py b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_3120242932.py new file mode 100644 index 0000000000..5c84b8d706 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_3120242932.py @@ -0,0 +1,45 @@ +""" +Create a Splunk custom destination with an empty string sourcetype returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest +from datadog_api_client.v2.model.custom_destination_create_request_attributes import ( + CustomDestinationCreateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_create_request_definition import ( + CustomDestinationCreateRequestDefinition, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType + +body = CustomDestinationCreateRequest( + data=CustomDestinationCreateRequestDefinition( + attributes=CustomDestinationCreateRequestAttributes( + enabled=False, + forward_tags=False, + forwarder_destination=CustomDestinationForwardDestinationSplunk( + access_token="my-access-token", + endpoint="https://example.com", + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + sourcetype="", + ), + name="Nginx logs", + query="source:nginx", + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.create_logs_custom_destination(body=body) + + print(response) diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2034509257.py b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2034509257.py new file mode 100644 index 0000000000..2c91891446 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2034509257.py @@ -0,0 +1,49 @@ +""" +Update a Splunk custom destination's destination preserves the null sourcetype returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest +from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, +) + +# there is a valid "custom_destination_splunk_with_null_sourcetype" in the system +CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID = environ[ + "CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID" +] + +body = CustomDestinationUpdateRequest( + data=CustomDestinationUpdateRequestDefinition( + attributes=CustomDestinationUpdateRequestAttributes( + forwarder_destination=CustomDestinationForwardDestinationSplunk( + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + endpoint="https://updated-example.com", + access_token="my-access-token", + ), + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + id=CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.update_logs_custom_destination( + custom_destination_id=CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID, body=body + ) + + print(response) diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_213195663.py b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_213195663.py new file mode 100644 index 0000000000..ea0e26c8fc --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_213195663.py @@ -0,0 +1,48 @@ +""" +Update a Splunk custom destination with a sourcetype returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest +from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, +) + +# there is a valid "custom_destination_splunk" in the system +CUSTOM_DESTINATION_SPLUNK_DATA_ID = environ["CUSTOM_DESTINATION_SPLUNK_DATA_ID"] + +body = CustomDestinationUpdateRequest( + data=CustomDestinationUpdateRequestDefinition( + attributes=CustomDestinationUpdateRequestAttributes( + forwarder_destination=CustomDestinationForwardDestinationSplunk( + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + endpoint="https://example.com", + access_token="my-access-token", + sourcetype="new-sourcetype", + ), + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + id=CUSTOM_DESTINATION_SPLUNK_DATA_ID, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.update_logs_custom_destination( + custom_destination_id=CUSTOM_DESTINATION_SPLUNK_DATA_ID, body=body + ) + + print(response) diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2612469098.py b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2612469098.py new file mode 100644 index 0000000000..9138d40700 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2612469098.py @@ -0,0 +1,48 @@ +""" +Update a Splunk custom destination with a null sourcetype returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest +from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, +) + +# there is a valid "custom_destination_splunk_with_sourcetype" in the system +CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID = environ["CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID"] + +body = CustomDestinationUpdateRequest( + data=CustomDestinationUpdateRequestDefinition( + attributes=CustomDestinationUpdateRequestAttributes( + forwarder_destination=CustomDestinationForwardDestinationSplunk( + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + endpoint="https://example.com", + access_token="my-access-token", + sourcetype=None, + ), + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + id=CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.update_logs_custom_destination( + custom_destination_id=CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID, body=body + ) + + print(response) diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2701272624.py b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2701272624.py new file mode 100644 index 0000000000..60649f8ef2 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2701272624.py @@ -0,0 +1,37 @@ +""" +Update a Splunk custom destination's attributes preserves the absent sourcetype returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest +from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, +) + +# there is a valid "custom_destination_splunk" in the system +CUSTOM_DESTINATION_SPLUNK_DATA_ID = environ["CUSTOM_DESTINATION_SPLUNK_DATA_ID"] + +body = CustomDestinationUpdateRequest( + data=CustomDestinationUpdateRequestDefinition( + attributes=CustomDestinationUpdateRequestAttributes( + name="Nginx logs (Updated)", + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + id=CUSTOM_DESTINATION_SPLUNK_DATA_ID, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.update_logs_custom_destination( + custom_destination_id=CUSTOM_DESTINATION_SPLUNK_DATA_ID, body=body + ) + + print(response) diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_3227001838.py b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_3227001838.py new file mode 100644 index 0000000000..41f67ba4c6 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_3227001838.py @@ -0,0 +1,47 @@ +""" +Update a Splunk custom destination's destination preserves the sourcetype returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import ( + CustomDestinationForwardDestinationSplunk, +) +from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import ( + CustomDestinationForwardDestinationSplunkType, +) +from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType +from datadog_api_client.v2.model.custom_destination_update_request import CustomDestinationUpdateRequest +from datadog_api_client.v2.model.custom_destination_update_request_attributes import ( + CustomDestinationUpdateRequestAttributes, +) +from datadog_api_client.v2.model.custom_destination_update_request_definition import ( + CustomDestinationUpdateRequestDefinition, +) + +# there is a valid "custom_destination_splunk_with_sourcetype" in the system +CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID = environ["CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID"] + +body = CustomDestinationUpdateRequest( + data=CustomDestinationUpdateRequestDefinition( + attributes=CustomDestinationUpdateRequestAttributes( + forwarder_destination=CustomDestinationForwardDestinationSplunk( + type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC, + endpoint="https://updated-example.com", + access_token="my-access-token", + ), + ), + type=CustomDestinationType.CUSTOM_DESTINATION, + id=CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = LogsCustomDestinationsApi(api_client) + response = api_instance.update_logs_custom_destination( + custom_destination_id=CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID, body=body + ) + + print(response) diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination.py index 75f06267dd..847f9edbfa 100644 --- a/src/datadog_api_client/v2/model/custom_destination_forward_destination.py +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination.py @@ -28,6 +28,13 @@ def __init__(self, **kwargs): :param access_token: Access token of the Splunk HTTP Event Collector. This field is not returned by the API. :type access_token: str + :param sourcetype: 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. + :type sourcetype: str, none_type, optional + :param index_name: Name of the Elasticsearch index (must follow [Elasticsearch's criteria](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-create-index.html#indices-create-api-path-params)). :type index_name: str diff --git a/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk.py b/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk.py index 9f562e7331..71189db006 100644 --- a/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk.py +++ b/src/datadog_api_client/v2/model/custom_destination_forward_destination_splunk.py @@ -3,11 +3,14 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + none_type, + unset, + UnsetType, ) @@ -27,17 +30,24 @@ def openapi_types(_): return { "access_token": (str,), "endpoint": (str,), + "sourcetype": (str, none_type), "type": (CustomDestinationForwardDestinationSplunkType,), } attribute_map = { "access_token": "access_token", "endpoint": "endpoint", + "sourcetype": "sourcetype", "type": "type", } def __init__( - self_, access_token: str, endpoint: str, type: CustomDestinationForwardDestinationSplunkType, **kwargs + self_, + access_token: str, + endpoint: str, + type: CustomDestinationForwardDestinationSplunkType, + sourcetype: Union[str, none_type, UnsetType] = unset, + **kwargs, ): """ The Splunk HTTP Event Collector (HEC) destination. @@ -49,9 +59,18 @@ def __init__( Must have HTTPS scheme and forwarding back to Datadog is not allowed. :type endpoint: str + :param sourcetype: 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. + :type sourcetype: str, none_type, optional + :param type: Type of the Splunk HTTP Event Collector (HEC) destination. :type type: CustomDestinationForwardDestinationSplunkType """ + if sourcetype is not unset: + kwargs["sourcetype"] = sourcetype super().__init__(kwargs) self_.access_token = access_token diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination.py index 809eced5df..58bdd7f298 100644 --- a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination.py +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination.py @@ -25,6 +25,13 @@ def __init__(self, **kwargs): :param type: Type of the HTTP destination. :type type: CustomDestinationResponseForwardDestinationHttpType + :param sourcetype: 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. + :type sourcetype: str, none_type, optional + :param index_name: Name of the Elasticsearch index (must follow [Elasticsearch's criteria](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-create-index.html#indices-create-api-path-params)). :type index_name: str diff --git a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk.py b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk.py index a671870c22..5d6d52c9ea 100644 --- a/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk.py +++ b/src/datadog_api_client/v2/model/custom_destination_response_forward_destination_splunk.py @@ -3,11 +3,14 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + none_type, + unset, + UnsetType, ) @@ -26,15 +29,23 @@ def openapi_types(_): return { "endpoint": (str,), + "sourcetype": (str, none_type), "type": (CustomDestinationResponseForwardDestinationSplunkType,), } attribute_map = { "endpoint": "endpoint", + "sourcetype": "sourcetype", "type": "type", } - def __init__(self_, endpoint: str, type: CustomDestinationResponseForwardDestinationSplunkType, **kwargs): + def __init__( + self_, + endpoint: str, + type: CustomDestinationResponseForwardDestinationSplunkType, + sourcetype: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): """ The Splunk HTTP Event Collector (HEC) destination. @@ -42,9 +53,18 @@ def __init__(self_, endpoint: str, type: CustomDestinationResponseForwardDestina Must have HTTPS scheme and forwarding back to Datadog is not allowed. :type endpoint: str + :param sourcetype: 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. + :type sourcetype: str, none_type, optional + :param type: Type of the Splunk HTTP Event Collector (HEC) destination. :type type: CustomDestinationResponseForwardDestinationSplunkType """ + if sourcetype is not unset: + kwargs["sourcetype"] = sourcetype super().__init__(kwargs) self_.endpoint = endpoint diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..47253f50af --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..c3e5979b38 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/d328c779-9b3b-41c7-a952-20a7446eb7d1 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..a1c69fc551 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..f8dfffbbc2 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/429e154f-5cf5-41ce-ae15-4bc41563f46f + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_empty_string_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_empty_string_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_empty_string_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..ed2bc92d80 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_empty_string_sourcetype_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/cb6c24f4-f420-42dd-bc86-ce51e03f7968 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_invalid_sourcetype_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_invalid_sourcetype_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_invalid_sourcetype_returns_bad_request_response.yaml new file mode 100644 index 0000000000..a0cf1a9c5d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_with_an_invalid_sourcetype_returns_bad_request_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: '{"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"}}' + 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"]} + + ' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_without_a_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_without_a_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..d66033d530 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_without_a_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_without_a_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..51bd6cd35d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_splunk_custom_destination_without_a_sourcetype_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/c475e180-758a-4503-a2ab-3ff1779c738a + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..43ba7b8a91 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..8fb58ff8c0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_null_sourcetype_returns_ok_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/f718e9ba-6676-46f9-ae62-1e63b0348dbc + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..a2f5a72828 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_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/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..a0a87ee9a6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destination_with_a_sourcetype_returns_ok_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/12f30686-f946-4eb1-8988-643d55ad0cb9 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_attributes_preserves_the_absent_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_attributes_preserves_the_absent_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..81e7c73875 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_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/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_attributes_preserves_the_absent_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_attributes_preserves_the_absent_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..0447e5b38a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_attributes_preserves_the_absent_sourcetype_returns_ok_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"name":"Nginx logs (Updated)"},"id":"9ac57fd5-857f-4082-badc-463ecd1e990d","type":"custom_destination"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/9ac57fd5-857f-4082-badc-463ecd1e990d + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_null_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_null_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..1bb65534b8 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_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/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_null_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_null_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..ea7cf2c78f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_null_sourcetype_returns_ok_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_sourcetype_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_sourcetype_returns_ok_response.frozen new file mode 100644 index 0000000000..788849b084 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_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/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_sourcetype_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_sourcetype_returns_ok_response.yaml new file mode 100644 index 0000000000..794c844118 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_splunk_custom_destinations_destination_preserves_the_sourcetype_returns_ok_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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"}}' + 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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/logs/config/custom-destinations/fa416048-c8e1-4b5a-a3e1-b6c2538d5903 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 8413be265a..11013dcb01 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/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/v2/features/logs_custom_destinations.feature b/tests/v2/features/logs_custom_destinations.feature index 44b8540485..e9aa229099 100644 --- a/tests/v2/features/logs_custom_destinations.feature +++ b/tests/v2/features/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