Struct datadog_api_client::datadogV1::model::model_toplist_widget_request::ToplistWidgetRequest
source · #[non_exhaustive]pub struct ToplistWidgetRequest {Show 17 fields
pub apm_query: Option<LogQueryDefinition>,
pub audit_query: Option<LogQueryDefinition>,
pub conditional_formats: Option<Vec<WidgetConditionalFormat>>,
pub event_query: Option<LogQueryDefinition>,
pub formulas: Option<Vec<WidgetFormula>>,
pub log_query: Option<LogQueryDefinition>,
pub network_query: Option<LogQueryDefinition>,
pub process_query: Option<ProcessQueryDefinition>,
pub profile_metrics_query: Option<LogQueryDefinition>,
pub q: Option<String>,
pub queries: Option<Vec<FormulaAndFunctionQueryDefinition>>,
pub response_format: Option<FormulaAndFunctionResponseFormat>,
pub rum_query: Option<LogQueryDefinition>,
pub security_query: Option<LogQueryDefinition>,
pub sort: Option<WidgetSortBy>,
pub style: Option<WidgetRequestStyle>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}Expand description
Updated top list widget.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.apm_query: Option<LogQueryDefinition>The log query.
audit_query: Option<LogQueryDefinition>The log query.
conditional_formats: Option<Vec<WidgetConditionalFormat>>List of conditional formats.
event_query: Option<LogQueryDefinition>The log query.
formulas: Option<Vec<WidgetFormula>>List of formulas that operate on queries.
log_query: Option<LogQueryDefinition>The log query.
network_query: Option<LogQueryDefinition>The log query.
process_query: Option<ProcessQueryDefinition>The process query to use in the widget.
profile_metrics_query: Option<LogQueryDefinition>The log query.
q: Option<String>Widget query.
queries: Option<Vec<FormulaAndFunctionQueryDefinition>>List of queries that can be returned directly or used in formulas.
response_format: Option<FormulaAndFunctionResponseFormat>Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets.
rum_query: Option<LogQueryDefinition>The log query.
security_query: Option<LogQueryDefinition>The log query.
sort: Option<WidgetSortBy>The controls for sorting the widget.
style: Option<WidgetRequestStyle>Define request widget style.
additional_properties: BTreeMap<String, Value>Implementations§
source§impl ToplistWidgetRequest
impl ToplistWidgetRequest
sourcepub fn new() -> ToplistWidgetRequest
pub fn new() -> ToplistWidgetRequest
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1213075383.rs (line 45)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetFormulaSort(
Box::new(
WidgetFormulaSort::new(
0,
WidgetSort::DESCENDING,
FormulaType::FORMULA,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}More examples
examples/v1_dashboards_CreateDashboard_2563642929.rs (line 45)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetGroupSort(
Box::new(
WidgetGroupSort::new(
"service".to_string(),
WidgetSort::ASCENDING,
GroupType::GROUP,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}pub fn apm_query(self, value: LogQueryDefinition) -> Self
pub fn audit_query(self, value: LogQueryDefinition) -> Self
pub fn conditional_formats(self, value: Vec<WidgetConditionalFormat>) -> Self
pub fn event_query(self, value: LogQueryDefinition) -> Self
sourcepub fn formulas(self, value: Vec<WidgetFormula>) -> Self
pub fn formulas(self, value: Vec<WidgetFormula>) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1213075383.rs (line 46)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetFormulaSort(
Box::new(
WidgetFormulaSort::new(
0,
WidgetSort::DESCENDING,
FormulaType::FORMULA,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}More examples
examples/v1_dashboards_CreateDashboard_2563642929.rs (line 46)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetGroupSort(
Box::new(
WidgetGroupSort::new(
"service".to_string(),
WidgetSort::ASCENDING,
GroupType::GROUP,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}pub fn log_query(self, value: LogQueryDefinition) -> Self
pub fn network_query(self, value: LogQueryDefinition) -> Self
pub fn process_query(self, value: ProcessQueryDefinition) -> Self
pub fn profile_metrics_query(self, value: LogQueryDefinition) -> Self
pub fn q(self, value: String) -> Self
sourcepub fn queries(self, value: Vec<FormulaAndFunctionQueryDefinition>) -> Self
pub fn queries(self, value: Vec<FormulaAndFunctionQueryDefinition>) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1213075383.rs (lines 47-60)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetFormulaSort(
Box::new(
WidgetFormulaSort::new(
0,
WidgetSort::DESCENDING,
FormulaType::FORMULA,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}More examples
examples/v1_dashboards_CreateDashboard_2563642929.rs (lines 47-60)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetGroupSort(
Box::new(
WidgetGroupSort::new(
"service".to_string(),
WidgetSort::ASCENDING,
GroupType::GROUP,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}sourcepub fn response_format(self, value: FormulaAndFunctionResponseFormat) -> Self
pub fn response_format(self, value: FormulaAndFunctionResponseFormat) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1213075383.rs (line 61)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetFormulaSort(
Box::new(
WidgetFormulaSort::new(
0,
WidgetSort::DESCENDING,
FormulaType::FORMULA,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}More examples
examples/v1_dashboards_CreateDashboard_2563642929.rs (line 61)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetGroupSort(
Box::new(
WidgetGroupSort::new(
"service".to_string(),
WidgetSort::ASCENDING,
GroupType::GROUP,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}pub fn rum_query(self, value: LogQueryDefinition) -> Self
pub fn security_query(self, value: LogQueryDefinition) -> Self
sourcepub fn sort(self, value: WidgetSortBy) -> Self
pub fn sort(self, value: WidgetSortBy) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1213075383.rs (lines 62-78)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetFormulaSort(
Box::new(
WidgetFormulaSort::new(
0,
WidgetSort::DESCENDING,
FormulaType::FORMULA,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}More examples
examples/v1_dashboards_CreateDashboard_2563642929.rs (lines 62-78)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::FREE,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::ToplistWidgetDefinition(
Box::new(
ToplistWidgetDefinition::new(
vec![
ToplistWidgetRequest::new()
.formulas(vec![WidgetFormula::new("query1".to_string())])
.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)
.sort(
WidgetSortBy::new()
.count(10)
.order_by(
vec![
WidgetSortOrderBy::WidgetGroupSort(
Box::new(
WidgetGroupSort::new(
"service".to_string(),
WidgetSort::ASCENDING,
GroupType::GROUP,
),
),
)
],
),
)
],
ToplistWidgetDefinitionType::TOPLIST,
)
.style(
ToplistWidgetStyle::new()
.display(
ToplistWidgetDisplay::ToplistWidgetStacked(
Box::new(
ToplistWidgetStacked::new(
ToplistWidgetLegend::INLINE,
ToplistWidgetStackedType::STACKED,
),
),
),
)
.scaling(ToplistWidgetScaling::RELATIVE),
)
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
.title("".to_string())
.title_align(WidgetTextAlign::LEFT)
.title_size("16".to_string()),
),
),
).layout(WidgetLayout::new(15, 47, 0, 0))
],
)
.description(Some("".to_string()))
.is_read_only(false)
.notify_list(Some(vec![]))
.template_variables(Some(vec![]));
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());
}
}pub fn style(self, value: WidgetRequestStyle) -> Self
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
source§impl Clone for ToplistWidgetRequest
impl Clone for ToplistWidgetRequest
source§fn clone(&self) -> ToplistWidgetRequest
fn clone(&self) -> ToplistWidgetRequest
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ToplistWidgetRequest
impl Debug for ToplistWidgetRequest
source§impl Default for ToplistWidgetRequest
impl Default for ToplistWidgetRequest
source§impl<'de> Deserialize<'de> for ToplistWidgetRequest
impl<'de> Deserialize<'de> for ToplistWidgetRequest
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for ToplistWidgetRequest
impl PartialEq for ToplistWidgetRequest
source§impl Serialize for ToplistWidgetRequest
impl Serialize for ToplistWidgetRequest
impl StructuralPartialEq for ToplistWidgetRequest
Auto Trait Implementations§
impl Freeze for ToplistWidgetRequest
impl RefUnwindSafe for ToplistWidgetRequest
impl Send for ToplistWidgetRequest
impl Sync for ToplistWidgetRequest
impl Unpin for ToplistWidgetRequest
impl UnwindSafe for ToplistWidgetRequest
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)