diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 8f404467bc29..bbfcb6da1046 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -6215,6 +6215,38 @@ components: type: string x-enum-varnames: - DECODER_PROCESSOR + LogsExcludeAttributeProcessor: + description: |- + Use this processor to remove an attribute from a log during processing. + The processor strips the specified attribute from the log event, which is useful + when the attribute contains sensitive data or is no longer needed downstream. + properties: + attribute_to_exclude: + description: Name of the log attribute to remove from the log event. + example: foo + type: string + is_enabled: + default: false + description: Whether or not the processor is enabled. + type: boolean + name: + description: Name of the processor. + type: string + type: + $ref: "#/components/schemas/LogsExcludeAttributeProcessorType" + required: + - type + - attribute_to_exclude + type: object + LogsExcludeAttributeProcessorType: + default: exclude-attribute + description: Type of logs exclude attribute processor. + enum: + - exclude-attribute + example: exclude-attribute + type: string + x-enum-varnames: + - EXCLUDE_ATTRIBUTE LogsExclusion: description: Represents the index exclusion filter object from configuration API. properties: @@ -6822,6 +6854,7 @@ components: - $ref: "#/components/schemas/LogsArrayProcessor" - $ref: "#/components/schemas/LogsDecoderProcessor" - $ref: "#/components/schemas/LogsSchemaProcessor" + - $ref: "#/components/schemas/LogsExcludeAttributeProcessor" LogsQueryCompute: description: Define computation for a log query. properties: diff --git a/features/v1/logs_pipelines.feature b/features/v1/logs_pipelines.feature index 00b7369e2317..1ab4401b0fdc 100644 --- a/features/v1/logs_pipelines.feature +++ b/features/v1/logs_pipelines.feature @@ -21,138 +21,138 @@ Feature: Logs Pipelines And a valid "appKeyAuth" key in the system And an instance of "LogsPipelines" API - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding 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", "support_rules": "rule_name_1 foo\nrule_name_2 bar"}, "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 + @generated @skip @team:DataDog/logs-onboarding 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", "support_rules": "rule_name_1 foo\nrule_name_2 bar"}, "is_enabled": false, "samples": [], "source": "message", "type": "grok-parser"}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Array Processor Append Operation returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayAppend", "processors": [{"type": "array-processor", "is_enabled": true, "name": "append_ip_to_array", "operation": {"type": "append", "source": "network.client.ip", "target": "sourceIps"}}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Array Processor Append Operation with preserve_source false returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayAppendNoPreserve", "processors": [{"type": "array-processor", "is_enabled": true, "name": "append_ip_and_remove_source", "operation": {"type": "append", "source": "network.client.ip", "target": "sourceIps", "preserve_source": false}}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Array Processor Append Operation with preserve_source true returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayAppendPreserve", "processors": [{"type": "array-processor", "is_enabled": true, "name": "append_ip_and_keep_source", "operation": {"type": "append", "source": "network.client.ip", "target": "sourceIps", "preserve_source": true}}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Array Processor Length Operation returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArrayLength", "processors": [{"type": "array-processor", "is_enabled": true, "name": "count_tags", "operation": {"type": "length", "source": "tags", "target": "tagCount"}}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Array Processor Select Operation returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testPipelineArraySelect", "processors": [{"type": "array-processor", "is_enabled": true, "name": "extract_referrer", "operation": {"type": "select", "source": "httpRequest.headers", "target": "referrer", "filter": "name:Referrer", "value_to_extract": "value"}}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Decoder Processor returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testDecoderProcessor", "processors": [{"type": "decoder-processor", "is_enabled": true, "name": "test_decoder", "source": "encoded.field", "target": "decoded.field", "binary_to_text_encoding": "base16", "input_representation": "utf_8"}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Schema Processor and preserve_source false returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testSchemaProcessor", "processors": [{"type": "schema-processor", "is_enabled": true, "name": "Apply OCSF schema for 3001", "schema": {"schema_type": "ocsf", "version": "1.5.0", "class_uid": 3001, "class_name": "Account Change", "profiles": ["cloud", "datetime"]}, "mappers": [{"type": "schema-category-mapper", "name": "activity_id and activity_name", "categories": [{"filter": {"query": "@eventName:(*Create*)"}, "name": "Create", "id": 1}, {"filter": {"query": "@eventName:(ChangePassword OR PasswordUpdated)"}, "name": "Password Change", "id": 3}, {"filter": {"query": "@eventName:(*Attach*)"}, "name": "Attach Policy", "id": 7}, {"filter": {"query": "@eventName:(*Detach* OR *Remove*)"}, "name": "Detach Policy", "id": 8}, {"filter": {"query": "@eventName:(*Delete*)"}, "name": "Delete", "id": 6}, {"filter": {"query": "@eventName:*"}, "name": "Other", "id": 99}], "targets": {"name": "ocsf.activity_name", "id": "ocsf.activity_id"}, "fallback": {"values": {"ocsf.activity_id": "99", "ocsf.activity_name": "Other"}, "sources": {"ocsf.activity_name": ["eventName"]}}}, {"type": "schema-category-mapper", "name": "status", "categories": [{"filter": {"query": "-@errorCode:*"}, "id": 1, "name": "Success"}, {"filter": {"query": "@errorCode:*"}, "id": 2, "name": "Failure"}], "targets": {"id": "ocsf.status_id", "name": "ocsf.status"}}, {"type": "schema-category-mapper", "name": "Set default severity", "categories": [{"filter": {"query": "@eventName:*"}, "name": "Informational", "id": 1}], "targets": {"name": "ocsf.severity", "id": "ocsf.severity_id"}}, {"type": "schema-remapper", "name": "Map userIdentity to ocsf.user.uid", "sources": ["userIdentity.principalId", "responseElements.role.roleId", "responseElements.user.userId"], "target": "ocsf.user.uid", "preserve_source": false}, {"type": "schema-remapper", "name": "Map userName to ocsf.user.name", "sources": ["requestParameters.userName", "responseElements.role.roleName", "requestParameters.roleName", "responseElements.user.userName"], "target": "ocsf.user.name", "preserve_source": false}, {"type": "schema-remapper", "name": "Map api to ocsf.api", "sources": ["api"], "target": "ocsf.api", "preserve_source": false}, {"type": "schema-remapper", "name": "Map user to ocsf.user", "sources": ["user"], "target": "ocsf.user", "preserve_source": false}, {"type": "schema-remapper", "name": "Map actor to ocsf.actor", "sources": ["actor"], "target": "ocsf.actor", "preserve_source": false}, {"type": "schema-remapper", "name": "Map cloud to ocsf.cloud", "sources": ["cloud"], "target": "ocsf.cloud", "preserve_source": false}, {"type": "schema-remapper", "name": "Map http_request to ocsf.http_request", "sources": ["http_request"], "target": "ocsf.http_request", "preserve_source": false}, {"type": "schema-remapper", "name": "Map metadata to ocsf.metadata", "sources": ["metadata"], "target": "ocsf.metadata", "preserve_source": false}, {"type": "schema-remapper", "name": "Map time to ocsf.time", "sources": ["time"], "target": "ocsf.time", "preserve_source": false}, {"type": "schema-remapper", "name": "Map src_endpoint to ocsf.src_endpoint", "sources": ["src_endpoint"], "target": "ocsf.src_endpoint", "preserve_source": false}, {"type": "schema-remapper", "name": "Map severity to ocsf.severity", "sources": ["severity"], "target": "ocsf.severity", "preserve_source": false}, {"type": "schema-remapper", "name": "Map severity_id to ocsf.severity_id", "sources": ["severity_id"], "target": "ocsf.severity_id", "preserve_source": false}]}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Schema Processor and preserve_source true returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testSchemaProcessor", "processors": [{"type": "schema-processor", "is_enabled": true, "name": "Apply OCSF schema for 3001", "schema": {"schema_type": "ocsf", "version": "1.5.0", "class_uid": 3001, "class_name": "Account Change", "profiles": ["cloud", "datetime"]}, "mappers": [{"type": "schema-category-mapper", "name": "activity_id and activity_name", "categories": [{"filter": {"query": "@eventName:(*Create*)"}, "name": "Create", "id": 1}, {"filter": {"query": "@eventName:(ChangePassword OR PasswordUpdated)"}, "name": "Password Change", "id": 3}, {"filter": {"query": "@eventName:(*Attach*)"}, "name": "Attach Policy", "id": 7}, {"filter": {"query": "@eventName:(*Detach* OR *Remove*)"}, "name": "Detach Policy", "id": 8}, {"filter": {"query": "@eventName:(*Delete*)"}, "name": "Delete", "id": 6}, {"filter": {"query": "@eventName:*"}, "name": "Other", "id": 99}], "targets": {"name": "ocsf.activity_name", "id": "ocsf.activity_id"}, "fallback": {"values": {"ocsf.activity_id": "99", "ocsf.activity_name": "Other"}, "sources": {"ocsf.activity_name": ["eventName"]}}}, {"type": "schema-category-mapper", "name": "status", "categories": [{"filter": {"query": "-@errorCode:*"}, "id": 1, "name": "Success"}, {"filter": {"query": "@errorCode:*"}, "id": 2, "name": "Failure"}], "targets": {"id": "ocsf.status_id", "name": "ocsf.status"}}, {"type": "schema-category-mapper", "name": "Set default severity", "categories": [{"filter": {"query": "@eventName:*"}, "name": "Informational", "id": 1}], "targets": {"name": "ocsf.severity", "id": "ocsf.severity_id"}}, {"type": "schema-remapper", "name": "Map userIdentity to ocsf.user.uid", "sources": ["userIdentity.principalId", "responseElements.role.roleId", "responseElements.user.userId"], "target": "ocsf.user.uid", "preserve_source": true}, {"type": "schema-remapper", "name": "Map userName to ocsf.user.name", "sources": ["requestParameters.userName", "responseElements.role.roleName", "requestParameters.roleName", "responseElements.user.userName"], "target": "ocsf.user.name", "preserve_source": true}, {"type": "schema-remapper", "name": "Map api to ocsf.api", "sources": ["api"], "target": "ocsf.api", "preserve_source": true}, {"type": "schema-remapper", "name": "Map user to ocsf.user", "sources": ["user"], "target": "ocsf.user", "preserve_source": true}, {"type": "schema-remapper", "name": "Map actor to ocsf.actor", "sources": ["actor"], "target": "ocsf.actor", "preserve_source": true}, {"type": "schema-remapper", "name": "Map cloud to ocsf.cloud", "sources": ["cloud"], "target": "ocsf.cloud", "preserve_source": true}, {"type": "schema-remapper", "name": "Map http_request to ocsf.http_request", "sources": ["http_request"], "target": "ocsf.http_request", "preserve_source": true}, {"type": "schema-remapper", "name": "Map metadata to ocsf.metadata", "sources": ["metadata"], "target": "ocsf.metadata", "preserve_source": true}, {"type": "schema-remapper", "name": "Map time to ocsf.time", "sources": ["time"], "target": "ocsf.time", "preserve_source": true}, {"type": "schema-remapper", "name": "Map src_endpoint to ocsf.src_endpoint", "sources": ["src_endpoint"], "target": "ocsf.src_endpoint", "preserve_source": true}, {"type": "schema-remapper", "name": "Map severity to ocsf.severity", "sources": ["severity"], "target": "ocsf.severity", "preserve_source": true}, {"type": "schema-remapper", "name": "Map severity_id to ocsf.severity_id", "sources": ["severity_id"], "target": "ocsf.severity_id", "preserve_source": true}]}], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with Span Id Remapper returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testPipeline", "processors": [{"type": "span-id-remapper", "is_enabled" : true, "name" : "test_filter", "sources" : [ "dd.span_id"] }], "tags": []} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with nested pipeline processor returns "OK" response Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testPipelineWithNested", "processors": [{"type": "pipeline", "is_enabled": true, "name": "nested_pipeline_with_metadata", "filter": {"query": "env:production"}, "tags": ["env:prod", "type:nested"], "description": "This is a nested pipeline for production logs"}], "tags": ["team:test"], "description": "Pipeline containing nested processor with tags and description"} When the request is sent Then the response status is 200 OK - @team:DataDog/event-platform-experience + @team:DataDog/logs-onboarding Scenario: Create a pipeline with schema processor Given new "CreateLogsPipeline" request And body with value {"filter": {"query": "source:python"}, "name": "testSchemaProcessor", "processors": [{"type": "schema-processor", "is_enabled": true, "name": "Apply OCSF schema for 3001", "schema": {"schema_type": "ocsf", "version": "1.5.0", "class_uid": 3001, "class_name": "Account Change", "profiles": ["cloud", "datetime"]}, "mappers": [{"type": "schema-category-mapper", "name": "activity_id and activity_name", "categories": [{"filter": {"query": "@eventName:(*Create*)"}, "name": "Create", "id": 1}, {"filter": {"query": "@eventName:(ChangePassword OR PasswordUpdated)"}, "name": "Password Change", "id": 3}, {"filter": {"query": "@eventName:(*Attach*)"}, "name": "Attach Policy", "id": 7}, {"filter": {"query": "@eventName:(*Detach* OR *Remove*)"}, "name": "Detach Policy", "id": 8}, {"filter": {"query": "@eventName:(*Delete*)"}, "name": "Delete", "id": 6}, {"filter": {"query": "@eventName:*"}, "name": "Other", "id": 99}], "targets": {"name": "ocsf.activity_name", "id": "ocsf.activity_id"}, "fallback": {"values": {"ocsf.activity_id": "99", "ocsf.activity_name": "Other"}, "sources": {"ocsf.activity_name": ["eventName"]}}}, {"type": "schema-category-mapper", "name": "status", "categories": [{"filter": {"query": "-@errorCode:*"}, "id": 1, "name": "Success"}, {"filter": {"query": "@errorCode:*"}, "id": 2, "name": "Failure"}], "targets": {"id": "ocsf.status_id", "name": "ocsf.status"}}, {"type": "schema-category-mapper", "name": "Set default severity", "categories": [{"filter": {"query": "@eventName:*"}, "name": "Informational", "id": 1}], "targets": {"name": "ocsf.severity", "id": "ocsf.severity_id"}}, {"type": "schema-remapper", "name": "Map userIdentity to ocsf.user.uid", "sources": ["userIdentity.principalId", "responseElements.role.roleId", "responseElements.user.userId"], "target": "ocsf.user.uid"}, {"type": "schema-remapper", "name": "Map userName to ocsf.user.name", "sources": ["requestParameters.userName", "responseElements.role.roleName", "requestParameters.roleName", "responseElements.user.userName"], "target": "ocsf.user.name"}, {"type": "schema-remapper", "name": "Map api to ocsf.api", "sources": ["api"], "target": "ocsf.api"}, {"type": "schema-remapper", "name": "Map user to ocsf.user", "sources": ["user"], "target": "ocsf.user"}, {"type": "schema-remapper", "name": "Map actor to ocsf.actor", "sources": ["actor"], "target": "ocsf.actor"}, {"type": "schema-remapper", "name": "Map cloud to ocsf.cloud", "sources": ["cloud"], "target": "ocsf.cloud"}, {"type": "schema-remapper", "name": "Map http_request to ocsf.http_request", "sources": ["http_request"], "target": "ocsf.http_request"}, {"type": "schema-remapper", "name": "Map metadata to ocsf.metadata", "sources": ["metadata"], "target": "ocsf.metadata"}, {"type": "schema-remapper", "name": "Map time to ocsf.time", "sources": ["time"], "target": "ocsf.time"}, {"type": "schema-remapper", "name": "Map src_endpoint to ocsf.src_endpoint", "sources": ["src_endpoint"], "target": "ocsf.src_endpoint"}, {"type": "schema-remapper", "name": "Map severity to ocsf.severity", "sources": ["severity"], "target": "ocsf.severity"}, {"type": "schema-remapper", "name": "Map severity_id to ocsf.severity_id", "sources": ["severity_id"], "target": "ocsf.severity_id"}]}], "tags": []} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Delete a pipeline returns "Bad Request" response Given new "DeleteLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Delete a pipeline returns "OK" response Given new "DeleteLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Get a pipeline returns "Bad Request" response Given new "GetLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Get a pipeline returns "OK" response Given new "GetLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Get all pipelines returns "OK" response Given new "ListLogsPipelines" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Get pipeline order returns "OK" response Given new "GetLogsPipelineOrder" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Update a pipeline returns "Bad Request" response Given new "UpdateLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" @@ -160,7 +160,7 @@ Feature: Logs Pipelines When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Update a pipeline returns "OK" response Given new "UpdateLogsPipeline" request And request contains "pipeline_id" parameter from "REPLACE.ME" @@ -168,21 +168,21 @@ Feature: Logs Pipelines When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Update pipeline order returns "Bad Request" response Given new "UpdateLogsPipelineOrder" request And body with value {"pipeline_ids": ["tags", "org_ids", "products"]} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Update pipeline order returns "OK" response Given new "UpdateLogsPipelineOrder" request And body with value {"pipeline_ids": ["tags", "org_ids", "products"]} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/event-platform-experience + @generated @skip @team:DataDog/logs-onboarding Scenario: Update pipeline order returns "Unprocessable Entity" response Given new "UpdateLogsPipelineOrder" request And body with value {"pipeline_ids": ["tags", "org_ids", "products"]} diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index ffb9b3c3429a..889fc6b779cd 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -292,6 +292,8 @@ def overrides "v1.logs_decoder_processor_binary_to_text_encoding" => "LogsDecoderProcessorBinaryToTextEncoding", "v1.logs_decoder_processor_input_representation" => "LogsDecoderProcessorInputRepresentation", "v1.logs_decoder_processor_type" => "LogsDecoderProcessorType", + "v1.logs_exclude_attribute_processor" => "LogsExcludeAttributeProcessor", + "v1.logs_exclude_attribute_processor_type" => "LogsExcludeAttributeProcessorType", "v1.logs_exclusion" => "LogsExclusion", "v1.logs_exclusion_filter" => "LogsExclusionFilter", "v1.logs_filter" => "LogsFilter", diff --git a/lib/datadog_api_client/v1/models/logs_exclude_attribute_processor.rb b/lib/datadog_api_client/v1/models/logs_exclude_attribute_processor.rb new file mode 100644 index 000000000000..4047dac582df --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_exclude_attribute_processor.rb @@ -0,0 +1,166 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Use this processor to remove an attribute from a log during processing. + # The processor strips the specified attribute from the log event, which is useful + # when the attribute contains sensitive data or is no longer needed downstream. + class LogsExcludeAttributeProcessor + include BaseGenericModel + + # Name of the log attribute to remove from the log event. + attr_reader :attribute_to_exclude + + # Whether or not the processor is enabled. + attr_accessor :is_enabled + + # Name of the processor. + attr_accessor :name + + # Type of logs exclude attribute processor. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attribute_to_exclude' => :'attribute_to_exclude', + :'is_enabled' => :'is_enabled', + :'name' => :'name', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attribute_to_exclude' => :'String', + :'is_enabled' => :'Boolean', + :'name' => :'String', + :'type' => :'LogsExcludeAttributeProcessorType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::LogsExcludeAttributeProcessor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attribute_to_exclude') + self.attribute_to_exclude = attributes[:'attribute_to_exclude'] + end + + if attributes.key?(:'is_enabled') + self.is_enabled = attributes[:'is_enabled'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attribute_to_exclude.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attribute_to_exclude [Object] Object to be assigned + # @!visibility private + def attribute_to_exclude=(attribute_to_exclude) + if attribute_to_exclude.nil? + fail ArgumentError, 'invalid value for "attribute_to_exclude", attribute_to_exclude cannot be nil.' + end + @attribute_to_exclude = attribute_to_exclude + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attribute_to_exclude == o.attribute_to_exclude && + is_enabled == o.is_enabled && + name == o.name && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attribute_to_exclude, is_enabled, name, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/logs_exclude_attribute_processor_type.rb b/lib/datadog_api_client/v1/models/logs_exclude_attribute_processor_type.rb new file mode 100644 index 000000000000..578c8b935c92 --- /dev/null +++ b/lib/datadog_api_client/v1/models/logs_exclude_attribute_processor_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Type of logs exclude attribute processor. + class LogsExcludeAttributeProcessorType + include BaseEnumModel + + EXCLUDE_ATTRIBUTE = "exclude-attribute".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/logs_processor.rb b/lib/datadog_api_client/v1/models/logs_processor.rb index f3e8958851b3..156f2eae4d94 100644 --- a/lib/datadog_api_client/v1/models/logs_processor.rb +++ b/lib/datadog_api_client/v1/models/logs_processor.rb @@ -45,7 +45,8 @@ def openapi_one_of :'LogsSpanRemapper', :'LogsArrayProcessor', :'LogsDecoderProcessor', - :'LogsSchemaProcessor' + :'LogsSchemaProcessor', + :'LogsExcludeAttributeProcessor' ] end # Builds the object