Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,72 @@ components:
- layout_type
- widgets
type: object
DashboardAvailableValuesEventsDataSource:
description: The events-based data source for the query.
enum:
- spans
- logs
- rum
example: spans
type: string
x-enum-varnames:
- SPANS
- LOGS
- RUM
DashboardAvailableValuesEventsQuery:
additionalProperties: false
description: Query for available values using an events-based data source (spans, logs, or rum).
properties:
data_source:
$ref: "#/components/schemas/DashboardAvailableValuesEventsDataSource"
group_by:
description: The fields to group by in the query.
items:
$ref: "#/components/schemas/DashboardAvailableValuesEventsQueryGroupByItems"
type: array
search:
$ref: "#/components/schemas/DashboardAvailableValuesEventsQuerySearch"
required:
- data_source
- search
- group_by
type: object
DashboardAvailableValuesEventsQueryGroupByItems:
additionalProperties: false
description: A field to group by in the available values query.
properties:
facet:
description: The facet to group by.
example: ""
type: string
required:
- facet
type: object
DashboardAvailableValuesEventsQuerySearch:
additionalProperties: false
description: The search filter for the query.
properties:
query:
description: The search query string.
example: ""
type: string
required:
- query
type: object
DashboardAvailableValuesMetricsQuery:
additionalProperties: false
description: Query for available values using the metrics data source.
properties:
data_source:
$ref: "#/components/schemas/FormulaAndFunctionMetricDataSource"
query:
description: The metrics query string.
example: ""
type: string
required:
- data_source
- query
type: object
DashboardBulkActionData:
description: Dashboard bulk action request data.
example: {"id": "123-abc-456", "type": "dashboard"}
Expand Down Expand Up @@ -1800,6 +1866,13 @@ components:
type: string
nullable: true
type: array
available_values_query:
$ref: "#/components/schemas/DashboardTemplateVariableAvailableValuesQuery"
data_source_mappings:
additionalProperties:
type: string
description: A mapping from data source type to the variable value to use for that data source.
type: object
default:
deprecated: true
description: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with `defaults`.
Expand Down Expand Up @@ -1831,6 +1904,11 @@ components:
required:
- name
type: object
DashboardTemplateVariableAvailableValuesQuery:
description: A query that dynamically computes the list of values available for this template variable.
oneOf:
- $ref: "#/components/schemas/DashboardAvailableValuesEventsQuery"
- $ref: "#/components/schemas/DashboardAvailableValuesMetricsQuery"
DashboardTemplateVariablePreset:
description: Template variables saved views.
properties:
Expand Down
6 changes: 3 additions & 3 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Feature: Dashboards
@generated @skip @team:DataDog/dashboards-backend
Scenario: Create a new dashboard returns "Bad Request" response
Given new "CreateDashboard" request
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "spans", "group_by": [{"facet": ""}], "search": {"query": ""}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
When the request is sent
Then the response status is 400 Bad Request

Expand Down Expand Up @@ -1481,15 +1481,15 @@ Feature: Dashboards
Scenario: Update a dashboard returns "Bad Request" response
Given new "UpdateDashboard" request
And request contains "dashboard_id" parameter from "REPLACE.ME"
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "spans", "group_by": [{"facet": ""}], "search": {"query": ""}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/dashboards-backend
Scenario: Update a dashboard returns "Item Not Found" response
Given new "UpdateDashboard" request
And request contains "dashboard_id" parameter from "REPLACE.ME"
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "spans", "group_by": [{"facet": ""}], "search": {"query": ""}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
When the request is sent
Then the response status is 404 Item Not Found

Expand Down
6 changes: 6 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ def overrides
"v1.content_encoding" => "ContentEncoding",
"v1.creator" => "Creator",
"v1.dashboard" => "Dashboard",
"v1.dashboard_available_values_events_data_source" => "DashboardAvailableValuesEventsDataSource",
"v1.dashboard_available_values_events_query" => "DashboardAvailableValuesEventsQuery",
"v1.dashboard_available_values_events_query_group_by_items" => "DashboardAvailableValuesEventsQueryGroupByItems",
"v1.dashboard_available_values_events_query_search" => "DashboardAvailableValuesEventsQuerySearch",
"v1.dashboard_available_values_metrics_query" => "DashboardAvailableValuesMetricsQuery",
"v1.dashboard_bulk_action_data" => "DashboardBulkActionData",
"v1.dashboard_bulk_delete_request" => "DashboardBulkDeleteRequest",
"v1.dashboard_delete_response" => "DashboardDeleteResponse",
Expand All @@ -103,6 +108,7 @@ def overrides
"v1.dashboard_summary_definition" => "DashboardSummaryDefinition",
"v1.dashboard_tab" => "DashboardTab",
"v1.dashboard_template_variable" => "DashboardTemplateVariable",
"v1.dashboard_template_variable_available_values_query" => "DashboardTemplateVariableAvailableValuesQuery",
"v1.dashboard_template_variable_preset" => "DashboardTemplateVariablePreset",
"v1.dashboard_template_variable_preset_value" => "DashboardTemplateVariablePresetValue",
"v1.dashboard_type" => "DashboardType",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
=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
# The events-based data source for the query.
class DashboardAvailableValuesEventsDataSource
include BaseEnumModel

SPANS = "spans".freeze
LOGS = "logs".freeze
RUM = "rum".freeze
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
=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
# Query for available values using an events-based data source (spans, logs, or rum).
class DashboardAvailableValuesEventsQuery
include BaseGenericModel

# The events-based data source for the query.
attr_reader :data_source

# The fields to group by in the query.
attr_reader :group_by

# The search filter for the query.
attr_reader :search

# Attribute mapping from ruby-style variable name to JSON key.
# @!visibility private
def self.attribute_map
{
:'data_source' => :'data_source',
:'group_by' => :'group_by',
:'search' => :'search'
}
end

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'data_source' => :'DashboardAvailableValuesEventsDataSource',
:'group_by' => :'Array<DashboardAvailableValuesEventsQueryGroupByItems>',
:'search' => :'DashboardAvailableValuesEventsQuerySearch'
}
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::DashboardAvailableValuesEventsQuery` initialize method"
end

# 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))
fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::DashboardAvailableValuesEventsQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
end
h[k.to_sym] = v
}

if attributes.key?(:'data_source')
self.data_source = attributes[:'data_source']
end

if attributes.key?(:'group_by')
if (value = attributes[:'group_by']).is_a?(Array)
self.group_by = value
end
end

if attributes.key?(:'search')
self.search = attributes[:'search']
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 @data_source.nil?
return false if @group_by.nil?
return false if @search.nil?
true
end

# Custom attribute writer method with validation
# @param data_source [Object] Object to be assigned
# @!visibility private
def data_source=(data_source)
if data_source.nil?
fail ArgumentError, 'invalid value for "data_source", data_source cannot be nil.'
end
@data_source = data_source
end

# Custom attribute writer method with validation
# @param group_by [Object] Object to be assigned
# @!visibility private
def group_by=(group_by)
if group_by.nil?
fail ArgumentError, 'invalid value for "group_by", group_by cannot be nil.'
end
@group_by = group_by
end

# Custom attribute writer method with validation
# @param search [Object] Object to be assigned
# @!visibility private
def search=(search)
if search.nil?
fail ArgumentError, 'invalid value for "search", search cannot be nil.'
end
@search = search
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 &&
data_source == o.data_source &&
group_by == o.group_by &&
search == o.search
end

# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[data_source, group_by, search].hash
end
end
end
Loading
Loading