Skip to content

Commit 86ccea1

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add support for routes in datadog logs destination (#3106)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 5e3a040 commit 86ccea1

File tree

6 files changed

+143
-2
lines changed

6 files changed

+143
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36571,6 +36571,18 @@ components:
3657136571
items:
3657236572
type: string
3657336573
type: array
36574+
routes:
36575+
description: A list of routing rules that forward matching logs to Datadog
36576+
using dedicated API keys.
36577+
example:
36578+
- api_key_key: API_KEY_IDENTIFIER
36579+
include: service:api
36580+
route_id: datadog-logs-route-us1
36581+
site: us1
36582+
items:
36583+
$ref: '#/components/schemas/ObservabilityPipelineDatadogLogsDestinationRoute'
36584+
maxItems: 100
36585+
type: array
3657436586
type:
3657536587
$ref: '#/components/schemas/ObservabilityPipelineDatadogLogsDestinationType'
3657636588
required:
@@ -36580,6 +36592,29 @@ components:
3658036592
type: object
3658136593
x-pipeline-types:
3658236594
- logs
36595+
ObservabilityPipelineDatadogLogsDestinationRoute:
36596+
description: Defines how the `datadog_logs` destination routes matching logs
36597+
to a Datadog site using a specific API key.
36598+
properties:
36599+
api_key_key:
36600+
description: Name of the environment variable or secret that stores the
36601+
Datadog API key used by this route.
36602+
example: API_KEY_IDENTIFIER
36603+
type: string
36604+
include:
36605+
description: A Datadog search query that determines which logs are forwarded
36606+
using this route.
36607+
example: service:api
36608+
type: string
36609+
route_id:
36610+
description: Unique identifier for this route within the destination.
36611+
example: datadog-logs-route-us
36612+
type: string
36613+
site:
36614+
description: Datadog site where matching logs are sent (for example, `us1`).
36615+
example: us1
36616+
type: string
36617+
type: object
3658336618
ObservabilityPipelineDatadogLogsDestinationType:
3658436619
default: datadog_logs
3658536620
description: The destination type. The value should always be `datadog_logs`.

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15859,6 +15859,13 @@ datadog\_api\_client.v2.model.observability\_pipeline\_datadog\_logs\_destinatio
1585915859
:members:
1586015860
:show-inheritance:
1586115861

15862+
datadog\_api\_client.v2.model.observability\_pipeline\_datadog\_logs\_destination\_route module
15863+
-----------------------------------------------------------------------------------------------
15864+
15865+
.. automodule:: datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_route
15866+
:members:
15867+
:show-inheritance:
15868+
1586215869
datadog\_api\_client.v2.model.observability\_pipeline\_datadog\_logs\_destination\_type module
1586315870
----------------------------------------------------------------------------------------------
1586415871

src/datadog_api_client/v2/model/observability_pipeline_config_destination_item.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ def __init__(self, **kwargs):
6464
:param container_name: The name of the Azure Blob Storage container to store logs in.
6565
:type container_name: str
6666
67+
:param routes: A list of routing rules that forward matching logs to Datadog using dedicated API keys.
68+
:type routes: [ObservabilityPipelineDatadogLogsDestinationRoute], optional
69+
6770
:param api_version: The Elasticsearch API version to use. Set to `auto` to auto-detect.
6871
:type api_version: ObservabilityPipelineElasticsearchDestinationApiVersion, optional
6972

src/datadog_api_client/v2/model/observability_pipeline_datadog_logs_destination.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,63 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import List, TYPE_CHECKING
6+
from typing import List, Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
unset,
12+
UnsetType,
1113
)
1214

1315

1416
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_route import (
18+
ObservabilityPipelineDatadogLogsDestinationRoute,
19+
)
1520
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_type import (
1621
ObservabilityPipelineDatadogLogsDestinationType,
1722
)
1823

1924

2025
class ObservabilityPipelineDatadogLogsDestination(ModelNormal):
26+
validations = {
27+
"routes": {
28+
"max_items": 100,
29+
},
30+
}
31+
2132
@cached_property
2233
def openapi_types(_):
34+
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_route import (
35+
ObservabilityPipelineDatadogLogsDestinationRoute,
36+
)
2337
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_type import (
2438
ObservabilityPipelineDatadogLogsDestinationType,
2539
)
2640

