Skip to content

Commit ba3af12

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Adding datastream to Open Search destination and adding Auth Strategy for Observability Pipeline API (#3614)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 799994f commit ba3af12

4 files changed

Lines changed: 238 additions & 5 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38691,12 +38691,14 @@ components:
3869138691
- none
3869238692
- basic
3869338693
- bearer
38694+
- custom
3869438695
example: basic
3869538696
type: string
3869638697
x-enum-varnames:
3869738698
- NONE
3869838699
- BASIC
3869938700
- BEARER
38701+
- CUSTOM
3870038702
ObservabilityPipelineHttpClientSourceType:
3870138703
default: http_client
3870238704
description: The source type. The value should always be `http_client`.
@@ -39259,6 +39261,8 @@ components:
3925939261
description: The index to write logs to.
3926039262
example: logs-index
3926139263
type: string
39264+
data_stream:
39265+
$ref: '#/components/schemas/ObservabilityPipelineOpenSearchDestinationDataStream'
3926239266
id:
3926339267
description: The unique identifier for this component.
3926439268
example: opensearch-destination
@@ -39280,6 +39284,23 @@ components:
3928039284
type: object
3928139285
x-pipeline-types:
3928239286
- logs
39287+
ObservabilityPipelineOpenSearchDestinationDataStream:
39288+
description: Configuration options for writing to OpenSearch Data Streams instead
39289+
of a fixed index.
39290+
properties:
39291+
dataset:
39292+
description: The data stream dataset for your logs. This groups logs by
39293+
their source or application.
39294+
type: string
39295+
dtype:
39296+
description: The data stream type for your logs. This determines how logs
39297+
are categorized within the data stream.
39298+
type: string
39299+
namespace:
39300+
description: The data stream namespace for your logs. This separates logs
39301+
into different environments or domains.
39302+
type: string
39303+
type: object
3928339304
ObservabilityPipelineOpenSearchDestinationType:
3928439305
default: opensearch
3928539306
description: The destination type. The value should always be `opensearch`.

api/datadogV2/model_observability_pipeline_http_client_source_auth_strategy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ const (
1818
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_NONE ObservabilityPipelineHttpClientSourceAuthStrategy = "none"
1919
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_BASIC ObservabilityPipelineHttpClientSourceAuthStrategy = "basic"
2020
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_BEARER ObservabilityPipelineHttpClientSourceAuthStrategy = "bearer"
21+
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_CUSTOM ObservabilityPipelineHttpClientSourceAuthStrategy = "custom"
2122
)
2223

2324
var allowedObservabilityPipelineHttpClientSourceAuthStrategyEnumValues = []ObservabilityPipelineHttpClientSourceAuthStrategy{
2425
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_NONE,
2526
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_BASIC,
2627
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_BEARER,
28+
OBSERVABILITYPIPELINEHTTPCLIENTSOURCEAUTHSTRATEGY_CUSTOM,
2729
}
2830

2931
// GetAllowedValues reeturns the list of possible values.

api/datadogV2/model_observability_pipeline_open_search_destination.go

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
type ObservabilityPipelineOpenSearchDestination struct {
1717
// The index to write logs to.
1818
BulkIndex *string `json:"bulk_index,omitempty"`
19+
// Configuration options for writing to OpenSearch Data Streams instead of a fixed index.
20+
DataStream *ObservabilityPipelineOpenSearchDestinationDataStream `json:"data_stream,omitempty"`
1921
// The unique identifier for this component.
2022
Id string `json:"id"`
2123
// A list of component IDs whose output is used as the `input` for this component.
@@ -77,6 +79,34 @@ func (o *ObservabilityPipelineOpenSearchDestination) SetBulkIndex(v string) {
7779
o.BulkIndex = &v
7880
}
7981

82+
// GetDataStream returns the DataStream field value if set, zero value otherwise.
83+
func (o *ObservabilityPipelineOpenSearchDestination) GetDataStream() ObservabilityPipelineOpenSearchDestinationDataStream {
84+
if o == nil || o.DataStream == nil {
85+
var ret ObservabilityPipelineOpenSearchDestinationDataStream
86+
return ret
87+
}
88+
return *o.DataStream
89+
}
90+
91+
// GetDataStreamOk returns a tuple with the DataStream field value if set, nil otherwise
92+
// and a boolean to check if the value has been set.
93+
func (o *ObservabilityPipelineOpenSearchDestination) GetDataStreamOk() (*ObservabilityPipelineOpenSearchDestinationDataStream, bool) {
94+
if o == nil || o.DataStream == nil {
95+
return nil, false
96+
}
97+
return o.DataStream, true
98+
}
99+
100+
// HasDataStream returns a boolean if a field has been set.
101+
func (o *ObservabilityPipelineOpenSearchDestination) HasDataStream() bool {
102+
return o != nil && o.DataStream != nil
103+
}
104+
105+
// SetDataStream gets a reference to the given ObservabilityPipelineOpenSearchDestinationDataStream and assigns it to the DataStream field.
106+
func (o *ObservabilityPipelineOpenSearchDestination) SetDataStream(v ObservabilityPipelineOpenSearchDestinationDataStream) {
107+
o.DataStream = &v
108+
}
109+
80110
// GetId returns the Id field value.
81111
func (o *ObservabilityPipelineOpenSearchDestination) GetId() string {
82112
if o == nil {
@@ -155,6 +185,9 @@ func (o ObservabilityPipelineOpenSearchDestination) MarshalJSON() ([]byte, error
155185
if o.BulkIndex != nil {
156186
toSerialize["bulk_index"] = o.BulkIndex
157187
}
188+
if o.DataStream != nil {
189+
toSerialize["data_stream"] = o.DataStream
190+
}
158191
toSerialize["id"] = o.Id
159192
toSerialize["inputs"] = o.Inputs
160193
toSerialize["type"] = o.Type
@@ -168,10 +201,11 @@ func (o ObservabilityPipelineOpenSearchDestination) MarshalJSON() ([]byte, error
168201
// UnmarshalJSON deserializes the given payload.
169202
func (o *ObservabilityPipelineOpenSearchDestination) UnmarshalJSON(bytes []byte) (err error) {
170203
all := struct {
171-
BulkIndex *string `json:"bulk_index,omitempty"`
172-
Id *string `json:"id"`
173-
Inputs *[]string `json:"inputs"`
174-
Type *ObservabilityPipelineOpenSearchDestinationType `json:"type"`
204+
BulkIndex *string `json:"bulk_index,omitempty"`
205+
DataStream *ObservabilityPipelineOpenSearchDestinationDataStream `json:"data_stream,omitempty"`
206+
Id *string `json:"id"`
207+
Inputs *[]string `json:"inputs"`
208+
Type *ObservabilityPipelineOpenSearchDestinationType `json:"type"`
175209
}{}
176210
if err = datadog.Unmarshal(bytes, &all); err != nil {
177211
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -187,13 +221,17 @@ func (o *ObservabilityPipelineOpenSearchDestination) UnmarshalJSON(bytes []byte)
187221
}
188222
additionalProperties := make(map[string]interface{})
189223
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
190-
datadog.DeleteKeys(additionalProperties, &[]string{"bulk_index", "id", "inputs", "type"})
224+
datadog.DeleteKeys(additionalProperties, &[]string{"bulk_index", "data_stream", "id", "inputs", "type"})
191225
} else {
192226
return err
193227
}
194228

195229
hasInvalidField := false
196230
o.BulkIndex = all.BulkIndex
231+
if all.DataStream != nil && all.DataStream.UnparsedObject != nil && o.UnparsedObject == nil {
232+
hasInvalidField = true
233+
}
234+
o.DataStream = all.DataStream
197235
o.Id = *all.Id
198236
o.Inputs = *all.Inputs
199237
if !all.Type.IsValid() {
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
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+
5+
package datadogV2
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// ObservabilityPipelineOpenSearchDestinationDataStream Configuration options for writing to OpenSearch Data Streams instead of a fixed index.
12+
type ObservabilityPipelineOpenSearchDestinationDataStream struct {
13+
// The data stream dataset for your logs. This groups logs by their source or application.
14+
Dataset *string `json:"dataset,omitempty"`
15+
// The data stream type for your logs. This determines how logs are categorized within the data stream.
16+
Dtype *string `json:"dtype,omitempty"`
17+
// The data stream namespace for your logs. This separates logs into different environments or domains.
18+
Namespace *string `json:"namespace,omitempty"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewObservabilityPipelineOpenSearchDestinationDataStream instantiates a new ObservabilityPipelineOpenSearchDestinationDataStream object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewObservabilityPipelineOpenSearchDestinationDataStream() *ObservabilityPipelineOpenSearchDestinationDataStream {
29+
this := ObservabilityPipelineOpenSearchDestinationDataStream{}
30+
return &this
31+
}
32+
33+
// NewObservabilityPipelineOpenSearchDestinationDataStreamWithDefaults instantiates a new ObservabilityPipelineOpenSearchDestinationDataStream object.
34+
// This constructor will only assign default values to properties that have it defined,
35+
// but it doesn't guarantee that properties required by API are set.
36+
func NewObservabilityPipelineOpenSearchDestinationDataStreamWithDefaults() *ObservabilityPipelineOpenSearchDestinationDataStream {
37+
this := ObservabilityPipelineOpenSearchDestinationDataStream{}
38+
return &this
39+
}
40+
41+
// GetDataset returns the Dataset field value if set, zero value otherwise.
42+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDataset() string {
43+
if o == nil || o.Dataset == nil {
44+
var ret string
45+
return ret
46+
}
47+
return *o.Dataset
48+
}
49+
50+
// GetDatasetOk returns a tuple with the Dataset field value if set, nil otherwise
51+
// and a boolean to check if the value has been set.
52+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDatasetOk() (*string, bool) {
53+
if o == nil || o.Dataset == nil {
54+
return nil, false
55+
}
56+
return o.Dataset, true
57+
}
58+
59+
// HasDataset returns a boolean if a field has been set.
60+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) HasDataset() bool {
61+
return o != nil && o.Dataset != nil
62+
}
63+
64+
// SetDataset gets a reference to the given string and assigns it to the Dataset field.
65+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) SetDataset(v string) {
66+
o.Dataset = &v
67+
}
68+
69+
// GetDtype returns the Dtype field value if set, zero value otherwise.
70+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDtype() string {
71+
if o == nil || o.Dtype == nil {
72+
var ret string
73+
return ret
74+
}
75+
return *o.Dtype
76+
}
77+
78+
// GetDtypeOk returns a tuple with the Dtype field value if set, nil otherwise
79+
// and a boolean to check if the value has been set.
80+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetDtypeOk() (*string, bool) {
81+
if o == nil || o.Dtype == nil {
82+
return nil, false
83+
}
84+
return o.Dtype, true
85+
}
86+
87+
// HasDtype returns a boolean if a field has been set.
88+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) HasDtype() bool {
89+
return o != nil && o.Dtype != nil
90+
}
91+
92+
// SetDtype gets a reference to the given string and assigns it to the Dtype field.
93+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) SetDtype(v string) {
94+
o.Dtype = &v
95+
}
96+
97+
// GetNamespace returns the Namespace field value if set, zero value otherwise.
98+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetNamespace() string {
99+
if o == nil || o.Namespace == nil {
100+
var ret string
101+
return ret
102+
}
103+
return *o.Namespace
104+
}
105+
106+
// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise
107+
// and a boolean to check if the value has been set.
108+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) GetNamespaceOk() (*string, bool) {
109+
if o == nil || o.Namespace == nil {
110+
return nil, false
111+
}
112+
return o.Namespace, true
113+
}
114+
115+
// HasNamespace returns a boolean if a field has been set.
116+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) HasNamespace() bool {
117+
return o != nil && o.Namespace != nil
118+
}
119+
120+
// SetNamespace gets a reference to the given string and assigns it to the Namespace field.
121+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) SetNamespace(v string) {
122+
o.Namespace = &v
123+
}
124+
125+
// MarshalJSON serializes the struct using spec logic.
126+
func (o ObservabilityPipelineOpenSearchDestinationDataStream) MarshalJSON() ([]byte, error) {
127+
toSerialize := map[string]interface{}{}
128+
if o.UnparsedObject != nil {
129+
return datadog.Marshal(o.UnparsedObject)
130+
}
131+
if o.Dataset != nil {
132+
toSerialize["dataset"] = o.Dataset
133+
}
134+
if o.Dtype != nil {
135+
toSerialize["dtype"] = o.Dtype
136+
}
137+
if o.Namespace != nil {
138+
toSerialize["namespace"] = o.Namespace
139+
}
140+
141+
for key, value := range o.AdditionalProperties {
142+
toSerialize[key] = value
143+
}
144+
return datadog.Marshal(toSerialize)
145+
}
146+
147+
// UnmarshalJSON deserializes the given payload.
148+
func (o *ObservabilityPipelineOpenSearchDestinationDataStream) UnmarshalJSON(bytes []byte) (err error) {
149+
all := struct {
150+
Dataset *string `json:"dataset,omitempty"`
151+
Dtype *string `json:"dtype,omitempty"`
152+
Namespace *string `json:"namespace,omitempty"`
153+
}{}
154+
if err = datadog.Unmarshal(bytes, &all); err != nil {
155+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
156+
}
157+
additionalProperties := make(map[string]interface{})
158+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
159+
datadog.DeleteKeys(additionalProperties, &[]string{"dataset", "dtype", "namespace"})
160+
} else {
161+
return err
162+
}
163+
o.Dataset = all.Dataset
164+
o.Dtype = all.Dtype
165+
o.Namespace = all.Namespace
166+
167+
if len(additionalProperties) > 0 {
168+
o.AdditionalProperties = additionalProperties
169+
}
170+
171+
return nil
172+
}

0 commit comments

Comments
 (0)