From bc6ebe9280cc4ed8ef881d219acfdf5c448b5393 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 16 Jun 2026 17:53:49 +0000 Subject: [PATCH] Regenerate client from commit 0e0a8fa of spec repo --- .generator/schemas/v1/openapi.yaml | 185 ++++++++++++++ ...y-Map-Processor-returns-OK-response.frozen | 1 + ...rray-Map-Processor-returns-OK-response.yml | 48 ++++ ...c-sub-processor-returns-OK-response.frozen | 1 + ...etic-sub-processor-returns-OK-response.yml | 49 ++++ ...y-sub-processor-returns-OK-response.frozen | 1 + ...gory-sub-processor-returns-OK-response.yml | 48 ++++ ...ve-source-false-returns-OK-response.frozen | 1 + ...serve-source-false-returns-OK-response.yml | 48 ++++ .../CreateLogsPipeline_104735144.rb | 32 +++ .../CreateLogsPipeline_1185292896.rb | 42 ++++ .../CreateLogsPipeline_2402034476.rb | 29 +++ .../CreateLogsPipeline_3996915493.rb | 38 +++ features/v1/logs_pipelines.feature | 28 +++ lib/datadog_api_client/inflector.rb | 7 + ...logs_array_map_arithmetic_sub_processor.rb | 186 ++++++++++++++ .../logs_array_map_attribute_remapper.rb | 211 ++++++++++++++++ .../logs_array_map_category_sub_processor.rb | 178 ++++++++++++++ .../v1/models/logs_array_map_processor.rb | 228 ++++++++++++++++++ .../models/logs_array_map_processor_type.rb | 26 ++ ..._array_map_string_builder_sub_processor.rb | 186 ++++++++++++++ .../v1/models/logs_array_map_sub_processor.rb | 67 +++++ .../v1/models/logs_processor.rb | 3 +- 23 files changed, 1642 insertions(+), 1 deletion(-) create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.frozen create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.yml create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.frozen create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.yml create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.frozen create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.yml create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.frozen create mode 100644 cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.yml create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_104735144.rb create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.rb create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.rb create mode 100644 examples/v1/logs-pipelines/CreateLogsPipeline_3996915493.rb create mode 100644 lib/datadog_api_client/v1/models/logs_array_map_arithmetic_sub_processor.rb create mode 100644 lib/datadog_api_client/v1/models/logs_array_map_attribute_remapper.rb create mode 100644 lib/datadog_api_client/v1/models/logs_array_map_category_sub_processor.rb create mode 100644 lib/datadog_api_client/v1/models/logs_array_map_processor.rb create mode 100644 lib/datadog_api_client/v1/models/logs_array_map_processor_type.rb create mode 100644 lib/datadog_api_client/v1/models/logs_array_map_string_builder_sub_processor.rb create mode 100644 lib/datadog_api_client/v1/models/logs_array_map_sub_processor.rb diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 1a0f742ff687..dfb47692cb4c 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/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.frozen b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.frozen new file mode 100644 index 000000000000..4919e2c81ab6 --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-11T11:21:14.898Z \ No newline at end of file diff --git a/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.yml b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.yml new file mode 100644 index 000000000000..8f15230ee020 --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-returns-OK-response.yml @@ -0,0 +1,48 @@ +http_interactions: +- recorded_at: Thu, 11 Jun 2026 11:21:14 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines + response: + body: + encoding: UTF-8 + string: '{"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":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 11 Jun 2026 11:21:14 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines/hZIWv906QoyQIWpVKqb6pw + response: + body: + encoding: UTF-8 + string: '{} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.frozen b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.frozen new file mode 100644 index 000000000000..ff1b67db842f --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-11T11:21:29.886Z \ No newline at end of file diff --git a/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.yml b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.yml new file mode 100644 index 000000000000..4cf38b6fa1b0 --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-arithmetic-sub-processor-returns-OK-response.yml @@ -0,0 +1,49 @@ +http_interactions: +- recorded_at: Thu, 11 Jun 2026 11:21:29 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines + response: + body: + encoding: UTF-8 + string: '{"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":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 11 Jun 2026 11:21:29 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines/oqjvoc0pSh6ZgjsHgiDQCg + response: + body: + encoding: UTF-8 + string: '{} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.frozen b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.frozen new file mode 100644 index 000000000000..44f040139a0c --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-11T11:21:45.245Z \ No newline at end of file diff --git a/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.yml b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.yml new file mode 100644 index 000000000000..1b8c68e757e1 --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-using-category-sub-processor-returns-OK-response.yml @@ -0,0 +1,48 @@ +http_interactions: +- recorded_at: Thu, 11 Jun 2026 11:21:45 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines + response: + body: + encoding: UTF-8 + string: '{"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":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 11 Jun 2026 11:21:45 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines/m9rsoJZvRyekemX5ED_r9g + response: + body: + encoding: UTF-8 + string: '{} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.frozen b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.frozen new file mode 100644 index 000000000000..fa046304a137 --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-11T11:22:14.718Z \ No newline at end of file diff --git a/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.yml b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.yml new file mode 100644 index 000000000000..b7850e10cab6 --- /dev/null +++ b/cassettes/features/v1/logs_pipelines/Create-a-pipeline-with-Array-Map-Processor-with-preserve-source-false-returns-OK-response.yml @@ -0,0 +1,48 @@ +http_interactions: +- recorded_at: Thu, 11 Jun 2026 11:22:14 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines + response: + body: + encoding: UTF-8 + string: '{"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":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 11 Jun 2026 11:22:14 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v1/logs/config/pipelines/ltWiUpfFRCaNE9L65g2VvQ + response: + body: + encoding: UTF-8 + string: '{} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/logs-pipelines/CreateLogsPipeline_104735144.rb b/examples/v1/logs-pipelines/CreateLogsPipeline_104735144.rb new file mode 100644 index 000000000000..7e0ca6cabaf0 --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_104735144.rb @@ -0,0 +1,32 @@ +# Create a pipeline with Array Map Processor with preserve_source false returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::LogsPipelinesAPI.new + +body = DatadogAPIClient::V1::LogsPipeline.new({ + filter: DatadogAPIClient::V1::LogsFilter.new({ + query: "source:python", + }), + name: "testPipelineArrayMapNoPreserve", + processors: [ + DatadogAPIClient::V1::LogsArrayMapProcessor.new({ + type: DatadogAPIClient::V1::LogsArrayMapProcessorType::ARRAY_MAP_PROCESSOR, + is_enabled: true, + name: "map and remove source", + source: "items", + target: "out", + preserve_source: false, + processors: [ + DatadogAPIClient::V1::LogsArrayMapAttributeRemapper.new({ + type: DatadogAPIClient::V1::LogsAttributeRemapperType::ATTRIBUTE_REMAPPER, + sources: [ + "$sourceElem.id", + ], + target: "$targetElem.uid", + }), + ], + }), + ], + tags: [], +}) +p api_instance.create_logs_pipeline(body) diff --git a/examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.rb b/examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.rb new file mode 100644 index 000000000000..bf1526aaa6d2 --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.rb @@ -0,0 +1,42 @@ +# Create a pipeline with Array Map Processor using category sub-processor returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::LogsPipelinesAPI.new + +body = DatadogAPIClient::V1::LogsPipeline.new({ + filter: DatadogAPIClient::V1::LogsFilter.new({ + query: "source:python", + }), + name: "testPipelineArrayMapCategory", + processors: [ + DatadogAPIClient::V1::LogsArrayMapProcessor.new({ + type: DatadogAPIClient::V1::LogsArrayMapProcessorType::ARRAY_MAP_PROCESSOR, + is_enabled: true, + name: "categorize items", + source: "items", + target: "out", + processors: [ + DatadogAPIClient::V1::LogsArrayMapCategorySubProcessor.new({ + type: DatadogAPIClient::V1::LogsCategoryProcessorType::CATEGORY_PROCESSOR, + target: "$targetElem.level", + categories: [ + DatadogAPIClient::V1::LogsCategoryProcessorCategory.new({ + filter: DatadogAPIClient::V1::LogsFilter.new({ + query: "@$sourceElem.status:error", + }), + name: "error", + }), + DatadogAPIClient::V1::LogsCategoryProcessorCategory.new({ + filter: DatadogAPIClient::V1::LogsFilter.new({ + query: "*", + }), + name: "info", + }), + ], + }), + ], + }), + ], + tags: [], +}) +p api_instance.create_logs_pipeline(body) diff --git a/examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.rb b/examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.rb new file mode 100644 index 000000000000..b62bd4eba7d9 --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.rb @@ -0,0 +1,29 @@ +# Create a pipeline with Array Map Processor using arithmetic sub-processor returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::LogsPipelinesAPI.new + +body = DatadogAPIClient::V1::LogsPipeline.new({ + filter: DatadogAPIClient::V1::LogsFilter.new({ + query: "source:python", + }), + name: "testPipelineArrayMapArithmetic", + processors: [ + DatadogAPIClient::V1::LogsArrayMapProcessor.new({ + type: DatadogAPIClient::V1::LogsArrayMapProcessorType::ARRAY_MAP_PROCESSOR, + is_enabled: true, + name: "double counts", + source: "items", + target: "out", + processors: [ + DatadogAPIClient::V1::LogsArrayMapArithmeticSubProcessor.new({ + type: DatadogAPIClient::V1::LogsArithmeticProcessorType::ARITHMETIC_PROCESSOR, + expression: "$sourceElem.count * 2", + target: "$targetElem.doubled", + }), + ], + }), + ], + tags: [], +}) +p api_instance.create_logs_pipeline(body) diff --git a/examples/v1/logs-pipelines/CreateLogsPipeline_3996915493.rb b/examples/v1/logs-pipelines/CreateLogsPipeline_3996915493.rb new file mode 100644 index 000000000000..8a2240bf0b8a --- /dev/null +++ b/examples/v1/logs-pipelines/CreateLogsPipeline_3996915493.rb @@ -0,0 +1,38 @@ +# Create a pipeline with Array Map Processor returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::LogsPipelinesAPI.new + +body = DatadogAPIClient::V1::LogsPipeline.new({ + filter: DatadogAPIClient::V1::LogsFilter.new({ + query: "source:python", + }), + name: "testPipelineArrayMap", + processors: [ + DatadogAPIClient::V1::LogsArrayMapProcessor.new({ + type: DatadogAPIClient::V1::LogsArrayMapProcessorType::ARRAY_MAP_PROCESSOR, + is_enabled: true, + name: "map items", + source: "items", + target: "out", + preserve_source: true, + processors: [ + DatadogAPIClient::V1::LogsArrayMapAttributeRemapper.new({ + type: DatadogAPIClient::V1::LogsAttributeRemapperType::ATTRIBUTE_REMAPPER, + sources: [ + "$sourceElem.id", + ], + target: "$targetElem.uid", + preserve_source: true, + }), + DatadogAPIClient::V1::LogsArrayMapStringBuilderSubProcessor.new({ + type: DatadogAPIClient::V1::LogsStringBuilderProcessorType::STRING_BUILDER_PROCESSOR, + template: "item-%{$sourceElem.id}", + target: "$targetElem.label", + }), + ], + }), + ], + tags: [], +}) +p api_instance.create_logs_pipeline(body) diff --git a/features/v1/logs_pipelines.feature b/features/v1/logs_pipelines.feature index 1ab4401b0fdc..ac28f052615b 100644 --- a/features/v1/logs_pipelines.feature +++ b/features/v1/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 diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6ce68df8539e..8c33d8d6a2b4 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -282,6 +282,13 @@ def overrides "v1.logs_api_limit_reached_response" => "LogsAPILimitReachedResponse", "v1.logs_arithmetic_processor" => "LogsArithmeticProcessor", "v1.logs_arithmetic_processor_type" => "LogsArithmeticProcessorType", + "v1.logs_array_map_arithmetic_sub_processor" => "LogsArrayMapArithmeticSubProcessor", + "v1.logs_array_map_attribute_remapper" => "LogsArrayMapAttributeRemapper", + "v1.logs_array_map_category_sub_processor" => "LogsArrayMapCategorySubProcessor", + "v1.logs_array_map_processor" => "LogsArrayMapProcessor", + "v1.logs_array_map_processor_type" => "LogsArrayMapProcessorType", + "v1.logs_array_map_string_builder_sub_processor" => "LogsArrayMapStringBuilderSubProcessor", + "v1.logs_array_map_sub_processor" => "LogsArrayMapSubProcessor", "v1.logs_array_processor" => "LogsArrayProcessor", "v1.logs_array_processor_operation" => "LogsArrayProcessorOperation", "v1.logs_array_processor_operation_append" => "LogsArrayProcessorOperationAppend", diff --git a/lib/datadog_api_client/v1/models/logs_array_map_arithmetic_sub_processor.rb b/lib/datadog_api_client/v1/models/logs_array_map_arithmetic_sub_processor.rb new file mode 100644 index 000000000000..a8f33afb25c4 --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_array_map_arithmetic_sub_processor.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # An arithmetic sub-processor for use inside an array-map processor. + # Unlike the top-level arithmetic processor, `is_enabled` is not supported. + class LogsArrayMapArithmeticSubProcessor + include BaseGenericModel + + # Arithmetic operation to perform. + attr_reader :expression + + # Replace missing attribute values with 0. + attr_accessor :is_replace_missing + + # Name of the sub-processor. + attr_accessor :name + + # Target attribute path for the result. + attr_reader :target + + # Type of logs arithmetic processor. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'expression' => :'expression', + :'is_replace_missing' => :'is_replace_missing', + :'name' => :'name', + :'target' => :'target', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'expression' => :'String', + :'is_replace_missing' => :'Boolean', + :'name' => :'String', + :'target' => :'String', + :'type' => :'LogsArithmeticProcessorType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::LogsArrayMapArithmeticSubProcessor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'expression') + self.expression = attributes[:'expression'] + end + + if attributes.key?(:'is_replace_missing') + self.is_replace_missing = attributes[:'is_replace_missing'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'target') + self.target = attributes[:'target'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @expression.nil? + return false if @target.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param expression [Object] Object to be assigned + # @!visibility private + def expression=(expression) + if expression.nil? + fail ArgumentError, 'invalid value for "expression", expression cannot be nil.' + end + @expression = expression + end + + # Custom attribute writer method with validation + # @param target [Object] Object to be assigned + # @!visibility private + def target=(target) + if target.nil? + fail ArgumentError, 'invalid value for "target", target cannot be nil.' + end + @target = target + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expression == o.expression && + is_replace_missing == o.is_replace_missing && + name == o.name && + target == o.target && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [expression, is_replace_missing, name, target, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/logs_array_map_attribute_remapper.rb b/lib/datadog_api_client/v1/models/logs_array_map_attribute_remapper.rb new file mode 100644 index 000000000000..e937833f4e58 --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_array_map_attribute_remapper.rb @@ -0,0 +1,211 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # 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. + class LogsArrayMapAttributeRemapper + include BaseGenericModel + + # Name of the sub-processor. + attr_accessor :name + + # Override the target element if already set. + attr_accessor :override_on_conflict + + # Remove or preserve the remapped source element. + attr_accessor :preserve_source + + # Array of source attribute paths. + attr_reader :sources + + # Target attribute path. + attr_reader :target + + # 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. + attr_accessor :target_format + + # Type of logs attribute remapper. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'override_on_conflict' => :'override_on_conflict', + :'preserve_source' => :'preserve_source', + :'sources' => :'sources', + :'target' => :'target', + :'target_format' => :'target_format', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'override_on_conflict' => :'Boolean', + :'preserve_source' => :'Boolean', + :'sources' => :'Array', + :'target' => :'String', + :'target_format' => :'TargetFormatType', + :'type' => :'LogsAttributeRemapperType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::LogsArrayMapAttributeRemapper` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'override_on_conflict') + self.override_on_conflict = attributes[:'override_on_conflict'] + end + + if attributes.key?(:'preserve_source') + self.preserve_source = attributes[:'preserve_source'] + end + + if attributes.key?(:'sources') + if (value = attributes[:'sources']).is_a?(Array) + self.sources = value + end + end + + if attributes.key?(:'target') + self.target = attributes[:'target'] + end + + if attributes.key?(:'target_format') + self.target_format = attributes[:'target_format'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @sources.nil? + return false if @target.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param sources [Object] Object to be assigned + # @!visibility private + def sources=(sources) + if sources.nil? + fail ArgumentError, 'invalid value for "sources", sources cannot be nil.' + end + @sources = sources + end + + # Custom attribute writer method with validation + # @param target [Object] Object to be assigned + # @!visibility private + def target=(target) + if target.nil? + fail ArgumentError, 'invalid value for "target", target cannot be nil.' + end + @target = target + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + override_on_conflict == o.override_on_conflict && + preserve_source == o.preserve_source && + sources == o.sources && + target == o.target && + target_format == o.target_format && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, override_on_conflict, preserve_source, sources, target, target_format, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/logs_array_map_category_sub_processor.rb b/lib/datadog_api_client/v1/models/logs_array_map_category_sub_processor.rb new file mode 100644 index 000000000000..760e175d3450 --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_array_map_category_sub_processor.rb @@ -0,0 +1,178 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # A category sub-processor for use inside an array-map processor. + # Unlike the top-level category processor, `is_enabled` is not supported. + class LogsArrayMapCategorySubProcessor + include BaseGenericModel + + # Array of filters to match against a log and the corresponding value to assign. + attr_reader :categories + + # Name of the sub-processor. + attr_accessor :name + + # Target attribute path for the category value. + attr_reader :target + + # Type of logs category processor. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'categories' => :'categories', + :'name' => :'name', + :'target' => :'target', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'categories' => :'Array', + :'name' => :'String', + :'target' => :'String', + :'type' => :'LogsCategoryProcessorType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::LogsArrayMapCategorySubProcessor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'target') + self.target = attributes[:'target'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @categories.nil? + return false if @target.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param categories [Object] Object to be assigned + # @!visibility private + def categories=(categories) + if categories.nil? + fail ArgumentError, 'invalid value for "categories", categories cannot be nil.' + end + @categories = categories + end + + # Custom attribute writer method with validation + # @param target [Object] Object to be assigned + # @!visibility private + def target=(target) + if target.nil? + fail ArgumentError, 'invalid value for "target", target cannot be nil.' + end + @target = target + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + categories == o.categories && + name == o.name && + target == o.target && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [categories, name, target, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/logs_array_map_processor.rb b/lib/datadog_api_client/v1/models/logs_array_map_processor.rb new file mode 100644 index 000000000000..ca6adbeaeb82 --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_array_map_processor.rb @@ -0,0 +1,228 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # 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). + class LogsArrayMapProcessor + include BaseGenericModel + + # Whether or not the processor is enabled. + attr_accessor :is_enabled + + # Name of the processor. + attr_accessor :name + + # When `false` and `source != target`, the source attribute is removed after + # processing. Cannot be `false` when `source == target`. + attr_accessor :preserve_source + + # Sub-processors applied to each element. Allowed types: `attribute-remapper`, + # `string-builder-processor`, `arithmetic-processor`, `category-processor`. + attr_reader :processors + + # Attribute path of the source array. Elements are read-only via `$sourceElem` + # inside sub-processors. + attr_reader :source + + # Attribute path of the output array. Sub-processors write to `$targetElem` + # (or `$targetElem.`) to build each output element. + attr_reader :target + + # Type of logs array-map processor. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'is_enabled' => :'is_enabled', + :'name' => :'name', + :'preserve_source' => :'preserve_source', + :'processors' => :'processors', + :'source' => :'source', + :'target' => :'target', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'is_enabled' => :'Boolean', + :'name' => :'String', + :'preserve_source' => :'Boolean', + :'processors' => :'Array', + :'source' => :'String', + :'target' => :'String', + :'type' => :'LogsArrayMapProcessorType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::LogsArrayMapProcessor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'is_enabled') + self.is_enabled = attributes[:'is_enabled'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'preserve_source') + self.preserve_source = attributes[:'preserve_source'] + end + + if attributes.key?(:'processors') + if (value = attributes[:'processors']).is_a?(Array) + self.processors = value + end + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'target') + self.target = attributes[:'target'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @processors.nil? + return false if @source.nil? + return false if @target.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param processors [Object] Object to be assigned + # @!visibility private + def processors=(processors) + if processors.nil? + fail ArgumentError, 'invalid value for "processors", processors cannot be nil.' + end + @processors = processors + end + + # Custom attribute writer method with validation + # @param source [Object] Object to be assigned + # @!visibility private + def source=(source) + if source.nil? + fail ArgumentError, 'invalid value for "source", source cannot be nil.' + end + @source = source + end + + # Custom attribute writer method with validation + # @param target [Object] Object to be assigned + # @!visibility private + def target=(target) + if target.nil? + fail ArgumentError, 'invalid value for "target", target cannot be nil.' + end + @target = target + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is_enabled == o.is_enabled && + name == o.name && + preserve_source == o.preserve_source && + processors == o.processors && + source == o.source && + target == o.target && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [is_enabled, name, preserve_source, processors, source, target, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/logs_array_map_processor_type.rb b/lib/datadog_api_client/v1/models/logs_array_map_processor_type.rb new file mode 100644 index 000000000000..76c00d0cca19 --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_array_map_processor_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Type of logs array-map processor. + class LogsArrayMapProcessorType + include BaseEnumModel + + ARRAY_MAP_PROCESSOR = "array-map-processor".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/logs_array_map_string_builder_sub_processor.rb b/lib/datadog_api_client/v1/models/logs_array_map_string_builder_sub_processor.rb new file mode 100644 index 000000000000..e912556fa6da --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_array_map_string_builder_sub_processor.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # A string builder sub-processor for use inside an array-map processor. + # Unlike the top-level string builder processor, `is_enabled` is not supported. + class LogsArrayMapStringBuilderSubProcessor + include BaseGenericModel + + # Replace missing attribute values with an empty string. + attr_accessor :is_replace_missing + + # Name of the sub-processor. + attr_accessor :name + + # Target attribute path for the result. + attr_reader :target + + # Formula with one or more attributes and raw text. + attr_reader :template + + # Type of logs string builder processor. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'is_replace_missing' => :'is_replace_missing', + :'name' => :'name', + :'target' => :'target', + :'template' => :'template', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'is_replace_missing' => :'Boolean', + :'name' => :'String', + :'target' => :'String', + :'template' => :'String', + :'type' => :'LogsStringBuilderProcessorType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::LogsArrayMapStringBuilderSubProcessor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'is_replace_missing') + self.is_replace_missing = attributes[:'is_replace_missing'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'target') + self.target = attributes[:'target'] + end + + if attributes.key?(:'template') + self.template = attributes[:'template'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @target.nil? + return false if @template.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param target [Object] Object to be assigned + # @!visibility private + def target=(target) + if target.nil? + fail ArgumentError, 'invalid value for "target", target cannot be nil.' + end + @target = target + end + + # Custom attribute writer method with validation + # @param template [Object] Object to be assigned + # @!visibility private + def template=(template) + if template.nil? + fail ArgumentError, 'invalid value for "template", template cannot be nil.' + end + @template = template + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is_replace_missing == o.is_replace_missing && + name == o.name && + target == o.target && + template == o.template && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [is_replace_missing, name, target, template, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/logs_array_map_sub_processor.rb b/lib/datadog_api_client/v1/models/logs_array_map_sub_processor.rb new file mode 100644 index 000000000000..72e3464621b4 --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_array_map_sub_processor.rb @@ -0,0 +1,67 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # A sub-processor used inside an array-map processor. + # Allowed types: `attribute-remapper`, `string-builder-processor`, + # `arithmetic-processor`, `category-processor`. + module LogsArrayMapSubProcessor + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'LogsArrayMapAttributeRemapper', + :'LogsArrayMapArithmeticSubProcessor', + :'LogsArrayMapStringBuilderSubProcessor', + :'LogsArrayMapCategorySubProcessor' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/logs_processor.rb b/lib/datadog_api_client/v1/models/logs_processor.rb index 156f2eae4d94..fc216834c911 100644 --- a/lib/datadog_api_client/v1/models/logs_processor.rb +++ b/lib/datadog_api_client/v1/models/logs_processor.rb @@ -46,7 +46,8 @@ def openapi_one_of :'LogsArrayProcessor', :'LogsDecoderProcessor', :'LogsSchemaProcessor', - :'LogsExcludeAttributeProcessor' + :'LogsExcludeAttributeProcessor', + :'LogsArrayMapProcessor' ] end # Builds the object