Skip to content

Commit 1ddd4ab

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Resolve issue where the go client cannot resolve between memoryBuffer and memoryBufferSize options (DataDog#3698)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 12edd51 commit 1ddd4ab

5 files changed

Lines changed: 66 additions & 63 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39639,6 +39639,8 @@ components:
3963939639
$ref: '#/components/schemas/ObservabilityPipelineBufferOptionsDiskType'
3964039640
when_full:
3964139641
$ref: '#/components/schemas/ObservabilityPipelineBufferOptionsWhenFull'
39642+
required:
39643+
- max_size
3964239644
type: object
3964339645
ObservabilityPipelineElasticsearchDestination:
3964439646
description: 'The `elasticsearch` destination writes logs to an Elasticsearch
@@ -40892,6 +40894,8 @@ components:
4089240894
$ref: '#/components/schemas/ObservabilityPipelineBufferOptionsMemoryType'
4089340895
when_full:
4089440896
$ref: '#/components/schemas/ObservabilityPipelineBufferOptionsWhenFull'
40897+
required:
40898+
- max_size
4089540899
type: object
4089640900
ObservabilityPipelineMemoryBufferSizeOptions:
4089740901
description: Options for configuring a memory buffer by queue length.
@@ -40905,6 +40909,8 @@ components:
4090540909
$ref: '#/components/schemas/ObservabilityPipelineBufferOptionsMemoryType'
4090640910
when_full:
4090740911
$ref: '#/components/schemas/ObservabilityPipelineBufferOptionsWhenFull'
40912+
required:
40913+
- max_events
4090840914
type: object
4090940915
ObservabilityPipelineMetadataEntry:
4091040916
description: A custom metadata entry.

api/datadogV2/model_observability_pipeline_buffer_options.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (obj *ObservabilityPipelineBufferOptions) UnmarshalJSON(data []byte) error
4242
if err == nil {
4343
if obj.ObservabilityPipelineDiskBufferOptions != nil && obj.ObservabilityPipelineDiskBufferOptions.UnparsedObject == nil {
4444
jsonObservabilityPipelineDiskBufferOptions, _ := datadog.Marshal(obj.ObservabilityPipelineDiskBufferOptions)
45-
if string(jsonObservabilityPipelineDiskBufferOptions) == "{}" && string(data) != "{}" { // empty struct
45+
if string(jsonObservabilityPipelineDiskBufferOptions) == "{}" { // empty struct
4646
obj.ObservabilityPipelineDiskBufferOptions = nil
4747
} else {
4848
match++
@@ -59,7 +59,7 @@ func (obj *ObservabilityPipelineBufferOptions) UnmarshalJSON(data []byte) error
5959
if err == nil {
6060
if obj.ObservabilityPipelineMemoryBufferOptions != nil && obj.ObservabilityPipelineMemoryBufferOptions.UnparsedObject == nil {
6161
jsonObservabilityPipelineMemoryBufferOptions, _ := datadog.Marshal(obj.ObservabilityPipelineMemoryBufferOptions)
62-
if string(jsonObservabilityPipelineMemoryBufferOptions) == "{}" && string(data) != "{}" { // empty struct
62+
if string(jsonObservabilityPipelineMemoryBufferOptions) == "{}" { // empty struct
6363
obj.ObservabilityPipelineMemoryBufferOptions = nil
6464
} else {
6565
match++
@@ -76,7 +76,7 @@ func (obj *ObservabilityPipelineBufferOptions) UnmarshalJSON(data []byte) error
7676
if err == nil {
7777
if obj.ObservabilityPipelineMemoryBufferSizeOptions != nil && obj.ObservabilityPipelineMemoryBufferSizeOptions.UnparsedObject == nil {
7878
jsonObservabilityPipelineMemoryBufferSizeOptions, _ := datadog.Marshal(obj.ObservabilityPipelineMemoryBufferSizeOptions)
79-
if string(jsonObservabilityPipelineMemoryBufferSizeOptions) == "{}" && string(data) != "{}" { // empty struct
79+
if string(jsonObservabilityPipelineMemoryBufferSizeOptions) == "{}" { // empty struct
8080
obj.ObservabilityPipelineMemoryBufferSizeOptions = nil
8181
} else {
8282
match++

api/datadogV2/model_observability_pipeline_disk_buffer_options.go

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
package datadogV2
66

77
import (
8+
"fmt"
9+
810
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
911
)
1012

1113
// ObservabilityPipelineDiskBufferOptions Options for configuring a disk buffer.
1214
type ObservabilityPipelineDiskBufferOptions struct {
1315
// Maximum size of the disk buffer.
14-
MaxSize *int64 `json:"max_size,omitempty"`
16+
MaxSize int64 `json:"max_size"`
1517
// The type of the buffer that will be configured, a disk buffer.
1618
Type *ObservabilityPipelineBufferOptionsDiskType `json:"type,omitempty"`
1719
// Behavior when the buffer is full (block and stop accepting new events, or drop new events)
@@ -25,8 +27,9 @@ type ObservabilityPipelineDiskBufferOptions struct {
2527
// This constructor will assign default values to properties that have it defined,
2628
// and makes sure properties required by API are set, but the set of arguments
2729
// will change when the set of required properties is changed.
28-
func NewObservabilityPipelineDiskBufferOptions() *ObservabilityPipelineDiskBufferOptions {
30+
func NewObservabilityPipelineDiskBufferOptions(maxSize int64) *ObservabilityPipelineDiskBufferOptions {
2931
this := ObservabilityPipelineDiskBufferOptions{}
32+
this.MaxSize = maxSize
3033
var typeVar ObservabilityPipelineBufferOptionsDiskType = OBSERVABILITYPIPELINEBUFFEROPTIONSDISKTYPE_DISK
3134
this.Type = &typeVar
3235
var whenFull ObservabilityPipelineBufferOptionsWhenFull = OBSERVABILITYPIPELINEBUFFEROPTIONSWHENFULL_BLOCK
@@ -46,32 +49,27 @@ func NewObservabilityPipelineDiskBufferOptionsWithDefaults() *ObservabilityPipel
4649
return &this
4750
}
4851

49-
// GetMaxSize returns the MaxSize field value if set, zero value otherwise.
52+
// GetMaxSize returns the MaxSize field value.
5053
func (o *ObservabilityPipelineDiskBufferOptions) GetMaxSize() int64 {
51-
if o == nil || o.MaxSize == nil {
54+
if o == nil {
5255
var ret int64
5356
return ret
5457
}
55-
return *o.MaxSize
58+
return o.MaxSize
5659
}
5760

58-
// GetMaxSizeOk returns a tuple with the MaxSize field value if set, nil otherwise
61+
// GetMaxSizeOk returns a tuple with the MaxSize field value
5962
// and a boolean to check if the value has been set.
6063
func (o *ObservabilityPipelineDiskBufferOptions) GetMaxSizeOk() (*int64, bool) {
61-
if o == nil || o.MaxSize == nil {
64+
if o == nil {
6265
return nil, false
6366
}
64-
return o.MaxSize, true
65-
}
66-
67-
// HasMaxSize returns a boolean if a field has been set.
68-
func (o *ObservabilityPipelineDiskBufferOptions) HasMaxSize() bool {
69-
return o != nil && o.MaxSize != nil
67+
return &o.MaxSize, true
7068
}
7169

72-
// SetMaxSize gets a reference to the given int64 and assigns it to the MaxSize field.
70+
// SetMaxSize sets field value.
7371
func (o *ObservabilityPipelineDiskBufferOptions) SetMaxSize(v int64) {
74-
o.MaxSize = &v
72+
o.MaxSize = v
7573
}
7674

7775
// GetType returns the Type field value if set, zero value otherwise.
@@ -136,9 +134,7 @@ func (o ObservabilityPipelineDiskBufferOptions) MarshalJSON() ([]byte, error) {
136134
if o.UnparsedObject != nil {
137135
return datadog.Marshal(o.UnparsedObject)
138136
}
139-
if o.MaxSize != nil {
140-
toSerialize["max_size"] = o.MaxSize
141-
}
137+
toSerialize["max_size"] = o.MaxSize
142138
if o.Type != nil {
143139
toSerialize["type"] = o.Type
144140
}
@@ -155,13 +151,16 @@ func (o ObservabilityPipelineDiskBufferOptions) MarshalJSON() ([]byte, error) {
155151
// UnmarshalJSON deserializes the given payload.
156152
func (o *ObservabilityPipelineDiskBufferOptions) UnmarshalJSON(bytes []byte) (err error) {
157153
all := struct {
158-
MaxSize *int64 `json:"max_size,omitempty"`
154+
MaxSize *int64 `json:"max_size"`
159155
Type *ObservabilityPipelineBufferOptionsDiskType `json:"type,omitempty"`
160156
WhenFull *ObservabilityPipelineBufferOptionsWhenFull `json:"when_full,omitempty"`
161157
}{}
162158
if err = datadog.Unmarshal(bytes, &all); err != nil {
163159
return datadog.Unmarshal(bytes, &o.UnparsedObject)
164160
}
161+
if all.MaxSize == nil {
162+
return fmt.Errorf("required field max_size missing")
163+
}
165164
additionalProperties := make(map[string]interface{})
166165
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
167166
datadog.DeleteKeys(additionalProperties, &[]string{"max_size", "type", "when_full"})
@@ -170,7 +169,7 @@ func (o *ObservabilityPipelineDiskBufferOptions) UnmarshalJSON(bytes []byte) (er
170169
}
171170

172171
hasInvalidField := false
173-
o.MaxSize = all.MaxSize
172+
o.MaxSize = *all.MaxSize
174173
if all.Type != nil && !all.Type.IsValid() {
175174
hasInvalidField = true
176175
} else {

api/datadogV2/model_observability_pipeline_memory_buffer_options.go

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
package datadogV2
66

77
import (
8+
"fmt"
9+
810
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
911
)
1012

1113
// ObservabilityPipelineMemoryBufferOptions Options for configuring a memory buffer by byte size.
1214
type ObservabilityPipelineMemoryBufferOptions struct {
1315
// Maximum size of the memory buffer.
14-
MaxSize *int64 `json:"max_size,omitempty"`
16+
MaxSize int64 `json:"max_size"`
1517
// The type of the buffer that will be configured, a memory buffer.
1618
Type *ObservabilityPipelineBufferOptionsMemoryType `json:"type,omitempty"`
1719
// Behavior when the buffer is full (block and stop accepting new events, or drop new events)
@@ -25,8 +27,9 @@ type ObservabilityPipelineMemoryBufferOptions struct {
2527
// This constructor will assign default values to properties that have it defined,
2628
// and makes sure properties required by API are set, but the set of arguments
2729
// will change when the set of required properties is changed.
28-
func NewObservabilityPipelineMemoryBufferOptions() *ObservabilityPipelineMemoryBufferOptions {
30+
func NewObservabilityPipelineMemoryBufferOptions(maxSize int64) *ObservabilityPipelineMemoryBufferOptions {
2931
this := ObservabilityPipelineMemoryBufferOptions{}
32+
this.MaxSize = maxSize
3033
var typeVar ObservabilityPipelineBufferOptionsMemoryType = OBSERVABILITYPIPELINEBUFFEROPTIONSMEMORYTYPE_MEMORY
3134
this.Type = &typeVar
3235
var whenFull ObservabilityPipelineBufferOptionsWhenFull = OBSERVABILITYPIPELINEBUFFEROPTIONSWHENFULL_BLOCK
@@ -46,32 +49,27 @@ func NewObservabilityPipelineMemoryBufferOptionsWithDefaults() *ObservabilityPip
4649
return &this
4750
}
4851

49-
// GetMaxSize returns the MaxSize field value if set, zero value otherwise.
52+
// GetMaxSize returns the MaxSize field value.
5053
func (o *ObservabilityPipelineMemoryBufferOptions) GetMaxSize() int64 {
51-
if o == nil || o.MaxSize == nil {
54+
if o == nil {
5255
var ret int64
5356
return ret
5457
}
55-
return *o.MaxSize
58+
return o.MaxSize
5659
}
5760

58-
// GetMaxSizeOk returns a tuple with the MaxSize field value if set, nil otherwise
61+
// GetMaxSizeOk returns a tuple with the MaxSize field value
5962
// and a boolean to check if the value has been set.
6063
func (o *ObservabilityPipelineMemoryBufferOptions) GetMaxSizeOk() (*int64, bool) {
61-
if o == nil || o.MaxSize == nil {
64+
if o == nil {
6265
return nil, false
6366
}
64-
return o.MaxSize, true
65-
}
66-
67-
// HasMaxSize returns a boolean if a field has been set.
68-
func (o *ObservabilityPipelineMemoryBufferOptions) HasMaxSize() bool {
69-
return o != nil && o.MaxSize != nil
67+
return &o.MaxSize, true
7068
}
7169

72-
// SetMaxSize gets a reference to the given int64 and assigns it to the MaxSize field.
70+
// SetMaxSize sets field value.
7371
func (o *ObservabilityPipelineMemoryBufferOptions) SetMaxSize(v int64) {
74-
o.MaxSize = &v
72+
o.MaxSize = v
7573
}
7674

7775
// GetType returns the Type field value if set, zero value otherwise.
@@ -136,9 +134,7 @@ func (o ObservabilityPipelineMemoryBufferOptions) MarshalJSON() ([]byte, error)
136134
if o.UnparsedObject != nil {
137135
return datadog.Marshal(o.UnparsedObject)
138136
}
139-
if o.MaxSize != nil {
140-
toSerialize["max_size"] = o.MaxSize
141-
}
137+
toSerialize["max_size"] = o.MaxSize
142138
if o.Type != nil {
143139
toSerialize["type"] = o.Type
144140
}
@@ -155,13 +151,16 @@ func (o ObservabilityPipelineMemoryBufferOptions) MarshalJSON() ([]byte, error)
155151
// UnmarshalJSON deserializes the given payload.
156152
func (o *ObservabilityPipelineMemoryBufferOptions) UnmarshalJSON(bytes []byte) (err error) {
157153
all := struct {
158-
MaxSize *int64 `json:"max_size,omitempty"`
154+
MaxSize *int64 `json:"max_size"`
159155
Type *ObservabilityPipelineBufferOptionsMemoryType `json:"type,omitempty"`
160156
WhenFull *ObservabilityPipelineBufferOptionsWhenFull `json:"when_full,omitempty"`
161157
}{}
162158
if err = datadog.Unmarshal(bytes, &all); err != nil {
163159
return datadog.Unmarshal(bytes, &o.UnparsedObject)
164160
}
161+
if all.MaxSize == nil {
162+
return fmt.Errorf("required field max_size missing")
163+
}
165164
additionalProperties := make(map[string]interface{})
166165
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
167166
datadog.DeleteKeys(additionalProperties, &[]string{"max_size", "type", "when_full"})
@@ -170,7 +169,7 @@ func (o *ObservabilityPipelineMemoryBufferOptions) UnmarshalJSON(bytes []byte) (
170169
}
171170

172171
hasInvalidField := false
173-
o.MaxSize = all.MaxSize
172+
o.MaxSize = *all.MaxSize
174173
if all.Type != nil && !all.Type.IsValid() {
175174
hasInvalidField = true
176175
} else {

api/datadogV2/model_observability_pipeline_memory_buffer_size_options.go

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
package datadogV2
66

77
import (
8+
"fmt"
9+
810
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
911
)
1012

1113
// ObservabilityPipelineMemoryBufferSizeOptions Options for configuring a memory buffer by queue length.
1214
type ObservabilityPipelineMemoryBufferSizeOptions struct {
1315
// Maximum events for the memory buffer.
14-
MaxEvents *int64 `json:"max_events,omitempty"`
16+
MaxEvents int64 `json:"max_events"`
1517
// The type of the buffer that will be configured, a memory buffer.
1618
Type *ObservabilityPipelineBufferOptionsMemoryType `json:"type,omitempty"`
1719
// Behavior when the buffer is full (block and stop accepting new events, or drop new events)
@@ -25,8 +27,9 @@ type ObservabilityPipelineMemoryBufferSizeOptions struct {
2527
// This constructor will assign default values to properties that have it defined,
2628
// and makes sure properties required by API are set, but the set of arguments
2729
// will change when the set of required properties is changed.
28-
func NewObservabilityPipelineMemoryBufferSizeOptions() *ObservabilityPipelineMemoryBufferSizeOptions {
30+
func NewObservabilityPipelineMemoryBufferSizeOptions(maxEvents int64) *ObservabilityPipelineMemoryBufferSizeOptions {
2931
this := ObservabilityPipelineMemoryBufferSizeOptions{}
32+
this.MaxEvents = maxEvents
3033
var typeVar ObservabilityPipelineBufferOptionsMemoryType = OBSERVABILITYPIPELINEBUFFEROPTIONSMEMORYTYPE_MEMORY
3134
this.Type = &typeVar
3235
var whenFull ObservabilityPipelineBufferOptionsWhenFull = OBSERVABILITYPIPELINEBUFFEROPTIONSWHENFULL_BLOCK
@@ -46,32 +49,27 @@ func NewObservabilityPipelineMemoryBufferSizeOptionsWithDefaults() *Observabilit
4649
return &this
4750
}
4851

49-
// GetMaxEvents returns the MaxEvents field value if set, zero value otherwise.
52+
// GetMaxEvents returns the MaxEvents field value.
5053
func (o *ObservabilityPipelineMemoryBufferSizeOptions) GetMaxEvents() int64 {
51-
if o == nil || o.MaxEvents == nil {
54+
if o == nil {
5255
var ret int64
5356
return ret
5457
}
55-
return *o.MaxEvents
58+
return o.MaxEvents
5659
}
5760

58-
// GetMaxEventsOk returns a tuple with the MaxEvents field value if set, nil otherwise
61+
// GetMaxEventsOk returns a tuple with the MaxEvents field value
5962
// and a boolean to check if the value has been set.
6063
func (o *ObservabilityPipelineMemoryBufferSizeOptions) GetMaxEventsOk() (*int64, bool) {
61-
if o == nil || o.MaxEvents == nil {
64+
if o == nil {
6265
return nil, false
6366
}
64-
return o.MaxEvents, true
65-
}
66-
67-
// HasMaxEvents returns a boolean if a field has been set.
68-
func (o *ObservabilityPipelineMemoryBufferSizeOptions) HasMaxEvents() bool {
69-
return o != nil && o.MaxEvents != nil
67+
return &o.MaxEvents, true
7068
}
7169

72-
// SetMaxEvents gets a reference to the given int64 and assigns it to the MaxEvents field.
70+
// SetMaxEvents sets field value.
7371
func (o *ObservabilityPipelineMemoryBufferSizeOptions) SetMaxEvents(v int64) {
74-
o.MaxEvents = &v
72+
o.MaxEvents = v
7573
}
7674

7775
// GetType returns the Type field value if set, zero value otherwise.
@@ -136,9 +134,7 @@ func (o ObservabilityPipelineMemoryBufferSizeOptions) MarshalJSON() ([]byte, err
136134
if o.UnparsedObject != nil {
137135
return datadog.Marshal(o.UnparsedObject)
138136
}
139-
if o.MaxEvents != nil {
140-
toSerialize["max_events"] = o.MaxEvents
141-
}
137+
toSerialize["max_events"] = o.MaxEvents
142138
if o.Type != nil {
143139
toSerialize["type"] = o.Type
144140
}
@@ -155,13 +151,16 @@ func (o ObservabilityPipelineMemoryBufferSizeOptions) MarshalJSON() ([]byte, err
155151
// UnmarshalJSON deserializes the given payload.
156152
func (o *ObservabilityPipelineMemoryBufferSizeOptions) UnmarshalJSON(bytes []byte) (err error) {
157153
all := struct {
158-
MaxEvents *int64 `json:"max_events,omitempty"`
154+
MaxEvents *int64 `json:"max_events"`
159155
Type *ObservabilityPipelineBufferOptionsMemoryType `json:"type,omitempty"`
160156
WhenFull *ObservabilityPipelineBufferOptionsWhenFull `json:"when_full,omitempty"`
161157
}{}
162158
if err = datadog.Unmarshal(bytes, &all); err != nil {
163159
return datadog.Unmarshal(bytes, &o.UnparsedObject)
164160
}
161+
if all.MaxEvents == nil {
162+
return fmt.Errorf("required field max_events missing")
163+
}
165164
additionalProperties := make(map[string]interface{})
166165
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
167166
datadog.DeleteKeys(additionalProperties, &[]string{"max_events", "type", "when_full"})
@@ -170,7 +169,7 @@ func (o *ObservabilityPipelineMemoryBufferSizeOptions) UnmarshalJSON(bytes []byt
170169
}
171170

172171
hasInvalidField := false
173-
o.MaxEvents = all.MaxEvents
172+
o.MaxEvents = *all.MaxEvents
174173
if all.Type != nil && !all.Type.IsValid() {
175174
hasInvalidField = true
176175
} else {

0 commit comments

Comments
 (0)