Skip to content

Commit 879e260

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 015355f6 of spec repo
1 parent b97a6ed commit 879e260

8 files changed

+188
-5
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-07-22 20:03:17.328705",
8-
"spec_repo_commit": "cd020fa6"
7+
"regenerated": "2024-07-23 15:33:48.419346",
8+
"spec_repo_commit": "015355f6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-07-22 20:03:17.348534",
13-
"spec_repo_commit": "cd020fa6"
12+
"regenerated": "2024-07-23 15:33:48.441949",
13+
"spec_repo_commit": "015355f6"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,6 +2867,7 @@ components:
28672867
- events
28682868
- ci_tests
28692869
- ci_pipelines
2870+
- incident_analytics
28702871
example: logs
28712872
type: string
28722873
x-enum-varnames:
@@ -2880,6 +2881,7 @@ components:
28802881
- EVENTS
28812882
- CI_TESTS
28822883
- CI_PIPELINES
2884+
- INCIDENT_ANALYTICS
28832885
FormulaAndFunctionMetricAggregation:
28842886
description: The aggregation methods available for metrics queries.
28852887
enum:

LICENSE-3rdparty.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ mio,https://github.com/tokio-rs/mio,MIT,"Carl Lerche <[email protected]>, Thomas
6969
native-tls,https://github.com/sfackler/rust-native-tls,MIT OR Apache-2.0,Steven Fackler <[email protected]>
7070
num-conv,https://github.com/jhpratt/num-conv,MIT OR Apache-2.0,Jacob Pratt <[email protected]>
7171
num-traits,https://github.com/rust-num/num-traits,MIT OR Apache-2.0,The Rust Project Developers
72-
num_cpus,https://github.com/seanmonstar/num_cpus,MIT OR Apache-2.0,Sean McArthur <[email protected]>
7372
object,https://github.com/gimli-rs/object,Apache-2.0 OR MIT,The object Authors
7473
once_cell,https://github.com/matklad/once_cell,MIT OR Apache-2.0,Aleksey Kladov <[email protected]>
7574
openssl,https://github.com/sfackler/rust-openssl,Apache-2.0,Steven Fackler <[email protected]>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// Create a new timeseries widget with incident_analytics data source
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
4+
use datadog_api_client::datadogV1::model::Dashboard;
5+
use datadog_api_client::datadogV1::model::DashboardLayoutType;
6+
use datadog_api_client::datadogV1::model::DashboardReflowType;
7+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventAggregation;
8+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition;
9+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute;
10+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch;
11+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource;
12+
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
13+
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
14+
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinition;
15+
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinitionType;
16+
use datadog_api_client::datadogV1::model::TimeseriesWidgetLegendColumn;
17+
use datadog_api_client::datadogV1::model::TimeseriesWidgetLegendLayout;
18+
use datadog_api_client::datadogV1::model::TimeseriesWidgetRequest;
19+
use datadog_api_client::datadogV1::model::Widget;
20+
use datadog_api_client::datadogV1::model::WidgetDefinition;
21+
use datadog_api_client::datadogV1::model::WidgetDisplayType;
22+
use datadog_api_client::datadogV1::model::WidgetFormula;
23+
use datadog_api_client::datadogV1::model::WidgetLineType;
24+
use datadog_api_client::datadogV1::model::WidgetLineWidth;
25+
use datadog_api_client::datadogV1::model::WidgetRequestStyle;
26+
use datadog_api_client::datadogV1::model::WidgetTime;
27+
28+
#[tokio::main]
29+
async fn main() {
30+
let body =
31+
Dashboard::new(
32+
DashboardLayoutType::ORDERED,
33+
"Example-Dashboard with incident_analytics datasource".to_string(),
34+
vec![
35+
Widget::new(
36+
WidgetDefinition::TimeseriesWidgetDefinition(
37+
Box::new(
38+
TimeseriesWidgetDefinition::new(
39+
vec![
40+
TimeseriesWidgetRequest::new()
41+
.display_type(WidgetDisplayType::LINE)
42+
.formulas(vec![WidgetFormula::new("query1".to_string())])
43+
.queries(
44+
vec![
45+
FormulaAndFunctionQueryDefinition
46+
::FormulaAndFunctionEventQueryDefinition(
47+
Box::new(
48+
FormulaAndFunctionEventQueryDefinition::new(
49+
FormulaAndFunctionEventQueryDefinitionCompute::new(
50+
FormulaAndFunctionEventAggregation::COUNT,
51+
),
52+
FormulaAndFunctionEventsDataSource::INCIDENT_ANALYTICS,
53+
"query1".to_string(),
54+
)
55+
.group_by(vec![])
56+
.indexes(vec!["*".to_string()])
57+
.search(
58+
FormulaAndFunctionEventQueryDefinitionSearch::new(
59+
"test_level:test".to_string(),
60+
),
61+
),
62+
),
63+
)
64+
],
65+
)
66+
.response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
67+
.style(
68+
WidgetRequestStyle::new()
69+
.line_type(WidgetLineType::SOLID)
70+
.line_width(WidgetLineWidth::NORMAL)
71+
.palette("dog_classic".to_string()),
72+
)
73+
],
74+
TimeseriesWidgetDefinitionType::TIMESERIES,
75+
)
76+
.legend_columns(
77+
vec![
78+
TimeseriesWidgetLegendColumn::AVG,
79+
TimeseriesWidgetLegendColumn::MIN,
80+
TimeseriesWidgetLegendColumn::MAX,
81+
TimeseriesWidgetLegendColumn::VALUE,
82+
TimeseriesWidgetLegendColumn::SUM
83+
],
84+
)
85+
.legend_layout(TimeseriesWidgetLegendLayout::AUTO)
86+
.show_legend(true)
87+
.time(WidgetTime::new())
88+
.title("".to_string()),
89+
),
90+
),
91+
)
92+
],
93+
).reflow_type(DashboardReflowType::AUTO);
94+
let configuration = datadog::Configuration::new();
95+
let api = DashboardsAPI::with_config(configuration);
96+
let resp = api.create_dashboard(body).await;
97+
if let Ok(value) = resp {
98+
println!("{:#?}", value);
99+
} else {
100+
println!("{:#?}", resp.unwrap_err());
101+
}
102+
}

