#[non_exhaustive]pub struct WidgetLayout {
pub height: i64,
pub is_column_break: Option<bool>,
pub width: i64,
pub x: i64,
pub y: i64,
pub additional_properties: BTreeMap<String, Value>,
/* private fields */
}
Expand description
The layout for a widget on a free
or new dashboard layout dashboard.
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.height: i64
The height of the widget. Should be a non-negative integer.
is_column_break: Option<bool>
Whether the widget should be the first one on the second column in high density or not.
Note: Only for the new dashboard layout and only one widget in the dashboard should have this property set to true
.
width: i64
The width of the widget. Should be a non-negative integer.
x: i64
The position of the widget on the x (horizontal) axis. Should be a non-negative integer.
y: i64
The position of the widget on the y (vertical) axis. Should be a non-negative integer.
additional_properties: BTreeMap<String, Value>
Implementations§
Source§impl WidgetLayout
impl WidgetLayout
Sourcepub fn new(height: i64, width: i64, x: i64, y: i64) -> WidgetLayout
pub fn new(height: i64, width: i64, x: i64, y: i64) -> WidgetLayout
Examples found in repository?
examples/v1_dashboards_CreateDashboard_417992286.rs (line 20)
13async fn main() {
14 let body = Dashboard::new(
15 DashboardLayoutType::FREE,
16 "Example-Dashboard".to_string(),
17 vec![Widget::new(WidgetDefinition::NoteWidgetDefinition(Box::new(
18 NoteWidgetDefinition::new("# Example Note".to_string(), NoteWidgetDefinitionType::NOTE),
19 )))
20 .layout(WidgetLayout::new(24, 18, 0, 0))],
21 )
22 .description(Some("".to_string()))
23 .notify_list(Some(vec![]))
24 .template_variables(Some(vec![]));
25 let configuration = datadog::Configuration::new();
26 let api = DashboardsAPI::with_config(configuration);
27 let resp = api.create_dashboard(body).await;
28 if let Ok(value) = resp {
29 println!("{:#?}", value);
30 } else {
31 println!("{:#?}", resp.unwrap_err());
32 }
33}
More examples
examples/v1_dashboards_CreateDashboard_913313564.rs (line 24)
13async fn main() {
14 let body = Dashboard::new(
15 DashboardLayoutType::FREE,
16 "Example-Dashboard".to_string(),
17 vec![
18 Widget::new(WidgetDefinition::IFrameWidgetDefinition(Box::new(
19 IFrameWidgetDefinition::new(
20 IFrameWidgetDefinitionType::IFRAME,
21 "https://docs.datadoghq.com/api/latest/".to_string(),
22 ),
23 )))
24 .layout(WidgetLayout::new(12, 12, 0, 0)),
25 ],
26 )
27 .description(Some("".to_string()))
28 .notify_list(Some(vec![]))
29 .template_variables(Some(vec![]));
30 let configuration = datadog::Configuration::new();
31 let api = DashboardsAPI::with_config(configuration);
32 let resp = api.create_dashboard(body).await;
33 if let Ok(value) = resp {
34 println!("{:#?}", value);
35 } else {
36 println!("{:#?}", resp.unwrap_err());
37 }
38}
examples/v1_dashboards_CreateDashboard_651038379.rs (line 26)
14async fn main() {
15 let body = Dashboard::new(
16 DashboardLayoutType::FREE,
17 "Example-Dashboard".to_string(),
18 vec![
19 Widget::new(WidgetDefinition::ImageWidgetDefinition(Box::new(
20 ImageWidgetDefinition::new(
21 ImageWidgetDefinitionType::IMAGE,
22 "https://example.com/image.png".to_string(),
23 )
24 .sizing(WidgetImageSizing::COVER),
25 )))
26 .layout(WidgetLayout::new(12, 12, 0, 0)),
27 ],
28 )
29 .description(Some("".to_string()))
30 .notify_list(Some(vec![]))
31 .template_variables(Some(vec![]));
32 let configuration = datadog::Configuration::new();
33 let api = DashboardsAPI::with_config(configuration);
34 let resp = api.create_dashboard(body).await;
35 if let Ok(value) = resp {
36 println!("{:#?}", value);
37 } else {
38 println!("{:#?}", resp.unwrap_err());
39 }
40}
examples/v1_dashboards_CreateDashboard_1738608750.rs (line 28)
14async fn main() {
15 let body = Dashboard::new(
16 DashboardLayoutType::FREE,
17 "Example-Dashboard".to_string(),
18 vec![
19 Widget::new(WidgetDefinition::FreeTextWidgetDefinition(Box::new(
20 FreeTextWidgetDefinition::new(
21 "Example free text".to_string(),
22 FreeTextWidgetDefinitionType::FREE_TEXT,
23 )
24 .color("#4d4d4d".to_string())
25 .font_size("auto".to_string())
26 .text_align(WidgetTextAlign::LEFT),
27 )))
28 .layout(WidgetLayout::new(6, 24, 0, 0)),
29 ],
30 )
31 .description(None)
32 .notify_list(Some(vec![]))
33 .template_variables(Some(vec![]));
34 let configuration = datadog::Configuration::new();
35 let api = DashboardsAPI::with_config(configuration);
36 let resp = api.create_dashboard(body).await;
37 if let Ok(value) = resp {
38 println!("{:#?}", value);
39 } else {
40 println!("{:#?}", resp.unwrap_err());
41 }
42}
examples/v1_dashboards_CreateDashboard_2607944105.rs (line 30)
15async fn main() {
16 let body = Dashboard::new(
17 DashboardLayoutType::FREE,
18 "Example-Dashboard".to_string(),
19 vec![
20 Widget::new(WidgetDefinition::CheckStatusWidgetDefinition(Box::new(
21 CheckStatusWidgetDefinition::new(
22 "datadog.agent.up".to_string(),
23 WidgetGrouping::CHECK,
24 CheckStatusWidgetDefinitionType::CHECK_STATUS,
25 )
26 .tags(vec!["*".to_string()])
27 .title_align(WidgetTextAlign::LEFT)
28 .title_size("16".to_string()),
29 )))
30 .layout(WidgetLayout::new(8, 15, 0, 0)),
31 ],
32 )
33 .description(Some("".to_string()))
34 .notify_list(Some(vec![]))
35 .template_variables(Some(vec![]));
36 let configuration = datadog::Configuration::new();
37 let api = DashboardsAPI::with_config(configuration);
38 let resp = api.create_dashboard(body).await;
39 if let Ok(value) = resp {
40 println!("{:#?}", value);
41 } else {
42 println!("{:#?}", resp.unwrap_err());
43 }
44}
examples/v1_dashboards_CreateDashboard_3250131584.rs (line 29)
14async fn main() {
15 let body = Dashboard::new(
16 DashboardLayoutType::FREE,
17 "Example-Dashboard".to_string(),
18 vec![
19 Widget::new(WidgetDefinition::EventTimelineWidgetDefinition(Box::new(
20 EventTimelineWidgetDefinition::new(
21 "status:error priority:all".to_string(),
22 EventTimelineWidgetDefinitionType::EVENT_TIMELINE,
23 )
24 .tags_execution("and".to_string())
25 .title("".to_string())
26 .title_align(WidgetTextAlign::LEFT)
27 .title_size("16".to_string()),
28 )))
29 .layout(WidgetLayout::new(9, 47, 0, 0)),
30 ],
31 )
32 .description(None)
33 .notify_list(Some(vec![]))
34 .template_variables(Some(vec![]));
35 let configuration = datadog::Configuration::new();
36 let api = DashboardsAPI::with_config(configuration);
37 let resp = api.create_dashboard(body).await;
38 if let Ok(value) = resp {
39 println!("{:#?}", value);
40 } else {
41 println!("{:#?}", resp.unwrap_err());
42 }
43}
Additional examples can be found in:
- examples/v1_dashboards_CreateDashboard_2034634967.rs
- examples/v1_dashboards_CreateDashboard_2634813877.rs
- examples/v1_dashboards_CreateDashboard_2316374332.rs
- examples/v1_dashboards_CreateDashboard_1423904722.rs
- examples/v1_dashboards_CreateDashboard_2308247857.rs
- examples/v1_dashboards_CreateDashboard_2917274132.rs
- examples/v1_dashboards_CreateDashboard_1177423752.rs
- examples/v1_dashboards_CreateDashboard_173805046.rs
- examples/v1_dashboards_CreateDashboard_803346562.rs
- examples/v1_dashboards_CreateDashboard_1094917386.rs
- examples/v1_dashboards_CreateDashboard_2610827685.rs
- examples/v1_dashboards_CreateDashboard_109450134.rs
- examples/v1_dashboards_CreateDashboard_2652180930.rs
- examples/v1_dashboards_CreateDashboard_2029850837.rs
- examples/v1_dashboards_CreateDashboard_1200099236.rs
- examples/v1_dashboards_CreateDashboard_1754992756.rs
- examples/v1_dashboards_CreateDashboard_2921337351.rs
- examples/v1_dashboards_CreateDashboard_2705593938.rs
- examples/v1_dashboards_CreateDashboard_3562282606.rs
- examples/v1_dashboards_CreateDashboard_3777304439.rs
- examples/v1_dashboards_CreateDashboard_2349863258.rs
- examples/v1_dashboards_CreateDashboard_2644712913.rs
- examples/v1_dashboards_CreateDashboard_3513586382.rs
- examples/v1_dashboards_CreateDashboard_2490110261.rs
- examples/v1_dashboards_CreateDashboard_145494973.rs
- examples/v1_dashboards_CreateDashboard_765140092.rs
- examples/v1_dashboards_CreateDashboard_798168180.rs
- examples/v1_dashboards_CreateDashboard_1024858348.rs
- examples/v1_dashboards_CreateDashboard_252716965.rs
- examples/v1_dashboards_CreateDashboard_3882428227.rs
- examples/v1_dashboards_CreateDashboard_578885732.rs
- examples/v1_dashboards_CreateDashboard_1442588603.rs
- examples/v1_dashboards_CreateDashboard_2064651578.rs
- examples/v1_dashboards_CreateDashboard_2104498738.rs
- examples/v1_dashboards_CreateDashboard_2336428357.rs
- examples/v1_dashboards_CreateDashboard_1413226400.rs
- examples/v1_dashboards_CreateDashboard_1213075383.rs
- examples/v1_dashboards_CreateDashboard_2563642929.rs
- examples/v1_dashboards_CreateDashboard_3520534424.rs
- examples/v1_dashboards_CreateDashboard_1490099434.rs
- examples/v1_dashboards_CreateDashboard_2278756614.rs
- examples/v1_dashboards_CreateDashboard_2342457693.rs
- examples/v1_dashboards_CreateDashboard_915214113.rs
- examples/v1_dashboards_CreateDashboard_794302680.rs
Sourcepub fn is_column_break(self, value: bool) -> Self
pub fn is_column_break(self, value: bool) -> Self
Examples found in repository?
examples/v1_dashboards_CreateDashboard_1754992756.rs (line 37)
15async fn main() {
16 // there is a valid "powerpack" in the system
17 let powerpack_data_id = std::env::var("POWERPACK_DATA_ID").unwrap();
18 let body = Dashboard::new(
19 DashboardLayoutType::ORDERED,
20 "Example-Dashboard with powerpack widget".to_string(),
21 vec![
22 Widget::new(WidgetDefinition::PowerpackWidgetDefinition(Box::new(
23 PowerpackWidgetDefinition::new(
24 powerpack_data_id.clone(),
25 PowerpackWidgetDefinitionType::POWERPACK,
26 )
27 .template_variables(
28 PowerpackTemplateVariables::new()
29 .controlled_by_powerpack(vec![PowerpackTemplateVariableContents::new(
30 "foo".to_string(),
31 vec!["baz".to_string(), "qux".to_string(), "quuz".to_string()],
32 )
33 .prefix("bar".to_string())])
34 .controlled_externally(vec![]),
35 ),
36 )))
37 .layout(WidgetLayout::new(2, 2, 1, 1).is_column_break(false)),
38 ],
39 )
40 .description(Some("description".to_string()));
41 let configuration = datadog::Configuration::new();
42 let api = DashboardsAPI::with_config(configuration);
43 let resp = api.create_dashboard(body).await;
44 if let Ok(value) = resp {
45 println!("{:#?}", value);
46 } else {
47 println!("{:#?}", resp.unwrap_err());
48 }
49}
pub fn additional_properties(self, value: BTreeMap<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for WidgetLayout
impl Clone for WidgetLayout
Source§fn clone(&self) -> WidgetLayout
fn clone(&self) -> WidgetLayout
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 WidgetLayout
impl Debug for WidgetLayout
Source§impl<'de> Deserialize<'de> for WidgetLayout
impl<'de> Deserialize<'de> for WidgetLayout
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 WidgetLayout
impl PartialEq for WidgetLayout
Source§impl Serialize for WidgetLayout
impl Serialize for WidgetLayout
impl StructuralPartialEq for WidgetLayout
Auto Trait Implementations§
impl Freeze for WidgetLayout
impl RefUnwindSafe for WidgetLayout
impl Send for WidgetLayout
impl Sync for WidgetLayout
impl Unpin for WidgetLayout
impl UnwindSafe for WidgetLayout
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