diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index e922a2a26ab..a31e58ad49f 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -6182,6 +6182,76 @@ components: type: string x-enum-varnames: - ARITHMETIC_PROCESSOR + LogsArrayMapProcessor: + description: |- + The array-map processor transforms each element of a source array by running + sub-processors against it and writing results to a target array. + Sub-processors reference the current element via `$sourceElem` (read) and + `$targetElem` (write). Parent log attributes are read via plain paths as usual. + Supported sub-processor types: `attribute-remapper`, `string-builder-processor`, + `arithmetic-processor`, `category-processor`. + `is_enabled` on sub-processors is ignored; sub-processor execution is gated + entirely by the parent array-map's `is_enabled` flag. + properties: + is_enabled: + default: false + description: Whether or not the processor is enabled. + type: boolean + name: + description: Name of the processor. + type: string + preserve_source: + default: true + description: |- + When `false` and `source != target`, the source attribute is removed after + processing. Cannot be `false` when `source == target`. + type: boolean + processors: + description: |- + Sub-processors applied to each element. Allowed types: `attribute-remapper`, + `string-builder-processor`, `arithmetic-processor`, `category-processor`. + items: + $ref: "#/components/schemas/LogsArrayMapSubProcessor" + type: array + source: + description: |- + Attribute path of the source array. Elements are read-only via `$sourceElem` + inside sub-processors. + example: detail.resource.s3BucketDetails + type: string + target: + description: |- + Attribute path of the output array. Sub-processors write to `$targetElem` + (or `$targetElem.`) to build each output element. + example: ocsf.resources + type: string + type: + $ref: "#/components/schemas/LogsArrayMapProcessorType" + required: + - source + - target + - processors + - type + type: object + LogsArrayMapProcessorType: + default: array-map + description: Type of logs array-map processor. + enum: + - array-map + example: array-map + type: string + x-enum-varnames: + - ARRAY_MAP + LogsArrayMapSubProcessor: + description: |- + A sub-processor used inside an array-map processor. + Allowed types: `attribute-remapper`, `string-builder-processor`, + `arithmetic-processor`, `category-processor`. + oneOf: + - $ref: "#/components/schemas/LogsAttributeRemapper" + - $ref: "#/components/schemas/LogsStringBuilderProcessor" + - $ref: "#/components/schemas/LogsArithmeticProcessor" + - $ref: "#/components/schemas/LogsCategoryProcessor" LogsArrayProcessor: description: |- A processor for extracting, aggregating, or transforming values from JSON arrays within your logs. @@ -7237,6 +7307,7 @@ components: - $ref: "#/components/schemas/LogsDecoderProcessor" - $ref: "#/components/schemas/LogsSchemaProcessor" - $ref: "#/components/schemas/LogsExcludeAttributeProcessor" + - $ref: "#/components/schemas/LogsArrayMapProcessor" LogsQueryCompute: description: Define computation for a log query. properties: diff --git a/examples/v1/logs-pipelines/CreateLogsPipeline_104735144.java b/examples/v1/logs-pipelines/CreateLogsPipeline_104735144.java new file mode 100644 index 00000000000..77d836162d6 --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_104735144.java @@ -0,0 +1,54 @@ +// Create a pipeline with Array Map Processor with preserve_source false returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.LogsPipelinesApi; +import com.datadog.api.client.v1.model.LogsArrayMapProcessor; +import com.datadog.api.client.v1.model.LogsArrayMapProcessorType; +import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor; +import com.datadog.api.client.v1.model.LogsAttributeRemapper; +import com.datadog.api.client.v1.model.LogsAttributeRemapperType; +import com.datadog.api.client.v1.model.LogsFilter; +import com.datadog.api.client.v1.model.LogsPipeline; +import com.datadog.api.client.v1.model.LogsProcessor; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient); + + LogsPipeline body = + new LogsPipeline() + .filter(new LogsFilter().query("source:python")) + .name("testPipelineArrayMapNoPreserve") + .processors( + Collections.singletonList( + new LogsProcessor( + new LogsArrayMapProcessor() + .type(LogsArrayMapProcessorType.ARRAY_MAP) + .isEnabled(true) + .name("map and remove source") + .source("items") + .target("out") + .preserveSource(false) + .processors( + Collections.singletonList( + new LogsArrayMapSubProcessor( + new LogsAttributeRemapper() + .type(LogsAttributeRemapperType.ATTRIBUTE_REMAPPER) + .sources(Collections.singletonList("$sourceElem.id")) + .target("$targetElem.uid"))))))); + + try { + LogsPipeline result = apiInstance.createLogsPipeline(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline"); + 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/v1/logs-pipelines/CreateLogsPipeline_1185292896.java b/examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.java new file mode 100644 index 00000000000..6b0b612db82 --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.java @@ -0,0 +1,64 @@ +// Create a pipeline with Array Map Processor using category sub-processor returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.LogsPipelinesApi; +import com.datadog.api.client.v1.model.LogsArrayMapProcessor; +import com.datadog.api.client.v1.model.LogsArrayMapProcessorType; +import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor; +import com.datadog.api.client.v1.model.LogsCategoryProcessor; +import com.datadog.api.client.v1.model.LogsCategoryProcessorCategory; +import com.datadog.api.client.v1.model.LogsCategoryProcessorType; +import com.datadog.api.client.v1.model.LogsFilter; +import com.datadog.api.client.v1.model.LogsPipeline; +import com.datadog.api.client.v1.model.LogsProcessor; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient); + + LogsPipeline body = + new LogsPipeline() + .filter(new LogsFilter().query("source:python")) + .name("testPipelineArrayMapCategory") + .processors( + Collections.singletonList( + new LogsProcessor( + new LogsArrayMapProcessor() + .type(LogsArrayMapProcessorType.ARRAY_MAP) + .isEnabled(true) + .name("categorize items") + .source("items") + .target("out") + .processors( + Collections.singletonList( + new LogsArrayMapSubProcessor( + new LogsCategoryProcessor() + .type(LogsCategoryProcessorType.CATEGORY_PROCESSOR) + .target("$targetElem.level") + .categories( + Arrays.asList( + new LogsCategoryProcessorCategory() + .filter( + new LogsFilter() + .query("@$sourceElem.status:error")) + .name("error"), + new LogsCategoryProcessorCategory() + .filter(new LogsFilter().query("*")) + .name("info"))))))))); + + try { + LogsPipeline result = apiInstance.createLogsPipeline(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline"); + 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/v1/logs-pipelines/CreateLogsPipeline_2402034476.java b/examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.java new file mode 100644 index 00000000000..ec72146bf39 --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.java @@ -0,0 +1,53 @@ +// Create a pipeline with Array Map Processor using arithmetic sub-processor returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.LogsPipelinesApi; +import com.datadog.api.client.v1.model.LogsArithmeticProcessor; +import com.datadog.api.client.v1.model.LogsArithmeticProcessorType; +import com.datadog.api.client.v1.model.LogsArrayMapProcessor; +import com.datadog.api.client.v1.model.LogsArrayMapProcessorType; +import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor; +import com.datadog.api.client.v1.model.LogsFilter; +import com.datadog.api.client.v1.model.LogsPipeline; +import com.datadog.api.client.v1.model.LogsProcessor; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient); + + LogsPipeline body = + new LogsPipeline() + .filter(new LogsFilter().query("source:python")) + .name("testPipelineArrayMapArithmetic") + .processors( + Collections.singletonList( + new LogsProcessor( + new LogsArrayMapProcessor() + .type(LogsArrayMapProcessorType.ARRAY_MAP) + .isEnabled(true) + .name("double counts") + .source("items") + .target("out") + .processors( + Collections.singletonList( + new LogsArrayMapSubProcessor( + new LogsArithmeticProcessor() + .type(LogsArithmeticProcessorType.ARITHMETIC_PROCESSOR) + .expression("$sourceElem.count * 2") + .target("$targetElem.doubled"))))))); + + try { + LogsPipeline result = apiInstance.createLogsPipeline(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline"); + 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/v1/logs-pipelines/CreateLogsPipeline_3996915493.java b/examples/v1/logs-pipelines/CreateLogsPipeline_3996915493.java new file mode 100644 index 00000000000..ce0869e83b4 --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_3996915493.java @@ -0,0 +1,65 @@ +// Create a pipeline with Array Map Processor returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v1.api.LogsPipelinesApi; +import com.datadog.api.client.v1.model.LogsArrayMapProcessor; +import com.datadog.api.client.v1.model.LogsArrayMapProcessorType; +import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor; +import com.datadog.api.client.v1.model.LogsAttributeRemapper; +import com.datadog.api.client.v1.model.LogsAttributeRemapperType; +import com.datadog.api.client.v1.model.LogsFilter; +import com.datadog.api.client.v1.model.LogsPipeline; +import com.datadog.api.client.v1.model.LogsProcessor; +import com.datadog.api.client.v1.model.LogsStringBuilderProcessor; +import com.datadog.api.client.v1.model.LogsStringBuilderProcessorType; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient); + + LogsPipeline body = + new LogsPipeline() + .filter(new LogsFilter().query("source:python")) + .name("testPipelineArrayMap") + .processors( + Collections.singletonList( + new LogsProcessor( + new LogsArrayMapProcessor() + .type(LogsArrayMapProcessorType.ARRAY_MAP) + .isEnabled(true) + .name("map items") + .source("items") + .target("out") + .preserveSource(true) + .processors( + Arrays.asList( + new LogsArrayMapSubProcessor( + new LogsAttributeRemapper() + .type(LogsAttributeRemapperType.ATTRIBUTE_REMAPPER) + .sources(Collections.singletonList("$sourceElem.id")) + .target("$targetElem.uid") + .preserveSource(true)), + new LogsArrayMapSubProcessor( + new LogsStringBuilderProcessor() + .type( + LogsStringBuilderProcessorType + .STRING_BUILDER_PROCESSOR) + .template("item-%{$sourceElem.id}") + .target("$targetElem.label"))))))); + + try { + LogsPipeline result = apiInstance.createLogsPipeline(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline"); + 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/v1/model/LogsArrayMapProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessor.java new file mode 100644 index 00000000000..34ae5b971e8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessor.java @@ -0,0 +1,341 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * The array-map processor transforms each element of a source array by running sub-processors + * against it and writing results to a target array. Sub-processors reference the current element + * via $sourceElem (read) and $targetElem (write). Parent log attributes + * are read via plain paths as usual. Supported sub-processor types: attribute-remapper + * , string-builder-processor, arithmetic-processor, + * category-processor. is_enabled on sub-processors is ignored; sub-processor + * execution is gated entirely by the parent array-map's is_enabled flag. + */ +@JsonPropertyOrder({ + LogsArrayMapProcessor.JSON_PROPERTY_IS_ENABLED, + LogsArrayMapProcessor.JSON_PROPERTY_NAME, + LogsArrayMapProcessor.JSON_PROPERTY_PRESERVE_SOURCE, + LogsArrayMapProcessor.JSON_PROPERTY_PROCESSORS, + LogsArrayMapProcessor.JSON_PROPERTY_SOURCE, + LogsArrayMapProcessor.JSON_PROPERTY_TARGET, + LogsArrayMapProcessor.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LogsArrayMapProcessor { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IS_ENABLED = "is_enabled"; + private Boolean isEnabled = false; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_PRESERVE_SOURCE = "preserve_source"; + private Boolean preserveSource = true; + + public static final String JSON_PROPERTY_PROCESSORS = "processors"; + private List processors = new ArrayList<>(); + + public static final String JSON_PROPERTY_SOURCE = "source"; + private String source; + + public static final String JSON_PROPERTY_TARGET = "target"; + private String target; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsArrayMapProcessorType type = LogsArrayMapProcessorType.ARRAY_MAP; + + public LogsArrayMapProcessor() {} + + @JsonCreator + public LogsArrayMapProcessor( + @JsonProperty(required = true, value = JSON_PROPERTY_PROCESSORS) + List processors, + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCE) String source, + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) String target, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LogsArrayMapProcessorType type) { + this.processors = processors; + this.source = source; + this.target = target; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LogsArrayMapProcessor isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Whether or not the processor is enabled. + * + * @return isEnabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsEnabled() { + return isEnabled; + } + + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + public LogsArrayMapProcessor name(String name) { + this.name = name; + return this; + } + + /** + * Name of the processor. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public LogsArrayMapProcessor preserveSource(Boolean preserveSource) { + this.preserveSource = preserveSource; + return this; + } + + /** + * When false and source != target, the source attribute is removed + * after processing. Cannot be false when source == target. + * + * @return preserveSource + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRESERVE_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getPreserveSource() { + return preserveSource; + } + + public void setPreserveSource(Boolean preserveSource) { + this.preserveSource = preserveSource; + } + + public LogsArrayMapProcessor processors(List processors) { + this.processors = processors; + for (LogsArrayMapSubProcessor item : processors) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LogsArrayMapProcessor addProcessorsItem(LogsArrayMapSubProcessor processorsItem) { + this.processors.add(processorsItem); + this.unparsed |= processorsItem.unparsed; + return this; + } + + /** + * Sub-processors applied to each element. Allowed types: attribute-remapper, + * string-builder-processor, arithmetic-processor, category-processor + * . + * + * @return processors + */ + @JsonProperty(JSON_PROPERTY_PROCESSORS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getProcessors() { + return processors; + } + + public void setProcessors(List processors) { + this.processors = processors; + } + + public LogsArrayMapProcessor source(String source) { + this.source = source; + return this; + } + + /** + * Attribute path of the source array. Elements are read-only via $sourceElem inside + * sub-processors. + * + * @return source + */ + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public LogsArrayMapProcessor target(String target) { + this.target = target; + return this; + } + + /** + * Attribute path of the output array. Sub-processors write to $targetElem (or + * $targetElem.<field>) to build each output element. + * + * @return target + */ + @JsonProperty(JSON_PROPERTY_TARGET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public LogsArrayMapProcessor type(LogsArrayMapProcessorType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of logs array-map processor. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LogsArrayMapProcessorType getType() { + return type; + } + + public void setType(LogsArrayMapProcessorType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LogsArrayMapProcessor + */ + @JsonAnySetter + public LogsArrayMapProcessor putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LogsArrayMapProcessor object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LogsArrayMapProcessor logsArrayMapProcessor = (LogsArrayMapProcessor) o; + return Objects.equals(this.isEnabled, logsArrayMapProcessor.isEnabled) + && Objects.equals(this.name, logsArrayMapProcessor.name) + && Objects.equals(this.preserveSource, logsArrayMapProcessor.preserveSource) + && Objects.equals(this.processors, logsArrayMapProcessor.processors) + && Objects.equals(this.source, logsArrayMapProcessor.source) + && Objects.equals(this.target, logsArrayMapProcessor.target) + && Objects.equals(this.type, logsArrayMapProcessor.type) + && Objects.equals(this.additionalProperties, logsArrayMapProcessor.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + isEnabled, name, preserveSource, processors, source, target, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LogsArrayMapProcessor {\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" preserveSource: ").append(toIndentedString(preserveSource)).append("\n"); + sb.append(" processors: ").append(toIndentedString(processors)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessorType.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessorType.java new file mode 100644 index 00000000000..ae8e32468d2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessorType.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type of logs array-map processor. */ +@JsonSerialize(using = LogsArrayMapProcessorType.LogsArrayMapProcessorTypeSerializer.class) +public class LogsArrayMapProcessorType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("array-map")); + + public static final LogsArrayMapProcessorType ARRAY_MAP = + new LogsArrayMapProcessorType("array-map"); + + LogsArrayMapProcessorType(String value) { + super(value, allowedValues); + } + + public static class LogsArrayMapProcessorTypeSerializer + extends StdSerializer { + public LogsArrayMapProcessorTypeSerializer(Class t) { + super(t); + } + + public LogsArrayMapProcessorTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LogsArrayMapProcessorType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LogsArrayMapProcessorType fromValue(String value) { + return new LogsArrayMapProcessorType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapSubProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapSubProcessor.java new file mode 100644 index 00000000000..026834d9592 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapSubProcessor.java @@ -0,0 +1,416 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v1.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = LogsArrayMapSubProcessor.LogsArrayMapSubProcessorDeserializer.class) +@JsonSerialize(using = LogsArrayMapSubProcessor.LogsArrayMapSubProcessorSerializer.class) +public class LogsArrayMapSubProcessor extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(LogsArrayMapSubProcessor.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class LogsArrayMapSubProcessorSerializer + extends StdSerializer { + public LogsArrayMapSubProcessorSerializer(Class t) { + super(t); + } + + public LogsArrayMapSubProcessorSerializer() { + this(null); + } + + @Override + public void serialize( + LogsArrayMapSubProcessor value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class LogsArrayMapSubProcessorDeserializer + extends StdDeserializer { + public LogsArrayMapSubProcessorDeserializer() { + this(LogsArrayMapSubProcessor.class); + } + + public LogsArrayMapSubProcessorDeserializer(Class vc) { + super(vc); + } + + @Override + public LogsArrayMapSubProcessor deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize LogsAttributeRemapper + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsAttributeRemapper.class.equals(Integer.class) + || LogsAttributeRemapper.class.equals(Long.class) + || LogsAttributeRemapper.class.equals(Float.class) + || LogsAttributeRemapper.class.equals(Double.class) + || LogsAttributeRemapper.class.equals(Boolean.class) + || LogsAttributeRemapper.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsAttributeRemapper.class.equals(Integer.class) + || LogsAttributeRemapper.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsAttributeRemapper.class.equals(Float.class) + || LogsAttributeRemapper.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsAttributeRemapper.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsAttributeRemapper.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsAttributeRemapper.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LogsAttributeRemapper) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsAttributeRemapper'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LogsAttributeRemapper'", e); + } + + // deserialize LogsStringBuilderProcessor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsStringBuilderProcessor.class.equals(Integer.class) + || LogsStringBuilderProcessor.class.equals(Long.class) + || LogsStringBuilderProcessor.class.equals(Float.class) + || LogsStringBuilderProcessor.class.equals(Double.class) + || LogsStringBuilderProcessor.class.equals(Boolean.class) + || LogsStringBuilderProcessor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsStringBuilderProcessor.class.equals(Integer.class) + || LogsStringBuilderProcessor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsStringBuilderProcessor.class.equals(Float.class) + || LogsStringBuilderProcessor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsStringBuilderProcessor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsStringBuilderProcessor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsStringBuilderProcessor.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LogsStringBuilderProcessor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsStringBuilderProcessor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LogsStringBuilderProcessor'", e); + } + + // deserialize LogsArithmeticProcessor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsArithmeticProcessor.class.equals(Integer.class) + || LogsArithmeticProcessor.class.equals(Long.class) + || LogsArithmeticProcessor.class.equals(Float.class) + || LogsArithmeticProcessor.class.equals(Double.class) + || LogsArithmeticProcessor.class.equals(Boolean.class) + || LogsArithmeticProcessor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsArithmeticProcessor.class.equals(Integer.class) + || LogsArithmeticProcessor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsArithmeticProcessor.class.equals(Float.class) + || LogsArithmeticProcessor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsArithmeticProcessor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsArithmeticProcessor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsArithmeticProcessor.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LogsArithmeticProcessor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsArithmeticProcessor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LogsArithmeticProcessor'", e); + } + + // deserialize LogsCategoryProcessor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsCategoryProcessor.class.equals(Integer.class) + || LogsCategoryProcessor.class.equals(Long.class) + || LogsCategoryProcessor.class.equals(Float.class) + || LogsCategoryProcessor.class.equals(Double.class) + || LogsCategoryProcessor.class.equals(Boolean.class) + || LogsCategoryProcessor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsCategoryProcessor.class.equals(Integer.class) + || LogsCategoryProcessor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsCategoryProcessor.class.equals(Float.class) + || LogsCategoryProcessor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsCategoryProcessor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsCategoryProcessor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsCategoryProcessor.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LogsCategoryProcessor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsCategoryProcessor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LogsCategoryProcessor'", e); + } + + LogsArrayMapSubProcessor ret = new LogsArrayMapSubProcessor(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public LogsArrayMapSubProcessor getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "LogsArrayMapSubProcessor cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public LogsArrayMapSubProcessor() { + super("oneOf", Boolean.FALSE); + } + + public LogsArrayMapSubProcessor(LogsAttributeRemapper o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public LogsArrayMapSubProcessor(LogsStringBuilderProcessor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public LogsArrayMapSubProcessor(LogsArithmeticProcessor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public LogsArrayMapSubProcessor(LogsCategoryProcessor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("LogsAttributeRemapper", new GenericType() {}); + schemas.put("LogsStringBuilderProcessor", new GenericType() {}); + schemas.put("LogsArithmeticProcessor", new GenericType() {}); + schemas.put("LogsCategoryProcessor", new GenericType() {}); + JSON.registerDescendants(LogsArrayMapSubProcessor.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return LogsArrayMapSubProcessor.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: LogsAttributeRemapper, LogsStringBuilderProcessor, + * LogsArithmeticProcessor, LogsCategoryProcessor + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(LogsAttributeRemapper.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(LogsStringBuilderProcessor.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(LogsArithmeticProcessor.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(LogsCategoryProcessor.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be LogsAttributeRemapper, LogsStringBuilderProcessor," + + " LogsArithmeticProcessor, LogsCategoryProcessor"); + } + + /** + * Get the actual instance, which can be the following: LogsAttributeRemapper, + * LogsStringBuilderProcessor, LogsArithmeticProcessor, LogsCategoryProcessor + * + * @return The actual instance (LogsAttributeRemapper, LogsStringBuilderProcessor, + * LogsArithmeticProcessor, LogsCategoryProcessor) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsAttributeRemapper`. If the actual instance is not + * `LogsAttributeRemapper`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsAttributeRemapper` + * @throws ClassCastException if the instance is not `LogsAttributeRemapper` + */ + public LogsAttributeRemapper getLogsAttributeRemapper() throws ClassCastException { + return (LogsAttributeRemapper) super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsStringBuilderProcessor`. If the actual instance is not + * `LogsStringBuilderProcessor`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsStringBuilderProcessor` + * @throws ClassCastException if the instance is not `LogsStringBuilderProcessor` + */ + public LogsStringBuilderProcessor getLogsStringBuilderProcessor() throws ClassCastException { + return (LogsStringBuilderProcessor) super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsArithmeticProcessor`. If the actual instance is not + * `LogsArithmeticProcessor`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsArithmeticProcessor` + * @throws ClassCastException if the instance is not `LogsArithmeticProcessor` + */ + public LogsArithmeticProcessor getLogsArithmeticProcessor() throws ClassCastException { + return (LogsArithmeticProcessor) super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsCategoryProcessor`. If the actual instance is not + * `LogsCategoryProcessor`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsCategoryProcessor` + * @throws ClassCastException if the instance is not `LogsCategoryProcessor` + */ + public LogsCategoryProcessor getLogsCategoryProcessor() throws ClassCastException { + return (LogsCategoryProcessor) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/LogsProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsProcessor.java index 199b9fcba3b..09cdb347350 100644 --- a/src/main/java/com/datadog/api/client/v1/model/LogsProcessor.java +++ b/src/main/java/com/datadog/api/client/v1/model/LogsProcessor.java @@ -1010,6 +1010,51 @@ public LogsProcessor deserialize(JsonParser jp, DeserializationContext ctxt) log.log(Level.FINER, "Input data does not match schema 'LogsExcludeAttributeProcessor'", e); } + // deserialize LogsArrayMapProcessor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsArrayMapProcessor.class.equals(Integer.class) + || LogsArrayMapProcessor.class.equals(Long.class) + || LogsArrayMapProcessor.class.equals(Float.class) + || LogsArrayMapProcessor.class.equals(Double.class) + || LogsArrayMapProcessor.class.equals(Boolean.class) + || LogsArrayMapProcessor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsArrayMapProcessor.class.equals(Integer.class) + || LogsArrayMapProcessor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsArrayMapProcessor.class.equals(Float.class) + || LogsArrayMapProcessor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsArrayMapProcessor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsArrayMapProcessor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsArrayMapProcessor.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LogsArrayMapProcessor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsArrayMapProcessor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LogsArrayMapProcessor'", e); + } + LogsProcessor ret = new LogsProcessor(); if (match == 1) { ret.setActualInstance(deserialized); @@ -1143,6 +1188,11 @@ public LogsProcessor(LogsExcludeAttributeProcessor o) { setActualInstance(o); } + public LogsProcessor(LogsArrayMapProcessor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("LogsGrokParser", new GenericType() {}); schemas.put("LogsDateRemapper", new GenericType() {}); @@ -1168,6 +1218,7 @@ public LogsProcessor(LogsExcludeAttributeProcessor o) { schemas.put("LogsSchemaProcessor", new GenericType() {}); schemas.put( "LogsExcludeAttributeProcessor", new GenericType() {}); + schemas.put("LogsArrayMapProcessor", new GenericType() {}); JSON.registerDescendants(LogsProcessor.class, Collections.unmodifiableMap(schemas)); } @@ -1183,7 +1234,7 @@ public Map getSchemas() { * LogsUserAgentParser, LogsCategoryProcessor, LogsArithmeticProcessor, * LogsStringBuilderProcessor, LogsPipelineProcessor, LogsGeoIPParser, LogsLookupProcessor, * ReferenceTableLogsLookupProcessor, LogsTraceRemapper, LogsSpanRemapper, LogsArrayProcessor, - * LogsDecoderProcessor, LogsSchemaProcessor, LogsExcludeAttributeProcessor + * LogsDecoderProcessor, LogsSchemaProcessor, LogsExcludeAttributeProcessor, LogsArrayMapProcessor * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -1275,6 +1326,10 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(LogsArrayMapProcessor.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -1287,7 +1342,7 @@ public void setActualInstance(Object instance) { + " LogsStringBuilderProcessor, LogsPipelineProcessor, LogsGeoIPParser," + " LogsLookupProcessor, ReferenceTableLogsLookupProcessor, LogsTraceRemapper," + " LogsSpanRemapper, LogsArrayProcessor, LogsDecoderProcessor, LogsSchemaProcessor," - + " LogsExcludeAttributeProcessor"); + + " LogsExcludeAttributeProcessor, LogsArrayMapProcessor"); } /** @@ -1296,14 +1351,15 @@ public void setActualInstance(Object instance) { * LogsURLParser, LogsUserAgentParser, LogsCategoryProcessor, LogsArithmeticProcessor, * LogsStringBuilderProcessor, LogsPipelineProcessor, LogsGeoIPParser, LogsLookupProcessor, * ReferenceTableLogsLookupProcessor, LogsTraceRemapper, LogsSpanRemapper, LogsArrayProcessor, - * LogsDecoderProcessor, LogsSchemaProcessor, LogsExcludeAttributeProcessor + * LogsDecoderProcessor, LogsSchemaProcessor, LogsExcludeAttributeProcessor, LogsArrayMapProcessor * * @return The actual instance (LogsGrokParser, LogsDateRemapper, LogsStatusRemapper, * LogsServiceRemapper, LogsMessageRemapper, LogsAttributeRemapper, LogsURLParser, * LogsUserAgentParser, LogsCategoryProcessor, LogsArithmeticProcessor, * LogsStringBuilderProcessor, LogsPipelineProcessor, LogsGeoIPParser, LogsLookupProcessor, * ReferenceTableLogsLookupProcessor, LogsTraceRemapper, LogsSpanRemapper, LogsArrayProcessor, - * LogsDecoderProcessor, LogsSchemaProcessor, LogsExcludeAttributeProcessor) + * LogsDecoderProcessor, LogsSchemaProcessor, LogsExcludeAttributeProcessor, + * LogsArrayMapProcessor) */ @Override public Object getActualInstance() { @@ -1542,4 +1598,15 @@ public LogsExcludeAttributeProcessor getLogsExcludeAttributeProcessor() throws ClassCastException { return (LogsExcludeAttributeProcessor) super.getActualInstance(); } + + /** + * Get the actual instance of `LogsArrayMapProcessor`. If the actual instance is not + * `LogsArrayMapProcessor`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsArrayMapProcessor` + * @throws ClassCastException if the instance is not `LogsArrayMapProcessor` + */ + public LogsArrayMapProcessor getLogsArrayMapProcessor() throws ClassCastException { + return (LogsArrayMapProcessor) super.getActualInstance(); + } } diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.freeze new file mode 100644 index 00000000000..47ed4ffb124 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-05T10:37:09.718Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.json new file mode 100644 index 00000000000..79e724518d6 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineArrayMap\",\"processors\":[{\"is_enabled\":true,\"name\":\"map items\",\"preserve_source\":true,\"processors\":[{\"preserve_source\":true,\"sources\":[\"$sourceElem.id\"],\"target\":\"$targetElem.uid\",\"type\":\"attribute-remapper\"},{\"target\":\"$targetElem.label\",\"template\":\"item-%{$sourceElem.id}\",\"type\":\"string-builder-processor\"}],\"source\":\"items\",\"target\":\"out\",\"type\":\"array-map\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"52YCR0XwSreEg1PApRy_Bg\",\"type\":\"pipeline\",\"name\":\"testPipelineArrayMap\",\"is_enabled\":false,\"is_read_only\":false,\"filter\":{\"query\":\"source:python\"},\"processors\":[{\"name\":\"map items\",\"is_enabled\":true,\"source\":\"items\",\"target\":\"out\",\"processors\":[{\"is_enabled\":true,\"sources\":[\"$sourceElem.id\"],\"target\":\"$targetElem.uid\",\"target_type\":\"attribute\",\"preserve_source\":true,\"override_on_conflict\":false,\"type\":\"attribute-remapper\"},{\"is_enabled\":true,\"template\":\"item-%{$sourceElem.id}\",\"target\":\"$targetElem.label\",\"is_replace_missing\":false,\"type\":\"string-builder-processor\"}],\"preserve_source\":true,\"type\":\"array-map\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "012311a1-216d-a262-e3fd-d0441cf2ecb0" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/52YCR0XwSreEg1PApRy_Bg", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5f65d9bb-38c8-2b24-2ad0-634d5f84a6ff" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.freeze new file mode 100644 index 00000000000..be5a2a9ac61 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-05T10:38:03.240Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.json new file mode 100644 index 00000000000..a0393369438 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineArrayMapArithmetic\",\"processors\":[{\"is_enabled\":true,\"name\":\"double counts\",\"processors\":[{\"expression\":\"$sourceElem.count * 2\",\"target\":\"$targetElem.doubled\",\"type\":\"arithmetic-processor\"}],\"source\":\"items\",\"target\":\"out\",\"type\":\"array-map\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"69FzjRuHT5y8b65qAZE6aA\",\"type\":\"pipeline\",\"name\":\"testPipelineArrayMapArithmetic\",\"is_enabled\":false,\"is_read_only\":false,\"filter\":{\"query\":\"source:python\"},\"processors\":[{\"name\":\"double counts\",\"is_enabled\":true,\"source\":\"items\",\"target\":\"out\",\"processors\":[{\"is_enabled\":true,\"expression\":\"$sourceElem.count * 2\",\"target\":\"$targetElem.doubled\",\"is_replace_missing\":false,\"type\":\"arithmetic-processor\"}],\"preserve_source\":true,\"type\":\"array-map\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e133ccff-332f-6869-853b-2e276ab309b2" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/69FzjRuHT5y8b65qAZE6aA", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "dd061a6c-2175-7179-d92d-5aad3f95184b" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.freeze new file mode 100644 index 00000000000..bb7f17de165 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-05T16:22:24.547Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.json new file mode 100644 index 00000000000..f1b5a9af4ef --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineArrayMapCategory\",\"processors\":[{\"is_enabled\":true,\"name\":\"categorize items\",\"processors\":[{\"categories\":[{\"filter\":{\"query\":\"@$sourceElem.status:error\"},\"name\":\"error\"},{\"filter\":{\"query\":\"*\"},\"name\":\"info\"}],\"target\":\"$targetElem.level\",\"type\":\"category-processor\"}],\"source\":\"items\",\"target\":\"out\",\"type\":\"array-map\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"SM62G2OyTuyYF4py-_arUw\",\"type\":\"pipeline\",\"name\":\"testPipelineArrayMapCategory\",\"is_enabled\":false,\"is_read_only\":false,\"filter\":{\"query\":\"source:python\"},\"processors\":[{\"name\":\"categorize items\",\"is_enabled\":true,\"source\":\"items\",\"target\":\"out\",\"processors\":[{\"is_enabled\":true,\"categories\":[{\"filter\":{\"query\":\"@$sourceElem.status:error\"},\"name\":\"error\"},{\"filter\":{\"query\":\"*\"},\"name\":\"info\"}],\"target\":\"$targetElem.level\",\"type\":\"category-processor\"}],\"preserve_source\":true,\"type\":\"array-map\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "908600ca-eddf-6289-609f-04241e7e3a8c" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/SM62G2OyTuyYF4py-_arUw", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "98588c40-efb3-9992-ac4b-482d835fed1a" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_and_same_source_and_target_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_and_same_source_and_target_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..909ce154a85 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_and_same_source_and_target_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2026-06-05T16:22:48.400Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_and_same_source_and_target_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_and_same_source_and_target_returns_Bad_Request_response.json new file mode 100644 index 00000000000..6b6288ed343 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_and_same_source_and_target_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineArrayMapInvalid\",\"processors\":[{\"is_enabled\":true,\"name\":\"invalid preserve_source\",\"preserve_source\":false,\"processors\":[{\"sources\":[\"$sourceElem.id\"],\"target\":\"$targetElem.uid\",\"type\":\"attribute-remapper\"}],\"source\":\"items\",\"target\":\"items\",\"type\":\"array-map\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid Pipeline\",\"details\":[{\"code\":\"InvalidArgument\",\"message\":\"preserve_source:false is not allowed when source equals target\"}]}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "30e0f0b2-9adf-b6bf-1372-d22370438601" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.freeze new file mode 100644 index 00000000000..924555fe305 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-06-05T16:22:36.612Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.json b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.json new file mode 100644 index 00000000000..540b4ed8c62 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.json @@ -0,0 +1,58 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineArrayMapNoPreserve\",\"processors\":[{\"is_enabled\":true,\"name\":\"map and remove source\",\"preserve_source\":false,\"processors\":[{\"sources\":[\"$sourceElem.id\"],\"target\":\"$targetElem.uid\",\"type\":\"attribute-remapper\"}],\"source\":\"items\",\"target\":\"out\",\"type\":\"array-map\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"GyiShl9oRxOexHECB-wa2g\",\"type\":\"pipeline\",\"name\":\"testPipelineArrayMapNoPreserve\",\"is_enabled\":false,\"is_read_only\":false,\"filter\":{\"query\":\"source:python\"},\"processors\":[{\"name\":\"map and remove source\",\"is_enabled\":true,\"source\":\"items\",\"target\":\"out\",\"processors\":[{\"is_enabled\":true,\"sources\":[\"$sourceElem.id\"],\"target\":\"$targetElem.uid\",\"target_type\":\"attribute\",\"preserve_source\":false,\"override_on_conflict\":false,\"type\":\"attribute-remapper\"}],\"preserve_source\":false,\"type\":\"array-map\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "30022234-c022-57ae-7d7a-1543e0b92dbc" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/GyiShl9oRxOexHECB-wa2g", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "aae50bf0-8a04-72af-d35d-2afc97780c24" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_targetElem_as_source_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_targetElem_as_source_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..673c25a0701 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_targetElem_as_source_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2026-06-05T16:23:10.866Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_targetElem_as_source_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_targetElem_as_source_returns_Bad_Request_response.json new file mode 100644 index 00000000000..85e920ee0d7 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_targetElem_as_source_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineArrayMapTargetElemSource\",\"processors\":[{\"is_enabled\":true,\"name\":\"invalid targetElem source\",\"processors\":[{\"sources\":[\"$targetElem.uid\"],\"target\":\"$targetElem.label\",\"type\":\"attribute-remapper\"}],\"source\":\"items\",\"target\":\"out\",\"type\":\"array-map\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid Pipeline\",\"details\":[{\"code\":\"InvalidArgument\",\"message\":\"$targetElem cannot be used as a source, got: $targetElem.uid\"}]}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "821cd151-3f65-e0df-5362-6117f60531b5" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_unsupported_sub_processor_type_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_unsupported_sub_processor_type_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..a4e08c24b31 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_unsupported_sub_processor_type_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2026-06-05T16:22:59.979Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_unsupported_sub_processor_type_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_unsupported_sub_processor_type_returns_Bad_Request_response.json new file mode 100644 index 00000000000..090105fee58 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_unsupported_sub_processor_type_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"filter\":{\"query\":\"source:python\"},\"name\":\"testPipelineArrayMapUnsupported\",\"processors\":[{\"is_enabled\":true,\"name\":\"unsupported sub-processor\",\"processors\":[{\"grok\":{\"match_rules\":\"rule %{word:field}\",\"support_rules\":\"\"},\"source\":\"message\",\"type\":\"grok-parser\"}],\"source\":\"items\",\"target\":\"out\",\"type\":\"array-map\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Unsupported sub-processor type in array-map: grok-parser\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "468ec073-1a7d-ac96-194c-3ca3ef225a8b" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v1/api/logs_pipelines.feature b/src/test/resources/com/datadog/api/client/v1/api/logs_pipelines.feature index 1ab4401b0fd..2624bd25325 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/logs_pipelines.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/logs_pipelines.feature @@ -35,6 +35,55 @@ Feature: Logs Pipelines When the request is sent Then the response status is 200 OK + @team:DataDog/logs-onboarding + Scenario: Create a pipeline with Array Map Processor returns "OK" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMap", "processors": [{"type": "array-map", "is_enabled": true, "name": "map items", "source": "items", "target": "out", "preserve_source": true, "processors": [{"type": "attribute-remapper", "sources": ["$sourceElem.id"], "target": "$targetElem.uid", "preserve_source": true}, {"type": "string-builder-processor", "template": "item-%{$sourceElem.id}", "target": "$targetElem.label"}]}], "tags": []} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/logs-onboarding + Scenario: Create a pipeline with Array Map Processor using arithmetic sub-processor returns "OK" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMapArithmetic", "processors": [{"type": "array-map", "is_enabled": true, "name": "double counts", "source": "items", "target": "out", "processors": [{"type": "arithmetic-processor", "expression": "$sourceElem.count * 2", "target": "$targetElem.doubled"}]}], "tags": []} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/logs-onboarding + Scenario: Create a pipeline with Array Map Processor using category sub-processor returns "OK" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMapCategory", "processors": [{"type": "array-map", "is_enabled": true, "name": "categorize items", "source": "items", "target": "out", "processors": [{"type": "category-processor", "target": "$targetElem.level", "categories": [{"filter": {"query": "@$sourceElem.status:error"}, "name": "error"}, {"filter": {"query": "*"}, "name": "info"}]}]}], "tags": []} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/logs-onboarding + Scenario: Create a pipeline with Array Map Processor with $targetElem as source returns "Bad Request" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMapTargetElemSource", "processors": [{"type": "array-map", "is_enabled": true, "name": "invalid targetElem source", "source": "items", "target": "out", "processors": [{"type": "attribute-remapper", "sources": ["$targetElem.uid"], "target": "$targetElem.label"}]}], "tags": []} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-onboarding + Scenario: Create a pipeline with Array Map Processor with preserve_source false and same source and target returns "Bad Request" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMapInvalid", "processors": [{"type": "array-map", "is_enabled": true, "name": "invalid preserve_source", "source": "items", "target": "items", "preserve_source": false, "processors": [{"type": "attribute-remapper", "sources": ["$sourceElem.id"], "target": "$targetElem.uid"}]}], "tags": []} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-onboarding + Scenario: Create a pipeline with Array Map Processor with preserve_source false returns "OK" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMapNoPreserve", "processors": [{"type": "array-map", "is_enabled": true, "name": "map and remove source", "source": "items", "target": "out", "preserve_source": false, "processors": [{"type": "attribute-remapper", "sources": ["$sourceElem.id"], "target": "$targetElem.uid"}]}], "tags": []} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/logs-onboarding + Scenario: Create a pipeline with Array Map Processor with unsupported sub-processor type returns "Bad Request" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMapUnsupported", "processors": [{"type": "array-map", "is_enabled": true, "name": "unsupported sub-processor", "source": "items", "target": "out", "processors": [{"type": "grok-parser", "source": "message", "grok": {"match_rules": "rule %{word:field}", "support_rules": ""}}]}], "tags": []} + When the request is sent + Then the response status is 400 Bad Request + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Array Processor Append Operation returns "OK" response Given new "CreateLogsPipeline" request