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
87 changes: 84 additions & 3 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,9 @@ components:
type: string
markers:
description: List of markers.
example:
- display_type: percentile
value: '90'
items:
$ref: '#/components/schemas/WidgetMarker'
type: array
Expand Down Expand Up @@ -1816,6 +1819,11 @@ components:
$ref: '#/components/schemas/ApmStatsQueryDefinition'
event_query:
$ref: '#/components/schemas/LogQueryDefinition'
formulas:
description: List of formulas that operate on queries.
items:
$ref: '#/components/schemas/WidgetFormula'
type: array
log_query:
$ref: '#/components/schemas/LogQueryDefinition'
network_query:
Expand All @@ -1827,10 +1835,17 @@ components:
q:
description: Widget query.
type: string
queries:
description: List of queries that can be returned directly or used in formulas.
items:
$ref: '#/components/schemas/FormulaAndFunctionQueryDefinition'
type: array
query:
$ref: '#/components/schemas/DistributionWidgetHistogramRequestQuery'
request_type:
$ref: '#/components/schemas/DistributionWidgetHistogramRequestType'
response_format:
$ref: '#/components/schemas/FormulaAndFunctionResponseFormat'
rum_query:
$ref: '#/components/schemas/LogQueryDefinition'
security_query:
Expand All @@ -1854,6 +1869,12 @@ components:
description: Specifies minimum value to show on the x-axis. It takes a number,
percentile (p90 === 90th percentile), or auto for default behavior.
type: string
num_buckets:
description: Number of value buckets to target, aka the resolution of the
value bins.
example: 100
format: int64
type: integer
scale:
default: linear
description: Specifies the scale type. Possible values are `linear`.
Expand Down Expand Up @@ -3714,6 +3735,14 @@ components:
type: array
legend_size:
$ref: '#/components/schemas/WidgetLegendSize'
markers:
description: List of markers.
example:
- display_type: percentile
value: '90'
items:
$ref: '#/components/schemas/WidgetMarker'
type: array
requests:
description: List of widget types.
example:
Expand All @@ -3738,8 +3767,10 @@ components:
type: string
type:
$ref: '#/components/schemas/HeatMapWidgetDefinitionType'
xaxis:
$ref: '#/components/schemas/HeatMapWidgetXAxis'
yaxis:
$ref: '#/components/schemas/WidgetAxis'
$ref: '#/components/schemas/HeatMapWidgetYAxis'
required:
- type
- requests
Expand Down Expand Up @@ -3781,6 +3812,10 @@ components:
items:
$ref: '#/components/schemas/FormulaAndFunctionQueryDefinition'
type: array
query:
$ref: '#/components/schemas/DistributionWidgetHistogramRequestQuery'
request_type:
$ref: '#/components/schemas/DistributionWidgetHistogramRequestType'
response_format:
$ref: '#/components/schemas/FormulaAndFunctionResponseFormat'
rum_query:
Expand All @@ -3790,6 +3825,49 @@ components:
style:
$ref: '#/components/schemas/WidgetStyle'
type: object
HeatMapWidgetXAxis:
description: X Axis controls for the heat map widget.
properties:
num_buckets:
description: Number of time buckets to target, aka the resolution of the
time bins. This is only applicable for distribution of points (group distributions
use the roll-up modifier).
example: 50
format: int64
type: integer
type: object
HeatMapWidgetYAxis:
description: Y Axis controls for the heat map widget.
properties:
include_zero:
description: Set to `true` to include zero.
type: boolean
label:
description: The label of the axis to display on the graph. Only usable
on Scatterplot Widgets.
type: string
max:
default: auto
description: Specifies maximum numeric value to show on the axis. Defaults
to `auto`.
type: string
min:
default: auto
description: Specifies minimum numeric value to show on the axis. Defaults
to `auto`.
type: string
num_buckets:
description: Number of value buckets to target, aka the resolution of the
value bins.
example: 50
format: int64
type: integer
scale:
default: linear
description: Specifies the scale type. Possible values are `linear`, `log`,
`sqrt`, and `pow##` (for example `pow2` or `pow0.5`).
type: string
type: object
Host:
description: Object representing a host.
properties:
Expand Down Expand Up @@ -25147,7 +25225,7 @@ components:
display_type:
description: "Combination of:\n - A severity error, warning, ok, or info\n
\ - A line type: dashed, solid, or bold\nIn this case of a Distribution
widget, this can be set to be `x_axis_percentile`."
widget, this can be set to be `percentile`."
example: error dashed
type: string
label:
Expand All @@ -25158,8 +25236,11 @@ components:
description: Timestamp for the widget.
type: string
value:
description: Value to apply. Can be a single value y = 15 or a range of
description: 'Value to apply. Can be a single value y = 15 or a range of
values 0 < y < 10.

For Distribution widgets with `display_type` set to `percentile`, this
should be a numeric percentile value (e.g., "90" for P90).'
example: y = 15
type: string
required:
Expand Down
91 changes: 91 additions & 0 deletions examples/v1_dashboards_CreateDashboard_1093147852.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Create a new dashboard with distribution widget with markers and num_buckets
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinition;
use datadog_api_client::datadogV1::model::DistributionWidgetDefinitionType;
use datadog_api_client::datadogV1::model::DistributionWidgetRequest;
use datadog_api_client::datadogV1::model::DistributionWidgetXAxis;
use datadog_api_client::datadogV1::model::DistributionWidgetYAxis;
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricAggregation;
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricDataSource;
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinition;
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetDefinition;
use datadog_api_client::datadogV1::model::WidgetLayout;
use datadog_api_client::datadogV1::model::WidgetMarker;
use datadog_api_client::datadogV1::model::WidgetTextAlign;

