diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441bd..b2d75ef44df 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.java b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_140188544.java new file mode 100644 index 00000000000..d3f5687ac7e --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_140188544.java @@ -0,0 +1,53 @@ +// Create a Splunk custom destination with a sourcetype returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequest; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestDefinition; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + CustomDestinationCreateRequest body = + new CustomDestinationCreateRequest() + .data( + new CustomDestinationCreateRequestDefinition() + .attributes( + new CustomDestinationCreateRequestAttributes() + .enabled(false) + .forwardTags(false) + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .accessToken("my-access-token") + .endpoint("https://example.com") + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC) + .sourcetype("my-sourcetype"))) + .name("Nginx logs") + .query("source:nginx")) + .type(CustomDestinationType.CUSTOM_DESTINATION)); + + try { + CustomDestinationResponse result = apiInstance.createLogsCustomDestination(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#createLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1718754520.java b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1718754520.java new file mode 100644 index 00000000000..f5306db0e4a --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_1718754520.java @@ -0,0 +1,52 @@ +// Create a Splunk custom destination without a sourcetype returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequest; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestDefinition; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + CustomDestinationCreateRequest body = + new CustomDestinationCreateRequest() + .data( + new CustomDestinationCreateRequestDefinition() + .attributes( + new CustomDestinationCreateRequestAttributes() + .enabled(false) + .forwardTags(false) + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .accessToken("my-access-token") + .endpoint("https://example.com") + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC))) + .name("Nginx logs") + .query("source:nginx")) + .type(CustomDestinationType.CUSTOM_DESTINATION)); + + try { + CustomDestinationResponse result = apiInstance.createLogsCustomDestination(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#createLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2534546779.java b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2534546779.java new file mode 100644 index 00000000000..a9d2bb48418 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_2534546779.java @@ -0,0 +1,53 @@ +// Create a Splunk custom destination with a null sourcetype returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequest; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestDefinition; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + CustomDestinationCreateRequest body = + new CustomDestinationCreateRequest() + .data( + new CustomDestinationCreateRequestDefinition() + .attributes( + new CustomDestinationCreateRequestAttributes() + .enabled(false) + .forwardTags(false) + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .accessToken("my-access-token") + .endpoint("https://example.com") + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC) + .sourcetype(null))) + .name("Nginx logs") + .query("source:nginx")) + .type(CustomDestinationType.CUSTOM_DESTINATION)); + + try { + CustomDestinationResponse result = apiInstance.createLogsCustomDestination(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#createLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_3120242932.java b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_3120242932.java new file mode 100644 index 00000000000..583dc6649d1 --- /dev/null +++ b/examples/v2/logs-custom-destinations/CreateLogsCustomDestination_3120242932.java @@ -0,0 +1,53 @@ +// Create a Splunk custom destination with an empty string sourcetype returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequest; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationCreateRequestDefinition; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + CustomDestinationCreateRequest body = + new CustomDestinationCreateRequest() + .data( + new CustomDestinationCreateRequestDefinition() + .attributes( + new CustomDestinationCreateRequestAttributes() + .enabled(false) + .forwardTags(false) + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .accessToken("my-access-token") + .endpoint("https://example.com") + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC) + .sourcetype(""))) + .name("Nginx logs") + .query("source:nginx")) + .type(CustomDestinationType.CUSTOM_DESTINATION)); + + try { + CustomDestinationResponse result = apiInstance.createLogsCustomDestination(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#createLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2034509257.java b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2034509257.java new file mode 100644 index 00000000000..76d6312cb9a --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2034509257.java @@ -0,0 +1,56 @@ +// Update a Splunk custom destination's destination preserves the null sourcetype returns "OK" +// response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequest; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestDefinition; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + // there is a valid "custom_destination_splunk_with_null_sourcetype" in the system + String CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID = + System.getenv("CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID"); + + CustomDestinationUpdateRequest body = + new CustomDestinationUpdateRequest() + .data( + new CustomDestinationUpdateRequestDefinition() + .attributes( + new CustomDestinationUpdateRequestAttributes() + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC) + .endpoint("https://updated-example.com") + .accessToken("my-access-token")))) + .type(CustomDestinationType.CUSTOM_DESTINATION) + .id(CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID)); + + try { + CustomDestinationResponse result = + apiInstance.updateLogsCustomDestination( + CUSTOM_DESTINATION_SPLUNK_WITH_NULL_SOURCETYPE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#updateLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_213195663.java b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_213195663.java new file mode 100644 index 00000000000..32e3a297856 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_213195663.java @@ -0,0 +1,54 @@ +// Update a Splunk custom destination with a sourcetype returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequest; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestDefinition; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + // there is a valid "custom_destination_splunk" in the system + String CUSTOM_DESTINATION_SPLUNK_DATA_ID = System.getenv("CUSTOM_DESTINATION_SPLUNK_DATA_ID"); + + CustomDestinationUpdateRequest body = + new CustomDestinationUpdateRequest() + .data( + new CustomDestinationUpdateRequestDefinition() + .attributes( + new CustomDestinationUpdateRequestAttributes() + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC) + .endpoint("https://example.com") + .accessToken("my-access-token") + .sourcetype("new-sourcetype")))) + .type(CustomDestinationType.CUSTOM_DESTINATION) + .id(CUSTOM_DESTINATION_SPLUNK_DATA_ID)); + + try { + CustomDestinationResponse result = + apiInstance.updateLogsCustomDestination(CUSTOM_DESTINATION_SPLUNK_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#updateLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2612469098.java b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2612469098.java new file mode 100644 index 00000000000..542b7e8e075 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2612469098.java @@ -0,0 +1,56 @@ +// Update a Splunk custom destination with a null sourcetype returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequest; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestDefinition; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + // there is a valid "custom_destination_splunk_with_sourcetype" in the system + String CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID = + System.getenv("CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID"); + + CustomDestinationUpdateRequest body = + new CustomDestinationUpdateRequest() + .data( + new CustomDestinationUpdateRequestDefinition() + .attributes( + new CustomDestinationUpdateRequestAttributes() + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC) + .endpoint("https://example.com") + .accessToken("my-access-token") + .sourcetype(null)))) + .type(CustomDestinationType.CUSTOM_DESTINATION) + .id(CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID)); + + try { + CustomDestinationResponse result = + apiInstance.updateLogsCustomDestination( + CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#updateLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2701272624.java b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2701272624.java new file mode 100644 index 00000000000..b211d35edef --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_2701272624.java @@ -0,0 +1,43 @@ +// Update a Splunk custom destination's attributes preserves the absent sourcetype returns "OK" +// response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequest; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestDefinition; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + // there is a valid "custom_destination_splunk" in the system + String CUSTOM_DESTINATION_SPLUNK_DATA_ID = System.getenv("CUSTOM_DESTINATION_SPLUNK_DATA_ID"); + + CustomDestinationUpdateRequest body = + new CustomDestinationUpdateRequest() + .data( + new CustomDestinationUpdateRequestDefinition() + .attributes( + new CustomDestinationUpdateRequestAttributes().name("Nginx logs (Updated)")) + .type(CustomDestinationType.CUSTOM_DESTINATION) + .id(CUSTOM_DESTINATION_SPLUNK_DATA_ID)); + + try { + CustomDestinationResponse result = + apiInstance.updateLogsCustomDestination(CUSTOM_DESTINATION_SPLUNK_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#updateLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_3227001838.java b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_3227001838.java new file mode 100644 index 00000000000..8dd8d9849c7 --- /dev/null +++ b/examples/v2/logs-custom-destinations/UpdateLogsCustomDestination_3227001838.java @@ -0,0 +1,55 @@ +// Update a Splunk custom destination's destination preserves the sourcetype returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LogsCustomDestinationsApi; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestination; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunk; +import com.datadog.api.client.v2.model.CustomDestinationForwardDestinationSplunkType; +import com.datadog.api.client.v2.model.CustomDestinationResponse; +import com.datadog.api.client.v2.model.CustomDestinationType; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequest; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestAttributes; +import com.datadog.api.client.v2.model.CustomDestinationUpdateRequestDefinition; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsCustomDestinationsApi apiInstance = new LogsCustomDestinationsApi(defaultClient); + + // there is a valid "custom_destination_splunk_with_sourcetype" in the system + String CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID = + System.getenv("CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID"); + + CustomDestinationUpdateRequest body = + new CustomDestinationUpdateRequest() + .data( + new CustomDestinationUpdateRequestDefinition() + .attributes( + new CustomDestinationUpdateRequestAttributes() + .forwarderDestination( + new CustomDestinationForwardDestination( + new CustomDestinationForwardDestinationSplunk() + .type( + CustomDestinationForwardDestinationSplunkType + .SPLUNK_HEC) + .endpoint("https://updated-example.com") + .accessToken("my-access-token")))) + .type(CustomDestinationType.CUSTOM_DESTINATION) + .id(CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID)); + + try { + CustomDestinationResponse result = + apiInstance.updateLogsCustomDestination( + CUSTOM_DESTINATION_SPLUNK_WITH_SOURCETYPE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LogsCustomDestinationsApi#updateLogsCustomDestination"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationSplunk.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationSplunk.java index 4c108bd1229..fbeaf7b493c 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationSplunk.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationForwardDestinationSplunk.java @@ -16,11 +16,13 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; /** The Splunk HTTP Event Collector (HEC) destination. */ @JsonPropertyOrder({ CustomDestinationForwardDestinationSplunk.JSON_PROPERTY_ACCESS_TOKEN, CustomDestinationForwardDestinationSplunk.JSON_PROPERTY_ENDPOINT, + CustomDestinationForwardDestinationSplunk.JSON_PROPERTY_SOURCETYPE, CustomDestinationForwardDestinationSplunk.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( @@ -33,6 +35,9 @@ public class CustomDestinationForwardDestinationSplunk { public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; private String endpoint; + public static final String JSON_PROPERTY_SOURCETYPE = "sourcetype"; + private JsonNullable sourcetype = JsonNullable.undefined(); + public static final String JSON_PROPERTY_TYPE = "type"; private CustomDestinationForwardDestinationSplunkType type = CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC; @@ -92,6 +97,41 @@ public void setEndpoint(String endpoint) { this.endpoint = endpoint; } + public CustomDestinationForwardDestinationSplunk sourcetype(String sourcetype) { + this.sourcetype = JsonNullable.of(sourcetype); + return this; + } + + /** + * 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. + * + * @return sourcetype + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getSourcetype() { + return sourcetype.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SOURCETYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getSourcetype_JsonNullable() { + return sourcetype; + } + + @JsonProperty(JSON_PROPERTY_SOURCETYPE) + public void setSourcetype_JsonNullable(JsonNullable sourcetype) { + this.sourcetype = sourcetype; + } + + public void setSourcetype(String sourcetype) { + this.sourcetype = JsonNullable.of(sourcetype); + } + public CustomDestinationForwardDestinationSplunk type( CustomDestinationForwardDestinationSplunkType type) { this.type = type; @@ -176,6 +216,7 @@ public boolean equals(Object o) { (CustomDestinationForwardDestinationSplunk) o; return Objects.equals(this.accessToken, customDestinationForwardDestinationSplunk.accessToken) && Objects.equals(this.endpoint, customDestinationForwardDestinationSplunk.endpoint) + && Objects.equals(this.sourcetype, customDestinationForwardDestinationSplunk.sourcetype) && Objects.equals(this.type, customDestinationForwardDestinationSplunk.type) && Objects.equals( this.additionalProperties, @@ -184,7 +225,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(accessToken, endpoint, type, additionalProperties); + return Objects.hash(accessToken, endpoint, sourcetype, type, additionalProperties); } @Override @@ -193,6 +234,7 @@ public String toString() { sb.append("class CustomDestinationForwardDestinationSplunk {\n"); sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); sb.append(" endpoint: ").append(toIndentedString(endpoint)).append("\n"); + sb.append(" sourcetype: ").append(toIndentedString(sourcetype)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationSplunk.java b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationSplunk.java index ee84842d8c5..b07813e3989 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationSplunk.java +++ b/src/main/java/com/datadog/api/client/v2/model/CustomDestinationResponseForwardDestinationSplunk.java @@ -16,10 +16,12 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; /** The Splunk HTTP Event Collector (HEC) destination. */ @JsonPropertyOrder({ CustomDestinationResponseForwardDestinationSplunk.JSON_PROPERTY_ENDPOINT, + CustomDestinationResponseForwardDestinationSplunk.JSON_PROPERTY_SOURCETYPE, CustomDestinationResponseForwardDestinationSplunk.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( @@ -29,6 +31,9 @@ public class CustomDestinationResponseForwardDestinationSplunk { public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; private String endpoint; + public static final String JSON_PROPERTY_SOURCETYPE = "sourcetype"; + private JsonNullable sourcetype = JsonNullable.undefined(); + public static final String JSON_PROPERTY_TYPE = "type"; private CustomDestinationResponseForwardDestinationSplunkType type = CustomDestinationResponseForwardDestinationSplunkType.SPLUNK_HEC; @@ -66,6 +71,41 @@ public void setEndpoint(String endpoint) { this.endpoint = endpoint; } + public CustomDestinationResponseForwardDestinationSplunk sourcetype(String sourcetype) { + this.sourcetype = JsonNullable.of(sourcetype); + return this; + } + + /** + * 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. + * + * @return sourcetype + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getSourcetype() { + return sourcetype.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SOURCETYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getSourcetype_JsonNullable() { + return sourcetype; + } + + @JsonProperty(JSON_PROPERTY_SOURCETYPE) + public void setSourcetype_JsonNullable(JsonNullable sourcetype) { + this.sourcetype = sourcetype; + } + + public void setSourcetype(String sourcetype) { + this.sourcetype = JsonNullable.of(sourcetype); + } + public CustomDestinationResponseForwardDestinationSplunk type( CustomDestinationResponseForwardDestinationSplunkType type) { this.type = type; @@ -151,6 +191,8 @@ public boolean equals(Object o) { customDestinationResponseForwardDestinationSplunk = (CustomDestinationResponseForwardDestinationSplunk) o; return Objects.equals(this.endpoint, customDestinationResponseForwardDestinationSplunk.endpoint) + && Objects.equals( + this.sourcetype, customDestinationResponseForwardDestinationSplunk.sourcetype) && Objects.equals(this.type, customDestinationResponseForwardDestinationSplunk.type) && Objects.equals( this.additionalProperties, @@ -159,7 +201,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(endpoint, type, additionalProperties); + return Objects.hash(endpoint, sourcetype, type, additionalProperties); } @Override @@ -167,6 +209,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CustomDestinationResponseForwardDestinationSplunk {\n"); sb.append(" endpoint: ").append(toIndentedString(endpoint)).append("\n"); + sb.append(" sourcetype: ").append(toIndentedString(sourcetype)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..47253f50af8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:47.455Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..b50c79d708b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "896b2ffd-def9-ece3-cfc5-5bf21df0cd79" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/d328c779-9b3b-41c7-a952-20a7446eb7d1", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b0c9326a-11bd-84d5-1c31-e1565da92ef4" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..a1c69fc5518 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:49.008Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..98297e4644b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e40e6584-080a-0a97-6abb-aac7f44042c6" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/429e154f-5cf5-41ce-ae15-4bc41563f46f", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6f5cc353-eb80-06ad-8ba4-a0b573ec4fe5" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_empty_string_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_empty_string_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..da14a342ca6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_empty_string_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:50.210Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_empty_string_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_empty_string_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..47bac16456d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_empty_string_sourcetype_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8f986873-4882-068e-c4ad-8e924082c5d3" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/cb6c24f4-f420-42dd-bc86-ce51e03f7968", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2868263b-6837-d9dc-48b2-0187b7a96820" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_invalid_sourcetype_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_invalid_sourcetype_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..fd52717727a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_invalid_sourcetype_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:51.766Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_invalid_sourcetype_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_invalid_sourcetype_returns_Bad_Request_response.json new file mode 100644 index 00000000000..d3cad05cbbb --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_with_an_invalid_sourcetype_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid custom destination configuration\",\"Sourcetype must be a string or null\"]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "693f4f26-e2ce-e7c2-ced9-dc68aa07dd81" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_without_a_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_without_a_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..d66033d5304 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_without_a_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:52.120Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_without_a_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_without_a_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..974714d3199 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_Splunk_custom_destination_without_a_sourcetype_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c5f2cb22-dd25-69ae-21c0-8923ae1a9dad" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/c475e180-758a-4503-a2ab-3ff1779c738a", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "81138bc4-bf30-0674-40ba-1dbac6d5252c" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..81e7c738758 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:55.981Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..79c2c403806 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_attributes_preserves_the_absent_sourcetype_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5582114d-01bc-519a-080e-4ff4ad1ac1aa" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"name\":\"Nginx logs (Updated)\"},\"id\":\"9ac57fd5-857f-4082-badc-463ecd1e990d\",\"type\":\"custom_destination\"}}" + }, + "headers": {}, + "method": "PATCH", + "path": "/api/v2/logs/config/custom-destinations/9ac57fd5-857f-4082-badc-463ecd1e990d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2461a2cc-d618-f242-e374-2306f71c00ae" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/9ac57fd5-857f-4082-badc-463ecd1e990d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "39d0bda9-8ebe-1408-ef7d-a64cb7fe9b22" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..1bb65534b86 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:59.087Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..6b8ab613238 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_null_sourcetype_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ea2caff9-3217-2082-ff6f-1a9b63bdeab5" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PATCH", + "path": "/api/v2/logs/config/custom-destinations/1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cf03b4ac-e14e-a01a-bbc9-7be9f47fca0e" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/1cf9102b-169d-4a5c-a82b-aa5b3a12d6c5", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "98dc633b-8c61-03f6-3262-6f3aa69d1665" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..788849b0847 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:24:00.500Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..21637a507b2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_s_destination_preserves_the_sourcetype_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e54a3c94-e361-a1bd-4cd5-a01660135f4d" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PATCH", + "path": "/api/v2/logs/config/custom-destinations/fa416048-c8e1-4b5a-a3e1-b6c2538d5903", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "dcc8ffde-b2dc-f9f5-e296-945e1be56738" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/fa416048-c8e1-4b5a-a3e1-b6c2538d5903", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "eaf8a3ab-dbb4-7d9e-cd56-f7daa2ec6bbe" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..43ba7b8a91f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:53.183Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..ffc60bb20ac --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_null_sourcetype_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "47eb4467-823d-62ef-9092-b78c74c31ec6" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PATCH", + "path": "/api/v2/logs/config/custom-destinations/f718e9ba-6676-46f9-ae62-1e63b0348dbc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e3a14e2b-f8e7-5e6e-8712-2075385db725" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/f718e9ba-6676-46f9-ae62-1e63b0348dbc", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "186dd21c-72dc-cdef-b665-8d0376bc32db" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.freeze new file mode 100644 index 00000000000..a2f5a72828e --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-03-25T16:23:54.709Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.json new file mode 100644 index 00000000000..587414ad362 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_Splunk_custom_destination_with_a_sourcetype_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/logs/config/custom-destinations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8be1f4d5-8cdf-9c06-4a83-0f1ef7840528" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PATCH", + "path": "/api/v2/logs/config/custom-destinations/12f30686-f946-4eb1-8988-643d55ad0cb9", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "032ed595-24d2-522b-ba6f-ed95c56d2705" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/logs/config/custom-destinations/12f30686-f946-4eb1-8988-643d55ad0cb9", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "29ec4785-3292-5089-c837-cc56301f0e58" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 8413be265af..11013dcb01e 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/logs_custom_destinations.feature b/src/test/resources/com/datadog/api/client/v2/api/logs_custom_destinations.feature index 44b85404852..e9aa2290997 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/logs_custom_destinations.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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