Skip to content

Commit

Permalink
Regenerate client from commit b987a775 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jun 21, 2023
1 parent cdbd4d2 commit 0392477
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-06-21 18:47:24.706777",
"spec_repo_commit": "0f485c44"
"regenerated": "2023-06-21 21:28:59.061508",
"spec_repo_commit": "b987a775"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-06-21 18:47:24.722522",
"spec_repo_commit": "0f485c44"
"regenerated": "2023-06-21 21:28:59.075719",
"spec_repo_commit": "b987a775"
}
}
}
16 changes: 14 additions & 2 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2735,11 +2735,13 @@ components:
enum:
- timeseries
- scalar
- event_list
example: timeseries
type: string
x-enum-varnames:
- TIMESERIES
- SCALAR
- EVENT_LIST
FormulaAndFunctionSLODataSource:
description: Data source for SLO measures queries.
enum:
Expand Down Expand Up @@ -3059,8 +3061,6 @@ components:
query: <METRIC_1>{<SCOPE_1>}
items:
$ref: '#/components/schemas/GeomapWidgetRequest'
maxItems: 1
minItems: 1
type: array
style:
$ref: '#/components/schemas/GeomapWidgetDefinitionStyle'
Expand Down Expand Up @@ -3127,6 +3127,16 @@ components:
GeomapWidgetRequest:
description: An updated geomap widget.
properties:
columns:
description: Widget columns.
example:
- field: timestamp
width: auto
- field: content
width: full
items:
$ref: '#/components/schemas/ListStreamColumn'
type: array
formulas:
description: List of formulas that operate on queries.
items:
Expand All @@ -3142,6 +3152,8 @@ components:
items:
$ref: '#/components/schemas/FormulaAndFunctionQueryDefinition'
type: array
query:
$ref: '#/components/schemas/ListStreamQuery'
response_format:
$ref: '#/components/schemas/FormulaAndFunctionResponseFormat'
rum_query:
Expand Down
98 changes: 98 additions & 0 deletions examples/v1/dashboards/CreateDashboard_3513586382.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
"""
Create a geomap widget using an event_list request
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.model.dashboard import Dashboard
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat
from datadog_api_client.v1.model.geomap_widget_definition import GeomapWidgetDefinition
from datadog_api_client.v1.model.geomap_widget_definition_style import GeomapWidgetDefinitionStyle
from datadog_api_client.v1.model.geomap_widget_definition_type import GeomapWidgetDefinitionType
from datadog_api_client.v1.model.geomap_widget_definition_view import GeomapWidgetDefinitionView
from datadog_api_client.v1.model.geomap_widget_request import GeomapWidgetRequest
from datadog_api_client.v1.model.list_stream_column import ListStreamColumn
from datadog_api_client.v1.model.list_stream_column_width import ListStreamColumnWidth
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_layout import WidgetLayout
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign

body = Dashboard(
title="Example-Dashboard",
description="Example-Dashboard",
widgets=[
Widget(
definition=GeomapWidgetDefinition(
title="",
title_size="16",
title_align=WidgetTextAlign.LEFT,
type=GeomapWidgetDefinitionType.GEOMAP,
requests=[
GeomapWidgetRequest(
response_format=FormulaAndFunctionResponseFormat.EVENT_LIST,
query=ListStreamQuery(
data_source=ListStreamSource.LOGS_STREAM,
query_string="",
indexes=[],
),
columns=[
ListStreamColumn(
field="@network.client.geoip.location.latitude",
width=ListStreamColumnWidth.AUTO,
),
ListStreamColumn(
field="@network.client.geoip.location.longitude",
width=ListStreamColumnWidth.AUTO,
),
ListStreamColumn(
field="@network.client.geoip.country.iso_code",
width=ListStreamColumnWidth.AUTO,
),
ListStreamColumn(
field="@network.client.geoip.subdivision.name",
width=ListStreamColumnWidth.AUTO,
),
ListStreamColumn(
field="classic",
width=ListStreamColumnWidth.AUTO,
),
ListStreamColumn(
field="",
width=ListStreamColumnWidth.AUTO,
),
],
),
],
style=GeomapWidgetDefinitionStyle(
palette="hostmap_blues",
palette_flip=False,
),
view=GeomapWidgetDefinitionView(
focus="WORLD",
),
),
layout=WidgetLayout(
x=0,
y=0,
width=12,
height=6,
),
),
],
template_variables=[],
layout_type=DashboardLayoutType.ORDERED,
notify_list=[],
reflow_type=DashboardReflowType.FIXED,
tags=[],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = DashboardsApi(api_client)
response = api_instance.create_dashboard(body=body)

print(response)
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ class FormulaAndFunctionResponseFormat(ModelSimple):
"""
Timeseries or Scalar response.
:param value: Must be one of ["timeseries", "scalar"].
:param value: Must be one of ["timeseries", "scalar", "event_list"].
:type value: str
"""

allowed_values = {
"timeseries",
"scalar",
"event_list",
}
TIMESERIES: ClassVar["FormulaAndFunctionResponseFormat"]
SCALAR: ClassVar["FormulaAndFunctionResponseFormat"]
EVENT_LIST: ClassVar["FormulaAndFunctionResponseFormat"]

@cached_property
def openapi_types(_):
Expand All @@ -36,3 +38,4 @@ def openapi_types(_):

FormulaAndFunctionResponseFormat.TIMESERIES = FormulaAndFunctionResponseFormat("timeseries")
FormulaAndFunctionResponseFormat.SCALAR = FormulaAndFunctionResponseFormat("scalar")
FormulaAndFunctionResponseFormat.EVENT_LIST = FormulaAndFunctionResponseFormat("event_list")
7 changes: 0 additions & 7 deletions src/datadog_api_client/v1/model/geomap_widget_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@


class GeomapWidgetDefinition(ModelNormal):
validations = {
"requests": {
"max_items": 1,
"min_items": 1,
},
}

@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink
Expand Down
20 changes: 20 additions & 0 deletions src/datadog_api_client/v1/model/geomap_widget_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@


if TYPE_CHECKING:
from datadog_api_client.v1.model.list_stream_column import ListStreamColumn
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.log_query_definition import LogQueryDefinition
from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat
from datadog_api_client.v1.model.formula_and_function_metric_query_definition import (
FormulaAndFunctionMetricQueryDefinition,
Expand All @@ -41,33 +43,40 @@
class GeomapWidgetRequest(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.list_stream_column import ListStreamColumn
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.log_query_definition import LogQueryDefinition
from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat

return {
"columns": ([ListStreamColumn],),
"formulas": ([WidgetFormula],),
"log_query": (LogQueryDefinition,),
"q": (str,),
"queries": ([FormulaAndFunctionQueryDefinition],),
"query": (ListStreamQuery,),
"response_format": (FormulaAndFunctionResponseFormat,),
"rum_query": (LogQueryDefinition,),
"security_query": (LogQueryDefinition,),
}

attribute_map = {
"columns": "columns",
"formulas": "formulas",
"log_query": "log_query",
"q": "q",
"queries": "queries",
"query": "query",
"response_format": "response_format",
"rum_query": "rum_query",
"security_query": "security_query",
}

def __init__(
self_,
columns: Union[List[ListStreamColumn], UnsetType] = unset,
formulas: Union[List[WidgetFormula], UnsetType] = unset,
log_query: Union[LogQueryDefinition, UnsetType] = unset,
q: Union[str, UnsetType] = unset,
Expand All @@ -85,6 +94,7 @@ def __init__(
],
UnsetType,
] = unset,
query: Union[ListStreamQuery, UnsetType] = unset,
response_format: Union[FormulaAndFunctionResponseFormat, UnsetType] = unset,
rum_query: Union[LogQueryDefinition, UnsetType] = unset,
security_query: Union[LogQueryDefinition, UnsetType] = unset,
Expand All @@ -93,6 +103,9 @@ def __init__(
"""
An updated geomap widget.
:param columns: Widget columns.
:type columns: [ListStreamColumn], optional
:param formulas: List of formulas that operate on queries.
:type formulas: [WidgetFormula], optional
Expand All @@ -105,6 +118,9 @@ def __init__(
:param queries: List of queries that can be returned directly or used in formulas.
:type queries: [FormulaAndFunctionQueryDefinition], optional
:param query: Updated list stream widget.
:type query: ListStreamQuery, optional
:param response_format: Timeseries or Scalar response.
:type response_format: FormulaAndFunctionResponseFormat, optional
Expand All @@ -114,6 +130,8 @@ def __init__(
:param security_query: The log query.
:type security_query: LogQueryDefinition, optional
"""
if columns is not unset:
kwargs["columns"] = columns
if formulas is not unset:
kwargs["formulas"] = formulas
if log_query is not unset:
Expand All @@ -122,6 +140,8 @@ def __init__(
kwargs["q"] = q
if queries is not unset:
kwargs["queries"] = queries
if query is not unset:
kwargs["query"] = query
if response_format is not unset:
kwargs["response_format"] = response_format
if rum_query is not unset:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-06-21T19:29:03.584Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
interactions:
- request:
body: '{"description":"Test-Create_a_geomap_widget_using_an_event_list_request-1687375743","layout_type":"ordered","notify_list":[],"reflow_type":"fixed","tags":[],"template_variables":[],"title":"Test-Create_a_geomap_widget_using_an_event_list_request-1687375743","widgets":[{"definition":{"requests":[{"columns":[{"field":"@network.client.geoip.location.latitude","width":"auto"},{"field":"@network.client.geoip.location.longitude","width":"auto"},{"field":"@network.client.geoip.country.iso_code","width":"auto"},{"field":"@network.client.geoip.subdivision.name","width":"auto"},{"field":"classic","width":"auto"},{"field":"","width":"auto"}],"query":{"data_source":"logs_stream","indexes":[],"query_string":""},"response_format":"event_list"}],"style":{"palette":"hostmap_blues","palette_flip":false},"title":"","title_align":"left","title_size":"16","type":"geomap","view":{"focus":"WORLD"}},"layout":{"height":6,"width":12,"x":0,"y":0}}]}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"id":"cn7-qfm-s9w","title":"Test-Create_a_geomap_widget_using_an_event_list_request-1687375743","description":"Test-Create_a_geomap_widget_using_an_event_list_request-1687375743","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/cn7-qfm-s9w/test-createageomapwidgetusinganeventlistrequest-1687375743","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"columns":[{"field":"@network.client.geoip.location.latitude","width":"auto"},{"field":"@network.client.geoip.location.longitude","width":"auto"},{"field":"@network.client.geoip.country.iso_code","width":"auto"},{"field":"@network.client.geoip.subdivision.name","width":"auto"},{"field":"classic","width":"auto"},{"field":"","width":"auto"}],"query":{"data_source":"logs_stream","indexes":[],"query_string":""},"response_format":"event_list"}],"style":{"palette":"hostmap_blues","palette_flip":false},"title":"","title_align":"left","title_size":"16","type":"geomap","view":{"focus":"WORLD"}},"layout":{"height":6,"width":12,"x":0,"y":0},"id":8506811379916619}],"notify_list":[],"created_at":"2023-06-21T19:29:03.801081+00:00","modified_at":"2023-06-21T19:29:03.801081+00:00","reflow_type":"fixed","tags":[],"restricted_roles":[]}

'
headers:
content-type:
- application/json
status:
code: 200
message: OK
- request:
body: null
headers:
accept:
- application/json
method: DELETE
uri: https://api.datadoghq.com/api/v1/dashboard/cn7-qfm-s9w
response:
body:
string: '{"deleted_dashboard_id":"cn7-qfm-s9w"}

'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
9 changes: 9 additions & 0 deletions tests/v1/features/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "metrics"
And the response "widgets[0].definition.requests[0].query.name" is equal to "query1"

@team:DataDog/dashboards-backend
Scenario: Create a geomap widget using an event_list request
Given new "CreateDashboard" request
And body with value {"title": "{{ unique }}","description": "{{ unique }}","widgets":[{"definition":{"title":"","title_size":"16","title_align":"left","type":"geomap","requests":[{"response_format":"event_list","query":{"data_source":"logs_stream","query_string":"","indexes":[]},"columns":[{"field":"@network.client.geoip.location.latitude","width":"auto"},{"field":"@network.client.geoip.location.longitude","width":"auto"},{"field":"@network.client.geoip.country.iso_code","width":"auto"},{"field":"@network.client.geoip.subdivision.name","width":"auto"},{"field":"classic","width":"auto"},{"field":"","width":"auto"}]}],"style":{"palette":"hostmap_blues","palette_flip":false},"view":{"focus":"WORLD"}},"layout":{"x":0,"y":0,"width":12,"height":6}}],"template_variables":[],"layout_type":"ordered","notify_list":[],"reflow_type":"fixed","tags":[]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "logs_stream"

@generated @skip @team:DataDog/dashboards-backend
Scenario: Create a new dashboard returns "Bad Request" response
Given new "CreateDashboard" request
Expand Down

0 comments on commit 0392477

Please sign in to comment.