Skip to content

Commit 6bf00e7

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add support for routes in datadog logs destination (#2929)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 41f88f3 commit 6bf00e7

4 files changed

Lines changed: 195 additions & 1 deletion

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36571,6 +36571,18 @@ components:
3657136571
items:
3657236572
type: string
3657336573
type: array
36574+
routes:
36575+
description: A list of routing rules that forward matching logs to Datadog
36576+
using dedicated API keys.
36577+
example:
36578+
- api_key_key: API_KEY_IDENTIFIER
36579+
include: service:api
36580+
route_id: datadog-logs-route-us1
36581+
site: us1
36582+
items:
36583+
$ref: '#/components/schemas/ObservabilityPipelineDatadogLogsDestinationRoute'
36584+
maxItems: 100
36585+
type: array
3657436586
type:
3657536587
$ref: '#/components/schemas/ObservabilityPipelineDatadogLogsDestinationType'
3657636588
required:
@@ -36580,6 +36592,29 @@ components:
3658036592
type: object
3658136593
x-pipeline-types:
3658236594
- logs
36595+
ObservabilityPipelineDatadogLogsDestinationRoute:
36596+
description: Defines how the `datadog_logs` destination routes matching logs
36597+
to a Datadog site using a specific API key.
36598+
properties:
36599+
api_key_key:
36600+
description: Name of the environment variable or secret that stores the
36601+
Datadog API key used by this route.
36602+
example: API_KEY_IDENTIFIER
36603+
type: string
36604+
include:
36605+
description: A Datadog search query that determines which logs are forwarded
36606+
using this route.
36607+
example: service:api
36608+
type: string
36609+
route_id:
36610+
description: Unique identifier for this route within the destination.
36611+
example: datadog-logs-route-us
36612+
type: string
36613+
site:
36614+
description: Datadog site where matching logs are sent (for example, `us1`).
36615+
example: us1
36616+
type: string
36617+
type: object
3658336618
ObservabilityPipelineDatadogLogsDestinationType:
3658436619
default: datadog_logs
3658536620
description: The destination type. The value should always be `datadog_logs`.

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,7 @@ def overrides
32283228
"v2.observability_pipeline_datadog_agent_source" => "ObservabilityPipelineDatadogAgentSource",
32293229
"v2.observability_pipeline_datadog_agent_source_type" => "ObservabilityPipelineDatadogAgentSourceType",
32303230
"v2.observability_pipeline_datadog_logs_destination" => "ObservabilityPipelineDatadogLogsDestination",
3231+
"v2.observability_pipeline_datadog_logs_destination_route" => "ObservabilityPipelineDatadogLogsDestinationRoute",
32313232
"v2.observability_pipeline_datadog_logs_destination_type" => "ObservabilityPipelineDatadogLogsDestinationType",
32323233
"v2.observability_pipeline_datadog_metrics_destination" => "ObservabilityPipelineDatadogMetricsDestination",
32333234
"v2.observability_pipeline_datadog_metrics_destination_type" => "ObservabilityPipelineDatadogMetricsDestinationType",

lib/datadog_api_client/v2/models/observability_pipeline_datadog_logs_destination.rb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class ObservabilityPipelineDatadogLogsDestination
2929
# A list of component IDs whose output is used as the `input` for this component.
3030
attr_reader :inputs
3131

32+
# A list of routing rules that forward matching logs to Datadog using dedicated API keys.
33+
attr_reader :routes
34+
3235
# The destination type. The value should always be `datadog_logs`.
3336
attr_reader :type
3437

@@ -40,6 +43,7 @@ def self.attribute_map
4043
{
4144
:'id' => :'id',
4245
:'inputs' => :'inputs',
46+
:'routes' => :'routes',
4347
:'type' => :'type'
4448
}
4549
end
@@ -50,6 +54,7 @@ def self.openapi_types
5054
{
5155
:'id' => :'String',
5256
:'inputs' => :'Array<String>',
57+
:'routes' => :'Array<ObservabilityPipelineDatadogLogsDestinationRoute>',
5358
:'type' => :'ObservabilityPipelineDatadogLogsDestinationType'
5459
}
5560
end
@@ -82,6 +87,12 @@ def initialize(attributes = {})
8287
end
8388
end
8489

90+
if attributes.key?(:'routes')
91+
if (value = attributes[:'routes']).is_a?(Array)
92+
self.routes = value
93+
end
94+
end
95+
8596
if attributes.key?(:'type')
8697
self.type = attributes[:'type']
8798
end
@@ -93,6 +104,7 @@ def initialize(attributes = {})
93104
def valid?
94105
return false if @id.nil?
95106
return false if @inputs.nil?
107+
return false if !@routes.nil? && @routes.length > 100
96108
return false if @type.nil?
97109
true
98110
end
@@ -117,6 +129,16 @@ def inputs=(inputs)
117129
@inputs = inputs
118130
end
119131

132+
# Custom attribute writer method with validation
133+
# @param routes [Object] Object to be assigned
134+
# @!visibility private
135+
def routes=(routes)
136+
if !routes.nil? && routes.length > 100
137+
fail ArgumentError, 'invalid value for "routes", number of items must be less than or equal to 100.'
138+
end
139+
@routes = routes
140+
end
141+
120142
# Custom attribute writer method with validation
121143
# @param type [Object] Object to be assigned
122144
# @!visibility private
@@ -155,6 +177,7 @@ def ==(o)
155177
self.class == o.class &&
156178
id == o.id &&
157179
inputs == o.inputs &&
180+
routes == o.routes &&
158181
type == o.type &&
159182
additional_properties == o.additional_properties
160183
end
@@ -163,7 +186,7 @@ def ==(o)
163186
# @return [Integer] Hash code
164187
# @!visibility private
165188
def hash
166-
[id, inputs, type, additional_properties].hash
189+
[id, inputs, routes, type, additional_properties].hash
167190
end
168191
end
169192
end
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Defines how the `datadog_logs` destination routes matching logs to a Datadog site using a specific API key.
21+
class ObservabilityPipelineDatadogLogsDestinationRoute
22+
include BaseGenericModel
23+
24+
# Name of the environment variable or secret that stores the Datadog API key used by this route.
25+
attr_accessor :api_key_key
26+
27+
# A Datadog search query that determines which logs are forwarded using this route.
28+
attr_accessor :include
29+
30+
# Unique identifier for this route within the destination.
31+
attr_accessor :route_id
32+
33+
# Datadog site where matching logs are sent (for example, `us1`).
34+
attr_accessor :site
35+
36+
attr_accessor :additional_properties
37+
38+
# Attribute mapping from ruby-style variable name to JSON key.
39+
# @!visibility private
40+
def self.attribute_map
41+
{
42+
:'api_key_key' => :'api_key_key',
43+
:'include' => :'include',
44+
:'route_id' => :'route_id',
45+
:'site' => :'site'
46+
}
47+
end
48+
49+
# Attribute type mapping.
50+
# @!visibility private
51+
def self.openapi_types
52+
{
53+
:'api_key_key' => :'String',
54+
:'include' => :'String',
55+
:'route_id' => :'String',
56+
:'site' => :'String'
57+
}
58+
end
59+
60+
# Initializes the object
61+
# @param attributes [Hash] Model attributes in the form of hash
62+
# @!visibility private
63+
def initialize(attributes = {})
64+
if (!attributes.is_a?(Hash))
65+
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ObservabilityPipelineDatadogLogsDestinationRoute` initialize method"
66+
end
67+
68+
self.additional_properties = {}
69+
# check to see if the attribute exists and convert string to symbol for hash key
70+
attributes = attributes.each_with_object({}) { |(k, v), h|
71+
if (!self.class.attribute_map.key?(k.to_sym))
72+
self.additional_properties[k.to_sym] = v
73+
else
74+
h[k.to_sym] = v
75+
end
76+
}
77+
78+
if attributes.key?(:'api_key_key')
79+
self.api_key_key = attributes[:'api_key_key']
80+
end
81+
82+
if attributes.key?(:'include')
83+
self.include = attributes[:'include']
84+
end
85+
86+
if attributes.key?(:'route_id')
87+
self.route_id = attributes[:'route_id']
88+
end
89+
90+
if attributes.key?(:'site')
91+
self.site = attributes[:'site']
92+
end
93+
end
94+
95+
# Returns the object in the form of hash, with additionalProperties support.
96+
# @return [Hash] Returns the object in the form of hash
97+
# @!visibility private
98+
def to_hash
99+
hash = {}
100+
self.class.attribute_map.each_pair do |attr, param|
101+
value = self.send(attr)
102+
if value.nil?
103+
is_nullable = self.class.openapi_nullable.include?(attr)
104+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
105+
end
106+
107+
hash[param] = _to_hash(value)
108+
end
109+
self.additional_properties.each_pair do |attr, value|
110+
hash[attr] = value
111+
end
112+
hash
113+
end
114+
115+
# Checks equality by comparing each attribute.
116+
# @param o [Object] Object to be compared
117+
# @!visibility private
118+
def ==(o)
119+
return true if self.equal?(o)
120+
self.class == o.class &&
121+
api_key_key == o.api_key_key &&
122+
include == o.include &&
123+
route_id == o.route_id &&
124+
site == o.site &&
125+
additional_properties == o.additional_properties
126+
end
127+
128+
# Calculates hash code according to all attributes.
129+
# @return [Integer] Hash code
130+
# @!visibility private
131+
def hash
132+
[api_key_key, include, route_id, site, additional_properties].hash
133+
end
134+
end
135+
end

0 commit comments

Comments
 (0)