From 4915f7092031aef155e7153258bc13897d8e31f9 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:09:26 +0000 Subject: [PATCH] Add tags and description to logs pipelines (#2868) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 9 ++ api/datadogV1/model_logs_pipeline.go | 86 +++++++++++++++++-- .../v1/logs-pipelines/CreateLogsPipeline.go | 1 + .../v1/logs-pipelines/UpdateLogsPipeline.go | 1 + .../features/v1/logs_pipelines.feature | 8 +- 6 files changed, 97 insertions(+), 16 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 7f264faf311..e3bb06c9bf2 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-09 22:06:11.503685", - "spec_repo_commit": "8d40e082" + "regenerated": "2025-01-10 22:21:27.561108", + "spec_repo_commit": "2f8c42a8" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-01-09 22:06:11.519399", - "spec_repo_commit": "8d40e082" + "regenerated": "2025-01-10 22:21:27.576496", + "spec_repo_commit": "2f8c42a8" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 09a4d845e5f..d5ac7b28aae 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -5926,6 +5926,9 @@ components: Make sure to use an application key created by an admin.' properties: + description: + description: A description of the pipeline. + type: string filter: $ref: '#/components/schemas/LogsFilter' id: @@ -5948,6 +5951,12 @@ components: items: $ref: '#/components/schemas/LogsProcessor' type: array + tags: + description: A list of tags associated with the pipeline. + items: + description: A single tag using the format `key:value`. + type: string + type: array type: description: Type of pipeline. example: pipeline diff --git a/api/datadogV1/model_logs_pipeline.go b/api/datadogV1/model_logs_pipeline.go index 9b8def28455..04fc7110a85 100644 --- a/api/datadogV1/model_logs_pipeline.go +++ b/api/datadogV1/model_logs_pipeline.go @@ -16,6 +16,8 @@ import ( // **Note**: These endpoints are only available for admin users. // Make sure to use an application key created by an admin. type LogsPipeline struct { + // A description of the pipeline. + Description *string `json:"description,omitempty"` // Filter for logs. Filter *LogsFilter `json:"filter,omitempty"` // ID of the pipeline. @@ -28,6 +30,8 @@ type LogsPipeline struct { Name string `json:"name"` // Ordered list of processors in this pipeline. Processors []LogsProcessor `json:"processors,omitempty"` + // A list of tags associated with the pipeline. + Tags []string `json:"tags,omitempty"` // Type of pipeline. Type *string `json:"type,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -53,6 +57,34 @@ func NewLogsPipelineWithDefaults() *LogsPipeline { return &this } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LogsPipeline) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *LogsPipeline) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LogsPipeline) SetDescription(v string) { + o.Description = &v +} + // GetFilter returns the Filter field value if set, zero value otherwise. func (o *LogsPipeline) GetFilter() LogsFilter { if o == nil || o.Filter == nil { @@ -216,6 +248,34 @@ func (o *LogsPipeline) SetProcessors(v []LogsProcessor) { o.Processors = v } +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *LogsPipeline) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsPipeline) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *LogsPipeline) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *LogsPipeline) SetTags(v []string) { + o.Tags = v +} + // GetType returns the Type field value if set, zero value otherwise. func (o *LogsPipeline) GetType() string { if o == nil || o.Type == nil { @@ -250,6 +310,9 @@ func (o LogsPipeline) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } + if o.Description != nil { + toSerialize["description"] = o.Description + } if o.Filter != nil { toSerialize["filter"] = o.Filter } @@ -266,6 +329,9 @@ func (o LogsPipeline) MarshalJSON() ([]byte, error) { if o.Processors != nil { toSerialize["processors"] = o.Processors } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } if o.Type != nil { toSerialize["type"] = o.Type } @@ -279,13 +345,15 @@ func (o LogsPipeline) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Filter *LogsFilter `json:"filter,omitempty"` - Id *string `json:"id,omitempty"` - IsEnabled *bool `json:"is_enabled,omitempty"` - IsReadOnly *bool `json:"is_read_only,omitempty"` - Name *string `json:"name"` - Processors []LogsProcessor `json:"processors,omitempty"` - Type *string `json:"type,omitempty"` + Description *string `json:"description,omitempty"` + Filter *LogsFilter `json:"filter,omitempty"` + Id *string `json:"id,omitempty"` + IsEnabled *bool `json:"is_enabled,omitempty"` + IsReadOnly *bool `json:"is_read_only,omitempty"` + Name *string `json:"name"` + Processors []LogsProcessor `json:"processors,omitempty"` + Tags []string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -295,12 +363,13 @@ func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"filter", "id", "is_enabled", "is_read_only", "name", "processors", "type"}) + datadog.DeleteKeys(additionalProperties, &[]string{"description", "filter", "id", "is_enabled", "is_read_only", "name", "processors", "tags", "type"}) } else { return err } hasInvalidField := false + o.Description = all.Description if all.Filter != nil && all.Filter.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } @@ -310,6 +379,7 @@ func (o *LogsPipeline) UnmarshalJSON(bytes []byte) (err error) { o.IsReadOnly = all.IsReadOnly o.Name = *all.Name o.Processors = all.Processors + o.Tags = all.Tags o.Type = all.Type if len(additionalProperties) > 0 { diff --git a/examples/v1/logs-pipelines/CreateLogsPipeline.go b/examples/v1/logs-pipelines/CreateLogsPipeline.go index c3c4e89a5f7..071ae4688da 100644 --- a/examples/v1/logs-pipelines/CreateLogsPipeline.go +++ b/examples/v1/logs-pipelines/CreateLogsPipeline.go @@ -35,6 +35,7 @@ rule_name_2 bar Type: datadogV1.LOGSGROKPARSERTYPE_GROK_PARSER, }}, }, + Tags: []string{}, } ctx := datadog.NewDefaultContext(context.Background()) configuration := datadog.NewConfiguration() diff --git a/examples/v1/logs-pipelines/UpdateLogsPipeline.go b/examples/v1/logs-pipelines/UpdateLogsPipeline.go index 8455c6f3d8f..2b2d76978d4 100644 --- a/examples/v1/logs-pipelines/UpdateLogsPipeline.go +++ b/examples/v1/logs-pipelines/UpdateLogsPipeline.go @@ -35,6 +35,7 @@ rule_name_2 bar Type: datadogV1.LOGSGROKPARSERTYPE_GROK_PARSER, }}, }, + Tags: []string{}, } ctx := datadog.NewDefaultContext(context.Background()) configuration := datadog.NewConfiguration() diff --git a/tests/scenarios/features/v1/logs_pipelines.feature b/tests/scenarios/features/v1/logs_pipelines.feature index f7a68917032..e811aea3af0 100644 --- a/tests/scenarios/features/v1/logs_pipelines.feature +++ b/tests/scenarios/features/v1/logs_pipelines.feature @@ -26,14 +26,14 @@ Feature: Logs Pipelines @generated @skip @team:DataDog/event-platform-experience Scenario: Create a pipeline returns "Bad Request" response Given new "CreateLogsPipeline" request - And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}]} + And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}], "tags": []} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/event-platform-experience Scenario: Create a pipeline returns "OK" response Given new "CreateLogsPipeline" request - And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}]} + And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}], "tags": []} When the request is sent Then the response status is 200 OK @@ -81,7 +81,7 @@ Feature: Logs Pipelines Scenario: Update a pipeline returns "Bad Request" response Given new "UpdateLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" - And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}]} + And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}], "tags": []} When the request is sent Then the response status is 400 Bad Request @@ -89,7 +89,7 @@ Feature: Logs Pipelines Scenario: Update a pipeline returns "OK" response Given new "UpdateLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" - And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}]} + And body with value {"filter": {"query": "source:python"}, "name": "", "processors": [{"grok": {"match_rules": "rule_name_1 foo\nrule_name_2 bar\n", "support_rules": "rule_name_1 foo\nrule_name_2 bar\n"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}], "tags": []} When the request is sent Then the response status is 200 OK