Skip to content

Commit 6c82474

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 715b041 of spec repo
1 parent 8d615bb commit 6c82474

18 files changed

Lines changed: 391 additions & 6 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6611,6 +6611,7 @@ components:
66116611
- Select value from matching element
66126612
- Compute array length
66136613
- Append a value to an array
6614+
- Extract key-value pairs from an array
66146615
properties:
66156616
is_enabled:
66166617
default: false
@@ -6633,6 +6634,7 @@ components:
66336634
- $ref: "#/components/schemas/LogsArrayProcessorOperationAppend"
66346635
- $ref: "#/components/schemas/LogsArrayProcessorOperationLength"
66356636
- $ref: "#/components/schemas/LogsArrayProcessorOperationSelect"
6637+
- $ref: "#/components/schemas/LogsArrayProcessorOperationExtractKeyValue"
66366638
LogsArrayProcessorOperationAppend:
66376639
description: Operation that appends a value to a target array attribute.
66386640
properties:
@@ -6662,6 +6664,44 @@ components:
66626664
type: string
66636665
x-enum-varnames:
66646666
- APPEND
6667+
LogsArrayProcessorOperationExtractKeyValue:
6668+
description: Operation that extracts key-value pairs from a `source` array and stores the result in the `target` attribute.
6669+
properties:
6670+
key_to_extract:
6671+
description: Key of the attribute in each array element that holds the name to use for the extracted attribute.
6672+
example: name
6673+
type: string
6674+
override_on_conflict:
6675+
default: false
6676+
description: Whether to override the target element if it's already set.
6677+
type: boolean
6678+
source:
6679+
description: Attribute path of the array to extract key-value pairs from.
6680+
example: tags
6681+
type: string
6682+
target:
6683+
description: Attribute that receives the extracted key-value pairs. If not specified, the extracted attributes are added at the root level of the log.
6684+
example: extracted
6685+
type: string
6686+
type:
6687+
$ref: "#/components/schemas/LogsArrayProcessorOperationExtractKeyValueType"
6688+
value_to_extract:
6689+
description: Key of the attribute in each array element that holds the value to use for the extracted attribute.
6690+
example: value
6691+
type: string
6692+
required:
6693+
- type
6694+
- source
6695+
- key_to_extract
6696+
- value_to_extract
6697+
type: object
6698+
LogsArrayProcessorOperationExtractKeyValueType:
6699+
description: Operation type.
6700+
enum: [key-value]
6701+
example: key-value
6702+
type: string
6703+
x-enum-varnames:
6704+
- KEY_VALUE
66656705
LogsArrayProcessorOperationLength:
66666706
description: Operation that computes the length of a `source` array and stores the result in the `target` attribute.
66676707
properties:
@@ -6746,7 +6786,7 @@ components:
67466786
type: string
67476787
override_on_conflict:
67486788
default: false
6749-
description: Override or not the target element if already set,
6789+
description: Whether to override the target element if it's already set.
67506790
type: boolean
67516791
preserve_source:
67526792
default: false
@@ -7912,7 +7952,7 @@ components:
79127952
type: string
79137953
override_on_conflict:
79147954
default: false
7915-
description: Override or not the target element if already set.
7955+
description: Whether to override the target element if it's already set.
79167956
type: boolean
79177957
preserve_source:
79187958
default: false

docs/datadog_api_client.v1.model.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,20 @@ datadog\_api\_client.v1.model.logs\_array\_processor\_operation\_append\_type mo
21252125
:members:
21262126
:show-inheritance:
21272127

