diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 66c2a10ceb07..e03bade2cfeb 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -36571,6 +36571,18 @@ components: items: type: string type: array + routes: + description: A list of routing rules that forward matching logs to Datadog + using dedicated API keys. + example: + - api_key_key: API_KEY_IDENTIFIER + include: service:api + route_id: datadog-logs-route-us1 + site: us1 + items: + $ref: '#/components/schemas/ObservabilityPipelineDatadogLogsDestinationRoute' + maxItems: 100 + type: array type: $ref: '#/components/schemas/ObservabilityPipelineDatadogLogsDestinationType' required: @@ -36580,6 +36592,29 @@ components: type: object x-pipeline-types: - logs + ObservabilityPipelineDatadogLogsDestinationRoute: + description: Defines how the `datadog_logs` destination routes matching logs + to a Datadog site using a specific API key. + properties: + api_key_key: + description: Name of the environment variable or secret that stores the + Datadog API key used by this route. + example: API_KEY_IDENTIFIER + type: string + include: + description: A Datadog search query that determines which logs are forwarded + using this route. + example: service:api + type: string + route_id: + description: Unique identifier for this route within the destination. + example: datadog-logs-route-us + type: string + site: + description: Datadog site where matching logs are sent (for example, `us1`). + example: us1 + type: string + type: object ObservabilityPipelineDatadogLogsDestinationType: default: datadog_logs description: The destination type. The value should always be `datadog_logs`. diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 2d73f33509d5..cb5166b42185 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3228,6 +3228,7 @@ def overrides "v2.observability_pipeline_datadog_agent_source" => "ObservabilityPipelineDatadogAgentSource", "v2.observability_pipeline_datadog_agent_source_type" => "ObservabilityPipelineDatadogAgentSourceType", "v2.observability_pipeline_datadog_logs_destination" => "ObservabilityPipelineDatadogLogsDestination", + "v2.observability_pipeline_datadog_logs_destination_route" => "ObservabilityPipelineDatadogLogsDestinationRoute", "v2.observability_pipeline_datadog_logs_destination_type" => "ObservabilityPipelineDatadogLogsDestinationType", "v2.observability_pipeline_datadog_metrics_destination" => "ObservabilityPipelineDatadogMetricsDestination", "v2.observability_pipeline_datadog_metrics_destination_type" => "ObservabilityPipelineDatadogMetricsDestinationType", diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination.rb b/lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination.rb index ea784246329d..090ec2243bf6 100644 --- a/lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination.rb +++ b/lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination.rb @@ -29,6 +29,9 @@ class ObservabilityPipelineDatadogLogsDestination # A list of component IDs whose output is used as the `input` for this component. attr_reader :inputs + # A list of routing rules that forward matching logs to Datadog using dedicated API keys. + attr_reader :routes + # The destination type. The value should always be `datadog_logs`. attr_reader :type @@ -40,6 +43,7 @@ def self.attribute_map { :'id' => :'id', :'inputs' => :'inputs', + :'routes' => :'routes', :'type' => :'type' } end @@ -50,6 +54,7 @@ def self.openapi_types { :'id' => :'String', :'inputs' => :'Array', + :'routes' => :'Array', :'type' => :'ObservabilityPipelineDatadogLogsDestinationType' } end @@ -82,6 +87,12 @@ def initialize(attributes = {}) end end + if attributes.key?(:'routes') + if (value = attributes[:'routes']).is_a?(Array) + self.routes = value + end + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -93,6 +104,7 @@ def initialize(attributes = {}) def valid? return false if @id.nil? return false if @inputs.nil? + return false if !@routes.nil? && @routes.length > 100 return false if @type.nil? true end @@ -117,6 +129,16 @@ def inputs=(inputs) @inputs = inputs end + # Custom attribute writer method with validation + # @param routes [Object] Object to be assigned + # @!visibility private + def routes=(routes) + if !routes.nil? && routes.length > 100 + fail ArgumentError, 'invalid value for "routes", number of items must be less than or equal to 100.' + end + @routes = routes + end + # Custom attribute writer method with validation # @param type [Object] Object to be assigned # @!visibility private @@ -155,6 +177,7 @@ def ==(o) self.class == o.class && id == o.id && inputs == o.inputs && + routes == o.routes && type == o.type && additional_properties == o.additional_properties end @@ -163,7 +186,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [id, inputs, type, additional_properties].hash + [id, inputs, routes, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination_route.rb b/lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination_route.rb new file mode 100644 index 000000000000..7dd3d92b5586 --- /dev/null +++ b/lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination_route.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 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::V2 + # Defines how the `datadog_logs` destination routes matching logs to a Datadog site using a specific API key. + class ObservabilityPipelineDatadogLogsDestinationRoute + include BaseGenericModel + + # Name of the environment variable or secret that stores the Datadog API key used by this route. + attr_accessor :api_key_key + + # A Datadog search query that determines which logs are forwarded using this route. + attr_accessor :include + + # Unique identifier for this route within the destination. + attr_accessor :route_id + + # Datadog site where matching logs are sent (for example, `us1`). + attr_accessor :site + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'api_key_key' => :'api_key_key', + :'include' => :'include', + :'route_id' => :'route_id', + :'site' => :'site' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'api_key_key' => :'String', + :'include' => :'String', + :'route_id' => :'String', + :'site' => :'String' + } + 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::V2::ObservabilityPipelineDatadogLogsDestinationRoute` 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?(:'api_key_key') + self.api_key_key = attributes[:'api_key_key'] + end + + if attributes.key?(:'include') + self.include = attributes[:'include'] + end + + if attributes.key?(:'route_id') + self.route_id = attributes[:'route_id'] + end + + if attributes.key?(:'site') + self.site = attributes[:'site'] + end + 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 && + api_key_key == o.api_key_key && + include == o.include && + route_id == o.route_id && + site == o.site && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [api_key_key, include, route_id, site, additional_properties].hash + end + end +end