From e140d2130be3ff0d8387e8930e0bd8d61e1b7b56 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 16 Jun 2026 17:56:53 +0000 Subject: [PATCH] Regenerate client from commit 0e0a8fa of spec repo --- .generator/schemas/v1/openapi.yaml | 185 ++++++++ .../CreateLogsPipeline_104735144.java | 54 +++ .../CreateLogsPipeline_1185292896.java | 64 +++ .../CreateLogsPipeline_2402034476.java | 53 +++ .../CreateLogsPipeline_3996915493.java | 65 +++ .../LogsArrayMapArithmeticSubProcessor.java | 266 +++++++++++ .../model/LogsArrayMapAttributeRemapper.java | 341 ++++++++++++++ .../LogsArrayMapCategorySubProcessor.java | 252 ++++++++++ .../v1/model/LogsArrayMapProcessor.java | 341 ++++++++++++++ .../v1/model/LogsArrayMapProcessorType.java | 57 +++ ...LogsArrayMapStringBuilderSubProcessor.java | 268 +++++++++++ .../v1/model/LogsArrayMapSubProcessor.java | 440 ++++++++++++++++++ .../api/client/v1/model/LogsProcessor.java | 75 ++- ...y_Map_Processor_returns_OK_response.freeze | 1 + ...ray_Map_Processor_returns_OK_response.json | 58 +++ ...c_sub_processor_returns_OK_response.freeze | 1 + ...tic_sub_processor_returns_OK_response.json | 58 +++ ...y_sub_processor_returns_OK_response.freeze | 1 + ...ory_sub_processor_returns_OK_response.json | 58 +++ ...ve_source_false_returns_OK_response.freeze | 1 + ...erve_source_false_returns_OK_response.json | 58 +++ .../api/client/v1/api/logs_pipelines.feature | 28 ++ 22 files changed, 2721 insertions(+), 4 deletions(-) create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_104735144.java create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.java create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.java create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_3996915493.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/LogsArrayMapArithmeticSubProcessor.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/LogsArrayMapAttributeRemapper.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/LogsArrayMapCategorySubProcessor.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessor.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessorType.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/LogsArrayMapStringBuilderSubProcessor.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/LogsArrayMapSubProcessor.java create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_arithmetic_sub_processor_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_using_category_sub_processor_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v1/Create_a_pipeline_with_Array_Map_Processor_with_preserve_source_false_returns_OK_response.json diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 1a0f742ff68..dfb47692cb4 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -6182,6 +6182,190 @@ components: type: string x-enum-varnames: - ARITHMETIC_PROCESSOR + LogsArrayMapArithmeticSubProcessor: + description: |- + An arithmetic sub-processor for use inside an array-map processor. + Unlike the top-level arithmetic processor, `is_enabled` is not supported. + properties: + expression: + description: Arithmetic operation to perform. + example: "" + type: string + is_replace_missing: + default: false + description: Replace missing attribute values with 0. + type: boolean + name: + description: Name of the sub-processor. + type: string + target: + description: Target attribute path for the result. + example: "" + type: string + type: + $ref: "#/components/schemas/LogsArithmeticProcessorType" + required: + - expression + - target + - type + type: object + LogsArrayMapAttributeRemapper: + description: |- + An attribute remapper sub-processor for use inside an array-map processor. + Unlike the top-level attribute remapper, `is_enabled`, `source_type`, and + `target_type` are not supported. + properties: + name: + description: Name of the sub-processor. + type: string + override_on_conflict: + default: false + description: Override the target element if already set. + type: boolean + preserve_source: + default: false + description: Remove or preserve the remapped source element. + type: boolean + sources: + description: Array of source attribute paths. + example: + - "" + items: + type: string + type: array + target: + description: Target attribute path. + example: "" + type: string + target_format: + $ref: "#/components/schemas/TargetFormatType" + type: + $ref: "#/components/schemas/LogsAttributeRemapperType" + required: + - sources + - target + - type + type: object + LogsArrayMapCategorySubProcessor: + description: |- + A category sub-processor for use inside an array-map processor. + Unlike the top-level category processor, `is_enabled` is not supported. + properties: + categories: + description: Array of filters to match against a log and the corresponding value to assign. + items: + $ref: "#/components/schemas/LogsCategoryProcessorCategory" + type: array + name: + description: Name of the sub-processor. + type: string + target: + description: Target attribute path for the category value. + example: "" + type: string + type: + $ref: "#/components/schemas/LogsCategoryProcessorType" + required: + - categories + - target + - type + type: object + LogsArrayMapProcessor: + description: |- + The array-map processor transforms each element of a source array by applying + sub-processors in order and collecting the results into a target array. + Results can be written to a new array, to the source array (in-place), or to + an existing target array. Sub-processors can read from `$sourceElem.` + (object element field), bare `$sourceElem` (primitive element), or any parent + log attribute path. Sub-processors write to `$targetElem.` (object + output field) or bare `$targetElem` (primitive output). + 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-processor + description: Type of logs array-map processor. + enum: + - array-map-processor + example: array-map-processor + type: string + x-enum-varnames: + - ARRAY_MAP_PROCESSOR + LogsArrayMapStringBuilderSubProcessor: + description: |- + A string builder sub-processor for use inside an array-map processor. + Unlike the top-level string builder processor, `is_enabled` is not supported. + properties: + is_replace_missing: + default: false + description: Replace missing attribute values with an empty string. + type: boolean + name: + description: Name of the sub-processor. + type: string + target: + description: Target attribute path for the result. + example: "" + type: string + template: + description: Formula with one or more attributes and raw text. + example: "" + type: string + type: + $ref: "#/components/schemas/LogsStringBuilderProcessorType" + required: + - template + - target + - type + type: object + 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/LogsArrayMapAttributeRemapper" + - $ref: "#/components/schemas/LogsArrayMapArithmeticSubProcessor" + - $ref: "#/components/schemas/LogsArrayMapStringBuilderSubProcessor" + - $ref: "#/components/schemas/LogsArrayMapCategorySubProcessor" LogsArrayProcessor: description: |- A processor for extracting, aggregating, or transforming values from JSON arrays within your logs. @@ -7237,6 +7421,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..ac13bbab8e5 --- /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.LogsArrayMapAttributeRemapper; +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.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_PROCESSOR) + .isEnabled(true) + .name("map and remove source") + .source("items") + .target("out") + .preserveSource(false) + .processors( + Collections.singletonList( + new LogsArrayMapSubProcessor( + new LogsArrayMapAttributeRemapper() + .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..b7cb1055178 --- /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.LogsArrayMapCategorySubProcessor; +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.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_PROCESSOR) + .isEnabled(true) + .name("categorize items") + .source("items") + .target("out") + .processors( + Collections.singletonList( + new LogsArrayMapSubProcessor( + new LogsArrayMapCategorySubProcessor() + .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..565208b74a3 --- /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.LogsArithmeticProcessorType; +import com.datadog.api.client.v1.model.LogsArrayMapArithmeticSubProcessor; +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_PROCESSOR) + .isEnabled(true) + .name("double counts") + .source("items") + .target("out") + .processors( + Collections.singletonList( + new LogsArrayMapSubProcessor( + new LogsArrayMapArithmeticSubProcessor() + .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..9f29e6693a0 --- /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.LogsArrayMapAttributeRemapper; +import com.datadog.api.client.v1.model.LogsArrayMapProcessor; +import com.datadog.api.client.v1.model.LogsArrayMapProcessorType; +import com.datadog.api.client.v1.model.LogsArrayMapStringBuilderSubProcessor; +import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor; +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.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_PROCESSOR) + .isEnabled(true) + .name("map items") + .source("items") + .target("out") + .preserveSource(true) + .processors( + Arrays.asList( + new LogsArrayMapSubProcessor( + new LogsArrayMapAttributeRemapper() + .type(LogsAttributeRemapperType.ATTRIBUTE_REMAPPER) + .sources(Collections.singletonList("$sourceElem.id")) + .target("$targetElem.uid") + .preserveSource(true)), + new LogsArrayMapSubProcessor( + new LogsArrayMapStringBuilderSubProcessor() + .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/LogsArrayMapArithmeticSubProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapArithmeticSubProcessor.java new file mode 100644 index 00000000000..d9c28ee7cf1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapArithmeticSubProcessor.java @@ -0,0 +1,266 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * An arithmetic sub-processor for use inside an array-map processor. Unlike the top-level + * arithmetic processor, is_enabled is not supported. + */ +@JsonPropertyOrder({ + LogsArrayMapArithmeticSubProcessor.JSON_PROPERTY_EXPRESSION, + LogsArrayMapArithmeticSubProcessor.JSON_PROPERTY_IS_REPLACE_MISSING, + LogsArrayMapArithmeticSubProcessor.JSON_PROPERTY_NAME, + LogsArrayMapArithmeticSubProcessor.JSON_PROPERTY_TARGET, + LogsArrayMapArithmeticSubProcessor.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LogsArrayMapArithmeticSubProcessor { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXPRESSION = "expression"; + private String expression; + + public static final String JSON_PROPERTY_IS_REPLACE_MISSING = "is_replace_missing"; + private Boolean isReplaceMissing = false; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TARGET = "target"; + private String target; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsArithmeticProcessorType type = LogsArithmeticProcessorType.ARITHMETIC_PROCESSOR; + + public LogsArrayMapArithmeticSubProcessor() {} + + @JsonCreator + public LogsArrayMapArithmeticSubProcessor( + @JsonProperty(required = true, value = JSON_PROPERTY_EXPRESSION) String expression, + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) String target, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LogsArithmeticProcessorType type) { + this.expression = expression; + this.target = target; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LogsArrayMapArithmeticSubProcessor expression(String expression) { + this.expression = expression; + return this; + } + + /** + * Arithmetic operation to perform. + * + * @return expression + */ + @JsonProperty(JSON_PROPERTY_EXPRESSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getExpression() { + return expression; + } + + public void setExpression(String expression) { + this.expression = expression; + } + + public LogsArrayMapArithmeticSubProcessor isReplaceMissing(Boolean isReplaceMissing) { + this.isReplaceMissing = isReplaceMissing; + return this; + } + + /** + * Replace missing attribute values with 0. + * + * @return isReplaceMissing + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_REPLACE_MISSING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsReplaceMissing() { + return isReplaceMissing; + } + + public void setIsReplaceMissing(Boolean isReplaceMissing) { + this.isReplaceMissing = isReplaceMissing; + } + + public LogsArrayMapArithmeticSubProcessor name(String name) { + this.name = name; + return this; + } + + /** + * Name of the sub-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 LogsArrayMapArithmeticSubProcessor target(String target) { + this.target = target; + return this; + } + + /** + * Target attribute path for the result. + * + * @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 LogsArrayMapArithmeticSubProcessor type(LogsArithmeticProcessorType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of logs arithmetic processor. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LogsArithmeticProcessorType getType() { + return type; + } + + public void setType(LogsArithmeticProcessorType 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 LogsArrayMapArithmeticSubProcessor + */ + @JsonAnySetter + public LogsArrayMapArithmeticSubProcessor 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 LogsArrayMapArithmeticSubProcessor object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LogsArrayMapArithmeticSubProcessor logsArrayMapArithmeticSubProcessor = + (LogsArrayMapArithmeticSubProcessor) o; + return Objects.equals(this.expression, logsArrayMapArithmeticSubProcessor.expression) + && Objects.equals( + this.isReplaceMissing, logsArrayMapArithmeticSubProcessor.isReplaceMissing) + && Objects.equals(this.name, logsArrayMapArithmeticSubProcessor.name) + && Objects.equals(this.target, logsArrayMapArithmeticSubProcessor.target) + && Objects.equals(this.type, logsArrayMapArithmeticSubProcessor.type) + && Objects.equals( + this.additionalProperties, logsArrayMapArithmeticSubProcessor.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(expression, isReplaceMissing, name, target, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LogsArrayMapArithmeticSubProcessor {\n"); + sb.append(" expression: ").append(toIndentedString(expression)).append("\n"); + sb.append(" isReplaceMissing: ").append(toIndentedString(isReplaceMissing)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/LogsArrayMapAttributeRemapper.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapAttributeRemapper.java new file mode 100644 index 00000000000..4f0845cebc2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapAttributeRemapper.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; + +/** + * An attribute remapper sub-processor for use inside an array-map processor. Unlike the top-level + * attribute remapper, is_enabled, source_type, and target_type + * are not supported. + */ +@JsonPropertyOrder({ + LogsArrayMapAttributeRemapper.JSON_PROPERTY_NAME, + LogsArrayMapAttributeRemapper.JSON_PROPERTY_OVERRIDE_ON_CONFLICT, + LogsArrayMapAttributeRemapper.JSON_PROPERTY_PRESERVE_SOURCE, + LogsArrayMapAttributeRemapper.JSON_PROPERTY_SOURCES, + LogsArrayMapAttributeRemapper.JSON_PROPERTY_TARGET, + LogsArrayMapAttributeRemapper.JSON_PROPERTY_TARGET_FORMAT, + LogsArrayMapAttributeRemapper.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LogsArrayMapAttributeRemapper { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OVERRIDE_ON_CONFLICT = "override_on_conflict"; + private Boolean overrideOnConflict = false; + + public static final String JSON_PROPERTY_PRESERVE_SOURCE = "preserve_source"; + private Boolean preserveSource = false; + + public static final String JSON_PROPERTY_SOURCES = "sources"; + private List sources = new ArrayList<>(); + + public static final String JSON_PROPERTY_TARGET = "target"; + private String target; + + public static final String JSON_PROPERTY_TARGET_FORMAT = "target_format"; + private TargetFormatType targetFormat; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsAttributeRemapperType type = LogsAttributeRemapperType.ATTRIBUTE_REMAPPER; + + public LogsArrayMapAttributeRemapper() {} + + @JsonCreator + public LogsArrayMapAttributeRemapper( + @JsonProperty(required = true, value = JSON_PROPERTY_SOURCES) List sources, + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) String target, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LogsAttributeRemapperType type) { + this.sources = sources; + this.target = target; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LogsArrayMapAttributeRemapper name(String name) { + this.name = name; + return this; + } + + /** + * Name of the sub-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 LogsArrayMapAttributeRemapper overrideOnConflict(Boolean overrideOnConflict) { + this.overrideOnConflict = overrideOnConflict; + return this; + } + + /** + * Override the target element if already set. + * + * @return overrideOnConflict + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OVERRIDE_ON_CONFLICT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getOverrideOnConflict() { + return overrideOnConflict; + } + + public void setOverrideOnConflict(Boolean overrideOnConflict) { + this.overrideOnConflict = overrideOnConflict; + } + + public LogsArrayMapAttributeRemapper preserveSource(Boolean preserveSource) { + this.preserveSource = preserveSource; + return this; + } + + /** + * Remove or preserve the remapped source element. + * + * @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 LogsArrayMapAttributeRemapper sources(List sources) { + this.sources = sources; + return this; + } + + public LogsArrayMapAttributeRemapper addSourcesItem(String sourcesItem) { + this.sources.add(sourcesItem); + return this; + } + + /** + * Array of source attribute paths. + * + * @return sources + */ + @JsonProperty(JSON_PROPERTY_SOURCES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getSources() { + return sources; + } + + public void setSources(List sources) { + this.sources = sources; + } + + public LogsArrayMapAttributeRemapper target(String target) { + this.target = target; + return this; + } + + /** + * Target attribute path. + * + * @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 LogsArrayMapAttributeRemapper targetFormat(TargetFormatType targetFormat) { + this.targetFormat = targetFormat; + this.unparsed |= !targetFormat.isValid(); + return this; + } + + /** + * If the target_type of the remapper is attribute, try to cast the + * value to a new specific type. If the cast is not possible, the original type is kept. + * string, integer, or double are the possible types. If the + * target_type is tag, this parameter may not be specified. + * + * @return targetFormat + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TARGET_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TargetFormatType getTargetFormat() { + return targetFormat; + } + + public void setTargetFormat(TargetFormatType targetFormat) { + if (!targetFormat.isValid()) { + this.unparsed = true; + } + this.targetFormat = targetFormat; + } + + public LogsArrayMapAttributeRemapper type(LogsAttributeRemapperType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of logs attribute remapper. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LogsAttributeRemapperType getType() { + return type; + } + + public void setType(LogsAttributeRemapperType 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 LogsArrayMapAttributeRemapper + */ + @JsonAnySetter + public LogsArrayMapAttributeRemapper 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 LogsArrayMapAttributeRemapper object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LogsArrayMapAttributeRemapper logsArrayMapAttributeRemapper = (LogsArrayMapAttributeRemapper) o; + return Objects.equals(this.name, logsArrayMapAttributeRemapper.name) + && Objects.equals(this.overrideOnConflict, logsArrayMapAttributeRemapper.overrideOnConflict) + && Objects.equals(this.preserveSource, logsArrayMapAttributeRemapper.preserveSource) + && Objects.equals(this.sources, logsArrayMapAttributeRemapper.sources) + && Objects.equals(this.target, logsArrayMapAttributeRemapper.target) + && Objects.equals(this.targetFormat, logsArrayMapAttributeRemapper.targetFormat) + && Objects.equals(this.type, logsArrayMapAttributeRemapper.type) + && Objects.equals( + this.additionalProperties, logsArrayMapAttributeRemapper.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + overrideOnConflict, + preserveSource, + sources, + target, + targetFormat, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LogsArrayMapAttributeRemapper {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" overrideOnConflict: ").append(toIndentedString(overrideOnConflict)).append("\n"); + sb.append(" preserveSource: ").append(toIndentedString(preserveSource)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" targetFormat: ").append(toIndentedString(targetFormat)).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/LogsArrayMapCategorySubProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapCategorySubProcessor.java new file mode 100644 index 00000000000..ef8f9f27de0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapCategorySubProcessor.java @@ -0,0 +1,252 @@ +/* + * 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; + +/** + * A category sub-processor for use inside an array-map processor. Unlike the top-level category + * processor, is_enabled is not supported. + */ +@JsonPropertyOrder({ + LogsArrayMapCategorySubProcessor.JSON_PROPERTY_CATEGORIES, + LogsArrayMapCategorySubProcessor.JSON_PROPERTY_NAME, + LogsArrayMapCategorySubProcessor.JSON_PROPERTY_TARGET, + LogsArrayMapCategorySubProcessor.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LogsArrayMapCategorySubProcessor { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORIES = "categories"; + private List categories = new ArrayList<>(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TARGET = "target"; + private String target; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsCategoryProcessorType type = LogsCategoryProcessorType.CATEGORY_PROCESSOR; + + public LogsArrayMapCategorySubProcessor() {} + + @JsonCreator + public LogsArrayMapCategorySubProcessor( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORIES) + List categories, + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) String target, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LogsCategoryProcessorType type) { + this.categories = categories; + this.target = target; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LogsArrayMapCategorySubProcessor categories( + List categories) { + this.categories = categories; + for (LogsCategoryProcessorCategory item : categories) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LogsArrayMapCategorySubProcessor addCategoriesItem( + LogsCategoryProcessorCategory categoriesItem) { + this.categories.add(categoriesItem); + this.unparsed |= categoriesItem.unparsed; + return this; + } + + /** + * Array of filters to match against a log and the corresponding value to assign. + * + * @return categories + */ + @JsonProperty(JSON_PROPERTY_CATEGORIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getCategories() { + return categories; + } + + public void setCategories(List categories) { + this.categories = categories; + } + + public LogsArrayMapCategorySubProcessor name(String name) { + this.name = name; + return this; + } + + /** + * Name of the sub-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 LogsArrayMapCategorySubProcessor target(String target) { + this.target = target; + return this; + } + + /** + * Target attribute path for the category value. + * + * @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 LogsArrayMapCategorySubProcessor type(LogsCategoryProcessorType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of logs category processor. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LogsCategoryProcessorType getType() { + return type; + } + + public void setType(LogsCategoryProcessorType 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 LogsArrayMapCategorySubProcessor + */ + @JsonAnySetter + public LogsArrayMapCategorySubProcessor 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 LogsArrayMapCategorySubProcessor object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LogsArrayMapCategorySubProcessor logsArrayMapCategorySubProcessor = + (LogsArrayMapCategorySubProcessor) o; + return Objects.equals(this.categories, logsArrayMapCategorySubProcessor.categories) + && Objects.equals(this.name, logsArrayMapCategorySubProcessor.name) + && Objects.equals(this.target, logsArrayMapCategorySubProcessor.target) + && Objects.equals(this.type, logsArrayMapCategorySubProcessor.type) + && Objects.equals( + this.additionalProperties, logsArrayMapCategorySubProcessor.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(categories, name, target, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LogsArrayMapCategorySubProcessor {\n"); + sb.append(" categories: ").append(toIndentedString(categories)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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/LogsArrayMapProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessor.java new file mode 100644 index 00000000000..ea8cea24d30 --- /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 applying sub-processors in + * order and collecting the results into a target array. Results can be written to a new array, to + * the source array (in-place), or to an existing target array. Sub-processors can read from + * $sourceElem.<field> (object element field), bare $sourceElem (primitive + * element), or any parent log attribute path. Sub-processors write to + * $targetElem.<field> (object output field) or bare $targetElem + * (primitive output). + */ +@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_PROCESSOR; + + 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..761826c5fbe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapProcessorType.java @@ -0,0 +1,57 @@ +/* + * 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-processor")); + + public static final LogsArrayMapProcessorType ARRAY_MAP_PROCESSOR = + new LogsArrayMapProcessorType("array-map-processor"); + + 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/LogsArrayMapStringBuilderSubProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapStringBuilderSubProcessor.java new file mode 100644 index 00000000000..2a4b636c03e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapStringBuilderSubProcessor.java @@ -0,0 +1,268 @@ +/* + * 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.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * A string builder sub-processor for use inside an array-map processor. Unlike the top-level string + * builder processor, is_enabled is not supported. + */ +@JsonPropertyOrder({ + LogsArrayMapStringBuilderSubProcessor.JSON_PROPERTY_IS_REPLACE_MISSING, + LogsArrayMapStringBuilderSubProcessor.JSON_PROPERTY_NAME, + LogsArrayMapStringBuilderSubProcessor.JSON_PROPERTY_TARGET, + LogsArrayMapStringBuilderSubProcessor.JSON_PROPERTY_TEMPLATE, + LogsArrayMapStringBuilderSubProcessor.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LogsArrayMapStringBuilderSubProcessor { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IS_REPLACE_MISSING = "is_replace_missing"; + private Boolean isReplaceMissing = false; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TARGET = "target"; + private String target; + + public static final String JSON_PROPERTY_TEMPLATE = "template"; + private String template; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LogsStringBuilderProcessorType type = + LogsStringBuilderProcessorType.STRING_BUILDER_PROCESSOR; + + public LogsArrayMapStringBuilderSubProcessor() {} + + @JsonCreator + public LogsArrayMapStringBuilderSubProcessor( + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) String target, + @JsonProperty(required = true, value = JSON_PROPERTY_TEMPLATE) String template, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + LogsStringBuilderProcessorType type) { + this.target = target; + this.template = template; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LogsArrayMapStringBuilderSubProcessor isReplaceMissing(Boolean isReplaceMissing) { + this.isReplaceMissing = isReplaceMissing; + return this; + } + + /** + * Replace missing attribute values with an empty string. + * + * @return isReplaceMissing + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IS_REPLACE_MISSING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIsReplaceMissing() { + return isReplaceMissing; + } + + public void setIsReplaceMissing(Boolean isReplaceMissing) { + this.isReplaceMissing = isReplaceMissing; + } + + public LogsArrayMapStringBuilderSubProcessor name(String name) { + this.name = name; + return this; + } + + /** + * Name of the sub-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 LogsArrayMapStringBuilderSubProcessor target(String target) { + this.target = target; + return this; + } + + /** + * Target attribute path for the result. + * + * @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 LogsArrayMapStringBuilderSubProcessor template(String template) { + this.template = template; + return this; + } + + /** + * Formula with one or more attributes and raw text. + * + * @return template + */ + @JsonProperty(JSON_PROPERTY_TEMPLATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTemplate() { + return template; + } + + public void setTemplate(String template) { + this.template = template; + } + + public LogsArrayMapStringBuilderSubProcessor type(LogsStringBuilderProcessorType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of logs string builder processor. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LogsStringBuilderProcessorType getType() { + return type; + } + + public void setType(LogsStringBuilderProcessorType 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 LogsArrayMapStringBuilderSubProcessor + */ + @JsonAnySetter + public LogsArrayMapStringBuilderSubProcessor 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 LogsArrayMapStringBuilderSubProcessor object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LogsArrayMapStringBuilderSubProcessor logsArrayMapStringBuilderSubProcessor = + (LogsArrayMapStringBuilderSubProcessor) o; + return Objects.equals( + this.isReplaceMissing, logsArrayMapStringBuilderSubProcessor.isReplaceMissing) + && Objects.equals(this.name, logsArrayMapStringBuilderSubProcessor.name) + && Objects.equals(this.target, logsArrayMapStringBuilderSubProcessor.target) + && Objects.equals(this.template, logsArrayMapStringBuilderSubProcessor.template) + && Objects.equals(this.type, logsArrayMapStringBuilderSubProcessor.type) + && Objects.equals( + this.additionalProperties, logsArrayMapStringBuilderSubProcessor.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isReplaceMissing, name, target, template, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LogsArrayMapStringBuilderSubProcessor {\n"); + sb.append(" isReplaceMissing: ").append(toIndentedString(isReplaceMissing)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" template: ").append(toIndentedString(template)).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/LogsArrayMapSubProcessor.java b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapSubProcessor.java new file mode 100644 index 00000000000..c1b3191f703 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/LogsArrayMapSubProcessor.java @@ -0,0 +1,440 @@ +/* + * 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 LogsArrayMapAttributeRemapper + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsArrayMapAttributeRemapper.class.equals(Integer.class) + || LogsArrayMapAttributeRemapper.class.equals(Long.class) + || LogsArrayMapAttributeRemapper.class.equals(Float.class) + || LogsArrayMapAttributeRemapper.class.equals(Double.class) + || LogsArrayMapAttributeRemapper.class.equals(Boolean.class) + || LogsArrayMapAttributeRemapper.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsArrayMapAttributeRemapper.class.equals(Integer.class) + || LogsArrayMapAttributeRemapper.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsArrayMapAttributeRemapper.class.equals(Float.class) + || LogsArrayMapAttributeRemapper.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsArrayMapAttributeRemapper.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsArrayMapAttributeRemapper.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsArrayMapAttributeRemapper.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 (!((LogsArrayMapAttributeRemapper) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsArrayMapAttributeRemapper'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LogsArrayMapAttributeRemapper'", e); + } + + // deserialize LogsArrayMapArithmeticSubProcessor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsArrayMapArithmeticSubProcessor.class.equals(Integer.class) + || LogsArrayMapArithmeticSubProcessor.class.equals(Long.class) + || LogsArrayMapArithmeticSubProcessor.class.equals(Float.class) + || LogsArrayMapArithmeticSubProcessor.class.equals(Double.class) + || LogsArrayMapArithmeticSubProcessor.class.equals(Boolean.class) + || LogsArrayMapArithmeticSubProcessor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsArrayMapArithmeticSubProcessor.class.equals(Integer.class) + || LogsArrayMapArithmeticSubProcessor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsArrayMapArithmeticSubProcessor.class.equals(Float.class) + || LogsArrayMapArithmeticSubProcessor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsArrayMapArithmeticSubProcessor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsArrayMapArithmeticSubProcessor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsArrayMapArithmeticSubProcessor.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 (!((LogsArrayMapArithmeticSubProcessor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsArrayMapArithmeticSubProcessor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'LogsArrayMapArithmeticSubProcessor'", + e); + } + + // deserialize LogsArrayMapStringBuilderSubProcessor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsArrayMapStringBuilderSubProcessor.class.equals(Integer.class) + || LogsArrayMapStringBuilderSubProcessor.class.equals(Long.class) + || LogsArrayMapStringBuilderSubProcessor.class.equals(Float.class) + || LogsArrayMapStringBuilderSubProcessor.class.equals(Double.class) + || LogsArrayMapStringBuilderSubProcessor.class.equals(Boolean.class) + || LogsArrayMapStringBuilderSubProcessor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsArrayMapStringBuilderSubProcessor.class.equals(Integer.class) + || LogsArrayMapStringBuilderSubProcessor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsArrayMapStringBuilderSubProcessor.class.equals(Float.class) + || LogsArrayMapStringBuilderSubProcessor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsArrayMapStringBuilderSubProcessor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsArrayMapStringBuilderSubProcessor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()).readValueAs(LogsArrayMapStringBuilderSubProcessor.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 (!((LogsArrayMapStringBuilderSubProcessor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsArrayMapStringBuilderSubProcessor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'LogsArrayMapStringBuilderSubProcessor'", + e); + } + + // deserialize LogsArrayMapCategorySubProcessor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LogsArrayMapCategorySubProcessor.class.equals(Integer.class) + || LogsArrayMapCategorySubProcessor.class.equals(Long.class) + || LogsArrayMapCategorySubProcessor.class.equals(Float.class) + || LogsArrayMapCategorySubProcessor.class.equals(Double.class) + || LogsArrayMapCategorySubProcessor.class.equals(Boolean.class) + || LogsArrayMapCategorySubProcessor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LogsArrayMapCategorySubProcessor.class.equals(Integer.class) + || LogsArrayMapCategorySubProcessor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LogsArrayMapCategorySubProcessor.class.equals(Float.class) + || LogsArrayMapCategorySubProcessor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LogsArrayMapCategorySubProcessor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LogsArrayMapCategorySubProcessor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LogsArrayMapCategorySubProcessor.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 (!((LogsArrayMapCategorySubProcessor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LogsArrayMapCategorySubProcessor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'LogsArrayMapCategorySubProcessor'", 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(LogsArrayMapAttributeRemapper o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public LogsArrayMapSubProcessor(LogsArrayMapArithmeticSubProcessor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public LogsArrayMapSubProcessor(LogsArrayMapStringBuilderSubProcessor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public LogsArrayMapSubProcessor(LogsArrayMapCategorySubProcessor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "LogsArrayMapAttributeRemapper", new GenericType() {}); + schemas.put( + "LogsArrayMapArithmeticSubProcessor", + new GenericType() {}); + schemas.put( + "LogsArrayMapStringBuilderSubProcessor", + new GenericType() {}); + schemas.put( + "LogsArrayMapCategorySubProcessor", 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: LogsArrayMapAttributeRemapper, + * LogsArrayMapArithmeticSubProcessor, LogsArrayMapStringBuilderSubProcessor, + * LogsArrayMapCategorySubProcessor + * + *

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(LogsArrayMapAttributeRemapper.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + LogsArrayMapArithmeticSubProcessor.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + LogsArrayMapStringBuilderSubProcessor.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + LogsArrayMapCategorySubProcessor.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 LogsArrayMapAttributeRemapper," + + " LogsArrayMapArithmeticSubProcessor, LogsArrayMapStringBuilderSubProcessor," + + " LogsArrayMapCategorySubProcessor"); + } + + /** + * Get the actual instance, which can be the following: LogsArrayMapAttributeRemapper, + * LogsArrayMapArithmeticSubProcessor, LogsArrayMapStringBuilderSubProcessor, + * LogsArrayMapCategorySubProcessor + * + * @return The actual instance (LogsArrayMapAttributeRemapper, LogsArrayMapArithmeticSubProcessor, + * LogsArrayMapStringBuilderSubProcessor, LogsArrayMapCategorySubProcessor) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsArrayMapAttributeRemapper`. If the actual instance is not + * `LogsArrayMapAttributeRemapper`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsArrayMapAttributeRemapper` + * @throws ClassCastException if the instance is not `LogsArrayMapAttributeRemapper` + */ + public LogsArrayMapAttributeRemapper getLogsArrayMapAttributeRemapper() + throws ClassCastException { + return (LogsArrayMapAttributeRemapper) super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsArrayMapArithmeticSubProcessor`. If the actual instance is not + * `LogsArrayMapArithmeticSubProcessor`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsArrayMapArithmeticSubProcessor` + * @throws ClassCastException if the instance is not `LogsArrayMapArithmeticSubProcessor` + */ + public LogsArrayMapArithmeticSubProcessor getLogsArrayMapArithmeticSubProcessor() + throws ClassCastException { + return (LogsArrayMapArithmeticSubProcessor) super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsArrayMapStringBuilderSubProcessor`. If the actual instance is + * not `LogsArrayMapStringBuilderSubProcessor`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsArrayMapStringBuilderSubProcessor` + * @throws ClassCastException if the instance is not `LogsArrayMapStringBuilderSubProcessor` + */ + public LogsArrayMapStringBuilderSubProcessor getLogsArrayMapStringBuilderSubProcessor() + throws ClassCastException { + return (LogsArrayMapStringBuilderSubProcessor) super.getActualInstance(); + } + + /** + * Get the actual instance of `LogsArrayMapCategorySubProcessor`. If the actual instance is not + * `LogsArrayMapCategorySubProcessor`, the ClassCastException will be thrown. + * + * @return The actual instance of `LogsArrayMapCategorySubProcessor` + * @throws ClassCastException if the instance is not `LogsArrayMapCategorySubProcessor` + */ + public LogsArrayMapCategorySubProcessor getLogsArrayMapCategorySubProcessor() + throws ClassCastException { + return (LogsArrayMapCategorySubProcessor) 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..4919e2c81ab --- /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-11T11:21:14.898Z \ 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..1918f4223d2 --- /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-processor\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"hZIWv906QoyQIWpVKqb6pw\",\"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-processor\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4ca93b61-45a0-4b6d-de4c-1f4e0cac5b66" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/hZIWv906QoyQIWpVKqb6pw", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2b141bcd-4dd0-431a-6e10-528df1d56782" + } +] \ 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..ff1b67db842 --- /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-11T11:21:29.886Z \ 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..679f68c7cf2 --- /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-processor\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"oqjvoc0pSh6ZgjsHgiDQCg\",\"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-processor\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5b92624f-b8ed-c712-d3f5-ec45a299c051" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/oqjvoc0pSh6ZgjsHgiDQCg", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "924a877d-4ed7-781a-bbf6-a846ef1d0f51" + } +] \ 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..44f040139a0 --- /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-11T11:21:45.245Z \ 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..af910245a6c --- /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-processor\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"m9rsoJZvRyekemX5ED_r9g\",\"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-processor\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f1b388c4-7ff7-a675-4b4a-245be0bc7b8f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/m9rsoJZvRyekemX5ED_r9g", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "29554513-f97a-609d-4b36-c7bbc6f0f042" + } +] \ 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..fa046304a13 --- /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-11T11:22:14.718Z \ 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..55800c7b1e1 --- /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-processor\"}],\"tags\":[]}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v1/logs/config/pipelines", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"id\":\"ltWiUpfFRCaNE9L65g2VvQ\",\"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-processor\"}],\"tags\":[]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b72fdb61-bb65-53f9-3cdb-9a48060cae20" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v1/logs/config/pipelines/ltWiUpfFRCaNE9L65g2VvQ", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "0bd739a4-e269-0a3f-5e39-572a6ab5355c" + } +] \ 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..ac28f052615 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,34 @@ 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-processor", "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-processor", "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-processor", "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 preserve_source false returns "OK" response + Given new "CreateLogsPipeline" request + And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayMapNoPreserve", "processors": [{"type": "array-map-processor", "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 Processor Append Operation returns "OK" response Given new "CreateLogsPipeline" request