Skip to content

Commit 2f54d5f

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 63a241d of spec repo
1 parent af4cea8 commit 2f54d5f

13 files changed

Lines changed: 361 additions & 128 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19420,7 +19420,7 @@ components:
1942019420
description: The description of the widget.
1942119421
type: string
1942219422
requests:
19423-
description: One or more Topology requests.
19423+
description: One Topology request.
1942419424
items:
1942519425
$ref: "#/components/schemas/TopologyRequest"
1942619426
minItems: 1
@@ -19449,10 +19449,14 @@ components:
1944919449
x-enum-varnames:
1945019450
- TOPOLOGY_MAP
1945119451
TopologyQuery:
19452+
description: A topology data source query.
19453+
oneOf:
19454+
- $ref: "#/components/schemas/TopologyQueryDataStreamsOrServiceMap"
19455+
TopologyQueryDataStreamsOrServiceMap:
1945219456
description: Query to service-based topology data sources like the service map or data streams.
1945319457
properties:
1945419458
data_source:
19455-
$ref: "#/components/schemas/TopologyQueryDataSource"
19459+
$ref: "#/components/schemas/TopologyQueryDataStreamsOrServiceMapDataSource"
1945619460
filters:
1945719461
description: Your environment and primary tag (or * if enabled for your account).
1945819462
example: ["env:prod", "az:us-east"]
@@ -19461,16 +19465,24 @@ components:
1946119465
type: string
1946219466
minItems: 1
1946319467
type: array
19468+
query_string:
19469+
description: A search string for filtering services, used in `data_streams` queries only. When set, this replaces the `service` field
19470+
example: "service:myservice"
19471+
type: string
1946419472
service:
1946519473
description: Name of the service
19466-
example: myService
19474+
example: myservice
1946719475
type: string
19476+
required:
19477+
- data_source
19478+
- filters
1946819479
type: object
19469-
TopologyQueryDataSource:
19480+
TopologyQueryDataStreamsOrServiceMapDataSource:
1947019481
description: Name of the data source
1947119482
enum:
1947219483
- data_streams
1947319484
- service_map
19485+
example: data_streams
1947419486
type: string
1947519487
x-enum-varnames:
1947619488
- DATA_STREAMS
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-03-20T18:16:51.929Z