src/datadogV1/model/model_formula_and_function_events_data_source.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub enum FormulaAndFunctionEventsDataSource {
1717
EVENTS,
1818
CI_TESTS,
1919
CI_PIPELINES,
20+
INCIDENT_ANALYTICS,
2021
UnparsedObject(crate::datadog::UnparsedObject),
2122
}
2223

@@ -33,6 +34,7 @@ impl ToString for FormulaAndFunctionEventsDataSource {
3334
Self::EVENTS => String::from("events"),
3435
Self::CI_TESTS => String::from("ci_tests"),
3536
Self::CI_PIPELINES => String::from("ci_pipelines"),
37+
Self::INCIDENT_ANALYTICS => String::from("incident_analytics"),
3638
Self::UnparsedObject(v) => v.value.to_string(),
3739
}
3840
}
@@ -67,6 +69,7 @@ impl<'de> Deserialize<'de> for FormulaAndFunctionEventsDataSource {
6769
"events" => Self::EVENTS,
6870
"ci_tests" => Self::CI_TESTS,
6971
"ci_pipelines" => Self::CI_PIPELINES,
72+
"incident_analytics" => Self::INCIDENT_ANALYTICS,
7073
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
7174
value: serde_json::Value::String(s.into()),
7275
}),
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-07-23T14:59:59.215Z
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"request": {
5+
"body": {
6+
"string": "{\"layout_type\":\"ordered\",\"reflow_type\":\"auto\",\"title\":\"Test-Create_a_new_timeseries_widget_with_incident_analytics_data_source-1721746799 with incident_analytics datasource\",\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"incident_analytics\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"test_level:test\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{},\"title\":\"\",\"type\":\"timeseries\"}}]}",
7+
"encoding": null
8+
},
9+
"headers": {
10+
"Accept": [
11+
"application/json"
12+
],
13+
"Content-Type": [
14+
"application/json"
15+
]
16+
},
17+
"method": "post",
18+
"uri": "https://api.datadoghq.com/api/v1/dashboard"
19+
},
20+
"response": {
21+
"body": {
22+
"string": "{\"id\":\"r29-a2b-nhh\",\"title\":\"Test-Create_a_new_timeseries_widget_with_incident_analytics_data_source-1721746799 with incident_analytics datasource\",\"description\":null,\"author_handle\":\"[email protected]\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/r29-a2b-nhh/test-createanewtimeserieswidgetwithincidentanalyticsdatasource-1721746799-with-i\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"incident_analytics\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"test_level:test\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{},\"title\":\"\",\"type\":\"timeseries\"},\"id\":4216078110414841}],\"notify_list\":null,\"created_at\":\"2024-07-23T14:59:59.491800+00:00\",\"modified_at\":\"2024-07-23T14:59:59.491800+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}\n",
23+
"encoding": null
24+
},
25+
"headers": {
26+
"Content-Type": [
27+
"application/json"
28+
]
29+
},
30+
"status": {
31+
"code": 200,
32+
"message": "OK"
33+
}
34+
},
35+
"recorded_at": "Tue, 23 Jul 2024 14:59:59 GMT"
36+
},
37+
{
38+
"request": {
39+
"body": "",
40+
"headers": {
41+
"Accept": [
42+
"application/json"
43+
]
44+
},
45+
"method": "delete",
46+
"uri": "https://api.datadoghq.com/api/v1/dashboard/r29-a2b-nhh"
47+
},
48+
"response": {
49+
"body": {
50+
"string": "{\"deleted_dashboard_id\":\"r29-a2b-nhh\"}\n",
51+
"encoding": null
52+
},
53+
"headers": {
54+
"Content-Type": [
55+
"application/json"
56+
]
57+
},
58+
"status": {
59+
"code": 200,
60+
"message": "OK"
61+
}
62+
},
63+
"recorded_at": "Tue, 23 Jul 2024 14:59:59 GMT"
64+
}
65+
],
66+
"recorded_with": "VCR 6.0.0"
67+
}

tests/scenarios/features/v1/dashboards.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,15 @@ Feature: Dashboards
830830
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "ci_tests"
831831
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test"
832832

833+
@team:DataDog/dashboards-backend
834+
Scenario: Create a new timeseries widget with incident_analytics data source
835+
Given new "CreateDashboard" request
836+
And body with value {"title":"{{ unique }} with incident_analytics datasource","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"incident_analytics","name":"query1","search":{"query":"test_level:test"},"indexes":["*"],"compute":{"aggregation":"count"},"group_by":[]}],"response_format":"timeseries","style":{"palette":"dog_classic","line_type":"solid","line_width":"normal"},"display_type":"line"}]}}],"layout_type":"ordered","reflow_type":"auto"}
837+
When the request is sent
838+
Then the response status is 200 OK
839+
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "incident_analytics"
840+
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test"
841+
833842
@generated @skip @team:DataDog/dashboards-backend
834843
Scenario: Create a shared dashboard returns "Bad Request" response
835844
Given new "CreatePublicDashboard" request

0 commit comments

Comments
 (0)