Skip to content

Commit

Permalink
Regenerate client from commit fe8637d0 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Sep 25, 2024
1 parent 160f34a commit 0e83da4
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 4 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.6",
"regenerated": "2024-09-24 18:16:22.924081",
"spec_repo_commit": "2eb52c63"
"regenerated": "2024-09-25 14:20:58.529527",
"spec_repo_commit": "fe8637d0"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-24 18:16:22.938930",
"spec_repo_commit": "2eb52c63"
"regenerated": "2024-09-25 14:20:58.542891",
"spec_repo_commit": "fe8637d0"
}
}
}
72 changes: 72 additions & 0 deletions examples/v1/dashboards/CreateDashboard_1433408735.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""
Clients deserialize a dashboard with a empty time object
"""

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.formula_and_function_cloud_cost_data_source import (
FormulaAndFunctionCloudCostDataSource,
)
from datadog_api_client.v1.model.formula_and_function_cloud_cost_query_definition import (
FormulaAndFunctionCloudCostQueryDefinition,
)
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat
from datadog_api_client.v1.model.timeseries_widget_definition import TimeseriesWidgetDefinition
from datadog_api_client.v1.model.timeseries_widget_definition_type import TimeseriesWidgetDefinitionType
from datadog_api_client.v1.model.timeseries_widget_request import TimeseriesWidgetRequest
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_display_type import WidgetDisplayType
from datadog_api_client.v1.model.widget_formula import WidgetFormula
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_line_type import WidgetLineType
from datadog_api_client.v1.model.widget_line_width import WidgetLineWidth
from datadog_api_client.v1.model.widget_request_style import WidgetRequestStyle
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign

body = Dashboard(
title="Example-Dashboard",
widgets=[
Widget(
definition=TimeseriesWidgetDefinition(
title="Example Cloud Cost Query",
title_size="16",
title_align=WidgetTextAlign.LEFT,
type=TimeseriesWidgetDefinitionType.TIMESERIES,
requests=[
TimeseriesWidgetRequest(
formulas=[
WidgetFormula(
formula="query1",
),
],
queries=[
FormulaAndFunctionCloudCostQueryDefinition(
data_source=FormulaAndFunctionCloudCostDataSource.CLOUD_COST,
name="query1",
query="sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)",
),
],
response_format=FormulaAndFunctionResponseFormat.TIMESERIES,
style=WidgetRequestStyle(
palette="dog_classic",
line_type=WidgetLineType.SOLID,
line_width=WidgetLineWidth.NORMAL,
),
display_type=WidgetDisplayType.BARS,
),
],
time=WidgetLegacyLiveSpan(),
),
),
],
layout_type=DashboardLayoutType.ORDERED,
)

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
@@ -0,0 +1 @@
2024-09-24T19:19:31.807Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
interactions:
- request:
body: '{"layout_type":"ordered","title":"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571","widgets":[{"definition":{"requests":[{"display_type":"bars","formulas":[{"formula":"query1"}],"queries":[{"data_source":"cloud_cost","name":"query1","query":"sum:aws.cost.amortized{*}
by {aws_product}.rollup(sum, monthly)"}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"time":{},"title":"Example
Cloud Cost Query","title_align":"left","title_size":"16","type":"timeseries"}}]}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"id":"han-5zg-c32","title":"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/han-5zg-c32/test-clientsdeserializeadashboardwithaemptytimeobject-1727205571","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"display_type":"bars","formulas":[{"formula":"query1"}],"queries":[{"data_source":"cloud_cost","name":"query1","query":"sum:aws.cost.amortized{*}
by {aws_product}.rollup(sum, monthly)"}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"time":{},"title":"Example
Cloud Cost Query","title_align":"left","title_size":"16","type":"timeseries"},"id":4274057372149908}],"notify_list":null,"created_at":"2024-09-24T19:19:32.071328+00:00","modified_at":"2024-09-24T19:19:32.071328+00:00","experience_type":"default","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/han-5zg-c32
response:
body:
string: '{"deleted_dashboard_id":"han-5zg-c32"}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
8 changes: 8 additions & 0 deletions tests/v1/features/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ Feature: Dashboards
And a valid "appKeyAuth" key in the system
And an instance of "Dashboards" API

@replay-only @team:DataDog/dashboards-backend
Scenario: Clients deserialize a dashboard with a empty time object
Given new "CreateDashboard" request
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "Example Cloud Cost Query", "title_size": "16", "title_align": "left", "type": "timeseries", "requests": [ { "formulas": [ { "formula": "query1" } ], "queries": [ { "data_source": "cloud_cost", "name": "query1", "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)" } ], "response_format": "timeseries", "style": { "palette": "dog_classic", "line_type": "solid", "line_width": "normal" }, "display_type": "bars" } ], "time": {} } } ], "layout_type": "ordered" }
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.time" is equal to {}

@team:DataDog/dashboards-backend
Scenario: Create a distribution widget using a histogram request containing a formulas and functions APM Stats query
Given new "CreateDashboard" request
Expand Down

0 comments on commit 0e83da4

Please sign in to comment.