2128+
datadog\_api\_client.v1.model.logs\_array\_processor\_operation\_extract\_key\_value module
2129+
-------------------------------------------------------------------------------------------
2130+
2131+
.. automodule:: datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value
2132+
:members:
2133+
:show-inheritance:
2134+
2135+
datadog\_api\_client.v1.model.logs\_array\_processor\_operation\_extract\_key\_value\_type module
2136+
-------------------------------------------------------------------------------------------------
2137+
2138+
.. automodule:: datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value_type
2139+
:members:
2140+
:show-inheritance:
2141+
21282142
datadog\_api\_client.v1.model.logs\_array\_processor\_operation\_length module
21292143
------------------------------------------------------------------------------
21302144

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""
2+
Create a pipeline with Array Processor Key Value Operation returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.logs_pipelines_api import LogsPipelinesApi
7+
from datadog_api_client.v1.model.logs_array_processor import LogsArrayProcessor
8+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value import (
9+
LogsArrayProcessorOperationExtractKeyValue,
10+
)
11+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value_type import (
12+
LogsArrayProcessorOperationExtractKeyValueType,
13+
)
14+
from datadog_api_client.v1.model.logs_array_processor_type import LogsArrayProcessorType
15+
from datadog_api_client.v1.model.logs_filter import LogsFilter
16+
from datadog_api_client.v1.model.logs_pipeline import LogsPipeline
17+
18+
body = LogsPipeline(
19+
filter=LogsFilter(
20+
query="source:python",
21+
),
22+
name="testPipelineArrayKeyValue",
23+
processors=[
24+
LogsArrayProcessor(
25+
type=LogsArrayProcessorType.ARRAY_PROCESSOR,
26+
is_enabled=True,
27+
name="extract_kv",
28+
operation=LogsArrayProcessorOperationExtractKeyValue(
29+
type=LogsArrayProcessorOperationExtractKeyValueType.KEY_VALUE,
30+
source="tags",
31+
key_to_extract="name",
32+
value_to_extract="value",
33+
),
34+
),
35+
],
36+
tags=[],
37+
)
38+
39+
configuration = Configuration()
40+
with ApiClient(configuration) as api_client:
41+
api_instance = LogsPipelinesApi(api_client)
42+
response = api_instance.create_logs_pipeline(body=body)
43+
44+
print(response)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
"""
2+
Create a pipeline with Array Processor Key Value Operation with target and override_on_conflict returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.logs_pipelines_api import LogsPipelinesApi
7+
from datadog_api_client.v1.model.logs_array_processor import LogsArrayProcessor
8+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value import (
9+
LogsArrayProcessorOperationExtractKeyValue,
10+
)
11+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value_type import (
12+
LogsArrayProcessorOperationExtractKeyValueType,
13+
)
14+
from datadog_api_client.v1.model.logs_array_processor_type import LogsArrayProcessorType
15+
from datadog_api_client.v1.model.logs_filter import LogsFilter
16+
from datadog_api_client.v1.model.logs_pipeline import LogsPipeline
17+
18+
body = LogsPipeline(
19+
filter=LogsFilter(
20+
query="source:python",
21+
),
22+
name="testPipelineArrayKeyValueTarget",
23+
processors=[
24+
LogsArrayProcessor(
25+
type=LogsArrayProcessorType.ARRAY_PROCESSOR,
26+
is_enabled=True,
27+
name="extract_kv_to_target",
28+
operation=LogsArrayProcessorOperationExtractKeyValue(
29+
type=LogsArrayProcessorOperationExtractKeyValueType.KEY_VALUE,
30+
source="tags",
31+
key_to_extract="name",
32+
value_to_extract="value",
33+
target="extracted",
34+
override_on_conflict=True,
35+
),
36+
),
37+
],
38+
tags=[],
39+
)
40+
41+
configuration = Configuration()
42+
with ApiClient(configuration) as api_client:
43+
api_instance = LogsPipelinesApi(api_client)
44+
response = api_instance.create_logs_pipeline(body=body)
45+
46+
print(response)

src/datadog_api_client/v1/model/logs_array_processor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
from datadog_api_client.v1.model.logs_array_processor_operation_append import LogsArrayProcessorOperationAppend
2020
from datadog_api_client.v1.model.logs_array_processor_operation_length import LogsArrayProcessorOperationLength
2121
from datadog_api_client.v1.model.logs_array_processor_operation_select import LogsArrayProcessorOperationSelect
22+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value import (
23+
LogsArrayProcessorOperationExtractKeyValue,
24+
)
2225

2326

2427
class LogsArrayProcessor(ModelNormal):
@@ -48,6 +51,7 @@ def __init__(
4851
LogsArrayProcessorOperationAppend,
4952
LogsArrayProcessorOperationLength,
5053
LogsArrayProcessorOperationSelect,
54+
LogsArrayProcessorOperationExtractKeyValue,
5155
],
5256
type: LogsArrayProcessorType,
5357
is_enabled: Union[bool, UnsetType] = unset,
@@ -61,6 +65,7 @@ def __init__(
6165
* Select value from matching element
6266
* Compute array length
6367
* Append a value to an array
68+
* Extract key-value pairs from an array
6469
6570
:param is_enabled: Whether or not the processor is enabled.
6671
:type is_enabled: bool, optional

src/datadog_api_client/v1/model/logs_array_processor_operation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ def __init__(self, **kwargs):
3232
3333
:param value_to_extract: Key of the value to extract from the matching element.
3434
:type value_to_extract: str
35+
36+
:param key_to_extract: Key of the attribute in each array element that holds the name to use for the extracted attribute.
37+
:type key_to_extract: str
38+
39+
:param override_on_conflict: Whether to override the target element if it's already set.
40+
:type override_on_conflict: bool, optional
3541
"""
3642
super().__init__(kwargs)
3743

