Skip to content

Commit a2c714b

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

File tree

3 files changed

+304
-1
lines changed

3 files changed

+304
-1
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`.

src/main/java/com/datadog/api/client/v2/model/ObservabilityPipelineDatadogLogsDestination.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
@JsonPropertyOrder({
2828
ObservabilityPipelineDatadogLogsDestination.JSON_PROPERTY_ID,
2929
ObservabilityPipelineDatadogLogsDestination.JSON_PROPERTY_INPUTS,
30+
ObservabilityPipelineDatadogLogsDestination.JSON_PROPERTY_ROUTES,
3031
ObservabilityPipelineDatadogLogsDestination.JSON_PROPERTY_TYPE
3132
})
3233
@jakarta.annotation.Generated(
@@ -39,6 +40,9 @@ public class ObservabilityPipelineDatadogLogsDestination {
3940
public static final String JSON_PROPERTY_INPUTS = "inputs";
4041
private List<String> inputs = new ArrayList<>();
4142

43+
public static final String JSON_PROPERTY_ROUTES = "routes";
44+
private List<ObservabilityPipelineDatadogLogsDestinationRoute> routes = null;
45+
4246
public static final String JSON_PROPERTY_TYPE = "type";
4347
private ObservabilityPipelineDatadogLogsDestinationType type =
4448
ObservabilityPipelineDatadogLogsDestinationType.DATADOG_LOGS;
@@ -102,6 +106,41 @@ public void setInputs(List<String> inputs) {
102106
this.inputs = inputs;
103107
}
104108

109+
public ObservabilityPipelineDatadogLogsDestination routes(
110+
List<ObservabilityPipelineDatadogLogsDestinationRoute> routes) {
111+
this.routes = routes;
112+
for (ObservabilityPipelineDatadogLogsDestinationRoute item : routes) {
113+
this.unparsed |= item.unparsed;
114+
}
115+
return this;
116+
}
117+
118+
public ObservabilityPipelineDatadogLogsDestination addRoutesItem(
119+
ObservabilityPipelineDatadogLogsDestinationRoute routesItem) {
120+
if (this.routes == null) {
121+
this.routes = new ArrayList<>();
122+
}
123+
this.routes.add(routesItem);
124+
this.unparsed |= routesItem.unparsed;
125+
return this;
126+
}
127+
128+
/**
129+
* A list of routing rules that forward matching logs to Datadog using dedicated API keys.
130+
*
131+
* @return routes
132+
*/
133+
@jakarta.annotation.Nullable
134+
@JsonProperty(JSON_PROPERTY_ROUTES)
135+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
136+
public List<ObservabilityPipelineDatadogLogsDestinationRoute> getRoutes() {
137+
return routes;
138+
}
139+
140+
public void setRoutes(List<ObservabilityPipelineDatadogLogsDestinationRoute> routes) {
141+
this.routes = routes;
142+
}
143+
105144
public ObservabilityPipelineDatadogLogsDestination type(
106145
ObservabilityPipelineDatadogLogsDestinationType type) {
107146
this.type = type;
@@ -187,6 +226,7 @@ public boolean equals(Object o) {
187226
(ObservabilityPipelineDatadogLogsDestination) o;
188227
return Objects.equals(this.id, observabilityPipelineDatadogLogsDestination.id)
189228
&& Objects.equals(this.inputs, observabilityPipelineDatadogLogsDestination.inputs)
229+
&& Objects.equals(this.routes, observabilityPipelineDatadogLogsDestination.routes)
190230
&& Objects.equals(this.type, observabilityPipelineDatadogLogsDestination.type)
191231
&& Objects.equals(
192232
this.additionalProperties,
@@ -195,7 +235,7 @@ public boolean equals(Object o) {
195235

196236
@Override
197237
public int hashCode() {
198-
return Objects.hash(id, inputs, type, additionalProperties);
238+
return Objects.hash(id, inputs, routes, type, additionalProperties);
199239
}
200240

201241
@Override
@@ -204,6 +244,7 @@ public String toString() {
204244
sb.append("class ObservabilityPipelineDatadogLogsDestination {\n");
205245
sb.append(" id: ").append(toIndentedString(id)).append("\n");
206246
sb.append(" inputs: ").append(toIndentedString(inputs)).append("\n");
247+
sb.append(" routes: ").append(toIndentedString(routes)).append("\n");
207248
sb.append(" type: ").append(toIndentedString(type)).append("\n");
208249
sb.append(" additionalProperties: ")
209250
.append(toIndentedString(additionalProperties))
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
package com.datadog.api.client.v2.model;
8+
9+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
10+
import com.fasterxml.jackson.annotation.JsonAnySetter;
11+
import com.fasterxml.jackson.annotation.JsonIgnore;
12+
import com.fasterxml.jackson.annotation.JsonInclude;
13+
import com.fasterxml.jackson.annotation.JsonProperty;
14+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
15+
import java.util.HashMap;
16+
import java.util.Map;
17+
import java.util.Objects;
18+
19+
/**
20+
* Defines how the <code>datadog_logs</code> destination routes matching logs to a Datadog site
21+
* using a specific API key.
22+
*/
23+
@JsonPropertyOrder({
24+
ObservabilityPipelineDatadogLogsDestinationRoute.JSON_PROPERTY_API_KEY_KEY,
25+
ObservabilityPipelineDatadogLogsDestinationRoute.JSON_PROPERTY_INCLUDE,
26+
ObservabilityPipelineDatadogLogsDestinationRoute.JSON_PROPERTY_ROUTE_ID,
27+
ObservabilityPipelineDatadogLogsDestinationRoute.JSON_PROPERTY_SITE
28+
})
29+
@jakarta.annotation.Generated(
30+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
31+
public class ObservabilityPipelineDatadogLogsDestinationRoute {
32+
@JsonIgnore public boolean unparsed = false;
33+
public static final String JSON_PROPERTY_API_KEY_KEY = "api_key_key";
34+
private String apiKeyKey;
35+
36+
public static final String JSON_PROPERTY_INCLUDE = "include";
37+
private String include;
38+
39+
public static final String JSON_PROPERTY_ROUTE_ID = "route_id";
40+
private String routeId;
41+
42+
public static final String JSON_PROPERTY_SITE = "site";
43+
private String site;
44+
45+
public ObservabilityPipelineDatadogLogsDestinationRoute apiKeyKey(String apiKeyKey) {
46+
this.apiKeyKey = apiKeyKey;
47+
return this;
48+
}
49+
50+
/**
51+
* Name of the environment variable or secret that stores the Datadog API key used by this route.
52+
*
53+
* @return apiKeyKey
54+
*/
55+
@jakarta.annotation.Nullable
56+
@JsonProperty(JSON_PROPERTY_API_KEY_KEY)
57+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
58+
public String getApiKeyKey() {
59+
return apiKeyKey;
60+
}
61+
62+
public void setApiKeyKey(String apiKeyKey) {
63+
this.apiKeyKey = apiKeyKey;
64+
}
65+
66+
public ObservabilityPipelineDatadogLogsDestinationRoute include(String include) {
67+
this.include = include;
68+
return this;
69+
}
70+
71+
/**
72+
* A Datadog search query that determines which logs are forwarded using this route.
73+
*
74+
* @return include
75+
*/
76+
@jakarta.annotation.Nullable
77+
@JsonProperty(JSON_PROPERTY_INCLUDE)
78+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
79+
public String getInclude() {
80+
return include;
81+
}
82+
83+
public void setInclude(String include) {
84+
this.include = include;
85+
}
86+
87+
public ObservabilityPipelineDatadogLogsDestinationRoute routeId(String routeId) {
88+
this.routeId = routeId;
89+
return this;
90+
}
91+
92+
/**
93+
* Unique identifier for this route within the destination.
94+
*
95+
* @return routeId
96+
*/
97+
@jakarta.annotation.Nullable
98+
@JsonProperty(JSON_PROPERTY_ROUTE_ID)
99+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
100+
public String getRouteId() {
101+
return routeId;
102+
}
103+
104+
public void setRouteId(String routeId) {
105+
this.routeId = routeId;
106+
}
107+
108+
public ObservabilityPipelineDatadogLogsDestinationRoute site(String site) {
109+
this.site = site;
110+
return this;
111+
}
112+
113+
/**
114+
* Datadog site where matching logs are sent (for example, <code>us1</code>).
115+
*
116+
* @return site
117+
*/
118+
@jakarta.annotation.Nullable
119+
@JsonProperty(JSON_PROPERTY_SITE)
120+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
121+
public String getSite() {
122+
return site;
123+
}
124+
125+
public void setSite(String site) {
126+
this.site = site;
127+
}
128+
129+
/**
130+
* A container for additional, undeclared properties. This is a holder for any undeclared
131+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
132+
*/
133+
private Map<String, Object> additionalProperties;
134+
135+
/**
136+
* Set the additional (undeclared) property with the specified name and value. If the property
137+
* does not already exist, create it otherwise replace it.
138+
*
139+
* @param key The arbitrary key to set
140+
* @param value The associated value
141+
* @return ObservabilityPipelineDatadogLogsDestinationRoute
142+
*/
143+
@JsonAnySetter
144+
public ObservabilityPipelineDatadogLogsDestinationRoute putAdditionalProperty(
145+
String key, Object value) {
146+
if (this.additionalProperties == null) {
147+
this.additionalProperties = new HashMap<String, Object>();
148+
}
149+
this.additionalProperties.put(key, value);
150+
return this;
151+
}
152+
153+
/**
154+
* Return the additional (undeclared) property.
155+
*
156+
* @return The additional properties
157+
*/
158+
@JsonAnyGetter
159+
public Map<String, Object> getAdditionalProperties() {
160+
return additionalProperties;
161+
}
162+
163+
/**
164+
* Return the additional (undeclared) property with the specified name.
165+
*
166+
* @param key The arbitrary key to get
167+
* @return The specific additional property for the given key
168+
*/
169+
public Object getAdditionalProperty(String key) {
170+
if (this.additionalProperties == null) {
171+
return null;
172+
}
173+
return this.additionalProperties.get(key);
174+
}
175+
176+
/** Return true if this ObservabilityPipelineDatadogLogsDestinationRoute object is equal to o. */
177+
@Override
178+
public boolean equals(Object o) {
179+
if (this == o) {
180+
return true;
181+
}
182+
if (o == null || getClass() != o.getClass()) {
183+
return false;
184+
}
185+
ObservabilityPipelineDatadogLogsDestinationRoute
186+
observabilityPipelineDatadogLogsDestinationRoute =
187+
(ObservabilityPipelineDatadogLogsDestinationRoute) o;
188+
return Objects.equals(
189+
this.apiKeyKey, observabilityPipelineDatadogLogsDestinationRoute.apiKeyKey)
190+
&& Objects.equals(this.include, observabilityPipelineDatadogLogsDestinationRoute.include)
191+
&& Objects.equals(this.routeId, observabilityPipelineDatadogLogsDestinationRoute.routeId)
192+
&& Objects.equals(this.site, observabilityPipelineDatadogLogsDestinationRoute.site)
193+
&& Objects.equals(
194+
this.additionalProperties,
195+
observabilityPipelineDatadogLogsDestinationRoute.additionalProperties);
196+
}
197+
198+
@Override
199+
public int hashCode() {
200+
return Objects.hash(apiKeyKey, include, routeId, site, additionalProperties);
201+
}
202+
203+
@Override
204+
public String toString() {
205+
StringBuilder sb = new StringBuilder();
206+
sb.append("class ObservabilityPipelineDatadogLogsDestinationRoute {\n");
207+
sb.append(" apiKeyKey: ").append(toIndentedString(apiKeyKey)).append("\n");
208+
sb.append(" include: ").append(toIndentedString(include)).append("\n");
209+
sb.append(" routeId: ").append(toIndentedString(routeId)).append("\n");
210+
sb.append(" site: ").append(toIndentedString(site)).append("\n");
211+
sb.append(" additionalProperties: ")
212+
.append(toIndentedString(additionalProperties))
213+
.append("\n");
214+
sb.append('}');
215+
return sb.toString();
216+
}
217+
218+
/**
219+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
220+
*/
221+
private String toIndentedString(Object o) {
222+
if (o == null) {
223+
return "null";
224+
}
225+
return o.toString().replace("\n", "\n ");
226+
}
227+
}

0 commit comments

Comments
 (0)