#[non_exhaustive]pub struct WidgetRequestStyle {
pub line_type: Option<WidgetLineType>,
pub line_width: Option<WidgetLineWidth>,
pub palette: Option<String>,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
Define request widget style.
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.line_type: Option<WidgetLineType>
Type of lines displayed.
line_width: Option<WidgetLineWidth>
Width of line displayed.
palette: Option<String>
Color palette to apply to the widget.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl WidgetRequestStyle
impl WidgetRequestStyle
Sourcepub fn new() -> WidgetRequestStyle
pub fn new() -> WidgetRequestStyle
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3982498788.rs (line 35)
17async fn main() {
18 let body =
19 Dashboard::new(
20 DashboardLayoutType::ORDERED,
21 "Example-Dashboard with timeseries widget".to_string(),
22 vec![
23 Widget::new(
24 WidgetDefinition::TimeseriesWidgetDefinition(
25 Box::new(
26 TimeseriesWidgetDefinition::new(
27 vec![
28 TimeseriesWidgetRequest::new()
29 .display_type(WidgetDisplayType::BARS)
30 .on_right_yaxis(false)
31 .q(
32 "sum:trace.test.errors{env:prod,service:datadog-api-spec} by {resource_name}.as_count()".to_string(),
33 )
34 .style(
35 WidgetRequestStyle::new()
36 .line_type(WidgetLineType::SOLID)
37 .line_width(WidgetLineWidth::NORMAL)
38 .palette("warm".to_string()),
39 )
40 ],
41 TimeseriesWidgetDefinitionType::TIMESERIES,
42 ),
43 ),
44 ),
45 )
46 ],
47 );
48 let configuration = datadog::Configuration::new();
49 let api = DashboardsAPI::with_config(configuration);
50 let resp = api.create_dashboard(body).await;
51 if let Ok(value) = resp {
52 println!("{:#?}", value);
53 } else {
54 println!("{:#?}", resp.unwrap_err());
55 }
56}
More examples
examples/v1_notebooks_CreateNotebook.rs (line 60)
31async fn main() {
32 let body = NotebookCreateRequest::new(NotebookCreateData::new(
33 NotebookCreateDataAttributes::new(
34 vec![
35 NotebookCellCreateRequest::new(
36 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37 NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38 r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45 .to_string(),
46 NotebookMarkdownCellDefinitionType::MARKDOWN,
47 )),
48 )),
49 NotebookCellResourceType::NOTEBOOK_CELLS,
50 ),
51 NotebookCellCreateRequest::new(
52 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53 Box::new(
54 NotebookTimeseriesCellAttributes::new(
55 TimeseriesWidgetDefinition::new(
56 vec![TimeseriesWidgetRequest::new()
57 .display_type(WidgetDisplayType::LINE)
58 .q("avg:system.load.1{*}".to_string())
59 .style(
60 WidgetRequestStyle::new()
61 .line_type(WidgetLineType::SOLID)
62 .line_width(WidgetLineWidth::NORMAL)
63 .palette("dog_classic".to_string()),
64 )],
65 TimeseriesWidgetDefinitionType::TIMESERIES,
66 )
67 .show_legend(true)
68 .yaxis(WidgetAxis::new().scale("linear".to_string())),
69 )
70 .graph_size(NotebookGraphSize::MEDIUM)
71 .split_by(NotebookSplitBy::new(vec![], vec![]))
72 .time(None),
73 ),
74 ),
75 NotebookCellResourceType::NOTEBOOK_CELLS,
76 ),
77 ],
78 "Example-Notebook".to_string(),
79 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80 WidgetLiveSpan::PAST_ONE_HOUR,
81 ))),
82 )
83 .status(NotebookStatus::PUBLISHED),
84 NotebookResourceType::NOTEBOOKS,
85 ));
86 let configuration = datadog::Configuration::new();
87 let api = NotebooksAPI::with_config(configuration);
88 let resp = api.create_notebook(body).await;
89 if let Ok(value) = resp {
90 println!("{:#?}", value);
91 } else {
92 println!("{:#?}", resp.unwrap_err());
93 }
94}
examples/v1_dashboards_CreateDashboard_1433408735.rs (line 55)
25async fn main() {
26 let body =
27 Dashboard::new(
28 DashboardLayoutType::ORDERED,
29 "Example-Dashboard".to_string(),
30 vec![
31 Widget::new(
32 WidgetDefinition::TimeseriesWidgetDefinition(
33 Box::new(
34 TimeseriesWidgetDefinition::new(
35 vec![
36 TimeseriesWidgetRequest::new()
37 .display_type(WidgetDisplayType::BARS)
38 .formulas(vec![WidgetFormula::new("query1".to_string())])
39 .queries(
40 vec![
41 FormulaAndFunctionQueryDefinition
42 ::FormulaAndFunctionCloudCostQueryDefinition(
43 Box::new(
44 FormulaAndFunctionCloudCostQueryDefinition::new(
45 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
46 "query1".to_string(),
47 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
48 ),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
54 .style(
55 WidgetRequestStyle::new()
56 .line_type(WidgetLineType::SOLID)
57 .line_width(WidgetLineWidth::NORMAL)
58 .palette("dog_classic".to_string()),
59 )
60 ],
61 TimeseriesWidgetDefinitionType::TIMESERIES,
62 )
63 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
64 .title("Example Cloud Cost Query".to_string())
65 .title_align(WidgetTextAlign::LEFT)
66 .title_size("16".to_string()),
67 ),
68 ),
69 )
70 ],
71 );
72 let configuration = datadog::Configuration::new();
73 let api = DashboardsAPI::with_config(configuration);
74 let resp = api.create_dashboard(body).await;
75 if let Ok(value) = resp {
76 println!("{:#?}", value);
77 } else {
78 println!("{:#?}", resp.unwrap_err());
79 }
80}
examples/v1_dashboards_CreateDashboard_1284514532.rs (line 57)
27async fn main() {
28 let body =
29 Dashboard::new(
30 DashboardLayoutType::ORDERED,
31 "Example-Dashboard".to_string(),
32 vec![
33 Widget::new(
34 WidgetDefinition::TimeseriesWidgetDefinition(
35 Box::new(
36 TimeseriesWidgetDefinition::new(
37 vec![
38 TimeseriesWidgetRequest::new()
39 .display_type(WidgetDisplayType::BARS)
40 .formulas(vec![WidgetFormula::new("query1".to_string())])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionCloudCostQueryDefinition(
45 Box::new(
46 FormulaAndFunctionCloudCostQueryDefinition::new(
47 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
48 "query1".to_string(),
49 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
50 ),
51 ),
52 )
53 ],
54 )
55 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
56 .style(
57 WidgetRequestStyle::new()
58 .line_type(WidgetLineType::SOLID)
59 .line_width(WidgetLineWidth::NORMAL)
60 .palette("dog_classic".to_string()),
61 )
62 ],
63 TimeseriesWidgetDefinitionType::TIMESERIES,
64 )
65 .time(
66 WidgetTime::WidgetLegacyLiveSpan(
67 Box::new(WidgetLegacyLiveSpan::new().live_span(WidgetLiveSpan::WEEK_TO_DATE)),
68 ),
69 )
70 .title("Example Cloud Cost Query".to_string())
71 .title_align(WidgetTextAlign::LEFT)
72 .title_size("16".to_string()),
73 ),
74 ),
75 )
76 ],
77 );
78 let configuration = datadog::Configuration::new();
79 let api = DashboardsAPI::with_config(configuration);
80 let resp = api.create_dashboard(body).await;
81 if let Ok(value) = resp {
82 println!("{:#?}", value);
83 } else {
84 println!("{:#?}", resp.unwrap_err());
85 }
86}
examples/v1_notebooks_UpdateNotebook.rs (line 68)
32async fn main() {
33 // there is a valid "notebook" in the system
34 let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35 let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36 NotebookUpdateDataAttributes::new(
37 vec![
38 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39 NotebookCellCreateRequest::new(
40 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41 Box::new(NotebookMarkdownCellAttributes::new(
42 NotebookMarkdownCellDefinition::new(
43 r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50 .to_string(),
51 NotebookMarkdownCellDefinitionType::MARKDOWN,
52 ),
53 )),
54 ),
55 NotebookCellResourceType::NOTEBOOK_CELLS,
56 ),
57 )),
58 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59 NotebookCellCreateRequest::new(
60 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61 Box::new(
62 NotebookTimeseriesCellAttributes::new(
63 TimeseriesWidgetDefinition::new(
64 vec![TimeseriesWidgetRequest::new()
65 .display_type(WidgetDisplayType::LINE)
66 .q("avg:system.load.1{*}".to_string())
67 .style(
68 WidgetRequestStyle::new()
69 .line_type(WidgetLineType::SOLID)
70 .line_width(WidgetLineWidth::NORMAL)
71 .palette("dog_classic".to_string()),
72 )],
73 TimeseriesWidgetDefinitionType::TIMESERIES,
74 )
75 .show_legend(true)
76 .yaxis(WidgetAxis::new().scale("linear".to_string())),
77 )
78 .graph_size(NotebookGraphSize::MEDIUM)
79 .split_by(NotebookSplitBy::new(vec![], vec![]))
80 .time(None),
81 ),
82 ),
83 NotebookCellResourceType::NOTEBOOK_CELLS,
84 ),
85 )),
86 ],
87 "Example-Notebook-updated".to_string(),
88 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89 WidgetLiveSpan::PAST_ONE_HOUR,
90 ))),
91 )
92 .status(NotebookStatus::PUBLISHED),
93 NotebookResourceType::NOTEBOOKS,
94 ));
95 let configuration = datadog::Configuration::new();
96 let api = NotebooksAPI::with_config(configuration);
97 let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98 if let Ok(value) = resp {
99 println!("{:#?}", value);
100 } else {
101 println!("{:#?}", resp.unwrap_err());
102 }
103}
examples/v1_dashboards_CreateDashboard_2261785072.rs (line 68)
21async fn main() {
22 let body =
23 Dashboard::new(
24 DashboardLayoutType::ORDERED,
25 "Example-Dashboard".to_string(),
26 vec![
27 Widget::new(
28 WidgetDefinition::TimeseriesWidgetDefinition(
29 Box::new(
30 TimeseriesWidgetDefinition::new(
31 vec![
32 TimeseriesWidgetRequest::new()
33 .display_type(WidgetDisplayType::LINE)
34 .on_right_yaxis(false)
35 .queries(
36 vec![
37 FormulaAndFunctionQueryDefinition
38 ::FormulaAndFunctionMetricQueryDefinition(
39 Box::new(
40 FormulaAndFunctionMetricQueryDefinition::new(
41 FormulaAndFunctionMetricDataSource::METRICS,
42 "mymetric".to_string(),
43 "avg:system.cpu.user{*}".to_string(),
44 ),
45 ),
46 )
47 ],
48 )
49 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES),
50 TimeseriesWidgetRequest::new()
51 .display_type(WidgetDisplayType::OVERLAY)
52 .queries(
53 vec![
54 FormulaAndFunctionQueryDefinition
55 ::FormulaAndFunctionMetricQueryDefinition(
56 Box::new(
57 FormulaAndFunctionMetricQueryDefinition::new(
58 FormulaAndFunctionMetricDataSource::METRICS,
59 "mymetricoverlay".to_string(),
60 "avg:system.cpu.user{*}".to_string(),
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("purple".to_string()),
72 )
73 ],
74 TimeseriesWidgetDefinitionType::TIMESERIES,
75 ),
76 ),
77 ),
78 )
79 ],
80 );
81 let configuration = datadog::Configuration::new();
82 let api = DashboardsAPI::with_config(configuration);
83 let resp = api.create_dashboard(body).await;
84 if let Ok(value) = resp {
85 println!("{:#?}", value);
86 } else {
87 println!("{:#?}", resp.unwrap_err());
88 }
89}
Additional examples can be found in:
- examples/v1_dashboards_CreateDashboard_41622531.rs
- examples/v1_dashboards_CreateDashboard_1307120899.rs
- examples/v1_dashboards_CreateDashboard_985012506.rs
- examples/v1_dashboards_CreateDashboard_2800096921.rs
- examples/v1_dashboards_CreateDashboard_4262729673.rs
- examples/v1_dashboards_CreateDashboard_3451918078.rs
- examples/v1_dashboards_CreateDashboard_3066042014.rs
- examples/v1_dashboards_CreateDashboard_2278756614.rs
Sourcepub fn line_type(self, value: WidgetLineType) -> Self
pub fn line_type(self, value: WidgetLineType) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3982498788.rs (line 36)
17async fn main() {
18 let body =
19 Dashboard::new(
20 DashboardLayoutType::ORDERED,
21 "Example-Dashboard with timeseries widget".to_string(),
22 vec![
23 Widget::new(
24 WidgetDefinition::TimeseriesWidgetDefinition(
25 Box::new(
26 TimeseriesWidgetDefinition::new(
27 vec![
28 TimeseriesWidgetRequest::new()
29 .display_type(WidgetDisplayType::BARS)
30 .on_right_yaxis(false)
31 .q(
32 "sum:trace.test.errors{env:prod,service:datadog-api-spec} by {resource_name}.as_count()".to_string(),
33 )
34 .style(
35 WidgetRequestStyle::new()
36 .line_type(WidgetLineType::SOLID)
37 .line_width(WidgetLineWidth::NORMAL)
38 .palette("warm".to_string()),
39 )
40 ],
41 TimeseriesWidgetDefinitionType::TIMESERIES,
42 ),
43 ),
44 ),
45 )
46 ],
47 );
48 let configuration = datadog::Configuration::new();
49 let api = DashboardsAPI::with_config(configuration);
50 let resp = api.create_dashboard(body).await;
51 if let Ok(value) = resp {
52 println!("{:#?}", value);
53 } else {
54 println!("{:#?}", resp.unwrap_err());
55 }
56}
More examples
examples/v1_notebooks_CreateNotebook.rs (line 61)
31async fn main() {
32 let body = NotebookCreateRequest::new(NotebookCreateData::new(
33 NotebookCreateDataAttributes::new(
34 vec![
35 NotebookCellCreateRequest::new(
36 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37 NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38 r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45 .to_string(),
46 NotebookMarkdownCellDefinitionType::MARKDOWN,
47 )),
48 )),
49 NotebookCellResourceType::NOTEBOOK_CELLS,
50 ),
51 NotebookCellCreateRequest::new(
52 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53 Box::new(
54 NotebookTimeseriesCellAttributes::new(
55 TimeseriesWidgetDefinition::new(
56 vec![TimeseriesWidgetRequest::new()
57 .display_type(WidgetDisplayType::LINE)
58 .q("avg:system.load.1{*}".to_string())
59 .style(
60 WidgetRequestStyle::new()
61 .line_type(WidgetLineType::SOLID)
62 .line_width(WidgetLineWidth::NORMAL)
63 .palette("dog_classic".to_string()),
64 )],
65 TimeseriesWidgetDefinitionType::TIMESERIES,
66 )
67 .show_legend(true)
68 .yaxis(WidgetAxis::new().scale("linear".to_string())),
69 )
70 .graph_size(NotebookGraphSize::MEDIUM)
71 .split_by(NotebookSplitBy::new(vec![], vec![]))
72 .time(None),
73 ),
74 ),
75 NotebookCellResourceType::NOTEBOOK_CELLS,
76 ),
77 ],
78 "Example-Notebook".to_string(),
79 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80 WidgetLiveSpan::PAST_ONE_HOUR,
81 ))),
82 )
83 .status(NotebookStatus::PUBLISHED),
84 NotebookResourceType::NOTEBOOKS,
85 ));
86 let configuration = datadog::Configuration::new();
87 let api = NotebooksAPI::with_config(configuration);
88 let resp = api.create_notebook(body).await;
89 if let Ok(value) = resp {
90 println!("{:#?}", value);
91 } else {
92 println!("{:#?}", resp.unwrap_err());
93 }
94}
examples/v1_dashboards_CreateDashboard_1433408735.rs (line 56)
25async fn main() {
26 let body =
27 Dashboard::new(
28 DashboardLayoutType::ORDERED,
29 "Example-Dashboard".to_string(),
30 vec![
31 Widget::new(
32 WidgetDefinition::TimeseriesWidgetDefinition(
33 Box::new(
34 TimeseriesWidgetDefinition::new(
35 vec![
36 TimeseriesWidgetRequest::new()
37 .display_type(WidgetDisplayType::BARS)
38 .formulas(vec![WidgetFormula::new("query1".to_string())])
39 .queries(
40 vec![
41 FormulaAndFunctionQueryDefinition
42 ::FormulaAndFunctionCloudCostQueryDefinition(
43 Box::new(
44 FormulaAndFunctionCloudCostQueryDefinition::new(
45 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
46 "query1".to_string(),
47 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
48 ),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
54 .style(
55 WidgetRequestStyle::new()
56 .line_type(WidgetLineType::SOLID)
57 .line_width(WidgetLineWidth::NORMAL)
58 .palette("dog_classic".to_string()),
59 )
60 ],
61 TimeseriesWidgetDefinitionType::TIMESERIES,
62 )
63 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
64 .title("Example Cloud Cost Query".to_string())
65 .title_align(WidgetTextAlign::LEFT)
66 .title_size("16".to_string()),
67 ),
68 ),
69 )
70 ],
71 );
72 let configuration = datadog::Configuration::new();
73 let api = DashboardsAPI::with_config(configuration);
74 let resp = api.create_dashboard(body).await;
75 if let Ok(value) = resp {
76 println!("{:#?}", value);
77 } else {
78 println!("{:#?}", resp.unwrap_err());
79 }
80}
examples/v1_dashboards_CreateDashboard_1284514532.rs (line 58)
27async fn main() {
28 let body =
29 Dashboard::new(
30 DashboardLayoutType::ORDERED,
31 "Example-Dashboard".to_string(),
32 vec![
33 Widget::new(
34 WidgetDefinition::TimeseriesWidgetDefinition(
35 Box::new(
36 TimeseriesWidgetDefinition::new(
37 vec![
38 TimeseriesWidgetRequest::new()
39 .display_type(WidgetDisplayType::BARS)
40 .formulas(vec![WidgetFormula::new("query1".to_string())])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionCloudCostQueryDefinition(
45 Box::new(
46 FormulaAndFunctionCloudCostQueryDefinition::new(
47 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
48 "query1".to_string(),
49 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
50 ),
51 ),
52 )
53 ],
54 )
55 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
56 .style(
57 WidgetRequestStyle::new()
58 .line_type(WidgetLineType::SOLID)
59 .line_width(WidgetLineWidth::NORMAL)
60 .palette("dog_classic".to_string()),
61 )
62 ],
63 TimeseriesWidgetDefinitionType::TIMESERIES,
64 )
65 .time(
66 WidgetTime::WidgetLegacyLiveSpan(
67 Box::new(WidgetLegacyLiveSpan::new().live_span(WidgetLiveSpan::WEEK_TO_DATE)),
68 ),
69 )
70 .title("Example Cloud Cost Query".to_string())
71 .title_align(WidgetTextAlign::LEFT)
72 .title_size("16".to_string()),
73 ),
74 ),
75 )
76 ],
77 );
78 let configuration = datadog::Configuration::new();
79 let api = DashboardsAPI::with_config(configuration);
80 let resp = api.create_dashboard(body).await;
81 if let Ok(value) = resp {
82 println!("{:#?}", value);
83 } else {
84 println!("{:#?}", resp.unwrap_err());
85 }
86}
examples/v1_notebooks_UpdateNotebook.rs (line 69)
32async fn main() {
33 // there is a valid "notebook" in the system
34 let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35 let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36 NotebookUpdateDataAttributes::new(
37 vec![
38 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39 NotebookCellCreateRequest::new(
40 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41 Box::new(NotebookMarkdownCellAttributes::new(
42 NotebookMarkdownCellDefinition::new(
43 r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50 .to_string(),
51 NotebookMarkdownCellDefinitionType::MARKDOWN,
52 ),
53 )),
54 ),
55 NotebookCellResourceType::NOTEBOOK_CELLS,
56 ),
57 )),
58 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59 NotebookCellCreateRequest::new(
60 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61 Box::new(
62 NotebookTimeseriesCellAttributes::new(
63 TimeseriesWidgetDefinition::new(
64 vec![TimeseriesWidgetRequest::new()
65 .display_type(WidgetDisplayType::LINE)
66 .q("avg:system.load.1{*}".to_string())
67 .style(
68 WidgetRequestStyle::new()
69 .line_type(WidgetLineType::SOLID)
70 .line_width(WidgetLineWidth::NORMAL)
71 .palette("dog_classic".to_string()),
72 )],
73 TimeseriesWidgetDefinitionType::TIMESERIES,
74 )
75 .show_legend(true)
76 .yaxis(WidgetAxis::new().scale("linear".to_string())),
77 )
78 .graph_size(NotebookGraphSize::MEDIUM)
79 .split_by(NotebookSplitBy::new(vec![], vec![]))
80 .time(None),
81 ),
82 ),
83 NotebookCellResourceType::NOTEBOOK_CELLS,
84 ),
85 )),
86 ],
87 "Example-Notebook-updated".to_string(),
88 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89 WidgetLiveSpan::PAST_ONE_HOUR,
90 ))),
91 )
92 .status(NotebookStatus::PUBLISHED),
93 NotebookResourceType::NOTEBOOKS,
94 ));
95 let configuration = datadog::Configuration::new();
96 let api = NotebooksAPI::with_config(configuration);
97 let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98 if let Ok(value) = resp {
99 println!("{:#?}", value);
100 } else {
101 println!("{:#?}", resp.unwrap_err());
102 }
103}
examples/v1_dashboards_CreateDashboard_2261785072.rs (line 69)
21async fn main() {
22 let body =
23 Dashboard::new(
24 DashboardLayoutType::ORDERED,
25 "Example-Dashboard".to_string(),
26 vec![
27 Widget::new(
28 WidgetDefinition::TimeseriesWidgetDefinition(
29 Box::new(
30 TimeseriesWidgetDefinition::new(
31 vec![
32 TimeseriesWidgetRequest::new()
33 .display_type(WidgetDisplayType::LINE)
34 .on_right_yaxis(false)
35 .queries(
36 vec![
37 FormulaAndFunctionQueryDefinition
38 ::FormulaAndFunctionMetricQueryDefinition(
39 Box::new(
40 FormulaAndFunctionMetricQueryDefinition::new(
41 FormulaAndFunctionMetricDataSource::METRICS,
42 "mymetric".to_string(),
43 "avg:system.cpu.user{*}".to_string(),
44 ),
45 ),
46 )
47 ],
48 )
49 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES),
50 TimeseriesWidgetRequest::new()
51 .display_type(WidgetDisplayType::OVERLAY)
52 .queries(
53 vec![
54 FormulaAndFunctionQueryDefinition
55 ::FormulaAndFunctionMetricQueryDefinition(
56 Box::new(
57 FormulaAndFunctionMetricQueryDefinition::new(
58 FormulaAndFunctionMetricDataSource::METRICS,
59 "mymetricoverlay".to_string(),
60 "avg:system.cpu.user{*}".to_string(),
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("purple".to_string()),
72 )
73 ],
74 TimeseriesWidgetDefinitionType::TIMESERIES,
75 ),
76 ),
77 ),
78 )
79 ],
80 );
81 let configuration = datadog::Configuration::new();
82 let api = DashboardsAPI::with_config(configuration);
83 let resp = api.create_dashboard(body).await;
84 if let Ok(value) = resp {
85 println!("{:#?}", value);
86 } else {
87 println!("{:#?}", resp.unwrap_err());
88 }
89}
Additional examples can be found in:
- examples/v1_dashboards_CreateDashboard_41622531.rs
- examples/v1_dashboards_CreateDashboard_1307120899.rs
- examples/v1_dashboards_CreateDashboard_985012506.rs
- examples/v1_dashboards_CreateDashboard_2800096921.rs
- examples/v1_dashboards_CreateDashboard_4262729673.rs
- examples/v1_dashboards_CreateDashboard_3451918078.rs
- examples/v1_dashboards_CreateDashboard_3066042014.rs
- examples/v1_dashboards_CreateDashboard_2278756614.rs
Sourcepub fn line_width(self, value: WidgetLineWidth) -> Self
pub fn line_width(self, value: WidgetLineWidth) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3982498788.rs (line 37)
17async fn main() {
18 let body =
19 Dashboard::new(
20 DashboardLayoutType::ORDERED,
21 "Example-Dashboard with timeseries widget".to_string(),
22 vec![
23 Widget::new(
24 WidgetDefinition::TimeseriesWidgetDefinition(
25 Box::new(
26 TimeseriesWidgetDefinition::new(
27 vec![
28 TimeseriesWidgetRequest::new()
29 .display_type(WidgetDisplayType::BARS)
30 .on_right_yaxis(false)
31 .q(
32 "sum:trace.test.errors{env:prod,service:datadog-api-spec} by {resource_name}.as_count()".to_string(),
33 )
34 .style(
35 WidgetRequestStyle::new()
36 .line_type(WidgetLineType::SOLID)
37 .line_width(WidgetLineWidth::NORMAL)
38 .palette("warm".to_string()),
39 )
40 ],
41 TimeseriesWidgetDefinitionType::TIMESERIES,
42 ),
43 ),
44 ),
45 )
46 ],
47 );
48 let configuration = datadog::Configuration::new();
49 let api = DashboardsAPI::with_config(configuration);
50 let resp = api.create_dashboard(body).await;
51 if let Ok(value) = resp {
52 println!("{:#?}", value);
53 } else {
54 println!("{:#?}", resp.unwrap_err());
55 }
56}
More examples
examples/v1_notebooks_CreateNotebook.rs (line 62)
31async fn main() {
32 let body = NotebookCreateRequest::new(NotebookCreateData::new(
33 NotebookCreateDataAttributes::new(
34 vec![
35 NotebookCellCreateRequest::new(
36 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37 NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38 r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45 .to_string(),
46 NotebookMarkdownCellDefinitionType::MARKDOWN,
47 )),
48 )),
49 NotebookCellResourceType::NOTEBOOK_CELLS,
50 ),
51 NotebookCellCreateRequest::new(
52 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53 Box::new(
54 NotebookTimeseriesCellAttributes::new(
55 TimeseriesWidgetDefinition::new(
56 vec![TimeseriesWidgetRequest::new()
57 .display_type(WidgetDisplayType::LINE)
58 .q("avg:system.load.1{*}".to_string())
59 .style(
60 WidgetRequestStyle::new()
61 .line_type(WidgetLineType::SOLID)
62 .line_width(WidgetLineWidth::NORMAL)
63 .palette("dog_classic".to_string()),
64 )],
65 TimeseriesWidgetDefinitionType::TIMESERIES,
66 )
67 .show_legend(true)
68 .yaxis(WidgetAxis::new().scale("linear".to_string())),
69 )
70 .graph_size(NotebookGraphSize::MEDIUM)
71 .split_by(NotebookSplitBy::new(vec![], vec![]))
72 .time(None),
73 ),
74 ),
75 NotebookCellResourceType::NOTEBOOK_CELLS,
76 ),
77 ],
78 "Example-Notebook".to_string(),
79 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80 WidgetLiveSpan::PAST_ONE_HOUR,
81 ))),
82 )
83 .status(NotebookStatus::PUBLISHED),
84 NotebookResourceType::NOTEBOOKS,
85 ));
86 let configuration = datadog::Configuration::new();
87 let api = NotebooksAPI::with_config(configuration);
88 let resp = api.create_notebook(body).await;
89 if let Ok(value) = resp {
90 println!("{:#?}", value);
91 } else {
92 println!("{:#?}", resp.unwrap_err());
93 }
94}
examples/v1_dashboards_CreateDashboard_1433408735.rs (line 57)
25async fn main() {
26 let body =
27 Dashboard::new(
28 DashboardLayoutType::ORDERED,
29 "Example-Dashboard".to_string(),
30 vec![
31 Widget::new(
32 WidgetDefinition::TimeseriesWidgetDefinition(
33 Box::new(
34 TimeseriesWidgetDefinition::new(
35 vec![
36 TimeseriesWidgetRequest::new()
37 .display_type(WidgetDisplayType::BARS)
38 .formulas(vec![WidgetFormula::new("query1".to_string())])
39 .queries(
40 vec![
41 FormulaAndFunctionQueryDefinition
42 ::FormulaAndFunctionCloudCostQueryDefinition(
43 Box::new(
44 FormulaAndFunctionCloudCostQueryDefinition::new(
45 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
46 "query1".to_string(),
47 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
48 ),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
54 .style(
55 WidgetRequestStyle::new()
56 .line_type(WidgetLineType::SOLID)
57 .line_width(WidgetLineWidth::NORMAL)
58 .palette("dog_classic".to_string()),
59 )
60 ],
61 TimeseriesWidgetDefinitionType::TIMESERIES,
62 )
63 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
64 .title("Example Cloud Cost Query".to_string())
65 .title_align(WidgetTextAlign::LEFT)
66 .title_size("16".to_string()),
67 ),
68 ),
69 )
70 ],
71 );
72 let configuration = datadog::Configuration::new();
73 let api = DashboardsAPI::with_config(configuration);
74 let resp = api.create_dashboard(body).await;
75 if let Ok(value) = resp {
76 println!("{:#?}", value);
77 } else {
78 println!("{:#?}", resp.unwrap_err());
79 }
80}
examples/v1_dashboards_CreateDashboard_1284514532.rs (line 59)
27async fn main() {
28 let body =
29 Dashboard::new(
30 DashboardLayoutType::ORDERED,
31 "Example-Dashboard".to_string(),
32 vec![
33 Widget::new(
34 WidgetDefinition::TimeseriesWidgetDefinition(
35 Box::new(
36 TimeseriesWidgetDefinition::new(
37 vec![
38 TimeseriesWidgetRequest::new()
39 .display_type(WidgetDisplayType::BARS)
40 .formulas(vec![WidgetFormula::new("query1".to_string())])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionCloudCostQueryDefinition(
45 Box::new(
46 FormulaAndFunctionCloudCostQueryDefinition::new(
47 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
48 "query1".to_string(),
49 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
50 ),
51 ),
52 )
53 ],
54 )
55 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
56 .style(
57 WidgetRequestStyle::new()
58 .line_type(WidgetLineType::SOLID)
59 .line_width(WidgetLineWidth::NORMAL)
60 .palette("dog_classic".to_string()),
61 )
62 ],
63 TimeseriesWidgetDefinitionType::TIMESERIES,
64 )
65 .time(
66 WidgetTime::WidgetLegacyLiveSpan(
67 Box::new(WidgetLegacyLiveSpan::new().live_span(WidgetLiveSpan::WEEK_TO_DATE)),
68 ),
69 )
70 .title("Example Cloud Cost Query".to_string())
71 .title_align(WidgetTextAlign::LEFT)
72 .title_size("16".to_string()),
73 ),
74 ),
75 )
76 ],
77 );
78 let configuration = datadog::Configuration::new();
79 let api = DashboardsAPI::with_config(configuration);
80 let resp = api.create_dashboard(body).await;
81 if let Ok(value) = resp {
82 println!("{:#?}", value);
83 } else {
84 println!("{:#?}", resp.unwrap_err());
85 }
86}
examples/v1_notebooks_UpdateNotebook.rs (line 70)
32async fn main() {
33 // there is a valid "notebook" in the system
34 let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35 let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36 NotebookUpdateDataAttributes::new(
37 vec![
38 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39 NotebookCellCreateRequest::new(
40 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41 Box::new(NotebookMarkdownCellAttributes::new(
42 NotebookMarkdownCellDefinition::new(
43 r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50 .to_string(),
51 NotebookMarkdownCellDefinitionType::MARKDOWN,
52 ),
53 )),
54 ),
55 NotebookCellResourceType::NOTEBOOK_CELLS,
56 ),
57 )),
58 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59 NotebookCellCreateRequest::new(
60 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61 Box::new(
62 NotebookTimeseriesCellAttributes::new(
63 TimeseriesWidgetDefinition::new(
64 vec![TimeseriesWidgetRequest::new()
65 .display_type(WidgetDisplayType::LINE)
66 .q("avg:system.load.1{*}".to_string())
67 .style(
68 WidgetRequestStyle::new()
69 .line_type(WidgetLineType::SOLID)
70 .line_width(WidgetLineWidth::NORMAL)
71 .palette("dog_classic".to_string()),
72 )],
73 TimeseriesWidgetDefinitionType::TIMESERIES,
74 )
75 .show_legend(true)
76 .yaxis(WidgetAxis::new().scale("linear".to_string())),
77 )
78 .graph_size(NotebookGraphSize::MEDIUM)
79 .split_by(NotebookSplitBy::new(vec![], vec![]))
80 .time(None),
81 ),
82 ),
83 NotebookCellResourceType::NOTEBOOK_CELLS,
84 ),
85 )),
86 ],
87 "Example-Notebook-updated".to_string(),
88 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89 WidgetLiveSpan::PAST_ONE_HOUR,
90 ))),
91 )
92 .status(NotebookStatus::PUBLISHED),
93 NotebookResourceType::NOTEBOOKS,
94 ));
95 let configuration = datadog::Configuration::new();
96 let api = NotebooksAPI::with_config(configuration);
97 let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98 if let Ok(value) = resp {
99 println!("{:#?}", value);
100 } else {
101 println!("{:#?}", resp.unwrap_err());
102 }
103}
examples/v1_dashboards_CreateDashboard_2261785072.rs (line 70)
21async fn main() {
22 let body =
23 Dashboard::new(
24 DashboardLayoutType::ORDERED,
25 "Example-Dashboard".to_string(),
26 vec![
27 Widget::new(
28 WidgetDefinition::TimeseriesWidgetDefinition(
29 Box::new(
30 TimeseriesWidgetDefinition::new(
31 vec![
32 TimeseriesWidgetRequest::new()
33 .display_type(WidgetDisplayType::LINE)
34 .on_right_yaxis(false)
35 .queries(
36 vec![
37 FormulaAndFunctionQueryDefinition
38 ::FormulaAndFunctionMetricQueryDefinition(
39 Box::new(
40 FormulaAndFunctionMetricQueryDefinition::new(
41 FormulaAndFunctionMetricDataSource::METRICS,
42 "mymetric".to_string(),
43 "avg:system.cpu.user{*}".to_string(),
44 ),
45 ),
46 )
47 ],
48 )
49 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES),
50 TimeseriesWidgetRequest::new()
51 .display_type(WidgetDisplayType::OVERLAY)
52 .queries(
53 vec![
54 FormulaAndFunctionQueryDefinition
55 ::FormulaAndFunctionMetricQueryDefinition(
56 Box::new(
57 FormulaAndFunctionMetricQueryDefinition::new(
58 FormulaAndFunctionMetricDataSource::METRICS,
59 "mymetricoverlay".to_string(),
60 "avg:system.cpu.user{*}".to_string(),
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("purple".to_string()),
72 )
73 ],
74 TimeseriesWidgetDefinitionType::TIMESERIES,
75 ),
76 ),
77 ),
78 )
79 ],
80 );
81 let configuration = datadog::Configuration::new();
82 let api = DashboardsAPI::with_config(configuration);
83 let resp = api.create_dashboard(body).await;
84 if let Ok(value) = resp {
85 println!("{:#?}", value);
86 } else {
87 println!("{:#?}", resp.unwrap_err());
88 }
89}
Additional examples can be found in:
- examples/v1_dashboards_CreateDashboard_41622531.rs
- examples/v1_dashboards_CreateDashboard_1307120899.rs
- examples/v1_dashboards_CreateDashboard_985012506.rs
- examples/v1_dashboards_CreateDashboard_2800096921.rs
- examples/v1_dashboards_CreateDashboard_4262729673.rs
- examples/v1_dashboards_CreateDashboard_3451918078.rs
- examples/v1_dashboards_CreateDashboard_3066042014.rs
- examples/v1_dashboards_CreateDashboard_2278756614.rs
Sourcepub fn palette(self, value: String) -> Self
pub fn palette(self, value: String) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_3982498788.rs (line 38)
17async fn main() {
18 let body =
19 Dashboard::new(
20 DashboardLayoutType::ORDERED,
21 "Example-Dashboard with timeseries widget".to_string(),
22 vec![
23 Widget::new(
24 WidgetDefinition::TimeseriesWidgetDefinition(
25 Box::new(
26 TimeseriesWidgetDefinition::new(
27 vec![
28 TimeseriesWidgetRequest::new()
29 .display_type(WidgetDisplayType::BARS)
30 .on_right_yaxis(false)
31 .q(
32 "sum:trace.test.errors{env:prod,service:datadog-api-spec} by {resource_name}.as_count()".to_string(),
33 )
34 .style(
35 WidgetRequestStyle::new()
36 .line_type(WidgetLineType::SOLID)
37 .line_width(WidgetLineWidth::NORMAL)
38 .palette("warm".to_string()),
39 )
40 ],
41 TimeseriesWidgetDefinitionType::TIMESERIES,
42 ),
43 ),
44 ),
45 )
46 ],
47 );
48 let configuration = datadog::Configuration::new();
49 let api = DashboardsAPI::with_config(configuration);
50 let resp = api.create_dashboard(body).await;
51 if let Ok(value) = resp {
52 println!("{:#?}", value);
53 } else {
54 println!("{:#?}", resp.unwrap_err());
55 }
56}
More examples
examples/v1_notebooks_CreateNotebook.rs (line 63)
31async fn main() {
32 let body = NotebookCreateRequest::new(NotebookCreateData::new(
33 NotebookCreateDataAttributes::new(
34 vec![
35 NotebookCellCreateRequest::new(
36 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(Box::new(
37 NotebookMarkdownCellAttributes::new(NotebookMarkdownCellDefinition::new(
38 r#"## Some test markdown
39
40```js
41var x, y;
42x = 5;
43y = 6;
44```"#
45 .to_string(),
46 NotebookMarkdownCellDefinitionType::MARKDOWN,
47 )),
48 )),
49 NotebookCellResourceType::NOTEBOOK_CELLS,
50 ),
51 NotebookCellCreateRequest::new(
52 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
53 Box::new(
54 NotebookTimeseriesCellAttributes::new(
55 TimeseriesWidgetDefinition::new(
56 vec![TimeseriesWidgetRequest::new()
57 .display_type(WidgetDisplayType::LINE)
58 .q("avg:system.load.1{*}".to_string())
59 .style(
60 WidgetRequestStyle::new()
61 .line_type(WidgetLineType::SOLID)
62 .line_width(WidgetLineWidth::NORMAL)
63 .palette("dog_classic".to_string()),
64 )],
65 TimeseriesWidgetDefinitionType::TIMESERIES,
66 )
67 .show_legend(true)
68 .yaxis(WidgetAxis::new().scale("linear".to_string())),
69 )
70 .graph_size(NotebookGraphSize::MEDIUM)
71 .split_by(NotebookSplitBy::new(vec![], vec![]))
72 .time(None),
73 ),
74 ),
75 NotebookCellResourceType::NOTEBOOK_CELLS,
76 ),
77 ],
78 "Example-Notebook".to_string(),
79 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
80 WidgetLiveSpan::PAST_ONE_HOUR,
81 ))),
82 )
83 .status(NotebookStatus::PUBLISHED),
84 NotebookResourceType::NOTEBOOKS,
85 ));
86 let configuration = datadog::Configuration::new();
87 let api = NotebooksAPI::with_config(configuration);
88 let resp = api.create_notebook(body).await;
89 if let Ok(value) = resp {
90 println!("{:#?}", value);
91 } else {
92 println!("{:#?}", resp.unwrap_err());
93 }
94}
examples/v1_dashboards_CreateDashboard_1433408735.rs (line 58)
25async fn main() {
26 let body =
27 Dashboard::new(
28 DashboardLayoutType::ORDERED,
29 "Example-Dashboard".to_string(),
30 vec![
31 Widget::new(
32 WidgetDefinition::TimeseriesWidgetDefinition(
33 Box::new(
34 TimeseriesWidgetDefinition::new(
35 vec![
36 TimeseriesWidgetRequest::new()
37 .display_type(WidgetDisplayType::BARS)
38 .formulas(vec![WidgetFormula::new("query1".to_string())])
39 .queries(
40 vec![
41 FormulaAndFunctionQueryDefinition
42 ::FormulaAndFunctionCloudCostQueryDefinition(
43 Box::new(
44 FormulaAndFunctionCloudCostQueryDefinition::new(
45 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
46 "query1".to_string(),
47 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
48 ),
49 ),
50 )
51 ],
52 )
53 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
54 .style(
55 WidgetRequestStyle::new()
56 .line_type(WidgetLineType::SOLID)
57 .line_width(WidgetLineWidth::NORMAL)
58 .palette("dog_classic".to_string()),
59 )
60 ],
61 TimeseriesWidgetDefinitionType::TIMESERIES,
62 )
63 .time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
64 .title("Example Cloud Cost Query".to_string())
65 .title_align(WidgetTextAlign::LEFT)
66 .title_size("16".to_string()),
67 ),
68 ),
69 )
70 ],
71 );
72 let configuration = datadog::Configuration::new();
73 let api = DashboardsAPI::with_config(configuration);
74 let resp = api.create_dashboard(body).await;
75 if let Ok(value) = resp {
76 println!("{:#?}", value);
77 } else {
78 println!("{:#?}", resp.unwrap_err());
79 }
80}
examples/v1_dashboards_CreateDashboard_1284514532.rs (line 60)
27async fn main() {
28 let body =
29 Dashboard::new(
30 DashboardLayoutType::ORDERED,
31 "Example-Dashboard".to_string(),
32 vec![
33 Widget::new(
34 WidgetDefinition::TimeseriesWidgetDefinition(
35 Box::new(
36 TimeseriesWidgetDefinition::new(
37 vec![
38 TimeseriesWidgetRequest::new()
39 .display_type(WidgetDisplayType::BARS)
40 .formulas(vec![WidgetFormula::new("query1".to_string())])
41 .queries(
42 vec![
43 FormulaAndFunctionQueryDefinition
44 ::FormulaAndFunctionCloudCostQueryDefinition(
45 Box::new(
46 FormulaAndFunctionCloudCostQueryDefinition::new(
47 FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
48 "query1".to_string(),
49 "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
50 ),
51 ),
52 )
53 ],
54 )
55 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
56 .style(
57 WidgetRequestStyle::new()
58 .line_type(WidgetLineType::SOLID)
59 .line_width(WidgetLineWidth::NORMAL)
60 .palette("dog_classic".to_string()),
61 )
62 ],
63 TimeseriesWidgetDefinitionType::TIMESERIES,
64 )
65 .time(
66 WidgetTime::WidgetLegacyLiveSpan(
67 Box::new(WidgetLegacyLiveSpan::new().live_span(WidgetLiveSpan::WEEK_TO_DATE)),
68 ),
69 )
70 .title("Example Cloud Cost Query".to_string())
71 .title_align(WidgetTextAlign::LEFT)
72 .title_size("16".to_string()),
73 ),
74 ),
75 )
76 ],
77 );
78 let configuration = datadog::Configuration::new();
79 let api = DashboardsAPI::with_config(configuration);
80 let resp = api.create_dashboard(body).await;
81 if let Ok(value) = resp {
82 println!("{:#?}", value);
83 } else {
84 println!("{:#?}", resp.unwrap_err());
85 }
86}
examples/v1_notebooks_UpdateNotebook.rs (line 71)
32async fn main() {
33 // there is a valid "notebook" in the system
34 let notebook_data_id: i64 = std::env::var("NOTEBOOK_DATA_ID").unwrap().parse().unwrap();
35 let body = NotebookUpdateRequest::new(NotebookUpdateData::new(
36 NotebookUpdateDataAttributes::new(
37 vec![
38 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
39 NotebookCellCreateRequest::new(
40 NotebookCellCreateRequestAttributes::NotebookMarkdownCellAttributes(
41 Box::new(NotebookMarkdownCellAttributes::new(
42 NotebookMarkdownCellDefinition::new(
43 r#"## Some test markdown
44
45```js
46var x, y;
47x = 5;
48y = 6;
49```"#
50 .to_string(),
51 NotebookMarkdownCellDefinitionType::MARKDOWN,
52 ),
53 )),
54 ),
55 NotebookCellResourceType::NOTEBOOK_CELLS,
56 ),
57 )),
58 NotebookUpdateCell::NotebookCellCreateRequest(Box::new(
59 NotebookCellCreateRequest::new(
60 NotebookCellCreateRequestAttributes::NotebookTimeseriesCellAttributes(
61 Box::new(
62 NotebookTimeseriesCellAttributes::new(
63 TimeseriesWidgetDefinition::new(
64 vec![TimeseriesWidgetRequest::new()
65 .display_type(WidgetDisplayType::LINE)
66 .q("avg:system.load.1{*}".to_string())
67 .style(
68 WidgetRequestStyle::new()
69 .line_type(WidgetLineType::SOLID)
70 .line_width(WidgetLineWidth::NORMAL)
71 .palette("dog_classic".to_string()),
72 )],
73 TimeseriesWidgetDefinitionType::TIMESERIES,
74 )
75 .show_legend(true)
76 .yaxis(WidgetAxis::new().scale("linear".to_string())),
77 )
78 .graph_size(NotebookGraphSize::MEDIUM)
79 .split_by(NotebookSplitBy::new(vec![], vec![]))
80 .time(None),
81 ),
82 ),
83 NotebookCellResourceType::NOTEBOOK_CELLS,
84 ),
85 )),
86 ],
87 "Example-Notebook-updated".to_string(),
88 NotebookGlobalTime::NotebookRelativeTime(Box::new(NotebookRelativeTime::new(
89 WidgetLiveSpan::PAST_ONE_HOUR,
90 ))),
91 )
92 .status(NotebookStatus::PUBLISHED),
93 NotebookResourceType::NOTEBOOKS,
94 ));
95 let configuration = datadog::Configuration::new();
96 let api = NotebooksAPI::with_config(configuration);
97 let resp = api.update_notebook(notebook_data_id.clone(), body).await;
98 if let Ok(value) = resp {
99 println!("{:#?}", value);
100 } else {
101 println!("{:#?}", resp.unwrap_err());
102 }
103}
examples/v1_dashboards_CreateDashboard_2261785072.rs (line 71)
21async fn main() {
22 let body =
23 Dashboard::new(
24 DashboardLayoutType::ORDERED,
25 "Example-Dashboard".to_string(),
26 vec![
27 Widget::new(
28 WidgetDefinition::TimeseriesWidgetDefinition(
29 Box::new(
30 TimeseriesWidgetDefinition::new(
31 vec![
32 TimeseriesWidgetRequest::new()
33 .display_type(WidgetDisplayType::LINE)
34 .on_right_yaxis(false)
35 .queries(
36 vec![
37 FormulaAndFunctionQueryDefinition
38 ::FormulaAndFunctionMetricQueryDefinition(
39 Box::new(
40 FormulaAndFunctionMetricQueryDefinition::new(
41 FormulaAndFunctionMetricDataSource::METRICS,
42 "mymetric".to_string(),
43 "avg:system.cpu.user{*}".to_string(),
44 ),
45 ),
46 )
47 ],
48 )
49 .response_format(FormulaAndFunctionResponseFormat::TIMESERIES),
50 TimeseriesWidgetRequest::new()
51 .display_type(WidgetDisplayType::OVERLAY)
52 .queries(
53 vec![
54 FormulaAndFunctionQueryDefinition
55 ::FormulaAndFunctionMetricQueryDefinition(
56 Box::new(
57 FormulaAndFunctionMetricQueryDefinition::new(
58 FormulaAndFunctionMetricDataSource::METRICS,
59 "mymetricoverlay".to_string(),
60 "avg:system.cpu.user{*}".to_string(),
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("purple".to_string()),
72 )
73 ],
74 TimeseriesWidgetDefinitionType::TIMESERIES,
75 ),
76 ),
77 ),
78 )
79 ],
80 );
81 let configuration = datadog::Configuration::new();
82 let api = DashboardsAPI::with_config(configuration);
83 let resp = api.create_dashboard(body).await;
84 if let Ok(value) = resp {
85 println!("{:#?}", value);
86 } else {
87 println!("{:#?}", resp.unwrap_err());
88 }
89}
Additional examples can be found in:
- examples/v1_dashboards_CreateDashboard_41622531.rs
- examples/v1_dashboards_CreateDashboard_1307120899.rs
- examples/v1_dashboards_CreateDashboard_985012506.rs
- examples/v1_dashboards_CreateDashboard_2800096921.rs
- examples/v1_dashboards_CreateDashboard_4262729673.rs
- examples/v1_dashboards_CreateDashboard_3451918078.rs
- examples/v1_dashboards_CreateDashboard_3066042014.rs
- examples/v1_dashboards_CreateDashboard_2278756614.rs
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for WidgetRequestStyle
impl Clone for WidgetRequestStyle
Source§fn clone(&self) -> WidgetRequestStyle
fn clone(&self) -> WidgetRequestStyle
Returns a duplicate 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 WidgetRequestStyle
impl Debug for WidgetRequestStyle
Source§impl Default for WidgetRequestStyle
impl Default for WidgetRequestStyle
Source§impl<'de> Deserialize<'de> for WidgetRequestStyle
impl<'de> Deserialize<'de> for WidgetRequestStyle
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 WidgetRequestStyle
impl PartialEq for WidgetRequestStyle
Source§impl Serialize for WidgetRequestStyle
impl Serialize for WidgetRequestStyle
impl StructuralPartialEq for WidgetRequestStyle
Auto Trait Implementations§
impl Freeze for WidgetRequestStyle
impl RefUnwindSafe for WidgetRequestStyle
impl Send for WidgetRequestStyle
impl Sync for WidgetRequestStyle
impl Unpin for WidgetRequestStyle
impl UnwindSafe for WidgetRequestStyle
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