@@ -47,11 +53,15 @@ def _composed_schemas(_):
4753
from datadog_api_client.v1.model.logs_array_processor_operation_append import LogsArrayProcessorOperationAppend
4854
from datadog_api_client.v1.model.logs_array_processor_operation_length import LogsArrayProcessorOperationLength
4955
from datadog_api_client.v1.model.logs_array_processor_operation_select import LogsArrayProcessorOperationSelect
56+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value import (
57+
LogsArrayProcessorOperationExtractKeyValue,
58+
)
5059

5160
return {
5261
"oneOf": [
5362
LogsArrayProcessorOperationAppend,
5463
LogsArrayProcessorOperationLength,
5564
LogsArrayProcessorOperationSelect,
65+
LogsArrayProcessorOperationExtractKeyValue,
5666
],
5767
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value_type import (
18+
LogsArrayProcessorOperationExtractKeyValueType,
19+
)
20+
21+
22+
class LogsArrayProcessorOperationExtractKeyValue(ModelNormal):
23+
@cached_property
24+
def openapi_types(_):
25+
from datadog_api_client.v1.model.logs_array_processor_operation_extract_key_value_type import (
26+
LogsArrayProcessorOperationExtractKeyValueType,
27+
)
28+
29+
return {
30+
"key_to_extract": (str,),
31+
"override_on_conflict": (bool,),
32+
"source": (str,),
33+
"target": (str,),
34+
"type": (LogsArrayProcessorOperationExtractKeyValueType,),
35+
"value_to_extract": (str,),
36+
}
37+
38+
attribute_map = {
39+
"key_to_extract": "key_to_extract",
40+
"override_on_conflict": "override_on_conflict",
41+
"source": "source",
42+
"target": "target",
43+
"type": "type",
44+
"value_to_extract": "value_to_extract",
45+
}
46+
47+
def __init__(
48+
self_,
49+
key_to_extract: str,
50+
source: str,
51+
type: LogsArrayProcessorOperationExtractKeyValueType,
52+
value_to_extract: str,
53+
override_on_conflict: Union[bool, UnsetType] = unset,
54+
target: Union[str, UnsetType] = unset,
55+
**kwargs,
56+
):
57+
"""
58+
Operation that extracts key-value pairs from a ``source`` array and stores the result in the ``target`` attribute.
59+
60+
:param key_to_extract: Key of the attribute in each array element that holds the name to use for the extracted attribute.
61+
:type key_to_extract: str
62+
63+
:param override_on_conflict: Whether to override the target element if it's already set.
64+
:type override_on_conflict: bool, optional
65+
66+
:param source: Attribute path of the array to extract key-value pairs from.
67+
:type source: str
68+
69+
:param target: Attribute that receives the extracted key-value pairs. If not specified, the extracted attributes are added at the root level of the log.
70+
:type target: str, optional
71+
72+
:param type: Operation type.
73+
:type type: LogsArrayProcessorOperationExtractKeyValueType
74+
75+
:param value_to_extract: Key of the attribute in each array element that holds the value to use for the extracted attribute.
76+
:type value_to_extract: str
77+
"""
78+
if override_on_conflict is not unset:
79+
kwargs["override_on_conflict"] = override_on_conflict
80+
if target is not unset:
81+
kwargs["target"] = target
82+
super().__init__(kwargs)
83+
84+
self_.key_to_extract = key_to_extract
85+
self_.source = source
86+
self_.type = type
87+
self_.value_to_extract = value_to_extract
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class LogsArrayProcessorOperationExtractKeyValueType(ModelSimple):
16+
"""
17+
Operation type.
18+
19+
:param value: If omitted defaults to "key-value". Must be one of ["key-value"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"key-value",
25+
}
26+
KEY_VALUE: ClassVar["LogsArrayProcessorOperationExtractKeyValueType"]
27+
28+
@cached_property
29+
def openapi_types(_):
30+
return {
31+
"value": (str,),
32+
}
33+
34+
35+
LogsArrayProcessorOperationExtractKeyValueType.KEY_VALUE = LogsArrayProcessorOperationExtractKeyValueType("key-value")

src/datadog_api_client/v1/model/logs_attribute_remapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(
7575
:param name: Name of the processor.
7676
:type name: str, optional
7777
78-
:param override_on_conflict: Override or not the target element if already set,
78+
:param override_on_conflict: Whether to override the target element if it's already set.
7979
:type override_on_conflict: bool, optional
8080
8181
:param preserve_source: Remove or preserve the remapped source element.

src/datadog_api_client/v1/model/logs_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, **kwargs):
3636
:param sources: Array of source attributes.
3737
:type sources: [str]
3838
39-
:param override_on_conflict: Override or not the target element if already set,
39+
:param override_on_conflict: Whether to override the target element if it's already set.
4040
:type override_on_conflict: bool, optional
4141
4242
:param preserve_source: Remove or preserve the remapped source element.

0 commit comments

Comments
 (0)