Skip to content

Commit b931ea1

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 0a72619 of spec repo
1 parent 4a8efe3 commit b931ea1

16 files changed

Lines changed: 1733 additions & 3 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53818,6 +53818,16 @@ components:
5381853818
description: Name of the environment variable or secret that holds the username (used when `auth_strategy` is `plain`).
5381953819
example: HTTP_AUTH_USERNAME
5382053820
type: string
53821+
valid_tokens:
53822+
description: |-
53823+
A list of tokens that are accepted for authenticating incoming HTTP requests. When set,
53824+
the source rejects any request whose token does not match an enabled entry in this list.
53825+
Cannot be combined with the `plain` auth strategy.
53826+
items:
53827+
$ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidToken"
53828+
maxItems: 1000
53829+
minItems: 1
53830+
type: array
5382153831
required:
5382253832
- id
5382353833
- type
@@ -53843,6 +53853,55 @@ components:
5384353853
type: string
5384453854
x-enum-varnames:
5384553855
- HTTP_SERVER
53856+
ObservabilityPipelineHttpServerSourceValidToken:
53857+
description: An accepted token used to authenticate incoming HTTP server requests.
53858+
properties:
53859+
enabled:
53860+
default: true
53861+
description: |-
53862+
Indicates whether this token is currently accepted. Disabled tokens are rejected without
53863+
being removed from the configuration.
53864+
example: true
53865+
type: boolean
53866+
field_to_add:
53867+
$ref: "#/components/schemas/ObservabilityPipelineSourceValidTokenFieldToAdd"
53868+
path_to_token:
53869+
$ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidTokenPathToToken"
53870+
token_key:
53871+
description: Name of the environment variable or secret that holds the expected token value.
53872+
example: HTTP_SERVER_TOKEN
53873+
pattern: "^[A-Za-z0-9_]+$"
53874+
type: string
53875+
required:
53876+
- token_key
53877+
type: object
53878+
ObservabilityPipelineHttpServerSourceValidTokenPathToToken:
53879+
description: |-
53880+
Specifies where the worker extracts the token from in the incoming HTTP request.
53881+
This can be either a built-in location (`path` or `address`) or an HTTP header object.
53882+
oneOf:
53883+
- $ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidTokenPathToTokenLocation"
53884+
- $ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidTokenPathToTokenHeader"
53885+
ObservabilityPipelineHttpServerSourceValidTokenPathToTokenHeader:
53886+
description: Extract the token from a specific HTTP request header.
53887+
properties:
53888+
header:
53889+
description: The name of the HTTP header that carries the token.
53890+
example: X-Token
53891+
type: string
53892+
required:
53893+
- header
53894+
type: object
53895+
ObservabilityPipelineHttpServerSourceValidTokenPathToTokenLocation:
53896+
description: Built-in token location on the incoming HTTP request.
53897+
enum:
53898+
- path
53899+
- address
53900+
example: path
53901+
type: string
53902+
x-enum-varnames:
53903+
- PATH
53904+
- ADDRESS
5384653905
ObservabilityPipelineKafkaDestination:
5384753906
description: |-
5384853907
The `kafka` destination sends logs to Apache Kafka topics.
@@ -55866,6 +55925,27 @@ components:
5586655925
type: string
5586755926
x-enum-varnames:
5586855927
- SOCKET
55928+
ObservabilityPipelineSourceValidTokenFieldToAdd:
55929+
description: |-
55930+
An optional metadata field that is attached to every event authenticated by the
55931+
associated token. Both `key` and `value` must match `^[A-Za-z0-9_]+$`.
55932+
properties:
55933+
key:
55934+
description: The metadata field name to add to incoming events.
55935+
example: token_name
55936+
maxLength: 256
55937+
pattern: "^[A-Za-z0-9_]+$"
55938+
type: string
55939+
value:
55940+
description: The metadata field value to add to incoming events.
55941+
example: my_token
55942+
maxLength: 1024
55943+
pattern: "^[A-Za-z0-9_]+$"
55944+
type: string
55945+
required:
55946+
- key
55947+
- value
55948+
type: object
5586955949
ObservabilityPipelineSpec:
5587055950
description: Input schema representing an observability pipeline configuration. Used in create and validate requests.
5587155951
properties:
@@ -56062,6 +56142,15 @@ components:
5606256142
$ref: "#/components/schemas/ObservabilityPipelineTls"
5606356143
type:
5606456144
$ref: "#/components/schemas/ObservabilityPipelineSplunkHecSourceType"
56145+
valid_tokens:
56146+
description: |-
56147+
A list of tokens that are accepted for authenticating incoming HEC requests. When set, the source
56148+
rejects any request whose HEC token does not match an enabled entry in this list.
56149+
items:
56150+
$ref: "#/components/schemas/ObservabilityPipelineSplunkHecSourceValidToken"
56151+
maxItems: 1000
56152+
minItems: 1
56153+
type: array
5606556154
required:
5606656155
- id
5606756156
- type
@@ -56076,6 +56165,26 @@ components:
5607656165
type: string
5607756166
x-enum-varnames:
5607856167
- SPLUNK_HEC
56168+
ObservabilityPipelineSplunkHecSourceValidToken:
56169+
description: An accepted HEC token used to authenticate incoming Splunk HEC requests.
56170+
properties:
56171+
enabled:
56172+
default: true
56173+
description: |-
56174+
Indicates whether this token is currently accepted. Disabled tokens are rejected without
56175+
being removed from the configuration.
56176+
example: true
56177+
type: boolean
56178+
field_to_add:
56179+
$ref: "#/components/schemas/ObservabilityPipelineSourceValidTokenFieldToAdd"
56180+
token_key:
56181+
description: Name of the environment variable or secret that holds the expected HEC token value.
56182+
example: SPLUNK_HEC_TOKEN
56183+
pattern: "^[A-Za-z0-9_]+$"
56184+
type: string
56185+
required:
56186+
- token_key
56187+
type: object
5607956188
ObservabilityPipelineSplunkTcpSource:
5608056189
description: |-
5608156190
The `splunk_tcp` source receives logs from a Splunk Universal Forwarder over TCP.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// Validate an observability pipeline with Splunk HEC source valid_tokens returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.ObservabilityPipelinesApi;
6+
import com.datadog.api.client.v2.model.ObservabilityPipelineConfig;
7+
import com.datadog.api.client.v2.model.ObservabilityPipelineConfigDestinationItem;
8+
import com.datadog.api.client.v2.model.ObservabilityPipelineConfigProcessorGroup;
9+
import com.datadog.api.client.v2.model.ObservabilityPipelineConfigProcessorItem;
10+
import com.datadog.api.client.v2.model.ObservabilityPipelineConfigSourceItem;
11+
import com.datadog.api.client.v2.model.ObservabilityPipelineDataAttributes;
12+
import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogLogsDestination;
13+
import com.datadog.api.client.v2.model.ObservabilityPipelineDatadogLogsDestinationType;
14+
import com.datadog.api.client.v2.model.ObservabilityPipelineFilterProcessor;
15+
import com.datadog.api.client.v2.model.ObservabilityPipelineFilterProcessorType;
16+
import com.datadog.api.client.v2.model.ObservabilityPipelineSourceValidTokenFieldToAdd;
17+
import com.datadog.api.client.v2.model.ObservabilityPipelineSpec;
18+
import com.datadog.api.client.v2.model.ObservabilityPipelineSpecData;
19+
import com.datadog.api.client.v2.model.ObservabilityPipelineSplunkHecSource;
20+
import com.datadog.api.client.v2.model.ObservabilityPipelineSplunkHecSourceType;
21+
import com.datadog.api.client.v2.model.ObservabilityPipelineSplunkHecSourceValidToken;
22+
import com.datadog.api.client.v2.model.ValidationResponse;
23+
import java.util.Arrays;
24+
import java.util.Collections;
25+
26+
public class Example {
27+
public static void main(String[] args) {
28+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
29+
ObservabilityPipelinesApi apiInstance = new ObservabilityPipelinesApi(defaultClient);
30+
31+
ObservabilityPipelineSpec body =
32+
new ObservabilityPipelineSpec()
33+
.data(
34+
new ObservabilityPipelineSpecData()
35+
.attributes(
36+
new ObservabilityPipelineDataAttributes()
37+
.config(
38+
new ObservabilityPipelineConfig()
39+
.destinations(
40+
Collections.singletonList(
41+
new ObservabilityPipelineConfigDestinationItem(
42+
new ObservabilityPipelineDatadogLogsDestination()
43+
.id("datadog-logs-destination")
44+
.inputs(
45+
Collections.singletonList(
46+
"my-processor-group"))
47+
.type(
48+
ObservabilityPipelineDatadogLogsDestinationType
49+
.DATADOG_LOGS))))
50+
.processorGroups(
51+
Collections.singletonList(
52+
new ObservabilityPipelineConfigProcessorGroup()
53+
.enabled(true)
54+
.id("my-processor-group")
55+
.include("service:my-service")
56+
.inputs(
57+
Collections.singletonList("splunk-hec-source"))
58+
.processors(
59+
Collections.singletonList(
60+
new ObservabilityPipelineConfigProcessorItem(
61+
new ObservabilityPipelineFilterProcessor()
62+
.enabled(true)
63+
.id("filter-processor")
64+
.include("status:error")
65+
.type(
66+
ObservabilityPipelineFilterProcessorType
67+
.FILTER))))))
68+
.sources(
69+
Collections.singletonList(
70+
new ObservabilityPipelineConfigSourceItem(
71+
new ObservabilityPipelineSplunkHecSource()
72+
.id("splunk-hec-source")
73+
.type(
74+
ObservabilityPipelineSplunkHecSourceType
75+
.SPLUNK_HEC)
76+
.validTokens(
77+
Arrays.asList(
78+
new ObservabilityPipelineSplunkHecSourceValidToken()
79+
.tokenKey("SPLUNK_HEC_TOKEN")
80+
.enabled(true)
81+
.fieldToAdd(
82+
new ObservabilityPipelineSourceValidTokenFieldToAdd()
83+
.key("token_name")
84+
.value("primary_token")),
85+
new ObservabilityPipelineSplunkHecSourceValidToken()
86+
.tokenKey("SPLUNK_HEC_TOKEN_BACKUP")
87+
.enabled(false)))))))
88+
.name("Pipeline with Splunk HEC valid_tokens"))
89+
.type("pipelines"));
90+
91+
try {
92+
ValidationResponse result = apiInstance.validatePipeline(body);
93+
System.out.println(result);
94+
} catch (ApiException e) {
95+
System.err.println("Exception when calling ObservabilityPipelinesApi#validatePipeline");
96+
System.err.println("Status code: " + e.getCode());
97+
System.err.println("Reason: " + e.getResponseBody());
98+
System.err.println("Response headers: " + e.getResponseHeaders());
99+
e.printStackTrace();
100+
}
101+
}
102+
}

0 commit comments

Comments
 (0)