cassettes/features/v1/dashboards/Create-a-new-dashboard-with-topology-map-data-streams-widget.yml

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/v1/dashboards/CreateDashboard_2652180930.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
requests: [
2323
DatadogAPIClient::V1::TopologyRequest.new({
2424
request_type: DatadogAPIClient::V1::TopologyRequestType::TOPOLOGY,
25-
query: DatadogAPIClient::V1::TopologyQuery.new({
26-
data_source: DatadogAPIClient::V1::TopologyQueryDataSource::SERVICE_MAP,
25+
query: DatadogAPIClient::V1::TopologyQueryDataStreamsOrServiceMap.new({
26+
data_source: DatadogAPIClient::V1::TopologyQueryDataStreamsOrServiceMapDataSource::SERVICE_MAP,
2727
service: "",
2828
filters: [
2929
"env:none",
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Create a new dashboard with topology_map data_streams widget
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
5+
6+
body = DatadogAPIClient::V1::Dashboard.new({
7+
title: "Example-Dashboard",
8+
description: "",
9+
widgets: [
10+
DatadogAPIClient::V1::Widget.new({
11+
layout: DatadogAPIClient::V1::WidgetLayout.new({
12+
x: 0,
13+
y: 0,
14+
width: 47,
15+
height: 15,
16+
}),
17+
definition: DatadogAPIClient::V1::TopologyMapWidgetDefinition.new({
18+
title: "",
19+
title_size: "16",
20+
title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
21+
type: DatadogAPIClient::V1::TopologyMapWidgetDefinitionType::TOPOLOGY_MAP,
22+
requests: [
23+
DatadogAPIClient::V1::TopologyRequest.new({
24+
request_type: DatadogAPIClient::V1::TopologyRequestType::TOPOLOGY,
25+
query: DatadogAPIClient::V1::TopologyQueryDataStreamsOrServiceMap.new({
26+
data_source: DatadogAPIClient::V1::TopologyQueryDataStreamsOrServiceMapDataSource::DATA_STREAMS,
27+
service: "",
28+
filters: [
29+
"env:prod",
30+
],
31+
query_string: "service:myservice",
32+
}),
33+
}),
34+
],
35+
}),
36+
}),
37+
],
38+
template_variables: [],
39+
layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE,
40+
notify_list: [],
41+
})
42+
p api_instance.create_dashboard(body)

features/v1/dashboards.feature

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,19 @@ Feature: Dashboards
10891089
And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula"
10901090
And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0
10911091

1092+
@team:DataDog/dashboards-backend
1093+
Scenario: Create a new dashboard with topology_map data_streams widget
1094+
Given new "CreateDashboard" request
1095+
And body from file "dashboards_json_payload/topology_map_widget_data_streams.json"
1096+
When the request is sent
1097+
Then the response status is 200 OK
1098+
And the response "widgets[0].definition.type" is equal to "topology_map"
1099+
And the response "widgets[0].definition.requests[0].request_type" is equal to "topology"
1100+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "data_streams"
1101+
And the response "widgets[0].definition.requests[0].query.service" is equal to ""
1102+
And the response "widgets[0].definition.requests[0].query.filters" is equal to ["env:prod"]
1103+
And the response "widgets[0].definition.requests[0].query.query_string" is equal to "service:myservice"
1104+
10921105
@team:DataDog/dashboards-backend
10931106
Scenario: Create a new dashboard with topology_map widget
10941107
Given new "CreateDashboard" request
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"title": "{{ unique }}",
3+
"description": "",
4+
"widgets": [
5+
{
6+
"layout": {
7+
"x": 0,
8+
"y": 0,
9+
"width": 47,
10+
"height": 15
11+
},
12+
"definition": {
13+
"title": "",
14+
"title_size": "16",
15+
"title_align": "left",
16+
"type": "topology_map",
17+
"requests": [
18+
{
19+
"request_type": "topology",
20+
"query": {
21+
"data_source": "data_streams",
22+
"service": "",
23+
"filters": ["env:prod"],
24+
"query_string": "service:myservice"
25+
}
26+
}
27+
]
28+
}
29+
}
30+
],
31+
"template_variables": [],
32+
"layout_type": "free",
33+
"notify_list": []
34+
}

lib/datadog_api_client/inflector.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,8 @@ def overrides
865865
"v1.topology_map_widget_definition" => "TopologyMapWidgetDefinition",
866866
"v1.topology_map_widget_definition_type" => "TopologyMapWidgetDefinitionType",
867867
"v1.topology_query" => "TopologyQuery",
868-
"v1.topology_query_data_source" => "TopologyQueryDataSource",
868+
"v1.topology_query_data_streams_or_service_map" => "TopologyQueryDataStreamsOrServiceMap",
869+
"v1.topology_query_data_streams_or_service_map_data_source" => "TopologyQueryDataStreamsOrServiceMapDataSource",
869870
"v1.topology_request" => "TopologyRequest",
870871
"v1.topology_request_type" => "TopologyRequestType",
871872
"v1.tree_map_color_by" => "TreeMapColorBy",

lib/datadog_api_client/v1/models/topology_map_widget_definition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TopologyMapWidgetDefinition
2727
# The description of the widget.
2828
attr_accessor :description
2929

30-
# One or more Topology requests.
30+
# One Topology request.
3131
attr_reader :requests
3232

3333
# Title of your widget.

lib/datadog_api_client/v1/models/topology_query.rb

Lines changed: 35 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -17,129 +17,46 @@
1717
require 'time'
1818

1919
module DatadogAPIClient::V1
20-
# Query to service-based topology data sources like the service map or data streams.
21-
class TopologyQuery
22-
include BaseGenericModel
23-
24-
# Name of the data source
25-
attr_accessor :data_source
26-
27-
# Your environment and primary tag (or * if enabled for your account).
28-
attr_reader :filters
29-
30-
# Name of the service
31-
attr_accessor :service
32-
33-
attr_accessor :additional_properties
34-
35-
# Attribute mapping from ruby-style variable name to JSON key.
36-
# @!visibility private
37-
def self.attribute_map
38-
{
39-
:'data_source' => :'data_source',
40-
:'filters' => :'filters',
41-
:'service' => :'service'
42-
}
43-
end
44-
45-
# Attribute type mapping.
46-
# @!visibility private
47-
def self.openapi_types
48-
{
49-
:'data_source' => :'TopologyQueryDataSource',
50-
:'filters' => :'Array<String>',
51-
:'service' => :'String'
52-
}
53-
end
54-
55-
# Initializes the object
56-
# @param attributes [Hash] Model attributes in the form of hash
57-
# @!visibility private
58-
def initialize(attributes = {})
59-
if (!attributes.is_a?(Hash))
60-
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::TopologyQuery` initialize method"
61-
end
62-
63-
self.additional_properties = {}
64-
# check to see if the attribute exists and convert string to symbol for hash key
65-
attributes = attributes.each_with_object({}) { |(k, v), h|
66-
if (!self.class.attribute_map.key?(k.to_sym))
67-
self.additional_properties[k.to_sym] = v
68-
else
69-
h[k.to_sym] = v
70-
end
71-
}
72-
73-
if attributes.key?(:'data_source')
74-
self.data_source = attributes[:'data_source']
20+
# A topology data source query.
21+
module TopologyQuery
22+
class << self
23+
include BaseOneOfModel
24+
include BaseOneOfModelNoDiscriminator
25+
26+
# List of class defined in oneOf (OpenAPI v3)
27+
def openapi_one_of
28+
[
29+
:'TopologyQueryDataStreamsOrServiceMap'
30+
]
7531
end
76-
77-
if attributes.key?(:'filters')
78-
if (value = attributes[:'filters']).is_a?(Array)
79-
self.filters = value
32+
# Builds the object
33+
# @param data [Mixed] Data to be matched against the list of oneOf items
34+
# @return [Object] Returns the model or the data itself
35+
def build(data)
36+
# Go through the list of oneOf items and attempt to identify the appropriate one.
37+
# Note:
38+
# - We do not attempt to check whether exactly one item matches.
39+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
40+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
41+
# - TODO: scalar values are de facto behaving as if they were nullable.
42+
# - TODO: logging when debugging is set.
43+
openapi_one_of.each do |klass|
44+
begin
45+
next if klass == :AnyType # "nullable: true"
46+
typed_data = find_and_cast_into_type(klass, data)
47+
next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed
48+
return typed_data if typed_data
49+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
50+
end
8051
end
81-
end
8252

83-
if attributes.key?(:'service')
84-
self.service = attributes[:'service']
85-
end
86-
end
87-
88-
# Check to see if the all the properties in the model are valid
89-
# @return true if the model is valid
90-
# @!visibility private
91-
def valid?
92-
return false if !@filters.nil? && @filters.length < 1
93-
true
94-
end
95-
96-
# Custom attribute writer method with validation
97-
# @param filters [Object] Object to be assigned
98-
# @!visibility private
99-
def filters=(filters)
100-
if !filters.nil? && filters.length < 1
101-
fail ArgumentError, 'invalid value for "filters", number of items must be greater than or equal to 1.'
102-
end
103-
@filters = filters
104-
end
105-
106-
# Returns the object in the form of hash, with additionalProperties support.
107-
# @return [Hash] Returns the object in the form of hash
108-
# @!visibility private
109-
def to_hash
110-
hash = {}
111-
self.class.attribute_map.each_pair do |attr, param|
112-
value = self.send(attr)
113-
if value.nil?
114-
is_nullable = self.class.openapi_nullable.include?(attr)
115-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
53+
if openapi_one_of.include?(:AnyType)
54+
data
55+
else
56+
self._unparsed = true
57+
DatadogAPIClient::UnparsedObject.new(data)
11658
end
117-
118-
hash[param] = _to_hash(value)
11959
end
120-
self.additional_properties.each_pair do |attr, value|
121-
hash[attr] = value
122-
end
123-
hash
124-
end
125-
126-
# Checks equality by comparing each attribute.
127-
# @param o [Object] Object to be compared
128-
# @!visibility private
129-
def ==(o)
130-
return true if self.equal?(o)
131-
self.class == o.class &&
132-
data_source == o.data_source &&
133-
filters == o.filters &&
134-
service == o.service &&
135-
additional_properties == o.additional_properties
136-
end
137-
138-
# Calculates hash code according to all attributes.
139-
# @return [Integer] Hash code
140-
# @!visibility private
141-
def hash
142-
[data_source, filters, service, additional_properties].hash
14360
end
14461
end
14562
end

0 commit comments

Comments
 (0)