Skip to content

Commit 95edcab

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
OP make 'support_rules' field in parse_grok processor optional (#3233)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 73cf26a commit 95edcab

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "a6f5281",
3-
"generated": "2025-08-06 17:44:48.123"
2+
"spec_repo_commit": "befda92",
3+
"generated": "2025-08-06 19:12:53.581"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28224,7 +28224,6 @@ components:
2822428224
required:
2822528225
- source
2822628226
- match_rules
28227-
- support_rules
2822828227
type: object
2822928228
ObservabilityPipelineParseGrokProcessorRuleMatchRule:
2823028229
description: 'Defines a Grok parsing rule, which extracts structured fields

api/datadogV2/model_observability_pipeline_parse_grok_processor_rule.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type ObservabilityPipelineParseGrokProcessorRule struct {
2121
Source string `json:"source"`
2222
// A list of Grok helper rules that can be referenced by the parsing rules.
2323
//
24-
SupportRules []ObservabilityPipelineParseGrokProcessorRuleSupportRule `json:"support_rules"`
24+
SupportRules []ObservabilityPipelineParseGrokProcessorRuleSupportRule `json:"support_rules,omitempty"`
2525
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2626
UnparsedObject map[string]interface{} `json:"-"`
2727
AdditionalProperties map[string]interface{} `json:"-"`
@@ -31,11 +31,10 @@ type ObservabilityPipelineParseGrokProcessorRule struct {
3131
// This constructor will assign default values to properties that have it defined,
3232
// and makes sure properties required by API are set, but the set of arguments
3333
// will change when the set of required properties is changed.
34-
func NewObservabilityPipelineParseGrokProcessorRule(matchRules []ObservabilityPipelineParseGrokProcessorRuleMatchRule, source string, supportRules []ObservabilityPipelineParseGrokProcessorRuleSupportRule) *ObservabilityPipelineParseGrokProcessorRule {
34+
func NewObservabilityPipelineParseGrokProcessorRule(matchRules []ObservabilityPipelineParseGrokProcessorRuleMatchRule, source string) *ObservabilityPipelineParseGrokProcessorRule {
3535
this := ObservabilityPipelineParseGrokProcessorRule{}
3636
this.MatchRules = matchRules
3737
this.Source = source
38-
this.SupportRules = supportRules
3938
return &this
4039
}
4140

@@ -93,25 +92,30 @@ func (o *ObservabilityPipelineParseGrokProcessorRule) SetSource(v string) {
9392
o.Source = v
9493
}
9594

96-
// GetSupportRules returns the SupportRules field value.
95+
// GetSupportRules returns the SupportRules field value if set, zero value otherwise.
9796
func (o *ObservabilityPipelineParseGrokProcessorRule) GetSupportRules() []ObservabilityPipelineParseGrokProcessorRuleSupportRule {
98-
if o == nil {
97+
if o == nil || o.SupportRules == nil {
9998
var ret []ObservabilityPipelineParseGrokProcessorRuleSupportRule
10099
return ret
101100
}
102101
return o.SupportRules
103102
}
104103

105-
// GetSupportRulesOk returns a tuple with the SupportRules field value
104+
// GetSupportRulesOk returns a tuple with the SupportRules field value if set, nil otherwise
106105
// and a boolean to check if the value has been set.
107106
func (o *ObservabilityPipelineParseGrokProcessorRule) GetSupportRulesOk() (*[]ObservabilityPipelineParseGrokProcessorRuleSupportRule, bool) {
108-
if o == nil {
107+
if o == nil || o.SupportRules == nil {
109108
return nil, false
110109
}
111110
return &o.SupportRules, true
112111
}
113112

114-
// SetSupportRules sets field value.
113+
// HasSupportRules returns a boolean if a field has been set.
114+
func (o *ObservabilityPipelineParseGrokProcessorRule) HasSupportRules() bool {
115+
return o != nil && o.SupportRules != nil
116+
}
117+
118+
// SetSupportRules gets a reference to the given []ObservabilityPipelineParseGrokProcessorRuleSupportRule and assigns it to the SupportRules field.
115119
func (o *ObservabilityPipelineParseGrokProcessorRule) SetSupportRules(v []ObservabilityPipelineParseGrokProcessorRuleSupportRule) {
116120
o.SupportRules = v
117121
}
@@ -124,7 +128,9 @@ func (o ObservabilityPipelineParseGrokProcessorRule) MarshalJSON() ([]byte, erro
124128
}
125129
toSerialize["match_rules"] = o.MatchRules
126130
toSerialize["source"] = o.Source
127-
toSerialize["support_rules"] = o.SupportRules
131+
if o.SupportRules != nil {
132+
toSerialize["support_rules"] = o.SupportRules
133+
}
128134

129135
for key, value := range o.AdditionalProperties {
130136
toSerialize[key] = value
@@ -135,9 +141,9 @@ func (o ObservabilityPipelineParseGrokProcessorRule) MarshalJSON() ([]byte, erro
135141
// UnmarshalJSON deserializes the given payload.
136142
func (o *ObservabilityPipelineParseGrokProcessorRule) UnmarshalJSON(bytes []byte) (err error) {
137143
all := struct {
138-
MatchRules *[]ObservabilityPipelineParseGrokProcessorRuleMatchRule `json:"match_rules"`
139-
Source *string `json:"source"`
140-
SupportRules *[]ObservabilityPipelineParseGrokProcessorRuleSupportRule `json:"support_rules"`
144+
MatchRules *[]ObservabilityPipelineParseGrokProcessorRuleMatchRule `json:"match_rules"`
145+
Source *string `json:"source"`
146+
SupportRules []ObservabilityPipelineParseGrokProcessorRuleSupportRule `json:"support_rules,omitempty"`
141147
}{}
142148
if err = datadog.Unmarshal(bytes, &all); err != nil {
143149
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -148,9 +154,6 @@ func (o *ObservabilityPipelineParseGrokProcessorRule) UnmarshalJSON(bytes []byte
148154
if all.Source == nil {
149155
return fmt.Errorf("required field source missing")
150156
}
151-
if all.SupportRules == nil {
152-
return fmt.Errorf("required field support_rules missing")
153-
}
154157
additionalProperties := make(map[string]interface{})
155158
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
156159
datadog.DeleteKeys(additionalProperties, &[]string{"match_rules", "source", "support_rules"})
@@ -159,7 +162,7 @@ func (o *ObservabilityPipelineParseGrokProcessorRule) UnmarshalJSON(bytes []byte
159162
}
160163
o.MatchRules = *all.MatchRules
161164
o.Source = *all.Source
162-
o.SupportRules = *all.SupportRules
165+
o.SupportRules = all.SupportRules
163166

164167
if len(additionalProperties) > 0 {
165168
o.AdditionalProperties = additionalProperties

0 commit comments

Comments
 (0)