#[tokio::main]
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::ORDERED,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::DistributionWidgetDefinition(
Box::new(
DistributionWidgetDefinition::new(
vec![
DistributionWidgetRequest::new()
.queries(
vec![
FormulaAndFunctionQueryDefinition
::FormulaAndFunctionMetricQueryDefinition(
Box::new(
FormulaAndFunctionMetricQueryDefinition::new(
FormulaAndFunctionMetricDataSource::METRICS,
"query1".to_string(),
"avg:system.cpu.user{*} by {service}".to_string(),
).aggregator(FormulaAndFunctionMetricAggregation::AVG),
),
)
],
)
.response_format(FormulaAndFunctionResponseFormat::SCALAR)
],
DistributionWidgetDefinitionType::DISTRIBUTION,
)
.markers(
vec![
WidgetMarker::new("50".to_string()).display_type("percentile".to_string()),
WidgetMarker::new("99".to_string()).display_type("percentile".to_string()),
WidgetMarker::new("90".to_string()).display_type("percentile".to_string())
],
)
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string())
.xaxis(
DistributionWidgetXAxis::new()
.include_zero(true)
.max("auto".to_string())
.min("auto".to_string())
.num_buckets(55)
.scale("linear".to_string()),
)
.yaxis(
DistributionWidgetYAxis::new()
.include_zero(true)
.max("auto".to_string())
.min("auto".to_string())
.scale("linear".to_string()),
),
),
),
).layout(WidgetLayout::new(4, 4, 0, 0))
],
);
let configuration = datadog::Configuration::new();
let api = DashboardsAPI::with_config(configuration);
let resp = api.create_dashboard(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
81 changes: 81 additions & 0 deletions examples/v1_dashboards_CreateDashboard_2823363212.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Create a new dashboard with heatmap widget with markers and num_buckets
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestQuery;
use datadog_api_client::datadogV1::model::DistributionWidgetHistogramRequestType;
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricDataSource;
use datadog_api_client::datadogV1::model::FormulaAndFunctionMetricQueryDefinition;
use datadog_api_client::datadogV1::model::HeatMapWidgetDefinition;
use datadog_api_client::datadogV1::model::HeatMapWidgetDefinitionType;
use datadog_api_client::datadogV1::model::HeatMapWidgetRequest;
use datadog_api_client::datadogV1::model::HeatMapWidgetXAxis;
use datadog_api_client::datadogV1::model::HeatMapWidgetYAxis;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetDefinition;
use datadog_api_client::datadogV1::model::WidgetLayout;
use datadog_api_client::datadogV1::model::WidgetMarker;
use datadog_api_client::datadogV1::model::WidgetTextAlign;

#[tokio::main]
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::ORDERED,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::HeatMapWidgetDefinition(
Box::new(
HeatMapWidgetDefinition::new(
vec![
HeatMapWidgetRequest::new()
.query(
DistributionWidgetHistogramRequestQuery
::FormulaAndFunctionMetricQueryDefinition(
Box::new(
FormulaAndFunctionMetricQueryDefinition::new(
FormulaAndFunctionMetricDataSource::METRICS,
"query1".to_string(),
"histogram:trace.servlet.request{*}".to_string(),
),
),
),
)
.request_type(DistributionWidgetHistogramRequestType::HISTOGRAM)
],
HeatMapWidgetDefinitionType::HEATMAP,
)
.markers(
vec![
WidgetMarker::new("50".to_string()).display_type("percentile".to_string()),
WidgetMarker::new("99".to_string()).display_type("percentile".to_string())
],
)
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string())
.xaxis(HeatMapWidgetXAxis::new().num_buckets(75))
.yaxis(
HeatMapWidgetYAxis::new()
.include_zero(true)
.max("auto".to_string())
.min("auto".to_string())
.num_buckets(55)
.scale("linear".to_string()),
),
),
),
).layout(WidgetLayout::new(4, 4, 0, 0))
],
);
let configuration = datadog::Configuration::new();
let api = DashboardsAPI::with_config(configuration);
let resp = api.create_dashboard(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
8 changes: 6 additions & 2 deletions src/datadogV1/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,10 @@ pub mod model_event_query_definition;
pub use self::model_event_query_definition::EventQueryDefinition;
pub mod model_heat_map_widget_definition_type;
pub use self::model_heat_map_widget_definition_type::HeatMapWidgetDefinitionType;
pub mod model_widget_axis;
pub use self::model_widget_axis::WidgetAxis;
pub mod model_heat_map_widget_x_axis;
pub use self::model_heat_map_widget_x_axis::HeatMapWidgetXAxis;
pub mod model_heat_map_widget_y_axis;
pub use self::model_heat_map_widget_y_axis::HeatMapWidgetYAxis;
pub mod model_host_map_widget_definition;
pub use self::model_host_map_widget_definition::HostMapWidgetDefinition;
pub mod model_widget_node_type;
Expand Down Expand Up @@ -436,6 +438,8 @@ pub mod model_timeseries_background;
pub use self::model_timeseries_background::TimeseriesBackground;
pub mod model_timeseries_background_type;
pub use self::model_timeseries_background_type::TimeseriesBackgroundType;
pub mod model_widget_axis;
pub use self::model_widget_axis::WidgetAxis;
pub mod model_query_value_widget_definition_type;
pub use self::model_query_value_widget_definition_type::QueryValueWidgetDefinitionType;
pub mod model_run_workflow_widget_definition;
Expand Down
Loading