2741
return {
2842
"id": (str,),
2943
"inputs": ([str],),
44+
"routes": ([ObservabilityPipelineDatadogLogsDestinationRoute],),
3045
"type": (ObservabilityPipelineDatadogLogsDestinationType,),
3146
}
3247

3348
attribute_map = {
3449
"id": "id",
3550
"inputs": "inputs",
51+
"routes": "routes",
3652
"type": "type",
3753
}
3854

39-
def __init__(self_, id: str, inputs: List[str], type: ObservabilityPipelineDatadogLogsDestinationType, **kwargs):
55+
def __init__(
56+
self_,
57+
id: str,
58+
inputs: List[str],
59+
type: ObservabilityPipelineDatadogLogsDestinationType,
60+
routes: Union[List[ObservabilityPipelineDatadogLogsDestinationRoute], UnsetType] = unset,
61+
**kwargs,
62+
):
4063
"""
4164
The ``datadog_logs`` destination forwards logs to Datadog Log Management.
4265
@@ -48,9 +71,14 @@ def __init__(self_, id: str, inputs: List[str], type: ObservabilityPipelineDatad
4871
:param inputs: A list of component IDs whose output is used as the ``input`` for this component.
4972
:type inputs: [str]
5073
74+
:param routes: A list of routing rules that forward matching logs to Datadog using dedicated API keys.
75+
:type routes: [ObservabilityPipelineDatadogLogsDestinationRoute], optional
76+
5177
:param type: The destination type. The value should always be ``datadog_logs``.
5278
:type type: ObservabilityPipelineDatadogLogsDestinationType
5379
"""
80+
if routes is not unset:
81+
kwargs["routes"] = routes
5482
super().__init__(kwargs)
5583

5684
self_.id = id
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
class ObservabilityPipelineDatadogLogsDestinationRoute(ModelNormal):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"api_key_key": (str,),
21+
"include": (str,),
22+
"route_id": (str,),
23+
"site": (str,),
24+
}
25+
26+
attribute_map = {
27+
"api_key_key": "api_key_key",
28+
"include": "include",
29+
"route_id": "route_id",
30+
"site": "site",
31+
}
32+
33+
def __init__(
34+
self_,
35+
api_key_key: Union[str, UnsetType] = unset,
36+
include: Union[str, UnsetType] = unset,
37+
route_id: Union[str, UnsetType] = unset,
38+
site: Union[str, UnsetType] = unset,
39+
**kwargs,
40+
):
41+
"""
42+
Defines how the ``datadog_logs`` destination routes matching logs to a Datadog site using a specific API key.
43+
44+
:param api_key_key: Name of the environment variable or secret that stores the Datadog API key used by this route.
45+
:type api_key_key: str, optional
46+
47+
:param include: A Datadog search query that determines which logs are forwarded using this route.
48+
:type include: str, optional
49+
50+
:param route_id: Unique identifier for this route within the destination.
51+
:type route_id: str, optional
52+
53+
:param site: Datadog site where matching logs are sent (for example, ``us1`` ).
54+
:type site: str, optional
55+
"""
56+
if api_key_key is not unset:
57+
kwargs["api_key_key"] = api_key_key
58+
if include is not unset:
59+
kwargs["include"] = include
60+
if route_id is not unset:
61+
kwargs["route_id"] = route_id
62+
if site is not unset:
63+
kwargs["site"] = site
64+
super().__init__(kwargs)

src/datadog_api_client/v2/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,6 +3026,9 @@
30263026
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination import (
30273027
ObservabilityPipelineDatadogLogsDestination,
30283028
)
3029+
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_route import (
3030+
ObservabilityPipelineDatadogLogsDestinationRoute,
3031+
)
30293032
from datadog_api_client.v2.model.observability_pipeline_datadog_logs_destination_type import (
30303033
ObservabilityPipelineDatadogLogsDestinationType,
30313034
)
@@ -7667,6 +7670,7 @@
76677670
"ObservabilityPipelineDatadogAgentSource",
76687671
"ObservabilityPipelineDatadogAgentSourceType",
76697672
"ObservabilityPipelineDatadogLogsDestination",
7673+
"ObservabilityPipelineDatadogLogsDestinationRoute",
76707674
"ObservabilityPipelineDatadogLogsDestinationType",
76717675
"ObservabilityPipelineDatadogMetricsDestination",
76727676
"ObservabilityPipelineDatadogMetricsDestinationType",

0 commit comments

Comments
 (0)