-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit bc0f83d2 of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Feb 15, 2023
1 parent
ee7ecfa
commit 7f5f29f
Showing
8 changed files
with
226 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
Create a new dashboard with slo list widget with sort | ||
""" | ||
|
||
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.slo_list_widget_definition import SLOListWidgetDefinition | ||
from datadog_api_client.v1.model.slo_list_widget_definition_type import SLOListWidgetDefinitionType | ||
from datadog_api_client.v1.model.slo_list_widget_query import SLOListWidgetQuery | ||
from datadog_api_client.v1.model.slo_list_widget_request import SLOListWidgetRequest | ||
from datadog_api_client.v1.model.slo_list_widget_request_type import SLOListWidgetRequestType | ||
from datadog_api_client.v1.model.widget import Widget | ||
from datadog_api_client.v1.model.widget_field_sort import WidgetFieldSort | ||
from datadog_api_client.v1.model.widget_layout import WidgetLayout | ||
from datadog_api_client.v1.model.widget_sort import WidgetSort | ||
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign | ||
|
||
body = Dashboard( | ||
title="Example-Create_a_new_dashboard_with_slo_list_widget_with_sort", | ||
description="", | ||
widgets=[ | ||
Widget( | ||
layout=WidgetLayout( | ||
x=0, | ||
y=0, | ||
width=60, | ||
height=21, | ||
), | ||
definition=SLOListWidgetDefinition( | ||
title_size="16", | ||
title_align=WidgetTextAlign.LEFT, | ||
type=SLOListWidgetDefinitionType.SLO_LIST, | ||
requests=[ | ||
SLOListWidgetRequest( | ||
query=SLOListWidgetQuery( | ||
query_string="env:prod AND service:my-app", | ||
limit=75, | ||
sort=[ | ||
WidgetFieldSort( | ||
column="status.sli", | ||
order=WidgetSort.ASCENDING, | ||
), | ||
], | ||
), | ||
request_type=SLOListWidgetRequestType.SLO_LIST, | ||
), | ||
], | ||
), | ||
), | ||
], | ||
template_variables=[], | ||
layout_type=DashboardLayoutType.FREE, | ||
is_read_only=False, | ||
notify_list=[], | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = DashboardsApi(api_client) | ||
response = api_instance.create_dashboard(body=body) | ||
|
||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...assettes/test_scenarios/test_create_a_new_dashboard_with_slo_list_widget_with_sort.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-02-14T18:54:56.599Z |
80 changes: 80 additions & 0 deletions
80
.../cassettes/test_scenarios/test_create_a_new_dashboard_with_slo_list_widget_with_sort.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
interactions: | ||
- request: | ||
body: '{"name":"Test-Create_a_new_dashboard_with_slo_list_widget_with_sort-1676400896","query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"thresholds":[{"target":95,"timeframe":"7d","warning":98}],"type":"metric"}' | ||
headers: | ||
accept: | ||
- application/json | ||
content-type: | ||
- application/json | ||
method: POST | ||
uri: https://api.datadoghq.com/api/v1/slo | ||
response: | ||
body: | ||
string: '{"data":[{"id":"80091437d0165587a0831040981e44f9","name":"Test-Create_a_new_dashboard_with_slo_list_widget_with_sort-1676400896","tags":[],"monitor_tags":[],"thresholds":[{"timeframe":"7d","target":95.0,"target_display":"95.","warning":98.0,"warning_display":"98."}],"type":"metric","type_id":1,"description":"","timeframe":"7d","warning_threshold":98,"target_threshold":95,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"creator":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"created_at":1676400896,"modified_at":1676400896}],"error":null} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_slo_list_widget_with_sort-1676400896","widgets":[{"definition":{"requests":[{"query":{"limit":75,"query_string":"env:prod | ||
AND service:my-app","sort":[{"column":"status.sli","order":"asc"}]},"request_type":"slo_list"}],"title_align":"left","title_size":"16","type":"slo_list"},"layout":{"height":21,"width":60,"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":"6hq-ih3-tzg","title":"Test-Create_a_new_dashboard_with_slo_list_widget_with_sort-1676400896","description":"","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"free","url":"/dashboard/6hq-ih3-tzg/test-createanewdashboardwithslolistwidgetwithsort-1676400896","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"query":{"limit":75,"query_string":"env:prod | ||
AND service:my-app","sort":[{"column":"status.sli","order":"asc"}]},"request_type":"slo_list"}],"title_align":"left","title_size":"16","type":"slo_list"},"layout":{"height":21,"width":60,"x":0,"y":0},"id":1642439378480719}],"notify_list":[],"created_at":"2023-02-14T18:54:57.012649+00:00","modified_at":"2023-02-14T18:54:57.012649+00:00","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/6hq-ih3-tzg | ||
response: | ||
body: | ||
string: '{"deleted_dashboard_id":"6hq-ih3-tzg"} | ||
' | ||
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/slo/80091437d0165587a0831040981e44f9 | ||
response: | ||
body: | ||
string: '{"data":["80091437d0165587a0831040981e44f9"],"error":null} | ||
' | ||
headers: | ||
content-type: | ||
- application/json | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
tests/v1/features/dashboards_json_payload/slo_list_widget_with_sort.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"title": "{{ unique }}", | ||
"description": "", | ||
"widgets": [ | ||
{ | ||
"layout": { | ||
"x": 0, | ||
"y": 0, | ||
"width": 60, | ||
"height": 21 | ||
}, | ||
"definition": { | ||
"title_size": "16", | ||
"title_align": "left", | ||
"type": "slo_list", | ||
"requests": [ | ||
{ | ||
"query": { | ||
"query_string": "env:prod AND service:my-app", | ||
"limit": 75, | ||
"sort": [ | ||
{ | ||
"column": "status.sli", | ||
"order": "asc" | ||
} | ||
] | ||
}, | ||
"request_type": "slo_list" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"template_variables": [], | ||
"layout_type": "free", | ||
"is_read_only": false, | ||
"notify_list": [] | ||
} |